user->canReadAlbum($gallery->album)) {
header("Location: " . makeAlbumUrl());
return;
}
if (isset($full) && !$gallery->user->canViewFullImages($gallery->album)) {
header("Location: " . makeAlbumUrl($gallery->session->albumName,
$id));
return;
}
if (!isset($full)) {
$full=NULL;
}
if (!isset($openAnchor)) {
$openAnchor=0;
}
if (isset($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);
}
if (!function_exists('array_search')) {
function array_search($needle, $haystack) {
for ($x=0; $x < sizeof($haystack); $x++) {
if ($haystack[$x] == $needle) {
return $x;
}
}
return NULL;
}
}
if (!empty($votes))
{
if (!isset($votes[$id]) && $gallery->album->getPollScale() == 1 && $gallery->album->getPollType() == "critique")
{
$votes[$id]=null;
}
saveResults($votes);
if ($gallery->album->getPollShowResults())
{
list($buf, $rank)=showResultsGraph(0);
print $buf;
}
}
// 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 (!isset($gallery->session->viewedItem[$gallery->session->albumName][$id])
&& !$gallery->session->offline) {
$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 = isset($gallery->session->fullOnly) &&
!strcmp($gallery->session->fullOnly,"on") &&
!strcmp($gallery->album->fields["use_fullOnly"],"yes");
if ($do_fullOnly) {
$full = $gallery->user->canViewFullImages($gallery->album);
}
$fitToWindow = !strcmp($gallery->album->fields["fit_to_window"], "yes") && !$gallery->album->isResized($index) && !$full && (!$GALLERY_EMBEDDED_INSIDE || $GALLERY_EMBEDDED_INSIDE =='phpBB2');
$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 = (int)(ceil($index / ($rows * $cols)));
$gallery->session->albumPage[$gallery->album->fields['name']] = $page;
/*
* 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 ---
$upArrowURL = '
';
$breadCount = 0;
$breadtext[$breadCount] = _("Album") .": session->albumName) .
"\">" . $gallery->album->fields['title'] . " " . $upArrowURL . "";
$breadCount++;
$pAlbum = $gallery->album;
$depth = 0;
do {
if (!strcmp($pAlbum->fields["returnto"], "no")) {
break;
}
$depth++;
$pAlbumName = $pAlbum->fields['parentAlbumName'];
if ($pAlbumName && (!$gallery->session->offline
|| $gallery->session->offlineAlbums[$pAlbumName])) {
$pAlbum = new Album();
$pAlbum->load($pAlbumName);
$breadtext[$breadCount] = _("Album") .": " . $pAlbum->fields['title'] . " " . $upArrowURL . "";
} elseif (!$gallery->session->offline || isset($gallery->session->offlineAlbums["albums.php"])) {
//-- we're at the top! ---
$breadtext[$breadCount] = _("Gallery") .": " . $gallery->app->galleryTitle . " " . $upArrowURL . "";
$pAlbumName = '';
}
$breadCount++;
} while ($pAlbumName && $depth < $gallery->app->maximumAlbumDepth);
//-- we built the array backwards, so reverse it now ---
for ($i = count($breadtext) - 1; $i >= 0; $i--) {
$breadcrumb["text"][] = $breadtext[$i];
}
$extra_fields=$gallery->album->getExtraFields();
$title=NULL;
if (in_array("Title", $extra_fields))
{
$title=$gallery->album->getExtraField($index, "Title");
}
if (!$title) {
$title=$index;
}
if (!$GALLERY_EMBEDDED_INSIDE) {
doctype() ?>
|
album, $index) ?>
|
||
| '; echo makeFormIntro("view_photo.php", array("name" => "vote_form", "method" => "POST")); ?> ' . addPolling("item.$id"); print ''; echo "\n\t | "; echo "\n||
| '; echo showResults("item.$id"); echo "\n\t | "; echo "\n||
| '; $automaticFields=automaticFieldsList(); $field="Upload Date"; $table=''; $key=array_search($field, $extra_fields); if (is_int($key)) { $table .= " | ||
| ".$automaticFields[$field].": | ". strftime($gallery->app->dateTimeString , $gallery->album->getUploadDate($index)). " | |
| ".$automaticFields[$field].": | ". strftime($gallery->app->dateTimeString , mktime ($itemCaptureDate['hours'], $itemCaptureDate['minutes'], $itemCaptureDate['seconds'], $itemCaptureDate['mon'], $itemCaptureDate['mday'], $itemCaptureDate['year'])). " | |
| ".$automaticFields[$field].": | ". $dimensions[0]." x ".$dimensions[1]." (". ((int) $photo->getFileSize($full) >> 10) ."k) | |
| $field: | ".
str_replace("\n", " ", $value). " | |
| $field: | ".
str_replace("\n", " ", $value). " | |