/** * support to show an image from an album * The imagename is optional. If absent the album thumb image will be * used and the link will be to the album. If present the link will be * to the image. * * @param string $albumname * @param string $imagename * @param int $size the size to make the image. If omitted image will be 50% of 'image_size' option. * @param bool $linkalbum set true to link specific image to album instead of image */ function zenpageAlbumImage($albumname, $imagename = NULL, $size = NULL, $linkalbum = false) { global $_zp_gallery; echo '<br />'; $album = newAlbum($albumname); if ($album->loaded) { if (is_null($size)) { $size = floor(getOption('image_size') * 0.5); } $image = NULL; if (is_null($imagename)) { $linkalbum = true; $image = $album->getAlbumThumbImage(); } else { $image = newImage($album, $imagename); } if ($image && $image->loaded) { makeImageCurrent($image); if ($linkalbum) { rem_context(ZP_IMAGE); echo '<a href="' . html_encode($album->getLink()) . '" title="' . sprintf(gettext('View the %s album'), $albumname) . '">'; add_context(ZP_IMAGE); printCustomSizedImage(sprintf(gettext('View the album %s'), $albumname), $size); rem_context(ZP_IMAGE | ZP_ALBUM); echo '</a>'; } else { echo '<a href="' . html_encode(getImageURL()) . '" title="' . sprintf(gettext('View %s'), $imagename) . '">'; printCustomSizedImage(sprintf(gettext('View %s'), $imagename), $size); rem_context(ZP_IMAGE | ZP_ALBUM); echo '</a>'; } } else { ?> <span style="background:red;color:black;"> <?php printf(gettext('<code>zenpageAlbumImage()</code> did not find the image %1$s:%2$s'), $albumname, $imagename); ?> </span> <?php } } else { ?> <span style="background:red;color:black;"> <?php printf(gettext('<code>zenpageAlbumImage()</code> did not find the album %1$s'), $albumname); ?> </span> <?php } }
/** * recovers search parameters from stored cookie, clears the cookie * * @param string $what the page type * @param string $album Name of the album * @param string $image Name of the image */ function handleSearchParms($what, $album = NULL, $image = NULL) { global $_zp_current_search, $zp_request, $_zp_last_album, $_zp_current_album, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery, $_zp_loggedin; $_zp_last_album = zp_getCookie('zenphoto_last_album'); if (is_object($zp_request) && get_class($zp_request) == 'SearchEngine') { // we are are on a search return $zp_request->getAlbumList(); } $params = zp_getCookie('zenphoto_search_params'); if (!empty($params)) { $context = get_context(); $_zp_current_search = new SearchEngine(); $_zp_current_search->setSearchParams($params); // check to see if we are still "in the search context" if (!is_null($image)) { $dynamic_album = $_zp_current_search->getDynamicAlbum(); if ($_zp_current_search->getImageIndex($album->name, $image->filename) !== false) { if ($dynamic_album) { $_zp_current_album = $dynamic_album; } $context = $context | ZP_SEARCH_LINKED | ZP_IMAGE_LINKED; } } if (!is_null($album)) { $albumname = $album->name; zp_setCookie('zenphoto_last_album', $albumname); if (hasDynamicAlbumSuffix($albumname) && !is_dir(ALBUM_FOLDER_SERVERPATH . $albumname)) { $albumname = stripSuffix($albumname); // strip off the suffix as it will not be reflected in the search path } // see if the album is within the search context. NB for these purposes we need to look at all albums! $save_logon = $_zp_loggedin; $_zp_loggedin = $_zp_loggedin | VIEW_ALL_RIGHTS; $search_album_list = $_zp_current_search->getAlbums(0); $_zp_loggedin = $save_logon; foreach ($search_album_list as $searchalbum) { if (strpos($albumname, $searchalbum) !== false) { $context = $context | ZP_SEARCH_LINKED | ZP_ALBUM_LINKED; break; } } } else { zp_clearCookie('zenphoto_last_album'); } if (!is_null($_zp_current_zenpage_page)) { $pages = $_zp_current_search->getPages(); if (!empty($pages)) { $tltlelink = $_zp_current_zenpage_page->getTitlelink(); foreach ($pages as $apage) { if ($apage == $tltlelink) { $context = $context | ZP_SEARCH_LINKED; break; } } } } if (!is_null($_zp_current_zenpage_news)) { $news = $_zp_current_search->getArticles(0, NULL, true); if (!empty($news)) { $tltlelink = $_zp_current_zenpage_news->getTitlelink(); foreach ($news as $anews) { if ($anews['titlelink'] == $tltlelink) { $context = $context | ZP_SEARCH_LINKED; break; } } } } if ($context & ZP_SEARCH_LINKED) { set_context($context); } else { // not an object in the current search path $_zp_current_search = null; rem_context(ZP_SEARCH); if (!isset($_REQUEST['preserve_serch_params'])) { zp_clearCookie("zenphoto_search_params"); } } } }
<?php // force UTF-8 Ø rem_context(ZP_ALBUM | ZP_IMAGE); if (function_exists('printCustomMenu') && ($menu = getOption('effervescence_menu'))) { ?> <div class="menu"> <?php printCustomMenu($menu, 'list', '', "menu-active", "submenu", "menu-active", 2); ?> </div> <?php } else { // "standard zenpage sidebar menus if (extensionEnabled('zenpage') && ZP_NEWS_ENABLED) { if (getNumNews(true)) { ?> <div class="menu"> <h3><?php echo gettext("News articles"); ?> </h3> <?php printAllNewsCategories(gettext("All news"), true, "", "menu-active", true, "submenu", "menu-active"); ?> <div class="menu_rule"></div> </div> <?php } } ?>
/** * Iterate through comments; use the ZP_COMMENT context. * Return true if there are more comments * @param bool $desc set true for desecnding order * * @return bool */ function next_comment($desc = false) { global $_zp_current_image, $_zp_current_album, $_zp_current_comment, $_zp_comments, $_zp_current_zenpage_page, $_zp_current_zenpage_news; //ZENPAGE: comments support if (is_null($_zp_current_comment)) { if (in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) { if (is_null($_zp_current_image)) { return false; } $_zp_comments = $_zp_current_image->getComments(false, false, $desc); } else { if (!in_context(ZP_IMAGE) and in_context(ZP_ALBUM)) { $_zp_comments = $_zp_current_album->getComments(false, false, $desc); } } if (function_exists('is_NewsArticle')) { if (is_NewsArticle()) { $_zp_comments = $_zp_current_zenpage_news->getComments(false, false, $desc); } if (is_Pages()) { $_zp_comments = $_zp_current_zenpage_page->getComments(false, false, $desc); } } if (empty($_zp_comments)) { return false; } } else { if (empty($_zp_comments)) { $_zp_comments = NULL; $_zp_current_comment = NULL; rem_context(ZP_COMMENT); return false; } } $_zp_current_comment = array_shift($_zp_comments); if ($_zp_current_comment['anon']) { $_zp_current_comment['email'] = $_zp_current_comment['name'] = '<' . gettext("Anonymous") . '>'; } add_context(ZP_COMMENT); return true; }