tiki-print_article.php 2.8 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3
// (c) Copyright 2002-2009 by authors of the Tiki Wiki/CMS/Groupware Project
// 
4 5
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
changi67's avatar
changi67 committed
6
// $Id: /cvsroot/tikiwiki/tiki/tiki-print_article.php,v 1.21.2.1 2007-11-26 16:30:04 sylvieg Exp $
7
$section = 'cms';
8 9
require_once ('tiki-setup.php');
include_once ('lib/articles/artlib.php');
10
if ($prefs['feature_cms_print'] != 'y') {
changi67's avatar
changi67 committed
11
	$smarty->assign('msg', tra("This feature is disabled") . ": feature_cms_print");
12 13 14
	$smarty->display("error.tpl");
	die;
}
15 16
if (!isset($_REQUEST["articleId"])) {
	$smarty->assign('msg', tra("No article indicated"));
17
	$smarty->display("error.tpl");
18
	die;
19
}
20 21 22 23
if (isset($_REQUEST["articleId"])) {
	$artlib->add_article_hit($_REQUEST["articleId"]);
	$smarty->assign('articleId', $_REQUEST["articleId"]);
	$article_data = $tikilib->get_article($_REQUEST["articleId"]);
24
	if ($article_data === false) {
25
		$smarty->assign('errortype', 401);
26 27 28 29
		$smarty->assign('msg', tra('Permission denied'));
		$smarty->display('error.tpl');
		die;
	}
30 31
	if (!$article_data) {
		$smarty->assign('msg', tra("Article not found"));
32
		$smarty->display("error.tpl");
33 34
		die;
	}
mose's avatar
mose committed
35
	if (($article_data["publishDate"] > $tikilib->now) && ($tiki_p_admin != 'y')) {
36
		$smarty->assign('msg', tra("Article is not published yet"));
37
		$smarty->display("error.tpl");
38 39 40 41 42 43 44 45 46
		die;
	}
	$smarty->assign('title', $article_data["title"]);
	$smarty->assign('authorName', $article_data["authorName"]);
	$smarty->assign('topicId', $article_data["topicId"]);
	$smarty->assign('useImage', $article_data["useImage"]);
	$smarty->assign('image_name', $article_data["image_name"]);
	$smarty->assign('image_type', $article_data["image_type"]);
	$smarty->assign('image_size', $article_data["image_size"]);
47 48
	$smarty->assign('image_x', $article_data["image_x"]);
	$smarty->assign('image_y', $article_data["image_y"]);
49
	$smarty->assign('image_data', urlencode($article_data["image_data"]));
50
	$smarty->assign('reads', $article_data["nbreads"]);
51 52 53 54 55 56 57 58 59 60 61 62 63 64
	$smarty->assign('size', $article_data["size"]);
	if (strlen($article_data["image_data"]) > 0) {
		$smarty->assign('hasImage', 'y');
		$hasImage = 'y';
	}
	$smarty->assign('heading', $article_data["heading"]);
	$smarty->assign('body', $article_data["body"]);
	$smarty->assign('publishDate', $article_data["publishDate"]);
	$smarty->assign('edit_data', 'y');
	$body = $article_data["body"];
	$heading = $article_data["heading"];
	$smarty->assign('parsed_body', $tikilib->parse_data($body));
	$smarty->assign('parsed_heading', $tikilib->parse_data($heading));
}
65
ask_ticket('print-article');
66
include_once ('tiki-section_options.php');
67 68
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
69
$smarty->assign('print_page', 'y');
70
$smarty->display("tiki-print_article.tpl");