Fixing shared HTML ID for Random extension.
This commit is contained in:
@ -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));
|
||||
}
|
||||
|
Reference in New Issue
Block a user