Fork me on GitHub

gallery module and strange 403 error  Bottom

  • At the "menalto Gallery" forums there is a solution to pop up full photo images in a separate window that doesn't work with gallery embedded in postnuke.
    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

    require_once(dirname(__file__) . '/lib/popup.php');


    **************
    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");

    }


    **************
    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

    makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1));

    **************
    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>




    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
  • I am having this exact same problem.....does anyone know the solution to this problem?
  • Same here. Doesn't seem to be any solution that I can come up with. I have looked through Menalto's site and there dosen't seem to be any solution there either. I'd love to get pop ups working because I am limited to pictures that are 640px wide right now. And if I want to include larger nice pictures it then meeses up the theme of the site.

This list is based on users active over the last 60 minutes.