Commit 7044f600 authored by Simon Welsh's avatar Simon Welsh

Remove special casing of old rows

git-svn-id: svn+ssh://lsgn/var/logbot-www@62 5f99df0c-6b0a-442a-b40a-040688e84a9d
parent 7a73e914
......@@ -40,7 +40,7 @@ final class DB {
if(!in_array($order, ['Relevance', 'Time'])) {
$order = 'Relevance';
}
$sql = 'SELECT "Time", "Text", "Command", "Target", "Nick", "ID", "Old", ts_rank_cd("Search", query, 16 | 32) AS "Relevance" FROM "Log", plainto_tsquery(\'english\', ' . $value . ') query WHERE "Search" @@ query ORDER BY "' . $order . '" DESC LIMIT 5000';
$sql = 'SELECT "Time", "Text", "Command", "Target", "Nick", "ID", ts_rank_cd("Search", query, 16 | 32) AS "Relevance" FROM "Log", plainto_tsquery(\'english\', ' . $value . ') query WHERE "Search" @@ query ORDER BY "' . $order . '" DESC LIMIT 5000';
$res = $this->query($sql);
$results = array();
while($row = pg_fetch_assoc($res)) {
......
......@@ -43,7 +43,7 @@ if(empty($results)) {
<a href={"search.php?q=" . urlencode($_GET['q']) . "&s=Time"}>time</a>.
</p>);
$body->appendChild(<logs:logs logs={$results} format={['d/m/Y H:i:s', 'd/m/Y H:i']} />);
$body->appendChild(<logs:logs logs={$results} format="d/m/Y H:i:s" />);
}
echo <logs:document head={$head} body={$body} />;
......@@ -4,12 +4,12 @@ class :logs:log extends :x:element {
attribute
int id @required,
array row @required,
array format;
string format = 'H:i:s';
protected function render() {
$id = $this->getAttribute('id');
$log = $this->getAttribute('row');
$format = $this->getAttribute('format') ?: array('H:i:s', 'H:i');
$format = $this->getAttribute('format');
$logTime = strtotime($log['Time']);
$index = 'log_' . $log['ID'];
......@@ -21,11 +21,7 @@ class :logs:log extends :x:element {
<a href={'index.php?date=' . $day . '#' . $index}>{$id}</a>:
</td>);
if($log['Old']) {
$stamp = date($format[1], $logTime);
} else {
$stamp = date($format[0], $logTime);
}
$stamp = date($format, $logTime);
$row->appendChild(<td class="irc-date">
[{$stamp}]
......
......@@ -4,7 +4,7 @@ class :logs:logs extends :x:element {
attribute
int stamp,
array logs,
array format;
string format;
protected function render() {
$stamp = $this->getAttribute('stamp');
......@@ -14,7 +14,7 @@ class :logs:logs extends :x:element {
$table = <table class="logs" />;
if(!$logs) {
$res = DB::inst()->query('SELECT "Time", "Text", "Command", "Target", "Nick", "ID", "Old" FROM "Log" WHERE DATE("Time") = \'' . date('Y-m-d', $stamp) . '\' ORDER BY "Time" ASC');
$res = DB::inst()->query('SELECT "Time", "Text", "Command", "Target", "Nick", "ID" FROM "Log" WHERE DATE("Time") = \'' . date('Y-m-d', $stamp) . '\' ORDER BY "Time" ASC');
$logs = array();
while($row = pg_fetch_assoc($res)) {
$logs[] = $row;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment