Cleaned up how the Image Replace html is made.

This commit is contained in:
green-ponies (jgen)
2011-09-03 16:03:21 -04:00
parent cc1545188c
commit 8e68d650a1
2 changed files with 24 additions and 13 deletions

View File

@ -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("<a href='$images_link'>Images uploaded</a>: $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) {