time and message searching in the log

This commit is contained in:
Shish
2018-07-22 15:08:53 +01:00
parent f31dabce20
commit d48e34030d
2 changed files with 32 additions and 15 deletions

View File

@@ -49,9 +49,13 @@ class LogDatabase extends Extension {
$args = array();
$page_num = int_escape($event->get_arg(0));
if($page_num <= 0) $page_num = 1;
if(!empty($_GET["time"])) {
$wheres[] = "date_sent LIKE :time";
$args["time"] = $_GET["time"]."%";
if(!empty($_GET["time-start"])) {
$wheres[] = "date_sent > :time_start";
$args["time_start"] = $_GET["time-start"];
}
if(!empty($_GET["time-end"])) {
$wheres[] = "date_sent < :time_end";
$args["time_end"] = $_GET["time-end"];
}
if(!empty($_GET["module"])) {
$wheres[] = "section = :module";
@@ -83,6 +87,10 @@ class LogDatabase extends Extension {
$wheres[] = "priority >= :priority";
$args["priority"] = 20;
}
if(!empty($_GET["message"])) {
$wheres[] = $database->scoreql_to_sql("SCORE_STRNORM(message) LIKE SCORE_STRNORM(:message)");
$args["message"] = "%" . $_GET["message"] . "%";
}
$where = "";
if(count($wheres) > 0) {
$where = "WHERE ";