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 13$access->check_permission('tiki_p_admin'); 14$access->check_authenticity('', false); 15 16$auto_query_args = ['offset', 'numrows', 'maxRecords', 'find', 'sort_mode']; 17if (isset($_POST["actionId"]) && ! empty($_POST["page"])) { 18 $prefslib = TikiLib::lib('prefs'); 19 $adminPage = $_POST["page"]; 20 $logResult = $logslib->get_info_action($_POST["actionId"]); 21 if (! empty($logResult['log']) && ! empty($logResult['object'])) { 22 $logObject = $logResult['object']; 23 $_POST['pp'] = $logObject; 24 $revertInfo = unserialize($logResult['log']); 25 if (! isset($revertInfo['reverted'])) { 26 $_POST["revertInfo"] = $revertInfo; 27 $logslib->revert_action($_POST["actionId"], $logObject, $adminPage, $revertInfo); 28 if (file_exists("admin/include_$adminPage.php")) { 29 include_once("admin/include_$adminPage.php"); 30 } 31 if (! empty($revertedActions)) { 32 Feedback::note(['mes' => $revertedActions, 'title' => tra('The following list of changes has been reverted:')]); 33 } 34 } else { 35 Feedback::error(['mes' => tr('Log already reverted')]); 36 } 37 } else { 38 Feedback::error(['mes' => tr('Invalid System Log ID')]); 39 } 40} 41 42if (isset($_REQUEST["clean"])) { 43 $access->check_authenticity(); 44 $date = strtotime("-" . $_REQUEST["months"] . " months"); 45 $logslib->clean_logs($date); 46} 47 48if (! isset($_REQUEST["sort_mode"])) { 49 $sort_mode = 'actionid_desc'; 50} else { 51 $sort_mode = $_REQUEST["sort_mode"]; 52} 53$smarty->assign_by_ref('sort_mode', $sort_mode); 54if (isset($_REQUEST["find"])) { 55 $find = $_REQUEST["find"]; 56} else { 57 $find = ''; 58} 59$smarty->assign('find', $find); 60if (! isset($_REQUEST["offset"])) { 61 $offset = 0; 62} else { 63 $offset = $_REQUEST["offset"]; 64} 65$smarty->assign_by_ref('offset', $offset); 66if (isset($_REQUEST["max"])) { 67 $maxRecords = $_REQUEST["max"]; 68} 69$smarty->assign_by_ref('maxRecords', $maxRecords); 70 71$list = $logslib->list_logs('', '', $offset, $maxRecords, $sort_mode, $find); 72$smarty->assign_by_ref('cant', $list['cant']); 73$smarty->assign('list', $list['data']); 74$urlquery['sort_mode'] = $sort_mode; 75$urlquery['find'] = $find; 76$smarty->assign_by_ref('urlquery', $urlquery); 77ask_ticket('admin-logs'); 78$smarty->assign('mid', 'tiki-syslog.tpl'); 79$smarty->display('tiki.tpl'); 80