time and message searching in the log
This commit is contained in:
parent
f31dabce20
commit
d48e34030d
@ -49,9 +49,13 @@ class LogDatabase extends Extension {
|
|||||||
$args = array();
|
$args = array();
|
||||||
$page_num = int_escape($event->get_arg(0));
|
$page_num = int_escape($event->get_arg(0));
|
||||||
if($page_num <= 0) $page_num = 1;
|
if($page_num <= 0) $page_num = 1;
|
||||||
if(!empty($_GET["time"])) {
|
if(!empty($_GET["time-start"])) {
|
||||||
$wheres[] = "date_sent LIKE :time";
|
$wheres[] = "date_sent > :time_start";
|
||||||
$args["time"] = $_GET["time"]."%";
|
$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"])) {
|
if(!empty($_GET["module"])) {
|
||||||
$wheres[] = "section = :module";
|
$wheres[] = "section = :module";
|
||||||
@ -83,6 +87,10 @@ class LogDatabase extends Extension {
|
|||||||
$wheres[] = "priority >= :priority";
|
$wheres[] = "priority >= :priority";
|
||||||
$args["priority"] = 20;
|
$args["priority"] = 20;
|
||||||
}
|
}
|
||||||
|
if(!empty($_GET["message"])) {
|
||||||
|
$wheres[] = $database->scoreql_to_sql("SCORE_STRNORM(message) LIKE SCORE_STRNORM(:message)");
|
||||||
|
$args["message"] = "%" . $_GET["message"] . "%";
|
||||||
|
}
|
||||||
$where = "";
|
$where = "";
|
||||||
if(count($wheres) > 0) {
|
if(count($wheres) > 0) {
|
||||||
$where = "WHERE ";
|
$where = "WHERE ";
|
||||||
|
@ -20,12 +20,14 @@ class LogDatabaseTheme extends Themelet {
|
|||||||
</style>
|
</style>
|
||||||
<table class='zebra'>
|
<table class='zebra'>
|
||||||
<thead>
|
<thead>
|
||||||
<tr><th>Time</th><th>Module</th><th>User</th><th colspan='2'>Message</th></tr>
|
<tr><th>Time</th><th>Module</th><th>User</th><th colspan='3'>Message</th></tr>
|
||||||
<form action='".make_link("log/view")."' method='GET'>
|
<form action='".make_link("log/view")."' method='GET'>
|
||||||
<tr class='sizedinputs'>
|
<tr class='sizedinputs'>
|
||||||
<td><input type='time' name='time' value='".$this->heie("time")."'></td>
|
<td><input type='date' name='time-start' value='".$this->heie("time-start")."'>
|
||||||
|
<br><input type='date' name='time-end' value='".$this->heie("time-end")."'></td>
|
||||||
<td><input type='text' name='module' value='".$this->heie("module")."'></td>
|
<td><input type='text' name='module' value='".$this->heie("module")."'></td>
|
||||||
<td><input type='text' name='user' value='".$this->heie("user")."'></td>
|
<td><input type='text' name='user' value='".$this->heie("user")."'></td>
|
||||||
|
<td><input type='text' name='message' value='".$this->heie("message")."'></td>
|
||||||
<td>
|
<td>
|
||||||
<select name='priority'>
|
<select name='priority'>
|
||||||
<option value='".SCORE_LOG_DEBUG."'>Debug</option>
|
<option value='".SCORE_LOG_DEBUG."'>Debug</option>
|
||||||
@ -55,7 +57,7 @@ class LogDatabaseTheme extends Themelet {
|
|||||||
"<a href='".make_link("user/".url_escape($event['username']))."'>".html_escape($event['username'])."</a>".
|
"<a href='".make_link("user/".url_escape($event['username']))."'>".html_escape($event['username'])."</a>".
|
||||||
"</span></td>";
|
"</span></td>";
|
||||||
}
|
}
|
||||||
$table .= "<td colspan='2'>".$this->scan_entities(html_escape($event['message']))."</td>";
|
$table .= "<td colspan='3'>".$this->scan_entities(html_escape($event['message']))."</td>";
|
||||||
$table .= "</tr>\n";
|
$table .= "</tr>\n";
|
||||||
}
|
}
|
||||||
$table .= "</tbody></table>";
|
$table .= "</tbody></table>";
|
||||||
@ -65,21 +67,28 @@ class LogDatabaseTheme extends Themelet {
|
|||||||
$page->set_heading("Event Log");
|
$page->set_heading("Event Log");
|
||||||
$page->add_block(new NavBlock());
|
$page->add_block(new NavBlock());
|
||||||
$page->add_block(new Block("Events", $table));
|
$page->add_block(new Block("Events", $table));
|
||||||
|
$this->display_paginator($page, "log/view", $this->get_args(), $page_num, $page_total);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function get_args() {
|
||||||
$args = "";
|
$args = "";
|
||||||
// Check if each arg is actually empty and skip it if so
|
// Check if each arg is actually empty and skip it if so
|
||||||
if(strlen($this->ueie("time")))
|
if(strlen($this->ueie("time-start")))
|
||||||
$args .= $this->ueie("time")."&";
|
$args .= $this->ueie("time-start")."&";
|
||||||
|
if(strlen($this->ueie("time-end")))
|
||||||
|
$args .= $this->ueie("time-end")."&";
|
||||||
if(strlen($this->ueie("module")))
|
if(strlen($this->ueie("module")))
|
||||||
$args .= $this->ueie("module")."&";
|
$args .= $this->ueie("module")."&";
|
||||||
if(strlen($this->ueie("user")))
|
if(strlen($this->ueie("user")))
|
||||||
$args .= $this->ueie("user")."&";
|
$args .= $this->ueie("user")."&";
|
||||||
|
if(strlen($this->ueie("message")))
|
||||||
|
$args .= $this->ueie("message")."&";
|
||||||
if(strlen($this->ueie("priority")))
|
if(strlen($this->ueie("priority")))
|
||||||
$args .= $this->ueie("priority");
|
$args .= $this->ueie("priority");
|
||||||
// If there are no args at all, set $args to null to prevent an unnecessary ? at the end of the paginator url
|
// If there are no args at all, set $args to null to prevent an unnecessary ? at the end of the paginator url
|
||||||
if(strlen($args) == 0)
|
if(strlen($args) == 0)
|
||||||
$args = null;
|
$args = null;
|
||||||
$this->display_paginator($page, "log/view", $args, $page_num, $page_total);
|
return $args;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function pri_to_col($pri) {
|
protected function pri_to_col($pri) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user