http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=29409
This solution requires the following code changes/adds
In util.php find
**************
Code
**************
and insert this script after it.
**************
Code
function pop_image($url, $url_is_complete=0) {
global $gallery, $index;
/* Separate the target from the arguments */
list($target, $arglist) = split("\?", $url);
/* Split the arguments into an associative array */
$tmpargs = split("&", $arglist);
foreach ($tmpargs as $arg) {
if (!$arg) {
continue;
}
list($key, $val) = split("\=", $arg);
$args[$key] = $val;
}
if (!$url_is_complete) {
$url = makeGalleryUrl($target, $args);
$url = "\"$url\"";
}
$photo = $gallery->album->getPhoto($index);
$image = $photo->image;
list($iWidth, $iHeight) = $image->getRawDimensions();
// maybee I should add the album name w/o spaces to winName
// solution for now is simply add time to name of window
$winName = time() . $index;
$winName = str_replace(" ", "", $winName);
return popup_js($url, $winName,
"height=" . $iHeight . ",width=" . $iWidth
.",location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no");
}
global $gallery, $index;
/* Separate the target from the arguments */
list($target, $arglist) = split("\?", $url);
/* Split the arguments into an associative array */
$tmpargs = split("&", $arglist);
foreach ($tmpargs as $arg) {
if (!$arg) {
continue;
}
list($key, $val) = split("\=", $arg);
$args[$key] = $val;
}
if (!$url_is_complete) {
$url = makeGalleryUrl($target, $args);
$url = "\"$url\"";
}
$photo = $gallery->album->getPhoto($index);
$image = $photo->image;
list($iWidth, $iHeight) = $image->getRawDimensions();
// maybee I should add the album name w/o spaces to winName
// solution for now is simply add time to name of window
$winName = time() . $index;
$winName = str_replace(" ", "", $winName);
return popup_js($url, $winName,
"height=" . $iHeight . ",width=" . $iWidth
.",location=no,scrollbars=no,menubars=no,toolbars=no,resizable=no");
}
**************
If you want the popup to have scroll bars, you will need to change scrollbars= no to scrollbars= yes in util.php
**************
Save and close util.php
**************
Open view_photo.php find this
**************
Code
**************
replace it with this
**************
Code
'#" onClick='.pop_image("view_popimage.php?index_id=" . $index).';return false';
**************
Save and close view_photo.php
**************
**************
Open your favorite text editor and create a new PHP file called view_popimage.php
Place the code below in it and save it to you gallery folder.
***********
Code
<?php
/* 2/01/2003 New file for popup window */
// Hack prevention.
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
print _("Security violation") ."\n";
exit;
}
$temp=$index_id;
require(dirname(__file__) . '/init.php');
// Hack check
if (!$gallery->user->canReadAlbum($gallery->album) && (!$gallery->user->canViewFullImages($gallery->album))) {
return;
}
?>
<html>
<head>
<?php
$index=$temp;
$photo=$gallery->album->getphoto($index);
$image = $photo->image;
$photoURL = $gallery->album->getAlbumDirURL("full") . "/" . $image->name . "." . $image->type;
//echo "<title>" . $gallery->album->getCaption($index) . "</title>";
echo "</head>";
echo "<body background=\"" . $photoURL . "\">";
?>
</body>
</html>
/* 2/01/2003 New file for popup window */
// Hack prevention.
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) || !empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
print _("Security violation") ."\n";
exit;
}
$temp=$index_id;
require(dirname(__file__) . '/init.php');
// Hack check
if (!$gallery->user->canReadAlbum($gallery->album) && (!$gallery->user->canViewFullImages($gallery->album))) {
return;
}
?>
<html>
<head>
<?php
$index=$temp;
$photo=$gallery->album->getphoto($index);
$image = $photo->image;
$photoURL = $gallery->album->getAlbumDirURL("full") . "/" . $image->name . "." . $image->type;
//echo "<title>" . $gallery->album->getCaption($index) . "</title>";
echo "</head>";
echo "<body background=\"" . $photoURL . "\">";
?>
</body>
</html>
In standalone version works fine but in postnuke the full image popup URL is generated with quotes and actually is rejected with a 403 error.
This is the URL is generated
http://www.dailyalbu…=view_popimage.php"
note the quotes in between.
There is no solution found yet at the gallery forums as there are not enough *nuke expertise. So I decided to post here.
Does someone gets what is actually happening ?
Thanks in advance
Giorgos
