tiki-removepage.php 2.15 KB
Newer Older
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
// $Id$
7

mose's avatar
mose committed
8
$section = 'wiki page';
9
$section_class = "tiki_wiki_page manage";	// This will be body class instead of $section
10

11 12 13
require_once ('tiki-setup.php');
include_once ('lib/wiki/histlib.php');
include_once ('lib/wiki/wikilib.php');
14

15
$access->check_feature('feature_wiki');
16

17
// Get the page from the request var or default it to HomePage
18 19
if (!isset($_REQUEST["page"])) {
	$smarty->assign('msg', tra("No page indicated"));
20
	$smarty->display("error.tpl");
21
	die;
22
} else {
23 24
	$page = $_REQUEST["page"];
	$smarty->assign_by_ref('page', $_REQUEST["page"]);
25
}
26 27 28 29 30
if (!($info = $tikilib->get_page_info($page))) {
	$smarty->assign('msg', tra('Page cannot be found'));
	$smarty->display('error.tpl');
	die;
}
31

changi67's avatar
changi67 committed
32
$tikilib->get_perm_object($page, 'wiki page', $info);
33 34
$access->check_permission( array('tiki_p_remove', 'tiki_p_edit') );

35 36 37
if ($_REQUEST["version"] <> "last") {
	$smarty->assign_by_ref('version', $_REQUEST["version"]);
	$version = $_REQUEST["version"];
38
} else {
changi67's avatar
changi67 committed
39
	$smarty->assign('version', 'last'); //get_strings tra('last version');
40 41
	$version = "last";
}
42
// If the page doesn't exist then display an error
43 44
if (!$tikilib->page_exists($page)) {
	$smarty->assign('msg', tra("Page cannot be found"));
45
	$smarty->display("error.tpl");
46
	die;
47
}
48
if (isset($_REQUEST["remove"])) {
49
	check_ticket('remove-page');
50 51
	if (isset($_REQUEST["all"]) && $_REQUEST["all"] == 'on') {
		$tikilib->remove_all_versions($_REQUEST["page"]);
changi67's avatar
changi67 committed
52
		header("location: tiki-index.php");
53 54 55 56 57
		die;
	} else {
		if ($version == "last") {
			$wikilib->remove_last_version($_REQUEST["page"]);
		} else {
58
			$histlib->remove_version($_REQUEST['page'], $_REQUEST['version'], $_REQUEST['historyId']);
59
		}
changi67's avatar
changi67 committed
60
		header("location: tiki-index.php");
61 62
		die;
	}
63
}
64
ask_ticket('remove-page');
mose's avatar
mose committed
65
include_once ('tiki-section_options.php');
66 67
// disallow robots to index page:
$smarty->assign('metatag_robots', 'NOINDEX, NOFOLLOW');
68
$smarty->assign('mid', 'tiki-removepage.tpl');
69
$smarty->display("tiki.tpl");