/* * 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 (!$gallery->album->isLoaded()) { header("Location: " . makeAlbumUrl()); return; } if (!$page) { $page = $gallery->session->albumPage[$gallery->album->fields["name"]]; if (!$page) { $page = 1; } } else { $gallery->session->albumPage[$gallery->album->fields["name"]] = $page; } $albumName = $gallery->session->albumName; if (!$gallery->session->viewedAlbum[$albumName]) { $gallery->session->viewedAlbum[$albumName] = 1; $gallery->album->incrementClicks(); } $rows = $gallery->album->fields["rows"]; $cols = $gallery->album->fields["cols"]; $numPhotos = $gallery->album->numPhotos($gallery->user->canWriteToAlbum($gallery->album)); $perPage = $rows * $cols; $maxPages = max(ceil($numPhotos / $perPage), 1); if ($page > $maxPages) { $page = $maxPages; } $start = ($page - 1) * $perPage + 1; $end = $start + $perPage; $nextPage = $page + 1; if ($nextPage > $maxPages) { $nextPage = 1; $last = 1; } $previousPage = $page - 1; if ($previousPage == 0) { $previousPage = $maxPages; $first = 1; } $bordercolor = $gallery->album->fields["bordercolor"]; $imageCellWidth = floor(100 / $cols) . "%"; $fullWidth="100%"; $navigator["page"] = $page; $navigator["pageVar"] = "page"; $navigator["maxPages"] = $maxPages; $navigator["fullWidth"] = $fullWidth; $navigator["url"] = makeAlbumUrl($gallery->session->albumName); $navigator["spread"] = 5; $navigator["bordercolor"] = $bordercolor; $breadCount = 0; $breadtext = array(); $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]; } $breadcrumb["bordercolor"] = $bordercolor; ?> if (!$GALLERY_EMBEDDED_INSIDE) { ?>