diff --git a/contrib/report_image/main.php b/contrib/report_image/main.php index 80c5da51..7e6200ea 100755 --- a/contrib/report_image/main.php +++ b/contrib/report_image/main.php @@ -52,7 +52,7 @@ class ReportImage extends Extension { } else if($event->get_arg(0) == "remove") { if(isset($_POST['id'])) { - if($user->is_admin()) { + if($user->can("view_image_reort")) { send_event(new RemoveReportedImageEvent($_POST['id'])); $page->set_mode("redirect"); $page->set_redirect(make_link("image_report/list")); @@ -60,7 +60,7 @@ class ReportImage extends Extension { } } else if($event->get_arg(0) == "list") { - if($user->is_admin()) { + if($user->can("view_image_report")) { $this->theme->display_reported_images($page, $this->get_reported_images()); } } @@ -97,8 +97,10 @@ class ReportImage extends Extension { public function onUserBlockBuilding(UserBlockBuildingEvent $event) { global $user; - if($user->is_admin()) { - $event->add_link("Reported Images", make_link("image_report/list")); + if($user->can("view_image_report")) { + $count = $this->count_reported_images(); + $h_count = $count > 0 ? " ($count)" : ""; + $event->add_link("Reported Images$h_count", make_link("image_report/list")); } } @@ -155,6 +157,11 @@ class ReportImage extends Extension { return $reports; } + + public function count_reported_images() { + global $database; + return $database->get_one("SELECT count(*) FROM image_reports"); + } } // ===== Changelog ===== // * Version 0.3a / 0.3a_rc - 11/06/07 - I can no longer use the same theme.php file for both SVN and RCx. Sorry. diff --git a/core/user.class.php b/core/user.class.php index 0f7b7c8a..fc32e689 100644 --- a/core/user.class.php +++ b/core/user.class.php @@ -116,6 +116,7 @@ class User { "edit_image_owner" => False, "mass_tag_edit" => False, "report_image" => $config->get_bool('report_image_anon'), + "view_image_report" => False, ), "user" => array( "change_setting" => False, @@ -138,6 +139,7 @@ class User { "edit_image_owner" => False, "mass_tag_edit" => False, "report_image" => True, + "view_image_report" => False, ), "admin" => array( "change_setting" => True, @@ -159,6 +161,7 @@ class User { "edit_image_owner" => True, "mass_tag_edit" => True, "report_image" => True, + "view_image_report" => True, ), );