/** * Helper function to list tags/categories as keywords separated by comma. * * @param array $array the array of the tags or categories to list */ private static function getMetaKeywords() { global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_current_category, $_zp_gallery_page, $_zp_zenpage; $words = ''; if (is_object($_zp_current_album) or is_object($_zp_current_image)) { $tags = getTags(); $words .= htmlmetatags::getMetaAlbumAndImageTags($tags, "gallery"); } else { if ($_zp_gallery_page === "index.php") { $tags = array_keys(getAllTagsCount(true)); // get all if no specific item is set $words .= htmlmetatags::getMetaAlbumAndImageTags($tags, "gallery"); } } if (extensionEnabled('zenpage')) { if (is_NewsArticle()) { $tags = getNewsCategories(getNewsID()); $words .= htmlmetatags::getMetaAlbumAndImageTags($tags, "zenpage"); $tags = getTags(); $words = $words . "," . htmlmetatags::getMetaAlbumAndImageTags($tags, "gallery"); } else { if (is_Pages()) { $tags = getTags(); $words = htmlmetatags::getMetaAlbumAndImageTags($tags, "gallery"); } else { if (is_News()) { $tags = $_zp_zenpage->getAllCategories(); $words .= htmlmetatags::getMetaAlbumAndImageTags($tags, "zenpage"); } else { if (is_NewsCategory()) { $words .= $_zp_current_category->getTitle(); } } } } } return $words; }
/** * Prints the parent items breadcrumb navigation for pages or categories * * @param string $before Text to place before the breadcrumb item * @param string $after Text to place after the breadcrumb item */ function printZenpageItemsBreadcrumb($before = NULL, $after = NULL) { global $_zp_current_zenpage_page, $_zp_current_category; $parentitems = array(); if (is_Pages()) { //$parentid = $_zp_current_zenpage_page->getParentID(); $parentitems = $_zp_current_zenpage_page->getParents(); } if (is_NewsCategory()) { //$parentid = $_zp_current_category->getParentID(); $parentitems = $_zp_current_category->getParents(); } foreach ($parentitems as $item) { if (is_Pages()) { $pageobj = new ZenpagePage($item); $parentitemurl = html_encode($pageobj->getLink()); $parentitemtitle = $pageobj->getTitle(); } if (is_NewsCategory()) { $catobj = new ZenpageCategory($item); $parentitemurl = $catobj->getLink(); $parentitemtitle = $catobj->getTitle(); } if ($before) { echo '<span class="beforetext">' . html_encode($before) . '</span>'; } echo "<a href='" . $parentitemurl . "'>" . html_encode($parentitemtitle) . "</a>"; if ($after) { echo '<span class="aftertext">' . html_encode($after) . '</span>'; } } }
} // Load plugins, then load the requested $obj (page, image, album, or index; defined above). $_zp_loaded_plugins = array(); if (file_exists(SERVERPATH . "/" . UTF8ToFilesystem($obj)) && $zp_request) { foreach (getEnabledPlugins() as $extension) { $_zp_loaded_plugins[] = $extension; require_once SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension; } // Zenpage automatic hitcounter update support if (function_exists("is_NewsArticle") and !$_zp_loggedin) { if (is_NewsArticle()) { $hc = $_zp_current_zenpage_news->get('hitcounter') + 1; $_zp_current_zenpage_news->set('hitcounter', $hc); $_zp_current_zenpage_news->save(); } if (is_NewsCategory()) { $catname = sanitize($_GET['category']); query("UPDATE " . prefix('zenpage_news_categories') . " SET `hitcounter` = `hitcounter`+1 WHERE `cat_link` = '" . $catname . "'", true); } if (is_Pages()) { $hc = $_zp_current_zenpage_page->get('hitcounter') + 1; $_zp_current_zenpage_page->set('hitcounter', $hc); $_zp_current_zenpage_page->save(); } } // re-initialize video dimensions if needed if (isImageVideo() & !is_null($_zp_flash_player)) { $_zp_current_image->updateDimensions(); } // Display the page itself if (!is_null($_zp_HTML_cache)) {
/** * * places a link on the theme page to switch to or from the mobile theme * @param string $text link text */ static function controlLink($text = NULL, $before = NULL, $after = Null) { $detect = new mobile(); if ($detect->isMobile()) { if (zp_getCookie('mobileTheme_disable')) { if (is_null($text)) { $text = gettext('View the mobile gallery'); } $enable = 'on'; } else { if (is_null($text)) { $text = gettext('View the normal gallery'); } $enable = 'off'; } if ($before) { echo '<span class="beforetext">' . html_encode($before) . '</span>'; } if (MOD_REWRITE) { $link = '?mobileTheme=' . $enable; } else { global $_zp_gallery_page, $_zp_current_images, $_zp_current_album, $_zp_current_zenpage_news, $_zp_current_category, $_zp_current_zenpage_page; switch ($_zp_gallery_page) { case 'index.php': $link = 'index.php?mobileTheme=' . $enable; break; case 'gallery.php': $link = 'index.php?p=gallery&mobileTheme=' . $enable; break; case 'album.php': $link = pathurlencode($_zp_current_album->getLink(null)) . '&mobileTheme=' . $enable; break; case 'image.php': $link = pathurlencode($_zp_current_image->getLink(null)) . '&mobileTheme=' . $enable; break; case 'news.php': if (is_NewsArticle()) { $link = html_encode($_zp_current_zenpage_news->getLink(null)) . '&mobileTheme=' . $enable; } else { if (is_NewsCategory()) { $link = html_encode($_zp_current_category->getLink(null)) . '&mobileTheme=' . $enable; } else { $link = html_encode(getNewsIndexURL()) . '&mobileTheme=' . $enable; } } break; case 'pages.php': $link = html_encode($_zp_current_zenpage_page->getLink()) . '&mobileTheme=' . $enable; break; default: $link = html_encode($_zp_gallery_page) . '?mobileTheme=' . $enable; break; } } ?> <span class="mobileThemeControlLink"> <a href="<?php echo $link; ?> " rel="external"> <?php echo html_encode($text); ?> </a> </span> <?php if ($after) { echo '<span class="aftertext">' . html_encode($after) . '</span>'; } } }
function hitcounter_load_script($obj) { if (getOption('hitcounter_ignoreIPList_enable')) { $ignoreIPAddressList = explode(',', str_replace(' ', '', getOption('hitcounter_ignoreIPList'))); $skip = in_array(getUserIP(), $ignoreIPAddressList); } else { $skip = false; } if (getOption('hitcounter_ignoreSearchCrawlers_enable') && !$skip) { $botList = explode(',', getOption('hitcounter_searchCrawlerList')); foreach ($botList as $bot) { if (stripos($_SERVER['HTTP_USER_AGENT'], trim($bot))) { $skip = true; break; } } } if (!$skip) { global $_zp_gallery_page, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_current_category; $hint = $show = false; if (checkAccess($hint, $show)) { // count only if permitted to access switch ($_zp_gallery_page) { case 'album.php': if (!$_zp_current_album->isMyItem(ALBUM_RIGHTS) && getCurrentPage() == 1) { $_zp_current_album->countHit(); } break; case 'image.php': if (!$_zp_current_album->isMyItem(ALBUM_RIGHTS)) { //update hit counter $_zp_current_image->countHit(); } break; case 'pages.php': if (!zp_loggedin(ZENPAGE_PAGES_RIGHTS)) { $_zp_current_zenpage_page->countHit(); } break; case 'news.php': if (!zp_loggedin(ZENPAGE_NEWS_RIGHTS)) { if (is_NewsArticle()) { $_zp_current_zenpage_news->countHit(); } else { if (is_NewsCategory()) { $_zp_current_category->countHit(); } } } break; default: if (!zp_loggedin()) { $page = stripSuffix($_zp_gallery_page); setOption('Page-Hitcounter-' . $page, getOption('Page-Hitcounter-' . $page) + 1); } break; } } } return $obj; }
/** * Function to create the page title to be used within the html <head> <title></title> element. * Usefull if you use one header.php for the header of all theme pages instead of individual ones on the theme pages * It returns the title and site name in reversed breadcrumb order: * <title of current page> | <parent item if present> | <gallery title> * It supports standard gallery pages as well a custom and Zenpage news articles, categories and pages. * * @param string $separator How you wish the parts to be separated * @param bool $listparentalbums If the parent albums should be printed in reversed order before the current * @param bool $listparentpage If the parent Zenpage pages should be printed in reversed order before the current page */ function getHeadTitle($separator = ' | ', $listparentalbums = true, $listparentpages = true) { global $_zp_gallery, $_zp_current_album, $_zp_current_image, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_gallery_page, $_zp_current_category, $_zp_page, $_myFavorites; $mainsitetitle = html_encode(getBare(getMainSiteName())); $separator = html_encode($separator); if ($mainsitetitle) { $mainsitetitle = $separator . $mainsitetitle; } $gallerytitle = html_encode(getBareGalleryTitle()); if ($_zp_page > 1) { $pagenumber = ' (' . $_zp_page . ')'; } else { $pagenumber = ''; } switch ($_zp_gallery_page) { case 'index.php': return $gallerytitle . $mainsitetitle . $pagenumber; break; case 'album.php': case 'image.php': if ($listparentalbums) { $parents = getParentAlbums(); $parentalbums = ''; if (count($parents) != 0) { $parents = array_reverse($parents); foreach ($parents as $parent) { $parentalbums .= html_encode(getBare($parent->getTitle())) . $separator; } } } else { $parentalbums = ''; } $albumtitle = html_encode(getBareAlbumTitle()) . $pagenumber . $separator . $parentalbums . $gallerytitle . $mainsitetitle; switch ($_zp_gallery_page) { case 'album.php': return $albumtitle; break; case 'image.php': return html_encode(getBareImageTitle()) . $separator . $albumtitle; break; } break; case 'news.php': if (function_exists("is_NewsArticle")) { if (is_NewsArticle()) { return html_encode(getBareNewsTitle()) . $pagenumber . $separator . gettext('News') . $separator . $gallerytitle . $mainsitetitle; } else { if (is_NewsCategory()) { return html_encode(getBare($_zp_current_category->getTitle())) . $pagenumber . $separator . gettext('News') . $separator . $gallerytitle . $mainsitetitle; } else { return gettext('News') . $pagenumber . $separator . $gallerytitle . $mainsitetitle; } } } break; case 'pages.php': if ($listparentpages) { $parents = $_zp_current_zenpage_page->getParents(); $parentpages = ''; if (count($parents) != 0) { $parents = array_reverse($parents); foreach ($parents as $parent) { $obj = new ZenpagePage($parent); $parentpages .= html_encode(getBare($obj->getTitle())) . $separator; } } } else { $parentpages = ''; } return html_encode(getBarePageTitle()) . $pagenumber . $separator . $parentpages . $gallerytitle . $mainsitetitle; break; case '404.php': return gettext('Object not found') . $separator . $gallerytitle . $mainsitetitle; break; default: // for all other possible static custom pages $custompage = stripSuffix($_zp_gallery_page); $standard = array('contact' => gettext('Contact'), 'register' => gettext('Register'), 'search' => gettext('Search'), 'archive' => gettext('Archive view'), 'password' => gettext('Password required')); if (is_object($_myFavorites)) { $standard['favorites'] = gettext('My favorites'); } if (array_key_exists($custompage, $standard)) { return $standard[$custompage] . $pagenumber . $separator . $gallerytitle . $mainsitetitle; } else { return $custompage . $pagenumber . $separator . $gallerytitle . $mainsitetitle; } break; } }
/** * @deprecated */ function zenpageHitcounter($option = 'pages', $viewonly = false, $id = NULL) { deprecated_function_notify(gettext('Use getHitcounter().')); global $_zp_current_zenpage_page, $_zp_current_zenpage_news; switch ($option) { case "pages": if (is_null($id)) { $id = getPageID(); } $dbtable = prefix('pages'); $doUpdate = true; break; case "category": if (is_null($id)) { $id = getCurrentNewsCategoryID(); } $dbtable = prefix('news_categories'); $doUpdate = getCurrentNewsPage() == 1; // only count initial page for a hit on an album break; case "news": if (is_null($id)) { $id = getNewsID(); } $dbtable = prefix('news'); $doUpdate = true; break; } if ($option == "pages" and is_Pages() or $option == "news" and is_NewsArticle() or $option == "category" and is_NewsCategory()) { if (zp_loggedin(ZENPAGE_PAGES_RIGHTS | ZENPAGE_NEWS_RIGHTS) || $viewonly) { $doUpdate = false; } $hitcounter = "hitcounter"; $whereID = " WHERE `id` = {$id}"; $sql = "SELECT `" . $hitcounter . "` FROM {$dbtable} {$whereID}"; if ($doUpdate) { $sql .= " FOR UPDATE"; } $result = query_single_row($sql); $resultupdate = $result['hitcounter']; if ($doUpdate) { $resultupdate++; query("UPDATE {$dbtable} SET `" . $hitcounter . "`= {$resultupdate} {$whereID}"); } return $resultupdate; } }
function footer() { global $_zp_gallery_page, $_zp_current_category, $_zp_gallery; ?> <div id="footer"> <?php if (function_exists('printFavoritesURL') && $_zp_gallery_page != 'password.php' && $_zp_gallery_page != 'favorites.php') { printFavoritesURL(NULL, '', ' | ', '<br />'); } if (class_exists('RSS')) { $prev = ' | '; switch ($_zp_gallery_page) { default: printRSSLink('Gallery', '', 'RSS', ''); break; case 'album.php': printRSSLink('Album', '', 'RSS', ''); break; case 'news.php': if (is_NewsCategory()) { printRSSLink('Category', '', 'RSS', '', true, null, '', NULL, $_zp_current_category->getTitlelink()); } else { printRSSLink('News', '', 'RSS', ''); } break; case 'password.php': $prev = ''; break; } } else { $prev = ''; } if ($_zp_gallery_page != 'password.php' && $_zp_gallery_page != 'archive.php') { printCustomPageURL(gettext('Archive View'), 'archive', '', $prev, ''); $prev = ' | '; } ?> <?php if ($_zp_gallery_page != 'contact.php' && extensionEnabled('contact_form') && ($_zp_gallery_page != 'password.php' || $_zp_gallery->isUnprotectedPage('contact'))) { printCustomPageURL(gettext('Contact us'), 'contact', '', $prev, ''); $prev = ' | '; } ?> <?php if ($_zp_gallery_page != 'register.php' && function_exists('printRegisterURL') && !zp_loggedin() && ($_zp_gallery_page != 'password.php' || $_zp_gallery->isUnprotectedPage('register'))) { printRegisterURL(gettext('Register for this site'), $prev, ''); $prev = ' | '; } ?> <?php @call_user_func('printUserLogin_out', $prev); ?> <br /> <?php @call_user_func('mobileTheme::controlLink'); ?> <br /> <?php @call_user_func('printLanguageSelector'); ?> <?php printZenphotoLink(); ?> </div> <?php }
function footer() { global $_zp_gallery_page, $_zp_current_category, $_zp_gallery; $exclude_login = array('password.php', 'register.php', 'contact.php'); ?> <div id="footer"> <?php switch ($_zp_gallery_page) { default: printRSSLink('Gallery', '', 'RSS', ''); break; case 'album.php': printRSSLink('Album', '', 'RSS', ''); break; case 'news.php': if (is_NewsCategory()) { printZenpageRSSLink('Category', $_zp_current_category->getTitlelink(), '', 'RSS', ''); } else { printZenpageRSSLink('News', '', '', 'RSS', ''); } break; } ?> <?php if ($_zp_gallery_page != 'password.php' && $_zp_gallery_page != 'archive.php') { printCustomPageURL(gettext('Archive View'), 'archive', '', ' | ', ''); } ?> <?php if ($_zp_gallery_page != 'contact.php' && getOption('zp_plugin_contact_form') && ($_zp_gallery_page != 'password' || $_zp_gallery->isUnprotectedPage('contact'))) { printCustomPageURL(gettext('Contact us'), 'contact', '', ' | ', ''); } ?> <?php if ($_zp_gallery_page != 'register.php' && !zp_loggedin() && function_exists('printRegistrationForm') && ($_zp_gallery_page != 'password.php' || $_zp_gallery->isUnprotectedPage('register'))) { printCustomPageURL(gettext('Register for this site'), 'register', '', ' | ', ''); } ?> <?php if (function_exists('printUserLogin_out') && !in_array($_zp_gallery_page, $exclude_login)) { printUserLogin_out(' | ', '', true); } ?> <?php if (function_exists('printLanguageSelector')) { ?> <br /> <?php printLanguageSelector(); } else { ?> <br /> <?php } ?> <?php printZenphotoLink(); ?> </div> <?php }
/** * Prints the parent items breadcrumb navigation for pages or categories * * @param string $mode 'pages or 'categories' * @param string $before Text to place before the breadcrumb item * @param string $after Text to place after the breadcrumb item */ function printZenpageItemsBreadcrumb($before = NULL, $after = NULL) { global $_zp_current_zenpage_page, $_zp_current_category; $parentitems = array(); if (is_Pages()) { //$parentid = $_zp_current_zenpage_page->getParentID(); $parentitems = $_zp_current_zenpage_page->getParents(); } if (is_NewsCategory()) { //$parentid = $_zp_current_category->getParentID(); $parentitems = $_zp_current_category->getParents(); } foreach ($parentitems as $item) { if (is_Pages()) { $pageobj = new ZenpagePage($item); $parentitemurl = html_encode(getPageLinkURL($item)); $parentitemtitle = $pageobj->getTitle(); } if (is_NewsCategory()) { $catobj = new ZenpageCategory($item); $parentitemurl = getNewsCategoryURL($item); $parentitemtitle = $catobj->getTitle(); } echo $before . "<a href='" . $parentitemurl . "'>" . $parentitemtitle . "</a>" . $after; } }
/** * Prints the parent items breadcrumb navigation for pages or categories * * @param string $before Text to place before the breadcrumb item * @param string $after Text to place after the breadcrumb item */ function printZenpageItemsBreadcrumb($before = NULL, $after = NULL) { global $_zp_current_page, $_zp_current_category, $_zp_current_search; if (in_context(ZP_SEARCH_LINKED)) { $page = $_zp_current_search->page; $searchwords = $_zp_current_search->getSearchWords(); $searchdate = $_zp_current_search->getSearchDate(); $searchfields = $_zp_current_search->getSearchFields(true); if (is_NewsCategory()) { $search_obj_list = array('news' => $_zp_current_search->getCategoryList()); } else { $search_obj_list = NULL; } $searchpagepath = getSearchURL($searchwords, $searchdate, $searchfields, $page, $search_obj_list); if (empty($searchdate)) { $title = gettext("Return to search"); $text = gettext("Search"); } else { $title = gettext("Return to archive"); $text = gettext("Archive"); } if ($before) { echo '<span class="beforetext">' . html_encode($before) . '</span>'; } echo "<a href='" . $searchpagepath . "' title='" . html_encode($title) . "'>" . html_encode($text) . "</a>"; if ($after) { echo '<span class="aftertext">' . html_encode($after) . '</span>'; } } else { if (is_Pages()) { //$parentid = $_zp_current_page->getParentID(); $parentitems = $_zp_current_page->getParents(); } else { if (is_NewsCategory()) { //$parentid = $_zp_current_category->getParentID(); $parentitems = $_zp_current_category->getParents(); } else { $parentitems = array(); } } foreach ($parentitems as $item) { if (is_Pages()) { $pageobj = newPage($item); $parentitemurl = $pageobj->getLink(); $parentitemtitle = $pageobj->getTitle(); } if (is_NewsCategory()) { $catobj = newCategory($item); $parentitemurl = $catobj->getLink(); $parentitemtitle = $catobj->getTitle(); } if ($before) { echo '<span class="beforetext">' . html_encode($before) . '</span>'; } echo "<a href='" . html_encode($parentitemurl) . "'>" . html_encode($parentitemtitle) . "</a>"; if ($after) { echo '<span class="aftertext">' . html_encode($after) . '</span>'; } } } }