1<?php
2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project
3//
4// All Rights Reserved. See copyright.txt for details and a complete list of authors.
5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.
6// $Id$
7
8$section = 'blogs';
9require_once('tiki-setup.php');
10$bloglib = TikiLib::lib('blog');
11$access->check_feature('feature_blogs');
12
13if (! isset($_REQUEST["postId"])) {
14	$smarty->assign('msg', tra("No post indicated"));
15	$smarty->display("error.tpl");
16	die;
17}
18
19$postId = $_REQUEST["postId"];
20$post_info = $bloglib->get_post($postId);
21
22$blogId = $post_info["blogId"];
23$tikilib->get_perm_object($postId, 'blog post');
24$access->check_permission('tiki_p_read_blog', '', 'blog post', $postId);
25
26
27$blog_data = $bloglib->get_blog($blogId);
28
29if (! $blog_data) {
30	$smarty->assign('msg', tra("Blog not found"));
31	$smarty->display("error.tpl");
32	die;
33}
34
35$parsed_data = TikiLib::lib('parser')->parse_data($post_info["data"], ['is_html' => true]);
36$parsed_data = preg_replace('/\.\.\.page\.\.\./', '<hr />', $parsed_data);
37
38$smarty->assign('blog_data', $blog_data);
39$smarty->assign('blogId', $blogId);
40$post_info['parsed_data'] = $parsed_data;
41$smarty->assign('post_info', $post_info);
42$smarty->assign('postId', $postId);
43
44ask_ticket('print-blog-post');
45
46// note: tiki-print_blog_post.tpl doesn't use the $mid system for page layout,
47//       this is assigned here to trick canonical.tpl into generating a link tag
48$smarty->assign('mid', 'tiki-view_blog_post.tpl');
49
50// disallow robots to index page:
51$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
52// Display the template
53$smarty->display("tiki-print_blog_post.tpl");
54