/*
* 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) { ?>
= $gallery->app->galleryTitle ?> :: = $gallery->album->fields["title"] ?>
= getStyleSheetLink() ?>
} ?>
includeHtmlWrap("album.header");
function showChoice($label, $target, $args) {
echo "";
}
$adminText = "";
if ($numPhotos == 1) {
$adminText .= "1 photo in this album";
} else {
$adminText .= "$numPhotos items in this album";
if ($maxPages > 1) {
$adminText .= " on " . pluralize($maxPages, "page");
}
}
if ($gallery->user->canWriteToAlbum($gallery->album)) {
$hidden = $gallery->album->numHidden();
$verb = "are";
if ($hidden == 1) {
$verb = "is";
}
if ($hidden) {
$adminText .= " ($hidden $verb hidden)";
}
}
$adminText .="";
$adminCommands = "";
if ($gallery->user->canAddToAlbum($gallery->album)) {
$adminCommands .= 'session->albumName).'">[add photos] ';
}
if ($gallery->user->canCreateSubAlbum($gallery->album)) {
$adminCommands .= ' $gallery->session->albumName),
"view_album.php") .
'">[new nested album] ';
}
if ($gallery->user->canChangeTextOfAlbum($gallery->album)) {
$adminCommands .= '[captions] ';
}
if ($gallery->user->canWriteToAlbum($gallery->album)) {
if ($gallery->album->numPhotos(1)) {
$adminCommands .= 'session->albumName).
'">[sort] ';
$adminCommands .= 'session->albumName . "&index=all").
'">[resize all] ';
$adminCommands .= 'session->albumName . "&index=all").
'">[rebuild thumbs] ';
}
$adminCommands .= 'session->albumName).
'">[properties] ';
}
if ($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($gallery->album)) {
$adminCommands .= 'session->albumName).
'">[permissions] ';
}
if (($gallery->user->isAdmin() || $gallery->user->isOwnerOfAlbum($gallery->album)) &&
!strcmp($gallery->album->fields["public_comments"],"yes")) {
$adminCommands .= '[view all comments] ';
}
$adminCommands .= '[slideshow] ';
if (!$GALLERY_EMBEDDED_INSIDE) {
if ($gallery->user->isLoggedIn()) {
$adminCommands .= " $page)) .
">[logout]";
} else {
$adminCommands .= '[login]';
}
}
$adminCommands .= "";
$adminbox["text"] = $adminText;
$adminbox["commands"] = $adminCommands;
$adminbox["bordercolor"] = $bordercolor;
$adminbox["top"] = true;
include ($GALLERY_BASEDIR . "layout/adminbox.inc");
?>
$breadcrumb["top"] = true;
if (strcmp($gallery->album->fields["returnto"], "no")
|| ($gallery->album->fields["parentAlbumName"])) {
include($GALLERY_BASEDIR . "layout/breadcrumb.inc");
}
include($GALLERY_BASEDIR . "layout/navigator.inc");
#-- if borders are off, just make them the bgcolor ----
$borderwidth = $gallery->album->fields["border"];
if (!strcmp($borderwidth, "off")) {
$bordercolor = $gallery->album->fields["bgcolor"];
$borderwidth = 1;
}
?>
border=0 cellspacing=0 cellpadding=7>
$numPhotos = $gallery->album->numPhotos(1);
$displayCommentLegend = 0; // this determines if we display "* Item contains a comment" at end of page
if ($numPhotos) {
$rowCount = 0;
// Find the correct starting point, accounting for hidden photos
$rowStart = 0;
$cnt = 0;
while ($cnt < $start) {
$rowStart = getNextPhoto($rowStart);
$cnt++;
}
while ($rowCount < $rows) {
/* Do the inline_albumthumb header row */
echo("
if ($gallery->user->canAddToAlbum($gallery->album)) { ?>
Hey! Add some photos.
} else { ?>
This album is empty.
} ?>
}
?>
if (!strcmp($gallery->album->fields["public_comments"], "yes") && $displayCommentLegend) { //display legend for comments ?>
* Comments available for this item.