tiki-print_blog_post.php 1.39 KB
Newer Older
awcolley's avatar
awcolley committed
1
<?php
2
// (c) Copyright 2002-2011 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
3
// 
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 7
// $Id$

8
$section = 'blogs';
9 10
require_once ('tiki-setup.php');
include_once ('lib/blogs/bloglib.php');
11 12
$access->check_feature('feature_blogs');

13 14
if (!isset($_REQUEST["postId"])) {
	$smarty->assign('msg', tra("No post indicated"));
15
	$smarty->display("error.tpl");
16 17
	die;
}
18

19
$postId = $_REQUEST["postId"];
20
$post_info = $bloglib->get_post($postId);
21

22 23
$blogId = $post_info["blogId"];
$tikilib->get_perm_object($blogId, 'blog');
24
$access->check_permission('tiki_p_read_blog');
25

26 27
$blog_data = $bloglib->get_blog($blogId);

28 29
if (!$blog_data) {
	$smarty->assign('msg', tra("Blog not found"));
30
	$smarty->display("error.tpl");
31
	die;
awcolley's avatar
awcolley committed
32
}
33

34
$parsed_data = $tikilib->parse_data($post_info["data"], array('is_html' => true));
35
$parsed_data = preg_replace('/\.\.\.page\.\.\./','<hr />',$parsed_data);
36 37 38

$smarty->assign('blog_data', $blog_data);
$smarty->assign('blogId', $blogId);
39
$post_info['parsed_data'] = $parsed_data;
40 41 42
$smarty->assign('post_info', $post_info);
$smarty->assign('postId', $postId);

43
ask_ticket('print-blog-post');
44

45 46
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
awcolley's avatar
awcolley committed
47 48
// Display the template
$smarty->display("tiki-print_blog_post.tpl");