예제 #1
0
 public static function Render2($logs)
 {
     $html = "<div class=logs><p>\n";
     foreach ($logs as $blah) {
         if ($blah["type"] == 0) {
             if ($blah["act"] == 0) {
                 $html .= "'''&lt;nowiki&gt;" . $blah["time"] . " [" . $blah["nick"] . "]&lt;/nowiki&gt;''' &lt;nowiki&gt;" . htmlspecialchars(LogsHtml::Remove($blah["contents"])) . "&lt;/nowiki&gt;&lt;br&gt;<br>\n";
             } else {
                 $html .= "'''" . $blah["time"] . " --" . $blah["nick"] . "''' &lt;nowiki&gt;" . htmlspecialchars(LogsHtml::Remove($blah["contents"])) . "&lt;/nowiki&gt;&lt;br&gt;<br>\n";
             }
         }
         switch ($blah["type"]) {
             case 1:
                 $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " has quit:''' " . htmlspecialchars(LogsHtml::Remove($blah["contents"])) . "&lt;br&gt;<br>\n";
                 continue;
             case 2:
                 $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " joined channel'''" . "&lt;br&gt;<br>\n";
                 continue;
             case 3:
                 $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " parted the channel''' " . LogsHtml::al($blah["contents"]) . "&lt;br&gt;<br>\n";
                 continue;
             case 4:
                 $html .= "'''" . $blah["time"] . " =" . $blah["nick"] . " was kicked from channel''' by " . $blah["contents"] . "&lt;br&gt;<br>\n";
                 continue;
         }
     }
     $html .= "</p></div>\n";
     return $html;
 }
예제 #2
0
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;
}