From ee292c2a25cfcff405b1a3e996b7d8d2dd71cafd Mon Sep 17 00:00:00 2001 From: Shish Date: Fri, 23 Apr 2010 04:08:22 +0100 Subject: [PATCH] crudely hide explicit images from the comment list of anons --- ext/comment/main.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/ext/comment/main.php b/ext/comment/main.php index 2835c79e..7e518dc2 100644 --- a/ext/comment/main.php +++ b/ext/comment/main.php @@ -244,6 +244,11 @@ class CommentList extends SimpleExtension { global $config; global $database; + if(class_exists("Ratings")) { + global $user; + $user_ratings = Ratings::get_user_privs($user); + } + if(is_null($current_page) || $current_page <= 0) { $current_page = 1; } @@ -267,6 +272,11 @@ class CommentList extends SimpleExtension { while(!$result->EOF) { $image = Image::by_id($result->fields["image_id"]); $comments = $this->get_comments($image->id); + if(class_exists("Ratings")) { + if(strpos($user_ratings, $image->rating) === FALSE) { + $image = null; // this is "clever", I may live to regret it + } + } if(!is_null($image)) $images[] = array($image, $comments); $result->MoveNext(); }