another simpleextnsion
This commit is contained in:
		
							parent
							
								
									351c3469dc
								
							
						
					
					
						commit
						ab1d755a01
					
				@ -12,27 +12,22 @@
 | 
				
			|||||||
 *  since been increased.
 | 
					 *  since been increased.
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class RegenThumb implements Extension {
 | 
					class RegenThumb extends SimpleExtension {
 | 
				
			||||||
	var $theme;
 | 
						public function onPageRequest($event) {
 | 
				
			||||||
 | 
					 | 
				
			||||||
	public function receive_event(Event $event) {
 | 
					 | 
				
			||||||
		global $config, $database, $page, $user;
 | 
							global $config, $database, $page, $user;
 | 
				
			||||||
		if(is_null($this->theme)) $this->theme = get_theme_object($this);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if(($event instanceof PageRequestEvent) && $event->page_matches("regen_thumb")) {
 | 
							if($event->page_matches("regen_thumb") && $user->is_admin() && isset($_POST['image_id'])) {
 | 
				
			||||||
			if($user->is_admin() && 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));
 | 
				
			||||||
				send_event(new ThumbnailGenerationEvent($image->hash, $image->ext));
 | 
								$this->theme->display_results($page, $image);
 | 
				
			||||||
				$this->theme->display_results($page, $image);
 | 
					 | 
				
			||||||
			}
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		if($event instanceof ImageAdminBlockBuildingEvent) {
 | 
						public function onImageAdminBlockBuilding($event) {
 | 
				
			||||||
			if($user->is_admin()) {
 | 
							global $user;
 | 
				
			||||||
				$event->add_part($this->theme->get_buttons_html($event->image->id));
 | 
							if($user->is_admin()) {
 | 
				
			||||||
			}
 | 
								$event->add_part($this->theme->get_buttons_html($event->image->id));
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
add_event_listener(new RegenThumb());
 | 
					 | 
				
			||||||
?>
 | 
					?>
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user