/* * Gallery - a web based photo album viewer and editor * Copyright (C) 2000-2002 Bharat Mediratta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or (at * your option) any later version. * * This program is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU * General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ ?> // 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; } ?> require($GALLERY_BASEDIR . "init.php"); ?> // Hack check if (!$gallery->user->canReadAlbum($gallery->album)) { header("Location: " . makeAlbumUrl()); return; } if ($id) { $index = $gallery->album->getPhotoIndex($id); if ($index == -1) { // That photo no longer exists. header("Location: " . makeAlbumUrl($gallery->session->albumName)); return; } } else { $id = $gallery->album->getPhotoId($index); } // is photo hidden? should user see it anyway? if (($gallery->album->isHidden($index)) && (!$gallery->user->canWriteToAlbum($gallery->album))){ header("Location: " . makeAlbumUrl($gallery->session->albumName)); return; } $albumName = $gallery->session->albumName; if (!$gallery->session->viewedItem[$gallery->session->albumName][$id]) { $gallery->session->viewedItem[$albumName][$id] = 1; $gallery->album->incrementItemClicks($index); } $photo = $gallery->album->getPhoto($index); if ($photo->isMovie()) { $image = $photo->thumbnail; } else { $image = $photo->image; } $photoURL = $gallery->album->getAlbumDirURL("full") . "/" . $image->name . "." . $image->type; list($imageWidth, $imageHeight) = $image->getRawDimensions(); $do_fullOnly = !strcmp($gallery->session->fullOnly,"on") && !strcmp($gallery->album->fields["use_fullOnly"],"yes"); if ($do_fullOnly) { $full = 1; } $fitToWindow = !strcmp($gallery->album->fields["fit_to_window"], "yes") && !$gallery->album->isResized($index) && !$full; if ($full) { $fullTag = "?full=1"; } $numPhotos = $gallery->album->numPhotos($gallery->user->canWriteToAlbum($gallery->album)); $next = $index+1; if ($next > $numPhotos) { //$next = 1; $last = 1; } $prev = $index-1; if ($prev <= 0) { //$prev = $numPhotos; $first = 1; } if ($index > $gallery->album->numPhotos(1)) { $index = $numPhotos; } /* * We might be prev/next navigating using this page * so recalculate the 'page' variable */ $rows = $gallery->album->fields["rows"]; $cols = $gallery->album->fields["cols"]; $perPage = $rows * $cols; $page = ceil($index / ($rows * $cols)); /* * Relative URLs are tricky if we don't know if we're rewriting * URLs or not. If we're rewriting, then the browser will think * we're down 1 dir farther than we really are. Use absolute * urls wherever possible. */ $top = $gallery->app->photoAlbumURL; $bordercolor = $gallery->album ->fields["bordercolor"]; $borderwidth = $gallery->album->fields["border"]; if (!strcmp($borderwidth, "off")) { $borderwidth = 1; } if (!strcmp($gallery->album->fields["resize_size"], "off")) { $mainWidth = 0; } else { $mainWidth = "100%"; } $navigator["id"] = $id; $navigator["allIds"] = $gallery->album->getIds($gallery->user->canWriteToAlbum($gallery->album)); $navigator["fullWidth"] = "100"; $navigator["widthUnits"] = "%"; $navigator["url"] = "."; $navigator["bordercolor"] = $bordercolor; #-- breadcrumb text --- $breadCount = 0; $breadtext[$breadCount] = "Album: session->albumName) . "\">" . $gallery->album->fields['title'] . ""; $breadCount++; $pAlbum = $gallery->album; do { if (!strcmp($pAlbum->fields["returnto"], "no")) { break; } $pAlbumName = $pAlbum->fields['parentAlbumName']; if ($pAlbumName) { $pAlbum = new Album(); $pAlbum->load($pAlbumName); $breadtext[$breadCount] = "Album: " . $pAlbum->fields['title'] . ""; } else { //-- we're at the top! --- $breadtext[$breadCount] = "Gallery: " . $gallery->app->galleryTitle . ""; } $breadCount++; } while ($pAlbumName); //-- we built the array backwards, so reverse it now --- for ($i = count($breadtext) - 1; $i >= 0; $i--) { $breadcrumb["text"][] = $breadtext[$i]; } ?> if (!$GALLERY_EMBEDDED_INSIDE) { ?>