diff --git a/ext/image/main.php b/ext/image/main.php index 1908d6f5..c448d0e7 100644 --- a/ext/image/main.php +++ b/ext/image/main.php @@ -200,12 +200,20 @@ class ImageIO extends SimpleExtension { } public function onUserPageBuilding($event) { + global $user; + global $config; + $u_id = url_escape($event->display_user->id); $i_image_count = Image::count_images(array("user_id={$event->display_user->id}")); $i_days_old = ((time() - strtotime($event->display_user->join_date)) / 86400) + 1; $h_image_rate = sprintf("%.1f", ($i_image_count / $i_days_old)); $images_link = make_link("post/list/user_id=$u_id/1"); $event->add_stats("Images uploaded: $i_image_count, $h_image_rate per day"); + + /* In the future, could perhaps allow users to replace images that they own as well... */ + if ($user->is_admin() && $config->get_bool("upload_replace")) { + $event->add_part($this->theme->get_replace_html($event->image->id)); + } } public function onSetupBuilding($event) { diff --git a/ext/image/theme.php b/ext/image/theme.php index 516a045d..3004bd5d 100644 --- a/ext/image/theme.php +++ b/ext/image/theme.php @@ -1,41 +1,44 @@ get_bool("jquery_confirm")) { $html = " ".make_form(make_link("image_admin/delete"),'POST',false,'delete_image')." - + "; } else { $html = " ".make_form(make_link("image_admin/delete"))." - + "; } - - if($config->get_bool("upload_replace") && $user->is_admin()) { - $html .= " + } + + /** + * Display link to replace the image + * + * @param $image_id The image to replace + */ + public function get_deleter_html($image_id) { + + $html = " ".make_form(make_link("image_admin/replace"))." - + - - "; - } + "; return $html; }