regen thumbs permission hack
This commit is contained in:
parent
902d0adbd7
commit
11340ca6da
@ -17,7 +17,7 @@ class RegenThumb extends Extension {
|
|||||||
public function onPageRequest(PageRequestEvent $event) {
|
public function onPageRequest(PageRequestEvent $event) {
|
||||||
global $config, $database, $page, $user;
|
global $config, $database, $page, $user;
|
||||||
|
|
||||||
if($event->page_matches("regen_thumb") && $user->is_admin() && isset($_POST['image_id'])) {
|
if($event->page_matches("regen_thumb") && $user->can("delete_image") && isset($_POST['image_id'])) {
|
||||||
$image = Image::by_id(int_escape($_POST['image_id']));
|
$image = Image::by_id(int_escape($_POST['image_id']));
|
||||||
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext, true));
|
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext, true));
|
||||||
$this->theme->display_results($page, $image);
|
$this->theme->display_results($page, $image);
|
||||||
@ -26,7 +26,7 @@ class RegenThumb extends Extension {
|
|||||||
|
|
||||||
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) {
|
public function onImageAdminBlockBuilding(ImageAdminBlockBuildingEvent $event) {
|
||||||
global $user;
|
global $user;
|
||||||
if($user->is_admin()) {
|
if($user->can("delete_image")) {
|
||||||
$event->add_part($this->theme->get_buttons_html($event->image->id));
|
$event->add_part($this->theme->get_buttons_html($event->image->id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user