"; $table .= "TimeModuleUserMessage"; $table .= "\n"; $n = 0; foreach($events as $event) { $oe = ($n++ % 2 == 0) ? "even" : "odd"; $c = $this->pri_to_col($event['priority']); $table .= ""; $table .= "".str_replace(" ", " ", $event['date_sent']).""; $table .= "".$event['section'].""; if($event['username'] == "Anonymous") { $table .= "".$event['address'].""; } else { $table .= "". "".html_escape($event['username'])."". ""; } $table .= "".$this->scan_entities(html_escape($event['message'])).""; $table .= "\n"; } $table .= ""; global $page; $page->set_title("Event Log"); $page->set_heading("Event Log"); $page->add_block(new NavBlock()); $page->add_block(new Block("Events", $table)); } protected function pri_to_col($pri) { switch($pri) { case SCORE_LOG_DEBUG: return "#999"; case SCORE_LOG_INFO: return "#000"; case SCORE_LOG_WARNING: return "#800"; case SCORE_LOG_ERROR: return "#C00"; case SCORE_LOG_CRITICAL: return "#F00"; default: return ""; } } protected function scan_entities($line) { $line = preg_replace_callback("/Image #(\d+)/s", array($this, "link_image"), $line); return $line; } protected function link_image($id) { $iid = int_escape($id[1]); return "Image #$iid"; } } ?>