minor tidyness

This commit is contained in:
Shish 2010-04-05 09:21:44 +01:00
parent cf6a533c74
commit 95393af219

View file

@ -31,16 +31,19 @@ class RandomImage extends SimpleExtension {
$action = $event->get_arg(0); $action = $event->get_arg(0);
$search_terms = explode(' ', $event->get_arg(1)); $search_terms = explode(' ', $event->get_arg(1));
} }
else {
# FIXME: throw exception
}
$image = Image::by_random($search_terms); $image = Image::by_random($search_terms);
if($event->get_arg(0) == "download") { if($action == "download") {
if(!is_null($image)) { if(!is_null($image)) {
$page->set_mode("data"); $page->set_mode("data");
$page->set_type("image/jpeg"); $page->set_type("image/jpeg");
$page->set_data(file_get_contents($image->get_image_filename())); $page->set_data(file_get_contents($image->get_image_filename()));
} }
} }
if($event->get_arg(0) == "view") { if($action == "view") {
if(!is_null($image)) { if(!is_null($image)) {
send_event(new DisplayingImageEvent($image, $page)); send_event(new DisplayingImageEvent($image, $page));
} }