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); // parts for each image $position = 10; $comment_limit = $config->get_int("comment_list_count", 10); $comment_captcha = $config->get_bool('comment_captcha'); foreach ($images as $pair) { $image = $pair[0]; $comments = $pair[1]; $thumb_html = $this->build_thumb_html($image); $comment_html = ""; $comment_count = count($comments); if ($comment_limit > 0 && $comment_count > $comment_limit) { $comment_html .= "
showing $comment_limit of $comment_count comments
"; $comments = array_slice($comments, -$comment_limit); $this->show_anon_id = false; } else { $this->show_anon_id = true; } $this->anon_id = 1; foreach ($comments as $comment) { $comment_html .= $this->comment_to_html($comment); } if (!$user->is_anonymous()) { if ($can_post) { $comment_html .= $this->build_postbox($image->id); } } else { if ($can_post) { if (!$comment_captcha) { $comment_html .= $this->build_postbox($image->id); } else { $link = make_link("post/view/".$image->id); $comment_html .= "Add Comment"; } } } $html = ''.$thumb_html.' | '.$comment_html.' |
IP Address | |
---|---|
No comments by this user.
'; } else { $html .= ""; } $page->add_block(new Block("Comments", $html, "left", 70, "comment-list-user")); } public function display_all_user_comments(array $comments, int $page_number, int $total_pages, User $user) { global $page; $html = ""; foreach ($comments as $comment) { $html .= $this->comment_to_html($comment, true); } if (empty($html)) { $html = 'No comments by this user.
'; } $page->add_block(new Block("Comments", $html, "main", 70, "comment-list-user")); $prev = $page_number - 1; $next = $page_number + 1; //$search_terms = array('I','have','no','idea','what','this','does!'); //$u_tags = url_escape(Tag::implode($search_terms)); //$query = empty($u_tags) ? "" : '/'.$u_tags; $h_prev = ($page_number <= 1) ? "Prev" : "Prev"; $h_index = "Index"; $h_next = ($page_number >= $total_pages) ? "Next" : "Next"; $page->set_title(html_escape($user->name)."'s comments"); $page->add_block(new Block("Navigation", $h_prev.' | '.$h_index.' | '.$h_next, "left", 0)); $this->display_paginator($page, "comment/beta-search/{$user->name}", null, $page_number, $total_pages); } protected function comment_to_html(Comment $comment, bool $trim=false): string { global $config, $user; $tfe = new TextFormattingEvent($comment->comment); send_event($tfe); $i_uid = $comment->owner_id; $h_name = html_escape($comment->owner_name); $h_timestamp = autodate($comment->posted); $h_comment = ($trim ? truncate($tfe->stripped, 50) : $tfe->formatted); $i_comment_id = $comment->comment_id; $i_image_id = $comment->image_id; if ($i_uid == $config->get_int("anon_id")) { $anoncode = ""; $anoncode2 = ""; if ($this->show_anon_id) { $anoncode = ''.$this->anon_id.''; if (!array_key_exists($comment->poster_ip, $this->anon_map)) { $this->anon_map[$comment->poster_ip] = $this->anon_id; } #if($user->can(UserAbilities::VIEW_IP)) { #$style = " style='color: ".$this->get_anon_colour($comment->poster_ip).";'"; if ($user->can(Permissions::VIEW_IP) || $config->get_bool("comment_samefags_public", false)) { if ($this->anon_map[$comment->poster_ip] != $this->anon_id) { $anoncode2 = '('.$this->anon_map[$comment->poster_ip].')'; } } } $h_userlink = "" . $h_name . $anoncode . $anoncode2 . ""; $this->anon_id++; } else { $h_userlink = ''.$h_name.''; } $hb = ($comment->owner_class == "hellbanned" ? "hb" : ""); if ($trim) { $html = "Search for posts containing a certain number of comments, or comments by a particular individual.
comments=1
Returns posts with exactly 1 comment.
comments>0
Returns posts with 1 or more comments.
Can use <, <=, >, >=, or =.
commented_by:username
Returns posts that have been commented on by "username".
commented_by_userno:123
Returns posts that have been commented on by user 123.