Fixing shared HTML ID for Random extension.

This commit is contained in:
green-ponies (jgen)
2012-02-09 01:01:36 -05:00
parent 969be8a228
commit 06e648d3e4
2 changed files with 4 additions and 3 deletions

View File

@ -24,6 +24,7 @@ class RandomImage extends Extension {
public function onPageRequest(PageRequestEvent $event) {
global $config, $database, $page, $user;
if($event->page_matches("random_image")) {
var $action;
if($event->count_args() == 1) {
$action = $event->get_arg(0);
$search_terms = array();
@ -37,14 +38,14 @@ class RandomImage extends Extension {
}
$image = Image::by_random($search_terms);
if($action == "download") {
if($action === "download") {
if(!is_null($image)) {
$page->set_mode("data");
$page->set_type("image/jpeg");
$page->set_data(file_get_contents($image->get_image_filename()));
}
}
if($action == "view") {
if($action === "view") {
if(!is_null($image)) {
send_event(new DisplayingImageEvent($image, $page));
}