tiki-sqllog.php 2.15 KB
Newer Older
1
<?php
changi67's avatar
changi67 committed
2 3 4
/**
 * @package tikiwiki
 */
5
// (c) Copyright 2002-2015 by authors of the Tiki Wiki CMS Groupware Project
changi67's avatar
changi67 committed
6 7 8
// 
// 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
9 10
// $Id$

11 12 13 14 15 16 17 18 19 20 21 22 23
$inputConfiguration = array(
	array( 'staticKeyFilters' =>
		array(
			'clean' => 'striptags',
			'offset' => 'digits',
			'numrows' => 'digits',
			'maxRecords' => 'digits',
			'find' => 'striptags',
			'sort_mode' => 'striptags',
		)
	)
);

changi67's avatar
changi67 committed
24
include_once ('tiki-setup.php');
25 26 27

$access->check_permission('tiki_p_admin');

28
if ($api_tiki != 'adodb') {
changi67's avatar
changi67 committed
29
	$smarty->assign('msg', tra('This feature is disabled') . ': adodb');
30 31 32
	$smarty->display('error.tpl');
	die;
}
33

34 35 36
$query = "show tables like 'adodb_logsql'";
$result = $tikilib->query($query, array());
if (!$result->numRows()) {
changi67's avatar
changi67 committed
37
	$smarty->assign('msg', tra('This feature is disabled') . ': log_sql');
38 39 40
	$smarty->display('error.tpl');
	die;
}
41 42 43 44 45 46
// let look at the log even if not active for older logs
//if ($prefs['log_sql'] != 'y') {
//	$smarty->assign('msg', tra('This feature is disabled').': log_sql');
//	$smarty->display('error.tpl');
//	die;
//}
changi67's avatar
changi67 committed
47
if (isset($_REQUEST['clean'])) {
48 49
	$access->check_authenticity(tra('Clean the sql logs'));
	$logslib->clean_logsql();
sylvieg's avatar
sylvieg committed
50 51
}
$auto_query_args = array('offset', 'numrows', 'find', 'sort_mode');
changi67's avatar
changi67 committed
52
$numrows = (isset($_REQUEST['numrows'])) ? $_REQUEST['numrows'] : (isset($_REQUEST['maxRecords']) ? $_REQUEST['maxRecords'] : $prefs['maxRecords']);
53 54
$smarty->assign_by_ref('numrows', $numrows);
$smarty->assign_by_ref('maxRecords', $numrows);
changi67's avatar
changi67 committed
55
$offset = (isset($_REQUEST['offset'])) ? $_REQUEST['offset'] : 0;
56
$smarty->assign_by_ref('offset', $offset);
changi67's avatar
changi67 committed
57
$sort_mode = (isset($_REQUEST['sort_mode'])) ? $_REQUEST['sort_mode'] : 'created_desc';
58
$smarty->assign_by_ref('sort_mode', $sort_mode);
changi67's avatar
changi67 committed
59
$find = (isset($_REQUEST['find'])) ? $_REQUEST['find'] : '';
60 61 62 63 64 65
$smarty->assign_by_ref('find', $find);
$logs = $logslib->list_logsql($sort_mode, $offset, $numrows, $find);
$smarty->assign_by_ref('logs', $logs['data']);
$smarty->assign_by_ref('cant', $logs['cant']);
$smarty->assign('mid', 'tiki-sqllog.tpl');
$smarty->display('tiki.tpl');