/** * 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 a RSS link for if (class_exists('RSS')) printRSSLink() and if (class_exists('RSS')) printRSSHeaderLink() * * @param string $option type of RSS: "Gallery" feed for latest images of the whole gallery * "Album" for latest images only of the album it is called from * "Collection" for latest images of the album it is called from and all of its subalbums * "Comments" for all comments of all albums and images * "Comments-image" for latest comments of only the image it is called from * "Comments-album" for latest comments of only the album it is called from * "AlbumsRSS" for latest albums * "AlbumsRSScollection" only for latest subalbums with the album it is called from * or * "News" feed for all news articles * "Category" for only the news articles of the category that is currently selected * "NewsWithImages" for all news articles and latest images * "Comments" for all news articles and pages * "Comments-news" for comments of only the news article it is called from * "Comments-page" for comments of only the page it is called from * "Comments-all" for comments from all albums, images, news articels and pages * "Pages" feed for all pages * @param string $lang optional to display a feed link for a specific language. Enter the locale like "de_DE" (the locale must be installed on your Zenphoto to work of course). If empty the locale set in the admin option or the language selector (getOption('locale') is used. * @param string $addl provided additional data for feeds (e.g. album object for album feeds, $categorylink for zenpage categories */ function getRSSLink($option, $lang = NULL, $addl = NULL) { global $_zp_current_album, $_zp_current_image, $_zp_current_admin_obj, $_zp_current_category; if (strtolower($option) == 'newswithimages') { RSS_internal_deprecations::getRSSLink($option); } if (empty($lang)) { $lang = zpFunctions::getLanguageText(getOption('locale')); } $link = NULL; switch (strtolower($option)) { case 'gallery': if (getOption('RSS_album_image')) { $link = array('rss' => 'gallery'); } break; case 'album': if (getOption('RSS_album_image')) { if (is_object($addl)) { $album = $addl; } else { $album = $_zp_current_album; } $link = array('rss' => 'gallery', 'albumname' => $album->getFileName()); break; } case 'collection': if (getOption('RSS_album_image')) { if (is_object($addl)) { $album = $addl; } else { $album = $_zp_current_album; } $link = array('rss' => 'gallery', 'folder' => $album->getFileName()); } break; case 'comments': if (getOption('RSS_comments')) { $link = array('rss' => 'comments', 'type' => 'gallery'); } break; case 'comments-image': if (getOption('RSS_comments')) { $link = array('rss' => 'comments', 'id' => (string) $_zp_current_image->getID(), 'type' => 'image'); } break; case 'comments-album': if (getOption('RSS_comments')) { $link = array('rss' => 'comments', 'id' => (string) $_zp_current_album->getID(), 'type' => 'album'); } break; case 'albumsrss': if (getOption('RSS_album_image')) { $link = array('rss' => 'gallery', 'albumsmode' => ''); } break; case 'albumsrsscollection': if (getOption('RSS_album_image')) { $link = array('rss' => 'gallery', 'folder' => $_zp_current_album->getFileName(), 'albumsmode' => ''); } break; case 'pages': if (getOption('RSS_pages')) { $link = array('rss' => 'pages'); } break; case 'news': if (getOption('RSS_articles')) { $link = array('rss' => 'news'); } break; case 'category': if (getOption('RSS_articles')) { if (empty($addl) && !is_null($_zp_current_category)) { $addl = $_zp_current_category->getTitlelink(); } if (empty($addl)) { $link = array('rss' => 'news'); } else { $link = array('rss' => 'news', 'category' => $addl); } } break; case 'newswithimages': if (getOption('RSS_articles')) { $link = array('rss' => 'news', 'withimages' => ''); } break; case 'comments': if (getOption('RSS_article_comments')) { $link = array('comments' => 1, 'type' => 'zenpage'); } break; case 'comments-news': if (getOption('RSS_article_comments')) { $link = array('rss' => 'comments', 'id' => (string) getNewsID(), 'type' => 'news'); } break; case 'comments-page': if (getOption('RSS_article_comments')) { $link = array('rss' => 'comments', 'id' => (string) getPageID(), 'type' => 'page'); } break; case 'comments-all': if (getOption('RSS_article_comments')) { $link = array('rss' => 'comments', 'type' => 'allcomments'); } break; } if (is_array($link)) { $link['lang'] = $lang; if (zp_loggedin() && getOption('RSS_portable_link')) { $link['user'] = (string) $_zp_current_admin_obj->getID(); $link['token'] = Zenphoto_Authority::passwordHash(serialize($link), ''); } $uri = WEBPATH . '/index.php?' . str_replace('=&', '&', http_build_query($link)); return $uri; } return NULL; }
/** * @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 printDisqusCommentForm() { global $_zp_gallery_page, $_zp_current_image, $_zp_current_album, $_zp_current_zenpage_news, $_zp_current_zenpage_page; $zpdisqus_shortname = getOption('zpbase_disqus_shortname'); $comments_open = false; switch ($_zp_gallery_page) { case 'image.php': if (!getOption('zpbase_disqus_comment_form_images')) { return; } $comments_open = $_zp_current_image->getCommentsAllowed(); $zpdisqus_id = 'image' . $_zp_current_image->getID(); $zpdisqus_title = $_zp_current_image->getTitle(); break; case 'album.php': if (!getOption('zpbase_disqus_comment_form_albums')) { return; } $comments_open = $_zp_current_album->getCommentsAllowed(); $zpdisqus_id = 'album' . $_zp_current_album->getID(); $zpdisqus_title = $_zp_current_album->getTitle(); break; case 'news.php': if (!getOption('zpbase_disqus_comment_form_articles')) { return; } $comments_open = $_zp_current_zenpage_news->getCommentsAllowed(); $zpdisqus_id = 'news' . getNewsID(); $zpdisqus_title = $_zp_current_zenpage_news->getTitle(); break; case 'pages.php': if (!getOption('zpbase_disqus_comment_form_pages')) { return; } $comments_open = $_zp_current_zenpage_page->getCommentsAllowed(); $zpdisqus_id = 'page' . getPageID(); $zpdisqus_title = $_zp_current_zenpage_page->getTitle(); break; } if ($zpdisqus_shortname != '' && $comments_open) { ?> <div id="disqus_thread"></div> <script type="text/javascript"> var disqus_shortname = '<?php echo $zpdisqus_shortname; ?> '; var disqus_identifier = '<?php echo $zpdisqus_id; ?> '; var disqus_title = '<?php echo $zpdisqus_title; ?> '; (function() { var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true; dsq.src = '//' + disqus_shortname + '.disqus.com/embed.js'; (document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq); })(); </script> <?php } elseif ($zpdisqus_shortname == '') { echo '<h3>' . gettext('Disqus shortname is not being provided...please contact the admin of this site') . '</h3>'; } }
/** * Prints a RSS link * * @param string $option type of RSS: "News" feed for all news articles * "Category" for only the news articles of the category that is currently selected * "NewsWithImages" for all news articles and latest images * "Comments" for all news articles and pages * "Comments-news" for comments of only the news article it is called from * "Comments-page" for comments of only the page it is called from * "Comments-all" for comments from all albums, images, news articels and pages * @param string $categorylink The specific category you want a RSS feed from (only 'Category' mode) * @param string $prev text to before before the link * @param string $linktext title of the link * @param string $next text to appear after the link * @param bool $printIcon print an RSS icon beside it? if true, the icon is zp-core/images/rss.png * @param string $class css class * @param string $lang optional to display a feed link for a specific language (currently works for latest images only). Enter the locale like "de_DE" (the locale must be installed on your Zenphoto to work of course). If empty the locale set in the admin option or the language selector (getOption('locale') is used. */ function printZenpageRSSLink($option = 'News', $categorylink = '', $prev = '', $linktext = '', $next = '', $printIcon = true, $class = null, $lang = NULL) { global $_zp_current_category; if ($printIcon) { $icon = ' <img src="' . FULLWEBPATH . '/' . ZENFOLDER . '/images/rss.png" alt="RSS Feed" />'; } else { $icon = ''; } if (!is_null($class)) { $class = 'class="' . $class . '"'; } if (empty($lang)) { $lang = getOption("locale"); } if ($option == 'Category') { if (!is_null($categorylink)) { $categorylink = '&category=' . sanitize($categorylink); } elseif (empty($categorylink) and !is_null($_zp_current_category)) { $categorylink = '&category=' . $_zp_current_category->getTitlelink(); } else { $categorylink = ''; } } $linktext = html_encode($linktext); switch ($option) { case "News": if (getOption('RSS_articles')) { echo $prev . "<a {$class} href=\"" . WEBPATH . "/index.php?rss-news&lang=" . $lang . "\" title=\"" . gettext("News RSS") . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next; } break; case "Category": if (getOption('RSS_articles')) { echo $prev . "<a {$class} href=\"" . WEBPATH . "/index.php?rss-news&lang=" . $lang . $categorylink . "\" title=\"" . gettext("News Category RSS") . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next; } break; case "NewsWithImages": if (getOption('RSS_articles')) { echo $prev . "<a {$class} href=\"" . WEBPATH . "/index.php?rss-news&withimages&lang=" . $lang . "\" title=\"" . gettext("News and Gallery RSS") . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next; } break; case "Comments": if (getOption('RSS_article_comments')) { echo $prev . "<a {$class} href=\"" . WEBPATH . "/index.php?rss-comments&type=zenpage&lang=" . $lang . "\" title=\"" . gettext("Zenpage Comments RSS") . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next; } break; case "Comments-news": if (getOption('RSS_article_comments')) { echo $prev . "<a {$class} href=\"" . WEBPATH . "/index.php?rss-comments&id=" . getNewsID() . "&title=" . urlencode(getNewsTitle()) . "&type=news&lang=" . $lang . "\" title=\"" . gettext("News article comments RSS") . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next; } break; case "Comments-page": if (getOption('RSS_article_comments')) { echo $prev . "<a {$class} href=\"" . WEBPATH . "/index.php?rss-comments&id=" . getPageID() . "&title=" . urlencode(getPageTitle()) . "&type=page&lang=" . $lang . "\" title=\"" . gettext("Page Comments RSS") . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next; } break; case "Comments-all": if (getOption('RSS_article_comments')) { echo $prev . "<a {$class} href=\"" . WEBPATH . "/index.php?rss-comments&type=allcomments&lang=" . $lang . "\" title=\"" . gettext("Page Comments RSS") . "\" rel=\"nofollow\">" . $linktext . "{$icon}</a>" . $next; } break; } }
static function admin_toolbox_news($redirect, $zf) { global $_zp_CMS, $_zp_current_category, $_zp_current_article; if (is_NewsArticle()) { if (zp_loggedin(ZENPAGE_NEWS_RIGHTS) && $_zp_CMS && $_zp_CMS->news_enabled) { // page is a NewsArticle--provide zenpage edit, delete, and Add links echo "<li><a href=\"" . $zf . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?newsarticle&edit&titlelink=" . html_encode($_zp_current_article->getTitleLink()) . "&subpage=object\">" . gettext("Edit Article") . "</a></li>"; if (GALLERY_SESSION) { // XSRF defense requires sessions ?> <li> <a href="javascript:confirmDelete('<?php echo $zf . '/' . PLUGIN_FOLDER; ?> /zenpage/admin-news.php?del=<?php echo getNewsID(); ?> &XSRFToken=<?php echo getXSRFToken('delete'); ?> ',deleteArticle)" title="<?php echo gettext("Delete article"); ?> "><?php echo gettext("Delete Article"); ?> </a> </li> <?php } echo "<li><a href=\"" . $zf . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?newsarticle&add\">" . gettext("Add Article") . "</a></li>"; } $redirect .= '&title=' . urlencode($_zp_current_article->getTitlelink()); } else { if (!empty($_zp_current_category)) { $redirect .= '&category=' . $_zp_current_category->getTitlelink(); } } return $redirect; }
/** * Prints the clickable drop down toolbox on any theme page with generic admin helpers * @param string $id the html/css theming id */ function printAdminToolbox($id = 'admin') { global $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_gallery_page, $_zp_gallery; if (zp_loggedin()) { $protocol = SERVER_PROTOCOL; if ($protocol == 'https_admin') { $protocol = 'https'; } $zf = $protocol . '://' . $_SERVER['HTTP_HOST'] . WEBPATH . "/" . ZENFOLDER; $dataid = $id . '_data'; $page = getCurrentPage(); $redirect = ''; ?> <script type="text/javascript"> // <!-- <![CDATA[ function newAlbum(folder,albumtab) { var album = prompt('<?php echo gettext('New album name?'); ?> ', '<?php echo gettext('new album'); ?> '); if (album) { launchScript('<?php echo $zf; ?> /admin-edit.php',['action=newalbum','album='+encodeURIComponent(folder),'name='+encodeURIComponent(album),'albumtab='+albumtab,'XSRFToken=<?php echo getXSRFToken('newalbum'); ?> ']); } } // ]]> --> </script> <?php echo '<div id="' . $id . '">' . "\n" . '<h3><a href="javascript:toggle(' . "'" . $dataid . "'" . ');">' . gettext('Admin Toolbox') . '</a></h3>' . "\n" . "\n</div>"; echo '<div id="' . $dataid . '" style="display: none;">' . "\n"; // open the list--all links go between here and the close of the list below echo "<ul style='list-style-type: none;'>"; // generic link to Admin.php echo "<li>"; printLink($zf . '/admin.php', gettext("Admin"), NULL, NULL, NULL); echo "</li>\n"; // setup for return links if (isset($_GET['p'])) { $redirect = "&p=" . urlencode(sanitize($_GET['p'])); } if ($page > 1) { $redirect .= "&page={$page}"; } if (zp_loggedin(OPTIONS_RIGHTS)) { // options link for all admins with options rights echo "<li>"; printLink($zf . '/admin-options.php?tab=general', gettext("Options"), NULL, NULL, NULL); echo "</li>\n"; } zp_apply_filter('admin_toolbox_global'); $gal = getOption('custom_index_page'); if (empty($gal) || !file_exists(SERVERPATH . '/' . THEMEFOLDER . '/' . $_zp_gallery->getCurrentTheme() . '/' . internalToFilesystem($gal) . '.php')) { $gal = 'index.php'; } else { $gal .= '.php'; } if ($_zp_gallery_page === $gal) { // script is either index.php or the gallery index page if (zp_loggedin(ALBUM_RIGHTS)) { // admin has edit rights so he can sort the gallery (at least those albums he is assigned) ?> <li><?php printLink($zf . '/admin-edit.php?page=edit', gettext("Sort Gallery"), NULL, NULL, NULL); ?> </li> <?php } if (zp_loggedin(UPLOAD_RIGHTS)) { // admin has upload rights, provide an upload link for a new album if (GALLERY_SESSION) { // XSRF defense requires sessions ?> <li><a href="javascript:newAlbum('',true);"><?php echo gettext("New Album"); ?> </a></li> <?php } } zp_apply_filter('admin_toolbox_gallery'); } else { if ($_zp_gallery_page === 'album.php') { // script is album.php $albumname = $_zp_current_album->name; if ($_zp_current_album->isMyItem(ALBUM_RIGHTS)) { // admin is empowered to edit this album--show an edit link echo "<li>"; printLink($zf . '/admin-edit.php?page=edit&album=' . pathurlencode($_zp_current_album->name), gettext('Edit album'), NULL, NULL, NULL); echo "</li>\n"; if (!$_zp_current_album->isDynamic()) { if ($_zp_current_album->getNumAlbums()) { ?> <li><?php printLink($zf . '/admin-edit.php?page=edit&album=' . pathurlencode($albumname) . '&tab=subalbuminfo', gettext("Sort subalbums"), NULL, NULL, NULL); ?> </li> <?php } if ($_zp_current_album->getNumImages() > 0) { ?> <li><?php printLink($zf . '/admin-albumsort.php?page=edit&album=' . pathurlencode($albumname) . '&tab=sort', gettext("Sort album images"), NULL, NULL, NULL); ?> </li> <?php } } // and a delete link if (GALLERY_SESSION) { // XSRF defense requires sessions ?> <li><a href="javascript:confirmDeleteAlbum('<?php echo $zf; ?> /admin-edit.php?page=edit&action=deletealbum&album=<?php echo urlencode(pathurlencode($albumname)); ?> &XSRFToken=<?php echo getXSRFToken('delete'); ?> ');" title="<?php echo gettext('Delete the album'); ?> "><?php echo gettext('Delete album'); ?> </a> </li> <?php } } if ($_zp_current_album->isMyItem(UPLOAD_RIGHTS) && !$_zp_current_album->isDynamic()) { // provide an album upload link if the admin has upload rights for this album and it is not a dynamic album ?> <li><?php printLink($zf . '/admin-upload.php?album=' . pathurlencode($albumname), gettext("Upload Here"), NULL, NULL, NULL); ?> </li> <?php if (GALLERY_SESSION) { // XSRF defense requires sessions ?> <li><a href="javascript:newAlbum('<?php echo pathurlencode($albumname); ?> ',true);"><?php echo gettext("New Album Here"); ?> </a> </li> <?php } } // set the return to this album/page zp_apply_filter('admin_toolbox_album', $albumname); $redirect = "&album=" . pathurlencode($albumname); if ($page > 1) { $redirect .= "&page={$page}"; } } else { if ($_zp_gallery_page === 'image.php') { // script is image.php if (!$_zp_current_album->isDynamic()) { // don't provide links when it is a dynamic album $albumname = $_zp_current_album->name; $imagename = $_zp_current_image->filename; if ($_zp_current_album->isMyItem(ALBUM_RIGHTS)) { // if admin has edit rights on this album, provide a delete link for the image. if (GALLERY_SESSION) { // XSRF defense requires sessions ?> <li><a href="javascript:confirmDelete('<?php echo $zf; ?> /admin-edit.php?page=edit&action=deleteimage&album=<?php echo urlencode(pathurlencode($albumname)); ?> &image=<?php echo urlencode($imagename); ?> &XSRFToken=<?php echo getXSRFToken('delete'); ?> ',deleteImage);" title="<?php echo gettext("Delete the image"); ?> "><?php echo gettext("Delete image"); ?> </a></li> <?php } ?> <li><a href="<?php echo $zf; ?> /admin-edit.php?page=edit&album=<?php echo pathurlencode($albumname); ?> &image=<?php echo urlencode($imagename); ?> &tab=imageinfo#IT" title="<?php echo gettext('Edit this image'); ?> "><?php echo gettext('Edit image'); ?> </a></li> <?php } // set return to this image page zp_apply_filter('admin_toolbox_image', $albumname, $imagename); $redirect = "&album=" . pathurlencode($albumname) . "&image=" . urlencode($imagename); } } else { if ($_zp_gallery_page === 'search.php' && !empty($_zp_current_search->words)) { // script is search.php with a search string if (zp_loggedin(UPLOAD_RIGHTS)) { // if admin has edit rights allow him to create a dynamic album from the search echo "<li><a href=\"" . $zf . "/admin-dynamic-album.php\" title=\"" . gettext("Create an album from the search") . "\">" . gettext("Create Album") . "</a></li>"; } zp_apply_filter('admin_toolbox_search'); $redirect = "&p=search" . $_zp_current_search->getSearchParams() . "&page={$page}"; } } } } // zenpage script pages if (function_exists('is_NewsArticle')) { if (is_NewsArticle()) { // page is a NewsArticle--provide zenpage edit, delete, and Add links $titlelink = getNewsTitlelink(); $redirect .= '&title=' . urlencode($titlelink); } if (is_Pages()) { // page is zenpage page--provide edit, delete, and add links $titlelink = getPageTitlelink(); $redirect .= '&title=' . urlencode($titlelink); } if (zp_loggedin(ZENPAGE_NEWS_RIGHTS)) { // admin has zenpage rights, provide link to the Zenpage admin tab echo "<li><a href=\"" . $zf . '/' . PLUGIN_FOLDER . "/zenpage/admin-news-articles.php\">" . gettext("News") . "</a></li>"; if (is_NewsArticle()) { // page is a NewsArticle--provide zenpage edit, delete, and Add links echo "<li><a href=\"" . $zf . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?newsarticle&edit&titlelink=" . urlencode($titlelink) . "\">" . gettext("Edit Article") . "</a></li>"; if (GALLERY_SESSION) { // XSRF defense requires sessions ?> <li><a href="javascript:confirmDelete('<?php echo $zf . '/' . PLUGIN_FOLDER; ?> /zenpage/admin-news-articles.php?del=<?php echo getNewsID(); ?> &XSRFToken=<?php echo getXSRFToken('delete'); ?> ',deleteArticle)" title="<?php echo gettext("Delete article"); ?> "><?php echo gettext("Delete Article"); ?> </a></li> <?php } echo "<li><a href=\"" . $zf . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?newsarticle&add\">" . gettext("Add Article") . "</a></li>"; zp_apply_filter('admin_toolbox_news', $titlelink); } } if (zp_loggedin(ZENPAGE_PAGES_RIGHTS)) { echo "<li><a href=\"" . $zf . '/' . PLUGIN_FOLDER . "/zenpage/admin-pages.php\">" . gettext("Pages") . "</a></li>"; if (is_Pages()) { // page is zenpage page--provide edit, delete, and add links echo "<li><a href=\"" . $zf . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?page&edit&titlelink=" . urlencode($titlelink) . "\">" . gettext("Edit Page") . "</a></li>"; if (GALLERY_SESSION) { // XSRF defense requires sessions ?> <li><a href="javascript:confirmDelete('<?php echo $zf . '/' . PLUGIN_FOLDER; ?> /zenpage/page-admin.php?del=<?php echo getPageID(); ?> &XSRFToken=<?php echo getXSRFToken('delete'); ?> ',deletePage)" title="<?php echo gettext("Delete page"); ?> "><?php echo gettext("Delete Page"); ?> </a></li> <?php } echo "<li><a href=\"" . FULLWEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . "/zenpage/admin-edit.php?page&add\">" . gettext("Add Page") . "</a></li>"; zp_apply_filter('admin_toolbox_page', $titlelink); } } } // logout link $sec = (int) (SERVER_PROTOCOL == 'https' & true); $link = FULLWEBPATH . '/index.php?logout=' . $sec . $redirect; ?> <li><a href="<?php echo $link; ?> "><?php echo gettext("Logout"); ?> </a></li> <?php // close the list echo "</ul>\n"; echo "</div>\n"; } }
/** * Prints the clickable drop down toolbox on any theme page with generic admin helpers * @param string $id the html/css theming id */ function printAdminToolbox($id = 'admin') { global $_zp_current_album, $_zp_current_image, $_zp_current_search, $_zp_loggedin, $_zp_gallery_page; if (zp_loggedin()) { echo '<script type="text/javascript" src="' . WEBPATH . '/' . ZENFOLDER . '/js/admin.js"></script>'; $zf = WEBPATH . "/" . ZENFOLDER; $dataid = $id . '_data'; $page = getCurrentPage(); $redirect = ''; echo '<div id="' . $id . '">' . "\n" . '<h3><a href="javascript: toggle(' . "'" . $dataid . "'" . ');">' . gettext('Admin Toolbox') . '</a></h3>' . "\n" . "\n</div>"; echo '<div id="' . $dataid . '" style="display: none;">' . "\n"; // open the list--all links go between here and the close of the list below echo "<ul style='list-style-type: none;'>"; // generic link to Admin.php echo "<li>"; printAdminLink(gettext('Admin'), '', "</li>\n"); // setup for return links if (isset($_GET['p'])) { $redirect = "&p=" . $_GET['p']; } if ($page > 1) { $redirect .= "&page={$page}"; } if ($_zp_loggedin & (ADMIN_RIGHTS | OPTIONS_RIGHTS)) { // options link for all admins with options rights echo "<li>"; printLink($zf . '/admin-options.php', gettext("Options"), NULL, NULL, NULL); echo "</li>\n"; } apply_filter('admin_toolbox_global'); $gal = getOption('custom_index_page'); if (empty($gal) || !file_exists(SERVERPATH . '/' . THEMEFOLDER . '/' . getOption('current_theme') . '/' . UTF8ToFilesystem($gal) . '.php')) { $gal = 'index.php'; } else { $gal .= '.php'; } if ($_zp_gallery_page === $gal) { // script is either index.php or the gallery index page if ($_zp_loggedin & (ADMIN_RIGHTS | EDIT_RIGHTS)) { // admin has edit rights so he can sort the gallery (at least those albums he is assigned) echo "<li>"; printSortableGalleryLink(gettext('Sort gallery'), gettext('Manual sorting')); echo "</li>\n"; } if ($_zp_loggedin & (ADMIN_RIGHTS | UPLOAD_RIGHTS)) { // admin has upload rights, provide an upload link for a new album echo "<li>"; printLink($zf . '/admin-upload.php', gettext("New album"), NULL, NULL, NULL); echo "</li>\n"; } apply_filter('admin_toolbox_gallery'); } else { if ($_zp_gallery_page === 'album.php') { // script is album.php $albumname = $_zp_current_album->name; if (isMyAlbum($albumname, EDIT_RIGHTS)) { // admin is empowered to edit this album--show an edit link echo "<li>"; printSubalbumAdmin(gettext('Edit album'), '', "</li>\n"); if (!$_zp_current_album->isDynamic()) { echo "<li>"; printSortableAlbumLink(gettext('Sort album'), gettext('Manual sorting')); echo "</li>\n"; } // and a delete link echo "<li><a href=\"javascript: confirmDeleteAlbum('" . $zf . "/admin-edit.php?page=edit&action=deletealbum&album=" . urlencode(urlencode($albumname)) . "','" . js_encode(gettext("Are you sure you want to delete this entire album?")) . "','" . js_encode(gettext("Are you Absolutely Positively sure you want to delete the album? THIS CANNOT BE UNDONE!")) . "');\" title=\"" . gettext("Delete the album") . "\">" . gettext("Delete album") . "</a></li>\n"; } if (isMyAlbum($albumname, UPLOAD_RIGHTS) && !$_zp_current_album->isDynamic()) { // provide an album upload link if the admin has upload rights for this album and it is not a dynamic album echo "<li>"; printLink($zf . '/admin-upload.php?album=' . urlencode($albumname), gettext("Upload Here"), NULL, NULL, NULL); echo "</li>\n"; echo "<li>"; printLink($zf . '/admin-upload.php?new&album=' . urlencode($albumname), gettext("New Album Here"), NULL, NULL, NULL); echo "</li>\n"; } // set the return to this album/page apply_filter('admin_toolbox_album'); $redirect = "&album=" . urlencode($albumname) . "&page={$page}"; } else { if ($_zp_gallery_page === 'image.php') { // script is image.php $albumname = $_zp_current_album->name; $imagename = urlencode($_zp_current_image->filename); if (isMyAlbum($albumname, EDIT_RIGHTS)) { // if admin has edit rights on this album, provide a delete link for the image. echo "<li><a href=\"javascript: confirmDeleteImage('" . $zf . "/admin-edit.php?page=edit&action=deleteimage&album=" . urlencode(urlencode($albumname)) . "&image=" . urlencode($imagename) . "','" . js_encode(gettext("Are you sure you want to delete the image? THIS CANNOT BE UNDONE!")) . "');\" title=\"" . gettext("Delete the image") . "\">" . gettext("Delete image") . "</a>"; echo "</li>\n"; echo '<li><a href="' . $zf . '/admin-edit.php?page=edit&album=' . urlencode($albumname) . '&image=' . urlencode($imagename) . '&tab=imageinfo#IT" title="' . gettext('Edit this image') . '">' . gettext('Edit image') . '</a></li>' . "\n"; } // set return to this image page apply_filter('admin_toolbox_image'); $redirect = "&album=" . urlencode($albumname) . "&image={$imagename}"; } else { if ($_zp_gallery_page === 'search.php' && !empty($_zp_current_search->words)) { // script is search.php with a search string if ($_zp_loggedin & (ADMIN_RIGHTS | UPLOAD_RIGHTS)) { // if admin has edit rights allow him to create a dynamic album from the search echo "<li><a href=\"" . $zf . "/admin-dynamic-album.php\" title=\"" . gettext("Create an album from the search") . "\">" . gettext("Create Album") . "</a></li>"; } apply_filter('admin_toolbox_search'); $redirect = "&p=search" . $_zp_current_search->getSearchParams() . "&page={$page}"; } } } } // zenpage script pages if (function_exists('is_NewsArticle')) { if ($_zp_loggedin & (ADMIN_RIGHTS | ZENPAGE_RIGHTS)) { // admin has zenpage rights, provide link to the zenpage admin tab echo "<li><a href=\"" . $zf . "/plugins/zenpage/\">" . gettext("Zenpage") . "</a></li>"; if (is_NewsArticle()) { // page is a NewsArticle--provide zenpage edit, delete, and Add links echo "<li><a href=\"" . $zf . "/plugins/zenpage/admin-edit.php?newsarticle&edit&titlelink=" . urlencode(getNewsTitlelink()) . "\">" . gettext("Edit Article") . "</li>"; ?> <li><a href="javascript: confirmDeleteImage('<?php echo $zf; ?> /plugins/zenpage/news-article-admin.php?del=<?php echo getNewsID(); ?> ','<?php echo js_encode(gettext("Are you sure you want to delete this article? THIS CANNOT BE UNDONE!")); ?> ')" title="<?php echo gettext("Delete article"); ?> "><?php echo gettext("Delete Article"); ?> </a></li> <?php echo "<li><a href=\"" . $zf . "/plugins/zenpage/admin-edit.php?newsarticle&add\">" . gettext("Add Article") . "</li>"; } if (is_Pages()) { // page is zenpage page--provide edit, delete, and add links echo "<li><a href=\"" . $zf . "/plugins/zenpage/admin-edit.php?page&edit&titlelink=" . urlencode(getPageTitlelink()) . "\">" . gettext("Edit Page") . "</li>"; ?> <li><a href="javascript: confirmDeleteImage('<?php echo $zf; ?> /plugins/zenpage/page-admin.php?del=<?php echo getPageID(); ?> ','<?php echo js_encode(gettext("Are you sure you want to delete this page? THIS CANNOT BE UNDONE!")); ?> ')" title="<?php echo gettext("Delete page"); ?> "><?php echo gettext("Delete Page"); ?> </a></li> <?php echo "<li><a href=\"" . FULLWEBPATH . "/" . ZENFOLDER . "/plugins/zenpage/admin-edit.php?page&add\">" . gettext("Add Page") . "</li>"; } } apply_filter('admin_toolbox_news'); } // logout link echo "<li><a href=\"" . $zf . "/admin.php?logout{$redirect}\">" . gettext("Logout") . "</a></li>\n"; // close the list echo "</ul>\n"; echo "</div>\n"; } }