Cleaned up how the Image Replace html is made.
This commit is contained in:
parent
cc1545188c
commit
8e68d650a1
@ -200,12 +200,20 @@ class ImageIO extends SimpleExtension {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public function onUserPageBuilding($event) {
|
public function onUserPageBuilding($event) {
|
||||||
|
global $user;
|
||||||
|
global $config;
|
||||||
|
|
||||||
$u_id = url_escape($event->display_user->id);
|
$u_id = url_escape($event->display_user->id);
|
||||||
$i_image_count = Image::count_images(array("user_id={$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;
|
$i_days_old = ((time() - strtotime($event->display_user->join_date)) / 86400) + 1;
|
||||||
$h_image_rate = sprintf("%.1f", ($i_image_count / $i_days_old));
|
$h_image_rate = sprintf("%.1f", ($i_image_count / $i_days_old));
|
||||||
$images_link = make_link("post/list/user_id=$u_id/1");
|
$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");
|
$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) {
|
public function onSetupBuilding($event) {
|
||||||
|
@ -1,41 +1,44 @@
|
|||||||
<?php
|
<?php
|
||||||
class ImageIOTheme {
|
class ImageIOTheme {
|
||||||
/*
|
/**
|
||||||
* Display a link to delete an image
|
* Display a link to delete an image
|
||||||
* (Added inline Javascript to confirm the deletion)
|
* (Added inline Javascript to confirm the deletion)
|
||||||
*
|
*
|
||||||
* $image_id = the image to delete
|
* @param $image_id The image to delete
|
||||||
*/
|
*/
|
||||||
public function get_deleter_html($image_id) {
|
public function get_deleter_html($image_id) {
|
||||||
global $user;
|
global $user;
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
$i_image_id = int_escape($image_id);
|
|
||||||
|
|
||||||
if($config->get_bool("jquery_confirm")) {
|
if($config->get_bool("jquery_confirm")) {
|
||||||
$html = "
|
$html = "
|
||||||
".make_form(make_link("image_admin/delete"),'POST',false,'delete_image')."
|
".make_form(make_link("image_admin/delete"),'POST',false,'delete_image')."
|
||||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
<input type='hidden' name='image_id' value='$image_id' />
|
||||||
<input type='submit' value='Delete' id='delete_image_submit' />
|
<input type='submit' value='Delete' id='delete_image_submit' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
} else {
|
} else {
|
||||||
$html = "
|
$html = "
|
||||||
".make_form(make_link("image_admin/delete"))."
|
".make_form(make_link("image_admin/delete"))."
|
||||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
<input type='hidden' name='image_id' value='$image_id' />
|
||||||
<input type='submit' value='Delete' onclick='return confirm(\"Delete the image?\");' />
|
<input type='submit' value='Delete' onclick='return confirm(\"Delete the image?\");' />
|
||||||
</form>
|
</form>
|
||||||
";
|
";
|
||||||
}
|
}
|
||||||
|
}
|
||||||
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"))."
|
".make_form(make_link("image_admin/replace"))."
|
||||||
<input type='hidden' name='image_id' value='$i_image_id' />
|
<input type='hidden' name='image_id' value='$image_id' />
|
||||||
<input type='submit' value='Replace' />
|
<input type='submit' value='Replace' />
|
||||||
</form>
|
</form>";
|
||||||
";
|
|
||||||
}
|
|
||||||
|
|
||||||
return $html;
|
return $html;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user