2012-08-30 08:00:17 +00:00
|
|
|
<?
|
2012-10-11 08:00:15 +00:00
|
|
|
list($Page,$Limit) = Format::page_limit(LOG_ENTRIES_PER_PAGE);
|
2012-08-30 08:00:17 +00:00
|
|
|
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!empty($_GET['search'])) {
|
2012-08-30 08:00:17 +00:00
|
|
|
$Search = db_string($_GET['search']);
|
|
|
|
} else {
|
|
|
|
$Search = false;
|
|
|
|
}
|
|
|
|
$Words = explode(' ', $Search);
|
2013-05-04 08:00:48 +00:00
|
|
|
$sql = '
|
|
|
|
SELECT SQL_CALC_FOUND_ROWS
|
|
|
|
ID,
|
|
|
|
Message,
|
|
|
|
Time
|
|
|
|
FROM log ';
|
|
|
|
if ($Search) {
|
2012-08-30 08:00:17 +00:00
|
|
|
$sql .= "WHERE Message LIKE '%";
|
|
|
|
$sql .= implode("%' AND Message LIKE '%", $Words);
|
|
|
|
$sql .= "%' ";
|
|
|
|
}
|
2013-05-04 08:00:48 +00:00
|
|
|
if (!check_perms('site_view_full_log')) {
|
|
|
|
if ($Search) {
|
|
|
|
$sql.=' AND ';
|
2012-08-30 08:00:17 +00:00
|
|
|
} else {
|
2013-05-04 08:00:48 +00:00
|
|
|
$sql.=' WHERE ';
|
2012-08-30 08:00:17 +00:00
|
|
|
}
|
2013-05-04 08:00:48 +00:00
|
|
|
$sql .= " Time>'".time_minus(3600 * 24 * 28)."' ";
|
2012-08-30 08:00:17 +00:00
|
|
|
}
|
|
|
|
|
2013-05-04 08:00:48 +00:00
|
|
|
$sql .= "
|
|
|
|
ORDER BY ID DESC
|
|
|
|
LIMIT $Limit";
|
2012-08-30 08:00:17 +00:00
|
|
|
|
|
|
|
$Log = $DB->query($sql);
|
|
|
|
$DB->query("SELECT FOUND_ROWS()");
|
|
|
|
list($NumResults) = $DB->next_record();
|
|
|
|
$TotalMatches = $NumResults;
|
|
|
|
$DB->set_query_id($Log);
|