tiki-list_contents.php 2.19 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.
6
// $Id$
changi67's avatar
changi67 committed
7

8 9
require_once ('tiki-setup.php');
include_once ('lib/dcs/dcslib.php');
changi67's avatar
changi67 committed
10
$auto_query_args = array('sort_mode', 'offset', 'find');
11
if (!isset($dcslib)) {
12
	$dcslib = new DCSLib;
13
}
14 15
$access->check_feature('feature_dynamic_content');
$access->check_permission('tiki_p_admin_dynamic');
16
if (isset($_REQUEST["remove"])) {
17 18
	$access->check_authenticity();
	$dcslib->remove_contents($_REQUEST["remove"]);
19
}
20
$smarty->assign('description', '');
21
$smarty->assign('contentLabel', '');
22 23
$smarty->assign('contentId', 0);
if (isset($_REQUEST["save"])) {
24
	check_ticket('list-contents');
25
	$smarty->assign('description', $_REQUEST["description"]);
26 27
	$smarty->assign('contentLabel', $_REQUEST["contentLabel"]);
	$id = $dcslib->replace_content($_REQUEST["contentId"], $_REQUEST["description"], $_REQUEST["contentLabel"]);
28
	$smarty->assign('contentId', $id);
29
}
30 31 32 33
if (isset($_REQUEST["edit"])) {
	$info = $dcslib->get_content($_REQUEST["edit"]);
	$smarty->assign('contentId', $info["contentId"]);
	$smarty->assign('description', $info["description"]);
34
	$smarty->assign('contentLabel', $info["contentLabel"]);
35
}
36 37
if (!isset($_REQUEST["sort_mode"])) {
	$sort_mode = 'contentId_desc';
38
} else {
39 40 41
	$sort_mode = $_REQUEST["sort_mode"];
}
$smarty->assign_by_ref('sort_mode', $sort_mode);
42 43
// If offset is set use it if not then use offset =0
// use the maxRecords php variable to set the limit
44 45
if (!isset($_REQUEST["offset"])) {
	$offset = 0;
46
} else {
47
	$offset = $_REQUEST["offset"];
48
}
49 50 51
$smarty->assign_by_ref('offset', $offset);
if (isset($_REQUEST["find"])) {
	$find = $_REQUEST["find"];
52
} else {
53
	$find = '';
54
}
55
$smarty->assign('find', $find);
56
// Get a list of last changes to the Wiki database
57
$listpages = $dcslib->list_content($offset, $maxRecords, $sort_mode, $find);
58
$smarty->assign_by_ref('cant', $listpages['cant']);
59
$smarty->assign_by_ref('listpages', $listpages["data"]);
60
ask_ticket('list-contents');
61
// Display the template
62
$smarty->assign('mid', 'tiki-list_contents.tpl');
63
$smarty->display("tiki.tpl");