public static function Render2($logs) { $html = "<div class=logs><p>\n"; foreach ($logs as $blah) { if ($blah["type"] == 0) { if ($blah["act"] == 0) { $html .= "'''<nowiki>" . $blah["time"] . " [" . $blah["nick"] . "]</nowiki>''' <nowiki>" . htmlspecialchars(LogsHtml::Remove($blah["contents"])) . "</nowiki><br><br>\n"; } else { $html .= "'''" . $blah["time"] . " --" . $blah["nick"] . "''' <nowiki>" . htmlspecialchars(LogsHtml::Remove($blah["contents"])) . "</nowiki><br><br>\n"; } } switch ($blah["type"]) { case 1: $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " has quit:''' " . htmlspecialchars(LogsHtml::Remove($blah["contents"])) . "<br><br>\n"; continue; case 2: $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " joined channel'''" . "<br><br>\n"; continue; case 3: $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " parted the channel''' " . LogsHtml::al($blah["contents"]) . "<br><br>\n"; continue; case 4: $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " was kicked from channel''' by " . $blah["contents"] . "<br><br>\n"; continue; } } $html .= "</p></div>\n"; return $html; }
function FetchLogs($channel) { $html = ""; $c = 0; $logs = array(); $display_joins = isset($_GET['data']); if ($display_joins) { $sql = "SELECT * FROM logs WHERE channel = '" . pg_escape_string($channel) . "' and time > to_timestamp( '" . pg_escape_string($_GET["start"] . " 00:00:00") . "', 'MM/DD/YYYY HH24:MI:SS' ) and time < to_timestamp( '" . pg_escape_string($_GET["end"] . " 23:59:59") . "', 'MM/DD/YYYY HH24:MI:SS' ) order by time asc;"; } else { $sql = "SELECT * FROM logs WHERE channel = '" . pg_escape_string($channel) . "' and time > to_timestamp( '" . pg_escape_string($_GET["start"] . " 00:00:00") . "', 'MM/DD/YYYY HH24:MI:SS' ) and time < to_timestamp( '" . pg_escape_string($_GET["end"] . " 23:59:59") . "', 'MM/DD/YYYY HH24:MI:SS' ) and type = 0 order by time asc;"; } $query = pg_query($sql); if (!$query) { die('SQL failure: ' . pg_last_error()); } while ($item = pg_fetch_assoc($query)) { $logs[] = $item; $c++; } if ($c == 0) { return "No logs found, try a different filter"; } $html .= "<p>Displaying {$c} items:</p>\n"; if (isset($_GET["wiki"])) { $html .= LogsWiki::Render2($logs); } else { $html .= LogsHtml::RenderLogs($logs); } return $html; }