1<?php 2/** 3 * @package tikiwiki 4 */ 5// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 6// 7// All Rights Reserved. See copyright.txt for details and a complete list of authors. 8// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 9// $Id$ 10 11require_once('tiki-setup.php'); 12$auto_query_args = ['sort_mode', 'offset', 'find']; 13//get_strings tra('Dynamic content') 14$access->check_feature('feature_dynamic_content'); 15$access->check_permission('tiki_p_admin_dynamic'); 16 17$dcslib = TikiLib::lib('dcs'); 18 19if (isset($_REQUEST["remove"])) { 20 $access->check_authenticity(); 21 $dcslib->remove_contents($_REQUEST["remove"]); 22} 23$smarty->assign('description', ''); 24$smarty->assign('contentLabel', ''); 25$smarty->assign('contentId', 0); 26if (isset($_REQUEST["save"])) { 27 check_ticket('list-contents'); 28 $smarty->assign('description', $_REQUEST["description"]); 29 $smarty->assign('contentLabel', $_REQUEST["contentLabel"]); 30 $id = $dcslib->replace_content($_REQUEST["contentId"], $_REQUEST["description"], $_REQUEST["contentLabel"]); 31 $smarty->assign('contentId', $id); 32} 33if (isset($_REQUEST["edit"])) { 34 $info = $dcslib->get_content($_REQUEST["edit"]); 35 $smarty->assign('contentId', $info["contentId"]); 36 $smarty->assign('description', $info["description"]); 37 $smarty->assign('contentLabel', $info["contentLabel"]); 38} 39if (! isset($_REQUEST["sort_mode"])) { 40 $sort_mode = 'contentId_desc'; 41} else { 42 $sort_mode = $_REQUEST["sort_mode"]; 43} 44$smarty->assign_by_ref('sort_mode', $sort_mode); 45// If offset is set use it if not then use offset =0 46// use the maxRecords php variable to set the limit 47if (! isset($_REQUEST["offset"])) { 48 $offset = 0; 49} else { 50 $offset = $_REQUEST["offset"]; 51} 52$smarty->assign_by_ref('offset', $offset); 53if (isset($_REQUEST["find"])) { 54 $find = $_REQUEST["find"]; 55} else { 56 $find = ''; 57} 58$smarty->assign('find', $find); 59// Get a list of last changes to the Wiki database 60$listpages = $dcslib->list_content($offset, $maxRecords, $sort_mode, $find); 61$smarty->assign_by_ref('cant', $listpages['cant']); 62$smarty->assign_by_ref('listpages', $listpages["data"]); 63ask_ticket('list-contents'); 64// Display the template 65$smarty->assign('mid', 'tiki-list_contents.tpl'); 66$smarty->display("tiki.tpl"); 67