session->albumName) ||
!$gallery->user->canReadAlbum($gallery->album) ||
!$gallery->album->isLoaded())
{
$gallery->session->gRedirDone = false;
header("Location: " . makeAlbumHeaderUrl('', '', array('gRedir' => 1)));
return;
}
list($full, $id, $index, $votes) =
getRequestVar(array('full', 'id', 'index', 'votes'));
list($save, $commenter_name, $comment_text) =
getRequestVar(array('save', 'commenter_name', 'comment_text'));
// Set $index from $id
if (isset($id)) {
$index = $gallery->album->getPhotoIndex($id);
if ($index == -1) {
// That photo no longer exists.
header("Location: " . makeAlbumHeaderUrl($gallery->session->albumName));
return;
}
}
else {
if ($index > $gallery->album->numPhotos(1)) {
$index = $gallery->album->numPhotos(1);
}
$id = $gallery->album->getPhotoId($index);
}
$nextId = getNextId($id);
$currentUrlResized = makeAlbumHeaderUrl($gallery->session->albumName, $id);
/* Determine if user has the rights to view full-sized images */
if (!empty($full) && !$gallery->user->canViewFullImages($gallery->album)) {
header("Location: $currentUrlResized");
return;
}
elseif (!$gallery->album->isResized($index) &&
!$gallery->user->canViewFullImages($gallery->album))
{
header("Location: " . makeAlbumHeaderUrl($gallery->session->albumName));
return;
}
if (!isset($full) || (isset($full) && !$gallery->album->isResized($index))) {
$full = NULL;
}
if (!empty($votes) && canVote()) {
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;
}
}
$albumName = $gallery->session->albumName;
$noCount = getRequestVar('noCount');
if ($noCount != 1 &&
!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->isMovieByIndex($index) &&
!$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;
}
// 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'];
$mainWidth = "100%";
$navigator["id"] = $id;
$navigator["allIds"] = $gallery->album->getIds(true);
$navigator["fullWidth"] = "100";
$navigator["widthUnits"] = "%";
$navigator["url"] = ".";
$navigator["bordercolor"] = $bordercolor;
#-- breadcrumb text ---
$breadcrumb["text"] = returnToPathArray($gallery->album, true);
$extra_fields = $gallery->album->getExtraFields(false);
$title = NULL;
if (in_array("Title", $extra_fields)) {
$title = $gallery->album->getExtraField($index, "Title");
}
if (!$title) {
$title = $photo->image->name;
}
if (isset($gallery->app->comments_length)) {
$maxlength = $gallery->app->comments_length;
} else {
$maxlength = 0;
}
if (!empty($save) && $gallery->user->canAddComments($gallery->album)) {
if ( empty($commenter_name) || empty($comment_text)) {
$error_text = gTranslate('core', "Name and comment are both required to save a new comment!");
}
elseif ($maxlength >0 && strlen($comment_text) > $maxlength) {
$error_text = sprintf(gTranslate('core', "Your comment is too long, the admin set maximum length to %d chars"), $maxlength);
}
elseif (isBlacklistedComment($tmp = array('commenter_name' => $commenter_name, 'comment_text' => $comment_text), false)) {
$error_text = gTranslate('core', "Your Comment contains forbidden words. It will not be added.");
}
else {
$comment_text = $comment_text;
$commenter_name = $commenter_name;
$IPNumber = $_SERVER['REMOTE_ADDR'];
$gallery->album->addComment($id, $comment_text, $IPNumber, $commenter_name);
$gallery->album->save();
emailComments($id, $comment_text, $commenter_name);
}
}
if(!$fitToWindow) {
$allImageAreas = $gallery->album->getAllImageAreas($index);
}
else {
$allImageAreas = '';
}
$metaTags = array();
$keyWords = $gallery->album->getKeywords($index);
if (!empty($keyWords)) {
$metaTags['Keywords'] = ereg_replace("[[:space:]]+",' ',$keyWords);
}
if (!$GALLERY_EMBEDDED_INSIDE) {
doctype(); ?>
app->galleryTitle . ' :: '. $gallery->album->fields["title"] . ' :: '. $title ; ?>
$metaTags));
/* prefetch/navigation */
$navcount = sizeof($navigator['allIds']);
$navpage = $navcount - 1;
$firstUrl = makeAlbumUrl($gallery->session->albumName, $navigator['allIds'][0], array('noCount' => 1));
$lastUrl = makeAlbumUrl($gallery->session->albumName, $navigator['allIds'][$navcount - 1], array('noCount' => 1));
$upUrl = makeAlbumUrl($gallery->session->albumName, '', array('noCount' => 1));
while ($navpage > 0) {
if (!strcmp($navigator['allIds'][$navpage], $id)) {
break;
}
$navpage--;
}
if ($navigator['allIds'][0] != $id) {
if ($navigator['allIds'][0] != 'unknown') {
echo "\n ". '';
}
if ($navigator['allIds'][$navpage-1] != 'unknown') {
$prevUrl = makeAlbumUrl($gallery->session->albumName, $navigator['allIds'][$navpage-1],
array('noCount' => 1));
echo "\n ". '';
}
}
if ($navigator['allIds'][$navcount - 1] != $id) {
if ($navigator['allIds'][$navpage+1] != 'unknown') {
$nextUrl = makeAlbumUrl($gallery->session->albumName, $navigator['allIds'][$navpage+1],
array('noCount' => 1));
echo "\n ". '';
}
if ($navigator['allIds'][$navcount-1] != 'unknown') {
echo "\n ". '';
}
}
echo "\n ". '';
if ($gallery->album->isRoot() &&
(!$gallery->session->offline || isset($gallery->session->offlineAlbums["albums.php"])))
{
echo "\n ". '';
}
if (!empty($gallery->album->fields["linkcolor"]) ||
!empty($gallery->album->fields["bgcolor"]) ||
!empty($gallery->album->fields['background']) ||
!empty($gallery->album->fields["textcolor"]))
{
?>
app->useIcons == 'no') ? false : true;
$albumItemOptions = getItemActions($index, $useIcons);
if ($fitToWindow) {
/* Include Javascript */
echo jsHTML("fitToWindow.js.php?imageWidth=$imageWidth&imageHeight=$imageHeight");
}
?>
session->albumName, $id, array("full" => 0));
$iconElements = array();
$adminTextIconElemens = array();
if (!$gallery->album->isMovie($id)) {
print "
\n";
print '
'."\n";
if(sizeof($albumItemOptions) < 3) {
if ($gallery->album->fields["use_exif"] == "yes" &&
(eregi("jpe?g\$", $photo->image->type)) &&
(isset($gallery->app->use_exif) || isset($gallery->app->exiftags)))
{
$albumName = $gallery->session->albumName;
$iconText = getIconText('frame_query.gif', gTranslate('core', "photo properties"));
$adminTextIconElemens[] = popup_link(
$iconText,
"view_photo_properties.php?set_albumName=$albumName&index=$index",
0, false, 550, 600, '', '', '', false);
}
/* If eCards are enabled, show the link.
* The eCard opens in a popup and sends the actual displayed photo.
*/
if(isset($gallery->album->fields["ecards"]) &&
$gallery->album->fields["ecards"] == 'yes' &&
$gallery->app->emailOn == 'yes')
{
$iconText = getIconText('ecard.gif', gTranslate('core', "Send Photo as eCard"));
$adminTextIconElemens[] = popup_link(
$iconText,
makeGalleryUrl('ecard_form.php', array('photoIndex' => $index,'gallery_popup' => 'true' )),
1, true, 550, 600, '', '', '', false);
}
}
if (!empty($gallery->album->fields["print_photos"]) &&
!$gallery->session->offline &&
!$gallery->album->isMovie($id))
{
$photo = $gallery->album->getPhoto($GLOBALS["index"]);
$photoPath = $gallery->album->getAlbumDirURL("full");
$prependURL = '';
if (!ereg('^https?://', $photoPath)) {
$prependURL = 'http';
if (isset($_SERVER['HTTPS']) && stristr($_SERVER['HTTPS'], "on")) {
$prependURL .= 's';
}
$prependURL .= '://'. $_SERVER['HTTP_HOST'];
}
$rawImage = $prependURL . $photoPath . "/" . $photo->image->name . "." . $photo->image->type;
$thumbImage= $prependURL . $photoPath . "/";
if ($photo->thumbnail) {
$thumbImage .= $photo->image->name . "." . "thumb" . "." . $photo->image->type;
}
else if ($photo->image->resizedName) {
$thumbImage .= $photo->image->name . "." . "sized" . "." . $photo->image->type;
}
else {
$thumbImage .= $photo->image->name . "." . $photo->image->type;
}
list($imageWidth, $imageHeight) = $photo->image->getRawDimensions();
/* Now build the admin Texts / left colun */
function enablePrintForm($name) {
global $printPhotoAccessForm, $printShutterflyForm;
switch ($name) {
case 'shutterfly':
$printShutterflyForm = true;
break;
case 'photoaccess':
$printPhotoAccessForm = true;
break;
default:
break;
}
}
/* display photo printing services */
$printServices = $gallery->album->fields['print_photos'];
$numServices = count($printServices);
$fullNames = array(
'Print Services' => array(
'fotokasten' => 'Fotokasten',
'shutterfly' => 'Shutterfly',
'photoaccess' => 'PhotoWorks',
),
'Mobile Service' => array('mpush' => 'mPUSH (mobile service)')
);
/* display a
album->isMovie($id)) {
if(!$do_fullOnly && ($full || $fitToWindow || $gallery->album->isResized($index))) {
switch(true) {
case $fitToWindow:
$href = '';
break;
case $full:
$href = makeAlbumUrl($gallery->session->albumName, $id);
break;
case $gallery->user->canViewFullImages($gallery->album):
$href = makeAlbumUrl($gallery->session->albumName, $id, array("full" => 1));
break;
}
}
}
else {
$href = $gallery->album->getPhotoPath($index) ;
}
$frame = $gallery->album->fields['image_frame'];
if ($fitToWindow && (eregi('safari|opera', $_SERVER['HTTP_USER_AGENT']) || $gallery->session->offline)) {
//Safari/Opera can't render dynamically sized image frame
$frame = 'none';
}
if(empty($full) && !empty($allImageAreas)) {
echo showImageMap($index, $href);
$photoTag = $gallery->album->getPhotoTag($index, $full, array('id' => 'galleryImage', 'usemap' => '#myMap'));
}
else {
$photoTag = $gallery->album->getPhotoTag($index, $full, array('id' => 'galleryImage'));
}
if($gallery->album->isMovie($id)) {
list($width, $height) = $photo->getThumbDimensions();
}
else {
list($width, $height) = $photo->getDimensions($full);
}
$gallery->html_wrap['borderColor'] = $gallery->album->fields["bordercolor"];
$gallery->html_wrap['borderWidth'] = $gallery->album->fields["border"];
$gallery->html_wrap['frame'] = $frame;
$gallery->html_wrap['imageWidth'] = $width;
$gallery->html_wrap['imageHeight'] = $height;
$gallery->html_wrap['imageHref'] = $href;
$gallery->html_wrap['imageTag'] = $photoTag;
if ($fitToWindow && $gallery->user->canViewFullImages($gallery->album)) {
$gallery->html_wrap['attr']['onclick'] = 'sizeChange.toggle()';
}
$gallery->html_wrap['pixelImage'] = getImagePath('pixel_trans.gif');
includeHtmlWrap("inline_photo.frame");
?>
album, $index) ?>
\n";
echo makeFormIntro('view_photo.php', array('name' => 'vote_form'));
?>
';
echo addPolling("item.$id");
?>
album->getPollShowResults()) {
echo "\n";
echo "\n". '
';
echo showResults("item.$id");
echo "\n
";
}
echo "\n";
if (isset($error_text)) {
echo gallery_error($error_text) ."
";
}
if ($gallery->user->canViewComments($gallery->album) && $gallery->app->comments_enabled == 'yes') {
echo viewComments($index, $gallery->user->canAddComments($gallery->album), $page_url);
}
echo "
";
includeHtmlWrap("inline_photo.footer");
if ($gallery->app->comments_enabled == 'yes' &&
$gallery->user->isLoggedIn() &&
$gallery->user->getEmail() &&
!$gallery->session->offline &&
$gallery->app->emailOn == "yes")
{
$emailMeComments = getRequestVar('emailMeComments');
if (!empty($emailMeComments)) {
if ($emailMeComments == 'true') {
$gallery->album->setEmailMe('comments', $gallery->user, $id);
}
else {
$gallery->album->unsetEmailMe('comments', $gallery->user, $id);
}
}
if (! $gallery->album->getEmailMe('comments', $gallery->user)) {
echo "\n
";
includeLayout('navtablebegin.inc');
if ($gallery->album->fields['nav_thumbs'] != 'no' &&
$gallery->album->fields['nav_thumbs_location'] != 'top') {
includeLayout('navmicro.inc');
includeLayout('navtablemiddle.inc');
}
if ( $gallery->album->fields['nav_thumbs'] != 'yes') {
includeLayout('navphoto.inc');
includeLayout('navtablemiddle.inc');
}
includeLayout('breadcrumb.inc');
includeLayout('navtableend.inc');
echo languageSelector();
if (isset($printShutterflyForm)) { ?>