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 11$inputConfiguration = [ 12 [ 'staticKeyFilters' => 13 [ 14 'clean' => 'striptags', 15 'offset' => 'digits', 16 'numrows' => 'digits', 17 'maxRecords' => 'digits', 18 'find' => 'striptags', 19 'sort_mode' => 'striptags', 20 ] 21 ] 22]; 23 24include_once('tiki-setup.php'); 25 26$access->check_permission('tiki_p_admin'); 27 28if ($api_tiki != 'adodb') { 29 $smarty->assign('msg', tra('This feature is disabled') . ': adodb'); 30 $smarty->display('error.tpl'); 31 die; 32} 33 34$query = "show tables like 'adodb_logsql'"; 35$result = $tikilib->query($query, []); 36if (! $result->numRows()) { 37 $smarty->assign('msg', tra('This feature is disabled') . ': log_sql'); 38 $smarty->display('error.tpl'); 39 die; 40} 41// let look at the log even if not active for older logs 42//if ($prefs['log_sql'] != 'y') { 43// $smarty->assign('msg', tra('This feature is disabled').': log_sql'); 44// $smarty->display('error.tpl'); 45// die; 46//} 47if (isset($_REQUEST['clean'])) { 48 $access->check_authenticity(tra('Clean the sql logs')); 49 $logslib->clean_logsql(); 50} 51$auto_query_args = ['offset', 'numrows', 'find', 'sort_mode']; 52$numrows = (isset($_REQUEST['numrows'])) ? $_REQUEST['numrows'] : (isset($_REQUEST['maxRecords']) ? $_REQUEST['maxRecords'] : $prefs['maxRecords']); 53$smarty->assign_by_ref('numrows', $numrows); 54$smarty->assign_by_ref('maxRecords', $numrows); 55$offset = (isset($_REQUEST['offset'])) ? $_REQUEST['offset'] : 0; 56$smarty->assign_by_ref('offset', $offset); 57$sort_mode = (isset($_REQUEST['sort_mode'])) ? $_REQUEST['sort_mode'] : 'created_desc'; 58$smarty->assign_by_ref('sort_mode', $sort_mode); 59$find = (isset($_REQUEST['find'])) ? $_REQUEST['find'] : ''; 60$smarty->assign_by_ref('find', $find); 61$logs = $logslib->list_logsql($sort_mode, $offset, $numrows, $find); 62$smarty->assign_by_ref('logs', $logs['data']); 63$smarty->assign_by_ref('cant', $logs['cant']); 64$smarty->assign('mid', 'tiki-sqllog.tpl'); 65$smarty->display('tiki.tpl'); 66