Fixing shared HTML ID for Random extension.
This commit is contained in:
parent
969be8a228
commit
06e648d3e4
@ -24,6 +24,7 @@ class RandomImage extends Extension {
|
|||||||
public function onPageRequest(PageRequestEvent $event) {
|
public function onPageRequest(PageRequestEvent $event) {
|
||||||
global $config, $database, $page, $user;
|
global $config, $database, $page, $user;
|
||||||
if($event->page_matches("random_image")) {
|
if($event->page_matches("random_image")) {
|
||||||
|
var $action;
|
||||||
if($event->count_args() == 1) {
|
if($event->count_args() == 1) {
|
||||||
$action = $event->get_arg(0);
|
$action = $event->get_arg(0);
|
||||||
$search_terms = array();
|
$search_terms = array();
|
||||||
@ -37,14 +38,14 @@ class RandomImage extends Extension {
|
|||||||
}
|
}
|
||||||
$image = Image::by_random($search_terms);
|
$image = Image::by_random($search_terms);
|
||||||
|
|
||||||
if($action == "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($action == "view") {
|
if($action === "view") {
|
||||||
if(!is_null($image)) {
|
if(!is_null($image)) {
|
||||||
send_event(new DisplayingImageEvent($image, $page));
|
send_event(new DisplayingImageEvent($image, $page));
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ class RandomImageTheme extends Themelet {
|
|||||||
<center><div>
|
<center><div>
|
||||||
|
|
||||||
<a href='$h_view_link' style='position: relative; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
|
<a href='$h_view_link' style='position: relative; height: {$tsize[1]}px; width: {$tsize[0]}px;'>
|
||||||
<img id='thumb_$i_id' title='$h_tip' alt='$h_tip' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
|
<img id='thumb_rand_$i_id' title='$h_tip' alt='$h_tip' class='highlighted' style='height: {$tsize[1]}px; width: {$tsize[0]}px;' src='$h_thumb_link'>
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
</div></center>
|
</div></center>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user