$images */ public function display_comment_list(array $images, int $page_number, int $total_pages, bool $can_post): void { global $config, $page; //$prev = $page_number - 1; //$next = $page_number + 1; $page_title = $config->get_string(SetupConfig::TITLE); $page->set_title($page_title); $page->set_heading($page_title); $page->disable_left(); $page->add_block(new Block(null, $this->build_upload_box(), "main", 0)); $page->add_block(new Block(null, "
", "main", 80)); $this->display_paginator($page, "comment/list", null, $page_number, $total_pages); $this->post_page = false; // parts for each image $position = 10; foreach ($images as $pair) { $image = $pair[0]; $comments = $pair[1]; $h_filename = html_escape($image->filename); $h_filesize = to_shorthand_int($image->filesize); $w = $image->width; $h = $image->height; $comment_html = ""; $comment_id = 0; foreach ($comments as $comment) { $this->inner_id = $comment_id++; $comment_html .= $this->comment_to_html($comment, false); } $html = "

 


"; $html .= "File: id}")."\">$h_filename - ($h_filesize, {$w}x{$h}) - "; $html .= html_escape($image->get_tag_list()); $html .= "
"; $html .= "
" . $this->build_thumb_html($image) . "
"; $html .= "
$comment_html
"; $html .= "
"; $page->add_block(new Block(null, $html, "main", $position++)); } } public function display_recent_comments(array $comments): void { $this->post_page = false; parent::display_recent_comments($comments); } public function build_upload_box(): string { return "[[ insert upload-and-comment extension here ]]"; } protected function comment_to_html(Comment $comment, bool $trim = false): string { // because custom themes can't add params, because PHP $post_page = $this->post_page; $inner_id = $this->inner_id; global $user; $tfe = send_event(new TextFormattingEvent($comment->comment)); //$i_uid = $comment->owner_id; $h_name = html_escape($comment->owner_name); //$h_poster_ip = html_escape($comment->poster_ip); if ($trim) { $h_comment = truncate($tfe->stripped, 50); } else { $h_comment = $tfe->formatted; } $h_comment = preg_replace_ex("/(^|>)(>[^<\n]*)(<|\n|$)/", '${1}${2}${3}', $h_comment); // handles discrepency in comment page and homepage $h_comment = str_replace("
", "", $h_comment); $h_comment = str_replace("\n", "
", $h_comment); $i_comment_id = $comment->comment_id; $i_image_id = $comment->image_id; $h_userlink = "$h_name"; $h_date = $comment->posted; $h_del = ""; if ($user->can(Permissions::DELETE_COMMENT)) { $comment_preview = substr(html_unescape($tfe->stripped), 0, 50); $j_delete_confirm_message = json_encode("Delete comment by {$comment->owner_name}:\n$comment_preview"); $h_delete_script = html_escape("return confirm($j_delete_confirm_message);"); $h_delete_link = make_link("comment/delete/$i_comment_id/$i_image_id"); $h_del = " - [Delete]"; } if ($this->post_page) { $h_reply = "[Reply]"; } else { $h_reply = "[Reply]"; } if ($inner_id == 0) { return "
$h_userlink$h_del $h_date No.$i_comment_id $h_reply

$h_comment

"; } else { return "
>>". "
$h_userlink$h_del $h_date No.$i_comment_id

$h_comment

" . "
"; } } }