function printPageListWithNavAlt($prevtext, $nexttext, $nextprev = true, $class = NULL, $id = "pagelist") { echo "<div" . ($id ? " id=\"{$id}\"" : "") . " class=\"{$class}\">"; $total = getTotalPages(); $current = getCurrentPage(); echo "\n<ul class=\"{$class}\"><li>[</li>"; for ($i = 1; $i <= $total; $i++) { echo "\n <li" . ($i == $current ? " class=\"current\"" : "") . ">"; printLinkHTML(getPageURL($i), $i, "Page {$i}" . ($i == $current ? " (Current Page)" : "")); echo "</li>"; } echo "\n<li>]</li>"; if ($nextprev) { echo "\n <li class=\"prev\">"; printPrevPageURL($prevtext, "Previous Page"); echo "</li>"; } echo "\n<li></li>"; if ($nextprev) { echo "\n <li class=\"next\">"; printNextPageURL($nexttext, "Next Page"); echo "</li>"; } echo "\n</ul>"; echo "\n</div>\n"; }
static function printNavigation($prevtext, $nexttext, $oneImagePage = false, $navlen = 7, $firstlast = true) { $total = getTotalPages($oneImagePage); $current = getCurrentPage(); if ($total < 2) { $class .= ' disabled_nav'; } if ($navlen == 0) { $navlen = $total; } $extralinks = 2; if ($firstlast) { $extralinks += 2; } $len = floor(($navlen - $extralinks) / 2); $j = max(round($extralinks / 2), min($current - $len - (2 - round($extralinks / 2)), $total - $navlen + $extralinks - 1)); $ilim = min($total, max($navlen - round($extralinks / 2), $current + floor($len))); $k1 = round(($j - 2) / 2) + 1; $k2 = $total - round(($total - $ilim) / 2); if ($firstlast) { echo '<div class="nav-cell ' . ($current == 1 ? 'current' : 'first') . '">'; echo "<span class='valign'>"; printLink(getPageURL(1, $total), 1, "Page 1"); echo "</span></div>\n"; if ($j > 2) { echo '<div class="nav-cell">'; echo "<span class='valign'>"; printLink(getPageURL($k1, $total), $j - 1 > 2 ? '...' : $k1, "Page {$k1}"); echo "</span></div>\n"; } } for ($i = $j; $i <= $ilim; $i++) { echo '<div class="nav-cell' . ($i == $current ? " current" : "") . '">'; echo "<span class='valign'>"; printLink(getPageURL($i, $total), $i, "Page {$i}" . ($i == $current ? ' ' . gettext("(Current Page)") : "")); echo "</span></div>\n"; } if ($i < $total) { echo '<div class="nav-cell">'; echo "<span class='valign'>"; printLink(getPageURL($k2, $total), $total - $i > 1 ? '...' : $k2, "Page {$k2}"); echo "</span></div>\n"; } if ($firstlast && $i <= $total) { echo '<div class="nav-cell last">'; echo "<span class='valign'>"; printLink(getPageURL($total, $total), $total, "Page {$total}"); echo "</span></div>\n"; } $prevNextLinks = array(); $prevNextLinks['prev'] = ThemeUtil::getLink(getPrevPageURL(), $prevtext) . "\n"; $prevNextLinks['next'] = ThemeUtil::getLink(getNextPageURL(), $nexttext) . "\n"; return $prevNextLinks; }
function show_pagenav() { if (getTotalPages() != 1) { ?> <div id="pagenav"> <?php printPageListWithNav("« prev", "next »"); ?> </div> <?php } else { if (getTotalPages() == 1) { ?> <div id="pagenav"></div> <?php } } }
<div id="header"> <div id="gallerytitle"><h2><?php echo getGalleryTitle(); ?> </h2></div> <div id="img_header_bg"> <div id="img_header"> </div> </div> </div> <div id="navigation"> <ul> <?php $totalPages = getTotalPages(); $currentPage = getCurrentPage(); if (hasPrevPage()) { $link = getPrevPageURL(); } else { $link = "#"; } echo "<li><a href=\"{$link}\" title=\"Previous Page\">«</a></li>\n"; for ($i = 1; $i <= $totalPages; $i++) { echo $i == $currentPage ? '<li class="current">' : '<li>'; if ($i < 10) { $page = '0' . $i; } else { $page = $i; } printLinkHTML(getPageNumURL($i), $page, "Page {$page}");
/** * Returns the next image on a page. * sets $_zp_current_image to the next image in the album. * Returns true if there is an image to be shown * * @param bool $all set to true disable pagination * @param int $firstPageCount the number of images which can go on the page that transitions between albums and images * Normally this parameter should be NULL so as to use the default computations. * @param bool $mine overridePassword the password check * @return bool * * @return bool */ function next_image($all = false, $firstPageCount = NULL, $mine = NULL) { global $_zp_images, $_zp_current_image, $_zp_current_album, $_zp_page, $_zp_current_image_restore, $_zp_current_search, $_zp_gallery, $_firstPageImages; if ($mine != NULL && gettype($mine) != 'boolean' || func_num_args() > 3) { internal_deprecations::next_image(); } if (is_null($firstPageCount)) { $firstPageCount = $_firstPageImages; } $imagePageOffset = getTotalPages(2); /* gives us the count of pages for album thumbs */ if ($all) { $imagePage = 1; $firstPageCount = 0; } else { $_firstPageImages = $firstPageCount; /* save this so pagination can see it */ $imagePage = $_zp_page - $imagePageOffset; } if ($firstPageCount > 0 && $imagePageOffset > 0) { $imagePage = $imagePage + 1; /* can share with last album page */ } if ($imagePage <= 0) { return false; /* we are on an album page */ } if (is_null($_zp_images)) { if (in_context(ZP_SEARCH)) { $_zp_images = $_zp_current_search->getImages($all ? 0 : $imagePage, $firstPageCount, NULL, NULL, true, $mine); } else { $_zp_images = $_zp_current_album->getImages($all ? 0 : $imagePage, $firstPageCount, NULL, NULL, true, $mine); } if (empty($_zp_images)) { return NULL; } $_zp_current_image_restore = $_zp_current_image; $img = array_shift($_zp_images); $_zp_current_image = newImage($_zp_current_album, $img, true, true); save_context(); add_context(ZP_IMAGE); return true; } else { if (empty($_zp_images)) { $_zp_images = NULL; $_zp_current_image = $_zp_current_image_restore; restore_context(); return false; } else { $img = array_shift($_zp_images); $_zp_current_image = newImage($_zp_current_album, $img, true, true); return true; } } }
/** * Places album and all of its album pages on one sitemap * * Gets links to all albums incl. pagination and if the Google image video extension is enabled for images using this as well. * This is independent from the images fetched by getSitemapImages(). * * NOTE: Using the Google extension is currently NOT recommended if you have a huge gallery. * * @return string */ function getSitemapAlbums() { global $_zp_gallery, $sitemap_number; $data = ''; $sitemap_locales = generateLanguageList(); $albumchangefreq = getOption('sitemap_changefreq_albums'); $imagechangefreq = getOption('sitemap_changefreq_images'); $albumlastmod = getOption('sitemap_lastmod_albums'); $albumlastmod = sanitize($albumlastmod); $imagelastmod = getOption('sitemap_lastmod_images'); $albums = array(); getSitemapAlbumList($_zp_gallery, $albums, 'passAlbums'); $offset = $sitemap_number - 1; $albums = array_slice($albums, $offset, SITEMAP_CHUNK); if (!empty($albums)) { $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>'); $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); foreach ($albums as $album) { $albumobj = newAlbum($album['folder']); set_context(ZP_ALBUM); makeAlbumCurrent($albumobj); $pageCount = getTotalPages(); //$imageCount = getNumImages(); //$images = $albumobj->getImages(); $date = sitemap_getDateformat($albumobj, $albumlastmod); switch (SITEMAP_LOCALE_TYPE) { case 1: foreach ($sitemap_locales as $locale) { $url = seo_locale::localePath(true, $locale) . '/' . pathurlencode($albumobj->name); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= sitemap_echonl("\t</url>"); } break; case 2: foreach ($sitemap_locales as $locale) { $url = rewrite_path(pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), dynamic_locale::fullHostPath($locale)); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= sitemap_echonl("\t</url>"); } break; default: $url = rewrite_path(pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), FULLWEBPATH); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= sitemap_echonl("\t</url>"); break; } // print album pages if avaiable if ($pageCount > 1) { for ($x = 2; $x <= $pageCount; $x++) { switch (SITEMAP_LOCALE_TYPE) { case 1: foreach ($sitemap_locales as $locale) { $url = seo_locale::localePath(true, $locale) . '/' . pathurlencode($albumobj->name) . '/' . _PAGE_ . '/' . $x; $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= sitemap_echonl("\t</url>"); } break; case 2: foreach ($sitemap_locales as $locale) { $url = rewrite_path(pathurlencode($albumobj->name) . '/' . _PAGE_ . '/' . $x, '?album=' . pathurlencode($albumobj->name) . '&page=' . $x, dynamic_locale::fullHostPath($locale)); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= sitemap_echonl("\t</url>"); } break; default: $url = rewrite_path(pathurlencode($albumobj->name) . '/' . _PAGE_ . '/' . $x, '?album=' . pathurlencode($albumobj->name) . '&page=' . $x, FULLWEBPATH); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= sitemap_echonl("\t</url>"); break; } } } } $data .= sitemap_echonl('</urlset>'); // End off the <urlset> tag } restore_context(); return $data; }
<?php // force UTF-8 Ø global $_firstPageImages; $np = getOption('images_per_page'); if ($_firstPageImages > 0) { $_firstPageImages = $_firstPageImages - 1; $myimagepagestart = 1; } else { $_firstPageImages = $np - 1; $myimagepagestart = 0; } $myimagepage = $myimagepagestart + getCurrentPage() - getTotalPages(true); if ($myimagepage > 1) { $link_slides = 2; } else { $link_slides = 1; } setOption('images_per_page', $np - $link_slides, false); $_firstPageImages = NULL; setOption('custom_index_page', 'gallery', false); define('ALBUM_THUMB_WIDTH', 210); define('ALBUM_THUMB_HEIGHT', 59);
} else { /* flash */ if ($imagePage = isImagePage()) { ?> <div id="flash"> <p align=center><font color=#663300><?php echo gettext('For the best viewing experience') . ' '; ?> <a href="http://www.macromedia.com/go/getflashplayer/"><?php echo gettext('get Adobe Flash.'); ?> </a></p> <p align="center"><a href=" <?php if ($imagePage) { $url = html_encode(getPageURL(getTotalPages(true))); } else { $url = html_encode(getPageURL(getCurrentPage())); } if (substr($url, -1, 1) == '/') { $url = substr($url, 0, strlen($url) - 1); } echo $url = $url . (MOD_REWRITE ? "?" : "&") . 'noflash'; ?> "> View gallery without Flash</a>.</p> </div> <!-- flash --> <?php $flash_url = "index.php?p=search" . html_encode(getSearchParams()) . "&format=xml"; ?> <script type="text/javascript">
?> <!-- Simpleviewer section --> <div id="flash"> <p align="center"> <font color=#663300><?php echo gettext('For the best viewing experience') . ' '; ?> <a href="http://www.macromedia.com/go/getflashplayer/"><?php echo gettext('Get Adobe Flash.'); ?> </a></font> </p> <p align="center"> <?php if ($imagePage) { $url = htmlspecialchars(getPageURL(getTotalPages(true))); } else { $url = htmlspecialchars(getPageURL(getCurrentPage())); } printLinkWithQuery($url, 'noflash', gettext('View Gallery Without Flash')); echo "</p>"; $flash_url = htmlspecialchars(getAlbumLinkURL()); if (substr($flash_url, -1, 1) == '/') { $flash_url = substr($flash_url, 0, -1); } $flash_url = $flash_url . (getOption("mod_rewrite") ? "?" : "&") . "format=xml"; ?> <script type="text/javascript"> var fo = new SWFObject("<?php echo $_zp_themeroot; ?>
</head> <body> <div style="position:absolute;left:10px;top:10px;"> <div id="documentViewer" class="flexpaper_viewer" style="width:770px;height:500px"></div> <?php if (isset($_GET["doc"])) { $doc = substr($_GET["doc"], 0, strlen($_GET["doc"]) - 4); } else { $doc = "Report"; } $pdfFilePath = $configManager->getConfig('path.pdf'); ?> <script type="text/javascript"> function getDocumentUrl(document){ var numPages = <?php echo getTotalPages($pdfFilePath . $doc . ".pdf"); ?> ; var url = "{services/view.php?doc={doc}&format={format}&page=[*,0],{numPages}}"; url = url.replace("{doc}",document); url = url.replace("{numPages}",numPages); return url; } var searchServiceUrl = escape('php/services/containstext.php?doc=<?php echo $doc; ?> &page=[page]&searchterm=[searchterm]'); $('#documentViewer').FlexPaperViewer( { config : {
/** * Returns the next image on a page. * sets $_zp_current_image to the next image in the album. * Returns true if there is an image to be shown * * @param bool $all set to true disable pagination * @param int $firstPageCount the number of images which can go on the page that transitions between albums and images * Normally this parameter should be NULL so as to use the default computations. * @param bool $mine overridePassword the password check * @return bool * * @return bool */ function next_image($all = false, $firstPageCount = NULL, $mine = NULL) { global $_zp_images, $_zp_current_image, $_zp_current_album, $_zp_page, $_zp_current_image_restore, $_zp_current_search, $_zp_gallery, $_firstPageImages, $_imagePageOffset; if (is_null($firstPageCount)) { $firstPageCount = $_firstPageImages; } if (is_null($_imagePageOffset)) { $_imagePageOffset = getTotalPages(2); /* gives us the count of pages for album thumbs */ } if ($all) { $imagePage = 1; $firstPageCount = 0; } else { $_firstPageImages = $firstPageCount; /* save this so pagination can see it */ $imagePage = $_zp_page - $_imagePageOffset; } if ($firstPageCount > 0 && $_imagePageOffset > 0) { $imagePage = $imagePage + 1; /* can share with last album page */ } if ($imagePage <= 0) { $result = false; /* we are on an album page */ } else { if (is_null($_zp_images)) { if (in_context(ZP_SEARCH)) { $_zp_images = $_zp_current_search->getImages($all ? 0 : $imagePage, $firstPageCount, NULL, NULL, true, $mine); } else { $_zp_images = $_zp_current_album->getImages($all ? 0 : $imagePage, $firstPageCount, NULL, NULL, true, $mine); } if (empty($_zp_images)) { $result = NULL; } else { $_zp_current_image_restore = $_zp_current_image; $img = array_shift($_zp_images); $_zp_current_image = newImage($_zp_current_album, $img, true, true); save_context(); add_context(ZP_IMAGE); $result = true; } } else { if (empty($_zp_images)) { $_zp_images = NULL; $_zp_current_image = $_zp_current_image_restore; restore_context(); $result = false; } else { $img = array_shift($_zp_images); $_zp_current_image = newImage($_zp_current_album, $img, true, true); $result = true; } } } return zp_apply_filter('next_object_loop', $result, $_zp_current_image); }
/** * Places album and all of its album pages on one sitemap * * Gets links to all albums incl. pagination and if the Google image video extension is enabled for images using this as well. * This is independent from the images fetched by getSitemapImages(). * * NOTE: Using the Google extension is currently NOT recommended if you have a huge gallery. * * @return string */ function getSitemapAlbums() { global $_zp_gallery, $sitemap_number; $data = ''; $sitemap_locales = generateLanguageList(); $albumchangefreq = getOption('sitemap_changefreq_albums'); $imagechangefreq = getOption('sitemap_changefreq_images'); $albumlastmod = getOption('sitemap_lastmod_albums'); $albumlastmod = sanitize($albumlastmod); $imagelastmod = getOption('sitemap_lastmod_images'); $albums = array(); getSitemapAlbumList($_zp_gallery, $albums, 'passAlbums'); $offset = $sitemap_number - 1; $albums = array_slice($albums, $offset, SITEMAP_CHUNK); if (!empty($albums)) { $data .= sitemap_echonl('<?xml version="1.0" encoding="UTF-8"?>'); if (getOption('sitemap_google')) { $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:image="http://www.google.com/schemas/sitemap-image/1.1" xmlns:video="http://www.google.com/schemas/sitemap-video/1.1">'); } else { $data .= sitemap_echonl('<urlset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd" xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">'); } foreach ($albums as $album) { $albumobj = new Album($_zp_gallery, $album['folder']); set_context(ZP_ALBUM); makeAlbumCurrent($albumobj); //getting the album pages /* Custom images/albums per page taken out as it is not possible to set these now anymore. Maybe later becomes an options $images_per_page = getOption('images_per_page'); $albums_per_page = getOption('albums_per_page'); if(is_array($imagesperpage)) { foreach($imagesperpage as $alb=>$number) { if($alb == $albumobj->name) { setOption('images_per_page',$number,false); } else { setOption('images_per_page',$images_per_page); } } } if(is_array($albumsperpage)) { foreach($albumsperpage as $alb=>$number) { if($alb == $albumobj->name) { setOption('albums_per_page',$number,false); } else { setOption('albums_per_page',$albums_per_page); } } } */ $pageCount = getTotalPages(); $imageCount = getNumImages(); $images = $albumobj->getImages(); $loop_index = getSitemapGoogleLoopIndex($imageCount, $pageCount); $date = sitemap_getDateformat($albumobj, $albumlastmod); if (sitemap_multilingual()) { foreach ($sitemap_locales as $locale) { $url = FULLWEBPATH . '/' . rewrite_path($locale . '/' . pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), false); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); printSitemapGoogleImageVideoExtras(1, $loop_index, $albumobj, $images); $data .= sitemap_echonl("\t</url>"); } } else { $url = FULLWEBPATH . '/' . rewrite_path(pathurlencode($albumobj->name), '?album=' . pathurlencode($albumobj->name), false); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= getSitemapGoogleImageVideoExtras(1, $loop_index, $albumobj, $images); $data .= sitemap_echonl("\t</url>"); } // print album pages if avaiable if ($pageCount > 1) { for ($x = 2; $x <= $pageCount; $x++) { if (sitemap_multilingual()) { foreach ($sitemap_locales as $locale) { $url = FULLWEBPATH . '/' . rewrite_path($locale . '/' . pathurlencode($albumobj->name) . '/page/' . $x, '?album=' . pathurlencode($albumobj->name) . '&page=' . $x, false); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= getSitemapGoogleImageVideoExtras($x, $loop_index, $albumobj, $images); $data .= sitemap_echonl("\t</url>"); } } else { $url = FULLWEBPATH . '/' . rewrite_path(pathurlencode($albumobj->name) . '/page/' . $x, '?album=' . pathurlencode($albumobj->name) . '&page=' . $x, false); $data .= sitemap_echonl("\t<url>\n\t\t<loc>" . $url . "</loc>\n\t\t<lastmod>" . $date . "</lastmod>\n\t\t<changefreq>" . $albumchangefreq . "</changefreq>\n\t\t<priority>0.8</priority>\n"); $data .= getSitemapGoogleImageVideoExtras($x, $loop_index, $albumobj, $images); $data .= sitemap_echonl("\t</url>"); } } } } $data .= sitemap_echonl('</urlset>'); // End off the <urlset> tag } restore_context(); return $data; }
/** * Returns the next image on a page. * sets $_zp_current_image to the next image in the album. * Returns true if there is an image to be shown * * @param bool $all set to true disable pagination * @param int $firstPageCount the number of images which can go on the page that transitions between albums and images * @param string $sorttype overrides the default sort type * @param string $sortdirection overrides the default sort direction. * @param bool $overridePassword the password check * @return bool * * @return bool */ function next_image($all = false, $firstPageCount = 0, $sorttype = null, $sortdirection = NULL, $overridePassword = false) { global $_zp_images, $_zp_current_image, $_zp_current_album, $_zp_page, $_zp_current_image_restore, $_zp_conf_vars, $_zp_current_search, $_zp_gallery; if (!$overridePassword) { if (checkforPassword()) { return false; } } $imagePageOffset = getTotalPages(true) - 1; /* gives us the count of pages for album thumbs */ if ($all) { $imagePage = 1; } else { $_zp_conf_vars['images_first_page'] = $firstPageCount; /* save this so pagination can see it */ $imagePage = $_zp_page - $imagePageOffset; } if ($firstPageCount > 0 && $imagePageOffset > 0) { $imagePage = $imagePage + 1; /* can share with last album page */ } if ($imagePage <= 0) { return false; /* we are on an album page */ } if (is_null($_zp_images)) { if (in_context(ZP_SEARCH)) { $searchtype = true; $_zp_images = $_zp_current_search->getImages($all ? 0 : $imagePage, $firstPageCount); } else { if ($_zp_current_album->isDynamic()) { $searchtype = true; $search = $_zp_current_album->getSearchEngine(); $_zp_images = $search->getImages($all ? 0 : $imagePage, $firstPageCount); } else { $_zp_images = $_zp_current_album->getImages($all ? 0 : $imagePage, $firstPageCount, $sorttype, $sortdirection); } } if (empty($_zp_images)) { return false; } $_zp_current_image_restore = $_zp_current_image; $img = array_shift($_zp_images); if (is_array($img)) { $_zp_current_image = newImage(new Album($_zp_gallery, $img['folder']), $img['filename']); } else { $_zp_current_image = newImage($_zp_current_album, $img); } save_context(); add_context(ZP_IMAGE); return true; } else { if (empty($_zp_images)) { $_zp_images = NULL; $_zp_current_image = $_zp_current_image_restore; restore_context(); return false; } else { $img = array_shift($_zp_images); if (is_array($img)) { $_zp_current_image = newImage(new Album($_zp_gallery, $img['folder']), $img['filename']); } else { $_zp_current_image = newImage($_zp_current_album, $img); } return true; } } }