Prev"; $h_index = "Index"; $h_next = ($page_number >= $total_pages) ? "Next" : "Next"; $nav = "$h_prev | $h_index | $h_next"; $page->set_title("Comments"); $page->set_heading("Comments"); $page->add_block(new Block("Navigation", $nav, "left")); $this->display_paginator($page, "comment/list", null, $page_number, $total_pages); } public function display_recent_comments($page, $comments) { $html = $this->comments_to_html($comments, true); $html .= "
Full List";
$page->add_block(new Block("Comments", $html, "left"));
}
public function display_comments($page, $comments, $postbox, $image_id) {
if($postbox) {
$page->add_block(new Block("Comments",
$this->comments_to_html($comments).
$this->build_postbox($image_id), "main", 30));
}
else {
$page->add_block(new Block("Comments",
$this->comments_to_html($comments), "main", 30));
}
}
private function comments_to_html($comments, $trim=false) {
$html = "";
foreach($comments as $comment) {
$html .= $this->comment_to_html($comment, $trim);
}
return $html;
}
private function comment_to_html($comment, $trim=false) {
global $user;
$tfe = new TextFormattingEvent($comment->comment);
send_event($tfe);
$i_uid = int_escape($comment->owner_id);
$h_name = html_escape($comment->owner_name);
$h_poster_ip = html_escape($comment->poster_ip);
$h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted);
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
$h_userlink = "$h_name";
$h_dellink = $user->is_admin() ?
"
($h_poster_ip, stripped."');\" ".
"href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del)" : "";
$h_imagelink = $trim ? ">>>\n" : "";
return "
$h_userlink: $h_comment $h_imagelink $h_dellink
"; } // FIXME: privatise this public function build_postbox($image_id) { $i_image_id = int_escape($image_id); return " "; } public function add_comment_list($page, $image, $comments, $position, $with_postbox) { $html = "You need to create an account before you can comment