give a count of reported images in the admin's userbox

This commit is contained in:
Shish 2012-02-12 07:47:53 +00:00
parent 4133c72727
commit 4d0b3e69bd
2 changed files with 14 additions and 4 deletions

View file

@ -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.

View file

@ -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,
),
);