diff --git a/ext/comment/main.php b/ext/comment/main.php index 70b54224..f79eccfa 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -27,28 +27,6 @@ class Comment { // {{{ $this->image_id = $row['image_id']; $this->poster_ip = $row['poster_ip']; } - - public function to_html($trim=false) { - global $user; - - $tfe = new TextFormattingEvent($this->comment); - send_event($tfe); - - $i_uid = int_escape($this->owner_id); - $h_name = html_escape($this->owner_name); - $h_poster_ip = html_escape($this->poster_ip); - $h_comment = ($trim ? substr($tfe->stripped, 0, 50)."..." : $tfe->formatted); - $i_comment_id = int_escape($this->comment_id); - $i_image_id = int_escape($this->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

"; - } } // }}} class CommentList extends Extension { diff --git a/ext/comment/theme.php b/ext/comment/theme.php index 0f71a405..ce3f156d 100644 --- a/ext/comment/theme.php +++ b/ext/comment/theme.php @@ -41,11 +41,33 @@ class CommentListTheme extends Themelet { private function comments_to_html($comments, $trim=false) { $html = ""; foreach($comments as $comment) { - $html .= $comment->to_html($trim); + $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);