link to image in the event log

This commit is contained in:
Shish 2010-02-02 00:55:34 +00:00
parent 898f1e1f73
commit e779a880ca

View File

@ -20,7 +20,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>".html_escape($event['message'])."</td>"; $table .= "<td>".$this->scan_entities(html_escape($event['message']))."</td>";
$table .= "</tr>\n"; $table .= "</tr>\n";
} }
$table .= "</tbody></table>"; $table .= "</tbody></table>";
@ -42,5 +42,15 @@ class LogDatabaseTheme extends Themelet {
default: return ""; 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 "<a href='".make_link("post/view/$iid")."'>Image #$iid</a>";
}
} }
?> ?>