-
Notifications
You must be signed in to change notification settings - Fork 0
/
tiki-likepages.php
60 lines (59 loc) · 2.09 KB
/
tiki-likepages.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
/**
* @package tikiwiki
*/
// (c) Copyright 2002-2013 by authors of the Tiki Wiki CMS Groupware Project
//
// 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.
// $Id: tiki-likepages.php 44444 2013-01-05 21:24:24Z changi67 $
$section = 'wiki page';
$section_class = "tiki_wiki_page manage"; // This will be body class instead of $section
require_once ('tiki-setup.php');
include_once ('lib/wiki/wikilib.php');
$access->check_feature('feature_wiki');
$access->check_feature('feature_likePages');
// Get the page from the request var or default it to HomePage
if (!isset($_REQUEST["page"])) {
$smarty->assign('msg', tra("No page indicated"));
$smarty->display("error.tpl");
die;
} else {
$page = $_REQUEST["page"];
$smarty->assign_by_ref('page', $_REQUEST["page"]);
}
if (!($info = $tikilib->get_page_info($page))) {
$smarty->assign('msg', tra('Page cannot be found'));
$smarty->display('error.tpl');
die;
}
$tikilib->get_perm_object($page, 'wiki page', $info);
$access->check_permission('tiki_p_view');
$likepages = $wikilib->get_like_pages($page);
// If the page doesn't exist then display an error
if (!$tikilib->page_exists($page)) {
if (count($likepages) == 1) {
header("Status: 402 Found"); /* PHP3 */
header("HTTP/1.0 402 Found"); /* PHP4 */
header("Location: tiki-index.php?page=$likepages[0]");
die;
}
$smarty->assign('page_exists', 'n');
if (count($likepages) < 1) {
header("Status: 404 Not Found"); /* PHP3 */
header("HTTP/1.0 404 Not Found"); /* PHP4 */
$smarty->assign('headtitle', tra("Page cannot be found"));
$smarty->assign('errortitle', tra("Page cannot be found") . " (404)");
$smarty->assign('errortype', '404');
$smarty->display("error.tpl");
die;
}
}
$smarty->assign_by_ref('likepages', $likepages);
ask_ticket('likepages');
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
include_once ('tiki-section_options.php');
// Display the template
$smarty->assign('mid', 'tiki-likepages.tpl');
$smarty->display("tiki.tpl");