2007-04-16 11:58:25 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
class RegenThumb extends Extension {
|
2007-06-30 01:19:11 +00:00
|
|
|
var $theme;
|
2007-12-06 02:26:34 +00:00
|
|
|
|
2007-04-16 11:58:25 +00:00
|
|
|
public function receive_event($event) {
|
2007-06-30 01:19:11 +00:00
|
|
|
if(is_null($this->theme)) $this->theme = get_theme_object("regen_thumb", "RegenThumbTheme");
|
|
|
|
|
2007-07-17 07:45:35 +00:00
|
|
|
if(is_a($event, 'PageRequestEvent') && ($event->page_name == "regen_thumb")) {
|
2007-04-16 11:58:25 +00:00
|
|
|
global $user;
|
2007-12-06 02:26:34 +00:00
|
|
|
if($user->is_admin() && isset($_POST['image_id'])) {
|
|
|
|
global $database;
|
|
|
|
$image = $database->get_image(int_escape($_POST['image_id']));
|
|
|
|
send_event(new ThumbnailGenerationEvent($image->hash, $image->ext));
|
|
|
|
$this->theme->display_results($event->page, $image);
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if(is_a($event, 'DisplayingImageEvent')) {
|
|
|
|
global $user;
|
|
|
|
if($user->is_admin()) {
|
2007-07-10 21:16:49 +00:00
|
|
|
$this->theme->display_buttons($event->page, $event->image->id);
|
2007-04-16 11:58:25 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
add_event_listener(new RegenThumb());
|
|
|
|
?>
|