/** * Prints out the links for login/out, register formular if asked */ function printLoginZone() { if (!zp_loggedin() && (function_exists('printUserLogin_out') || function_exists('printUserLogin_out') || function_exists('printRegistrationForm'))) { $multi = 0; echo '<div id="loginout" class=" push_5 grid_10">'; if (zp_loggedin() && function_exists('printUserLogin_out')) { printUserLogin_out('', '', false); $multi++; } if (!zp_loggedin() && function_exists('printUserLogin_out')) { if ($multi) { echo ' - '; } printCustomPageURL(gettext('Login'), 'login', '', ''); $multi++; } if (!zp_loggedin() && function_exists('printRegistrationForm')) { if ($multi) { echo ' - '; } printCustomPageURL(gettext('Register for this site'), 'register', '', ''); } echo '</div>'; } }
function printThemeFooter() { echo '<ul class="menu footer">'; if (function_exists('printRegistrationForm') or function_exists('printUserLogin_out')) { if (zp_loggedin() and function_exists('printUserLogin_out')) { echo '<li>'; printUserLogin_out(); echo '</li>'; } else { echo '<li><a href="' . getCustomPageURL('login') . '">'; if (function_exists('printRegistrationForm')) { echo gettext('Register'); } if (function_exists('printRegistrationForm') and function_exists('printUserLogin_out')) { echo ' / '; } if (function_exists('printUserLogin_out')) { echo gettext('Login'); } echo '</a></li>'; } } if (function_exists('printContactForm')) { echo '<li><a href="' . getCustomPageURL('contact') . '">' . gettext('Contact') . '</a></li>'; } echo '</ul>'; }
static function admin_tabs($tabs) { global $_zp_current_admin_obj; if (zp_loggedin(ADMIN_RIGHTS) && $_zp_current_admin_obj->getID()) { if (isset($tabs['users']['subtabs'])) { $subtabs = $tabs['users']['subtabs']; } else { $subtabs = array(gettext('users') => 'admin-users.php?page=users&tab=users'); } $subtabs[gettext("access")] = PLUGIN_FOLDER . '/accessThreshold/admin_tab.php?page=users&tab=access'; ksort($subtabs, SORT_LOCALE_STRING); $tabs['users'] = array('text' => gettext("admin"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-users.php?page=users&tab=users', 'subtabs' => $subtabs, 'default' => 'users'); } return $tabs; if (zp_loggedin(ADMIN_RIGHTS)) { if (!isset($tabs['development'])) { $tabs['development'] = array('text' => gettext("development"), 'subtabs' => NULL); } $tabs['development']['subtabs'][gettext("accessThreshold")] = PLUGIN_FOLDER . '/accessThreshold/admin_tab.php?page=development&tab=accessThreshold'; $named = array_flip($tabs['development']['subtabs']); natcasesort($named); $tabs['development']['subtabs'] = $named = array_flip($named); $link = array_shift($named); if (strpos($link, '/') !== 0) { // zp_core relative $tabs['development']['link'] = WEBPATH . '/' . ZENFOLDER . '/' . $link; } else { $tabs['development']['link'] = WEBPATH . $link; } } return $tabs; }
function purgeOptions_admin_tabs($tabs) { if (zp_loggedin(OPTIONS_RIGHTS)) { $tabs['options']['subtabs'][gettext("purge")] = "/" . PURGEOPTIONS_FOLDER . 'purgeOptions_tab.php?page=options&tab=purge'; } return $tabs; }
static function customDisplayRights() { global $_zp_admin_tab; if (!zp_loggedin(ADMIN_RIGHTS) && $_zp_admin_tab == 'users') { ?> <script type="text/javascript"> // <!-- <![CDATA[ $(document).ready(function() { $('select[name="showgroup"]').parent("th").remove(); // the "Show" dropdownn menu $('.box-rights').remove(); // Rights. (the part with all the checkboxes). $('.box-albums-unpadded').remove(); // Albums, Pages, and Categories. $('.notebox').remove(); // All Noteboxes $('label[for="admin_language_0"], ul.flags').remove(); // Languages $('td:contains("<?php echo gettext("Quota"); ?> ")').parent("tr.userextrainfo").remove(); // Display of assigned quota (if the "quota_manager" plugin is enabled). $('tr.userextrainfo td:contains("<?php echo gettext("User group membership"); ?> ")').next().andSelf().remove(); // "User group membership" information (if the user_groups plugin is enabled). $('tr.userextrainfo td:contains("<?php echo gettext("Street"); ?> ")').parent("tr.userextrainfo").remove(); // Address information. }); // ]]> --> </script> <?php } }
function handleOptionSave($themename, $themealbum) { if (zp_loggedin(CODEBLOCK_RIGHTS)) { processCodeblockSave(0, $this); } return false; }
static function head() { if (!zp_loggedin(TAGS_RIGHTS)) { if (getOption('tagFromSearch_tagOnly')) { setOption('search_fields', 'tags', false); } } }
function toolbox_gallery_extensions() { if (zp_loggedin(ADMIN_RIGHTS | COMMENT_RIGHTS)) { echo "<li>"; printLink(WEBPATH . "/" . ZENFOLDER . '/admin-comments.php', gettext("Comments"), NULL, NULL, NULL); echo "</li>\n"; } }
static function tabs($tabs) { if (zp_loggedin(ADMIN_RIGHTS)) { $oldtabs = $tabs; $tabs = array(); foreach ($oldtabs as $tab => $data) { if ($tab == 'logs') { $tabs['clone'] = array('text' => gettext("clone"), 'link' => WEBPATH . "/" . ZENFOLDER . '/' . PLUGIN_FOLDER . '/cloneZenphoto/cloneTab.php', 'rights' => ADMIN_RIGHTS, 'subtabs' => NULL); } $tabs[$tab] = $data; } } return $tabs; }
function jQueryUploadHandler_admin_tabs($tabs) { if (zp_loggedin(UPLOAD_RIGHTS)) { $me = sprintf(gettext('images (%s)'), 'jQuery'); $mylink = 'admin-upload.php?page=upload&tab=jQuery&type=' . gettext('images'); if (is_null($tabs['upload'])) { $tabs['upload'] = array('text' => gettext("upload"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-upload.php', 'subtabs' => NULL); } $tabs['upload']['subtabs'][$me] = $mylink; if (zp_getcookie('uploadtype') == 'jQuery') { $tabs['upload']['link'] = WEBPATH . "/" . ZENFOLDER . '/' . $mylink; } } return $tabs; }
/** * The function for processing a message to see if it might be SPAM * returns: * 0 if the message is SPAM * 1 if the message might be SPAM (it will be marked for moderation) * 2 if the message is not SPAM * * @param string $author Author field from the posting * @param string $email Email field from the posting * @param string $website Website field from the posting * @param string $body The text of the comment * @param string $receiver The object on which the post was made * @param string $ip the IP address of the comment poster * * @return int */ function filterMessage($author, $email, $website, $body, $receiver, $ip) { if (zp_loggedin($receiver->manage_rights) || $receiver->isMyItem($receiver->manage_some_rights)) { // trust "managers" return 2; } $strategy = getOption('Action'); switch ($strategy) { case 'reject': return 0; case 'moderate': return 1; } return 2; }
function elFinder_admin_tabs($tabs) { if (zp_loggedin(FILES_RIGHTS)) { $me = sprintf(gettext('files (%s)'), 'elFinder'); $mylink = PLUGIN_FOLDER . '/' . 'elFinder/filemanager.php?page=upload&tab=elFinder&type=' . gettext('files'); if (is_null($tabs['upload'])) { $tabs['upload'] = array('text' => gettext("upload"), 'link' => WEBPATH . "/" . ZENFOLDER . '/admin-upload.php', 'subtabs' => NULL); } $tabs['upload']['subtabs'][$me] = $mylink; if (zp_getcookie('uploadtype') == 'elFinder') { $tabs['upload']['link'] = WEBPATH . "/" . ZENFOLDER . '/' . $mylink; } } return $tabs; }
function printThemeMenu() { echo '<ul id="main">'; if (getMainSiteName() != '') { echo '<li class="title">' . gettext('Main site') . '</li>'; echo '<ul>'; echo '<li><a href="' . getMainSiteURL() . '" title="' . getMainSiteName() . '">' . getMainSiteName() . '</a></li>'; echo '</ul>'; } if (function_exists('printAlbumMenu')) { echo '<li class="title">' . gettext('Gallery') . '</li>'; $temp = getGalleryTitle(); printAlbumMenu('list', false, '', 'menu-active', 'submenu', 'menu-active', $temp, true); } else { echo '<li class="title">' . gettext('Gallery') . '</li>'; echo '<ul>'; echo '<li><a href="' . getGalleryIndexURL() . '" title="' . getGalleryTitle() . '">' . getGalleryTitle() . '</a></li>'; echo '</ul>'; } if (function_exists('printNewsIndexURL')) { echo '<li class="title">' . gettext('News blog') . '</li>'; printAllNewsCategories("All news", FALSE, "", "menu-active"); } if (function_exists("printPageMenu")) { echo '<li class="title">' . gettext('Pages') . '</li>'; printPageMenu("list", "", "menu-active", "submenu", "menu-active"); } echo '<li class="title">' . gettext('Stay informed') . '</li>'; echo '<ul>'; echo '<li><a href="' . getCustomPageURL('archive') . '">' . gettext('Archives') . '</a></li>'; echo '</ul>'; echo '</ul>'; echo '<div id="login">'; echo '<div class="title">' . gettext('Connection') . '</div>'; if (function_exists('printUserLogin_out') and !zp_loggedin()) { printUserLogin_out(); } echo '</div>'; if (function_exists("printLanguageSelector")) { echo '<div id="languages">'; echo '<div class="title">' . gettext('Languages') . '</div>'; printLanguageSelector(); echo '<div class="clear_left"></div>'; echo '</div>'; } }
function zp_footer() { ?> <div id="credit"><?php if (zp_loggedin()) { printUserLogin_out($before = '', $after = '| ', $showLoginForm = NULL, $logouttext = NULL, $show_user = NULL); } else { printLinkHTML(WEBPATH . '/' . ZENFOLDER . '/admin.php', 'Admin | '); } printZenphotoLink(); ?> <?php printVersion(); ?> </a> | Using "Side Of Chili Theme" by: <a href="http://www.chilifrei.net" title="How Do You Like Your Chili?">ChiliFrei64</a></div> <?php }
function admin_approval_publish_object($object) { $msg = ''; if (!zp_loggedin($object->manage_rights)) { // not allowed to change the published status if (isset($object->data['show'])) { $show = $object->data['show']; } else { $show = 0; } $newshow = $object->getShow(); $object->setShow($show); if ($newshow != $show) { $msg = gettext('You do not have rights to change the <em>publish</em> state.'); } } return $msg; }
function front_end_edit_head() { global $_zp_current_album; //Note: this allows more users to edit the album than should be allowed. It is left to the exercise //of the user to improve this. Remember, it is not secure anyway! if (($rights = zp_loggedin()) & (ADMIN_RIGHTS | ALBUM_RIGHTS)) { if (in_context(ZP_ALBUM)) { $grant = $_zp_current_album->isMyItem(ALBUM_RIGHTS); } else { $grant = $rights & ADMIN_RIGHTS; } if ($grant) { ?> <script type="text/javascript" src="<?php echo WEBPATH . "/" . USER_PLUGIN_FOLDER; ?> /front_end_edit/jquery.editinplace.js"></script> <script type="text/javascript"> // <!-- <![CDATA[ var zpstrings = { /* Used in jquery.editinplace.js */ 'Save' : "<?php echo gettext('Save'); ?> ", 'Cancel' : "<?php echo gettext('Cancel'); ?> ", 'Saving' : "<?php echo gettext('Saving'); ?> ", 'ClickToEdit' : "<?php echo gettext('Click to edit...'); ?> " }; // ]]> --> </script> <?php } } }
/** * Adds user who uploaded the image to the description of the image * * @param object $image * @return object */ function updateImage($image) { global $_zp_current_admin; if (zp_loggedin()) { $bt = debug_backtrace(); foreach ($bt as $b) { if (isset($b['file']) && basename($b['file']) == 'admin-upload.php') { $newdesc = $image->getDesc(); if (empty($newdesc)) { $newdesc = gettext('Uploaded by: ') . $_zp_current_admin['name']; } else { $newdesc .= ' (' . gettext('Uploaded by: ') . $_zp_current_admin['name'] . ')'; } $image->setDesc($newdesc); } } } return $image; }
static function tabs($tabs) { if (zp_loggedin(ADMIN_RIGHTS)) { if (!isset($tabs['development'])) { $tabs['development'] = array('text' => gettext("development"), 'subtabs' => NULL); } $tabs['development']['subtabs'][gettext("deprecated")] = PLUGIN_FOLDER . '/deprecated-functions/admin_tab.php?page=development&tab=' . gettext('deprecated'); $named = array_flip($tabs['development']['subtabs']); natcasesort($named); $tabs['development']['subtabs'] = $named = array_flip($named); $link = array_shift($named); if (strpos($link, '/') !== 0) { // zp_core relative $tabs['development']['link'] = WEBPATH . '/' . ZENFOLDER . '/' . $link; } else { $tabs['development']['link'] = WEBPATH . $link; } } return $tabs; }
static function admin_tabs($tabs) { if (zp_loggedin(ADMIN_RIGHTS)) { if (!isset($tabs['development'])) { $tabs['development'] = array('text' => gettext("development"), 'subtabs' => NULL); } $tabs['development']['subtabs'][gettext("legacyConverter")] = '/' . USER_PLUGIN_FOLDER . '/zenphotoCompatibilityPack/legacyConverter.php?page=development&tab=' . gettext('legacyConverter'); $named = array_flip($tabs['development']['subtabs']); natcasesort($named); $tabs['development']['subtabs'] = $named = array_flip($named); $link = array_shift($named); if (strpos($link, '/') !== 0) { // zp_core relative $tabs['development']['link'] = WEBPATH . '/' . ZENFOLDER . '/' . $link; } else { $tabs['development']['link'] = WEBPATH . $link; } } return $tabs; }
static function publish_object($save, $object) { global $_admin_approval_error; if (is_subclass_of($object, 'ThemeObject') && !zp_loggedin($object->manage_rights)) { // not allowed to change the published status // retrieve the original value of publish details $data = $object->getData(); $show = (int) @$data['show']; $pub = @$data['publishdate']; $exp = @$data['expiredate']; if ($object->getShow() != $show || $object->getPublishDate() != $pub || $object->getExpireDate() != $exp) { // publish details have been changed, restore the original publish details $object->set('show', $show); $object->set('publishdate', $pub); $object->set('expiredate', $exp); $_admin_approval_error = gettext('You do not have rights to change the <em>publish</em> state.'); if (is_subclass_of($object, 'CMSItems')) { $_admin_approval_error = '<p class="errorbox fade-message">' . $_admin_approval_error . '</p>'; } } } return $save; }
function printFooter($page) { global $_zp_themeroot; ?> <!-- Footer --> <div class="footlinks"> <?php switch ($page) { case 'image': case 'album': $h = getHitcounter(); if ($h == 1) { echo "<p>" . sprintf(gettext('1 hit on this %s'), $page) . "</p>"; } else { echo "<p>" . sprintf(gettext('%1$u hits on this %2$s'), $h, $page) . "</p>"; } break; case 'gallery': ?> <small> <p><?php $albumNumber = getNumAlbums(); echo sprintf(gettext("Albums: %u"), $albumNumber); ?> · <?php echo sprintf(gettext("Subalbums: %u"), get_subalbum_count()); ?> · <?php $photosArray = query_single_row("SELECT count(*) FROM " . prefix('images')); $photosNumber = array_shift($photosArray); echo sprintf(gettext("Images: %u"), $photosNumber); ?> <?php if (getOption('Allow_comments')) { ?> · <?php $commentsArray = query_single_row("SELECT count(*) FROM " . prefix('comments') . " WHERE inmoderation = 0"); $commentsNumber = array_shift($commentsArray); echo sprintf(gettext("Comments: %u"), $commentsNumber); ?> <?php } ?> </p> </small> <?php break; } ?> <small><?php printThemeInfo(); ?> </small> <?php printZenphotoLink(); ?> <?php if ($page == 'gallery') { echo '<br />'; printRSSLink('Gallery', '', 'Gallery RSS', ''); } ?> <?php if (function_exists('printUserLogout')) { printUserLogout('<br />', '', true); } ?> <?php if (function_exists('printContactForm')) { printCustomPageURL(gettext('Contact us'), 'contact', '', '<br />'); } ?> <?php if (!zp_loggedin() && function_exists('printRegistrationForm')) { printCustomPageURL(gettext('Register for this site'), 'request', '', '<br />'); } ?> <?php if (function_exists('printLanguageSelector')) { printLanguageSelector(); } ?> </div> <!-- Administration Toolbox --> <?php printAdminToolbox(); }
/** * Gets latest comments for news articles and pages * * @param int $number how many comments you want. * @param string $type "all" for all latest comments for all news articles and all pages * "news" for the lastest comments of one specific news article * "page" for the lastest comments of one specific page * @param int $itemID the ID of the element to get the comments for if $type != "all" */ function getLatestZenpageComments($number, $type = "all", $itemID = "") { $itemID = sanitize_numeric($itemID); $number = sanitize_numeric($number); $checkauth = zp_loggedin(); if ($type == 'all' || $type == 'news') { $newspasswordcheck = ""; if (zp_loggedin(MANAGE_ALL_NEWS_RIGHTS)) { $newsshow = ''; } else { $newsshow = 'news.show=1 AND'; $newscheck = query_full_array("SELECT * FROM " . prefix('news') . " ORDER BY date"); foreach ($newscheck as $articlecheck) { $obj = new ZenpageNews($articlecheck['titlelink']); if ($obj->inProtectedCategory()) { if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) { $newsshow = ''; } else { $excludenews = " AND id != " . $articlecheck['id']; $newspasswordcheck = $newspasswordcheck . $excludenews; } } } } } if ($type == 'all' || $type == 'page') { $pagepasswordcheck = ""; if (zp_loggedin(MANAGE_ALL_PAGES_RIGHTS)) { $pagesshow = ''; } else { $pagesshow = 'pages.show=1 AND'; $pagescheck = query_full_array("SELECT * FROM " . prefix('pages') . " ORDER BY date"); foreach ($pagescheck as $pagecheck) { $obj = new ZenpagePage($pagecheck['titlelink']); if ($obj->isProtected()) { if ($checkauth && $obj->isMyItem(LIST_RIGHTS)) { $pagesshow = ''; } else { $excludepages = " AND pages.id != " . $pagecheck['id']; $pagepasswordcheck = $pagepasswordcheck . $excludepages; } } } } } switch ($type) { case "news": $whereNews = " WHERE {$newsshow} news.id = " . $itemID . " AND c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck; break; case "page": $wherePages = " WHERE {$pagesshow} pages.id = " . $itemID . " AND c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck; break; case "all": $whereNews = " WHERE {$newsshow} c.ownerid = news.id AND c.type = 'news' AND c.private = 0 AND c.inmoderation = 0" . $newspasswordcheck; $wherePages = " WHERE {$pagesshow} c.ownerid = pages.id AND c.type = 'pages' AND c.private = 0 AND c.inmoderation = 0" . $pagepasswordcheck; break; } $comments_news = array(); $comments_pages = array(); if ($type == "all" or $type == "news") { $comments_news = query_full_array("SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, news.title, news.titlelink FROM " . prefix('comments') . " AS c, " . prefix('news') . " AS news " . $whereNews . " ORDER BY c.id DESC LIMIT {$number}"); } if ($type == "all" or $type == "page") { $comments_pages = query_full_array($sql = "SELECT c.id, c.name, c.type, c.website," . " c.date, c.anon, c.comment, pages.title, pages.titlelink FROM " . prefix('comments') . " AS c, " . prefix('pages') . " AS pages " . $wherePages . " ORDER BY c.id DESC LIMIT {$number}"); } $comments = array(); foreach ($comments_news as $comment) { $comments[$comment['id']] = $comment; } foreach ($comments_pages as $comment) { $comments[$comment['id']] = $comment; } krsort($comments); return array_slice($comments, 0, $number); }
$count++; } ?> </div> <div id="text"> </div> <div id="footer"> <div id="logo"> <?php printZenphotoLink(); ?> </div> <div id="options"> <?php if (zp_loggedin()) { printUserLogin_out($before = '', $after = '|', $showLoginForm = NULL, $logouttext = NULL, $show_user = NULL); } else { printLinkHTML(WEBPATH . '/' . ZENFOLDER . '/admin.php', 'Admin'); } ?> </div> <div id="info"> <?php echo round(array_sum(explode(" ", microtime())) - $startTime, 4) . ' seconds'; echo '. Pink Clouds 1.0 . '; echo 'ZenPhoto '; printVersion(); ?> </div> </div>
?> </div> <div id="comments"> <?php if (function_exists('printCommentForm')) { printCommentForm(); } ?> </div> </div> <div id="credit"><?php if (!zp_loggedin()) { printUserLogin_out($before = '', $after = '|', $showLoginForm = NULL, $logouttext = NULL, $show_user = NULL); } else { printLink(WEBPATH . '/' . ZENFOLDER . '/admin.php', 'Admin'); } printZenphotoLink(); ?> </div> <?php zp_apply_filter('theme_body_close'); ?> </body> </html>
header('Content-Type: text/html; charset=utf-8'); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" href="<?php echo WEBPATH . '/' . ZENFOLDER; ?> /admin.css" type="text/css" /> <?php reconfigureCS(); ?> </head> <?php if (!zp_loggedin(ADMIN_RIGHTS)) { // If they are not logged in, display the login form and exit ?> <body style="background-image: none"> <?php $_zp_authority->printLoginForm(); ?> </body> <?php echo "\n</html>"; exitZP(); } ?> <body> <?php printLogoAndLinks();
</a> </span> | <?php echo gettext("A password is required for the page you requested"); ?> </h2> </div> <div id="padbox"> <?php printPasswordForm($hint, $show, false); ?> </div> </div> <div id="credit"> <?php if (!zp_loggedin() && function_exists('printRegisterURL') && $_zp_gallery->isUnprotectedPage('register')) { echo '<p>'; printRegisterURL(gettext('Register for this site'), '<br />'); echo '</p>'; } ?> <?php printSoftwareLink(); ?> </div> <?php zp_apply_filter('theme_body_close'); ?> </body> </html>
* * Piwik is a downloadable, open source (GPL licensed) real time web analytics software program. * It provides you with detailed reports on your website visitors: * the search engines and keywords they used, the language they speak, your popular pages... and so much more. * * Piwik aims to be an open source alternative to Google Analytics. * * @package plugins * @subpackage seo */ $plugin_is_filter = 9 | THEME_PLUGIN; $plugin_description = gettext('A plugin to insert your Piwik JavaScript tag into your theme pages.'); $plugin_author = "Stephen Billard (sbillard)"; $plugin_version = '1.4.3'; $option_interface = 'piwik_tag'; if (!getOption('piwik_admintracking') || !zp_loggedin(ADMIN_RIGHTS)) { zp_register_filter('theme_body_close', 'piwik_tag::placeTag'); } class piwik_tag { function __construct() { } function getOptionsSupported() { return array(gettext('piwik url') => array('key' => 'piwik_url', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 0, 'desc' => gettext('Enter your Piwik installation URL.')), gettext('site id') => array('key' => 'piwik_id', 'type' => OPTION_TYPE_TEXTBOX, 'order' => 1, 'desc' => gettext('Enter the site id assigned by Piwik.')), gettext('Enable Admin tracking') => array('key' => 'piwik_admintracking', 'type' => OPTION_TYPE_CHECKBOX, 'order' => 2, 'desc' => gettext('Controls if you want Piwik to track users with <code>Admin</code> rights.'))); } static function placeTag($exclude = NULL) { if (empty($exclude) || !in_array('piwik_tag', $exclude)) { $piwik_url = getOption('piwik_url');
/** * Gets news articles and images of a gallery to show them together on the news section * * NOTE: This function does not exclude articles that are password protected via a category * * @param int $articles_per_page The number of articles to get * @param string $mode "latestimages-thumbnail" * "latestimages-thumbnail-customcrop" * "latestimages-sizedimage" * "latestalbums-thumbnail" * "latestalbums-thumbnail-customcrop" * "latestalbums-sizedimage" * "latestimagesbyalbum-thumbnail" * "latestimagesbyalbum-thumbnail-customcrop" * "latestimagesbyalbum-sizedimage" * "latestupdatedalbums-thumbnail" (for RSS and getLatestNews() used only) * "latestupdatedalbums-thumbnail-customcrop" (for RSS and getLatestNews() used only) * "latestupdatedalbums-sizedimage" (for RSS and getLatestNews() used only) * NOTE: The "latestupdatedalbums" variants do NOT support pagination as required on the news loop! * * @param string $published "published" for published articles, * "unpublished" for un-published articles, * "all" for all articles * @param string $sortorder id, date or mtime, only for latestimages-... modes * @param bool $sticky set to true to place "sticky" articles at the front of the list. * @param string $direction "desc" or "asc" * @return array * @deprecated since version 1.4.6 */ protected function getCombiNews($articles_per_page = '', $mode = '', $published = NULL, $sortorder = NULL, $sticky = true, $sortdirection = 'desc') { global $_zp_combiNews_cache, $_zp_gallery; if (is_null($published)) { if (zp_loggedin(ZENPAGE_NEWS_RIGHTS | ALL_NEWS_RIGHTS)) { $published = "all"; } else { $published = "published"; } } if (empty($mode)) { $mode = getOption('zenpage_combinews_mode'); } if (isset($_zp_combiNews_cache[$published . $mode . $sticky . $sortorder . $sortdirection])) { return $_zp_combiNews_cache[$published . $mode . $sticky . $sortorder . $sortdirection]; } if ($published == "published") { $show = " WHERE `show` = 1 AND date <= '" . date('Y-m-d H:i:s') . "'"; $imagesshow = " AND images.show = 1 "; } else { $show = ""; $imagesshow = ""; } getAllAccessibleAlbums($_zp_gallery, $albumlist, false); if (empty($albumlist)) { $albumWhere = 'albums.`id` is NULL'; } else { $albumWhere = 'albums.`id` in (' . implode(',', $albumlist) . ')'; } if ($articles_per_page) { $offset = self::getOffset($articles_per_page); } else { $offset = 0; } if (empty($sortorder)) { $combinews_sortorder = getOption("zenpage_combinews_sortorder"); } else { $combinews_sortorder = $sortorder; } $stickyorder = ''; if ($sticky) { $stickyorder = 'sticky DESC,'; } switch (strtolower($sortdirection)) { case 'desc': default: $sortdir = 'DESC'; break; case 'asc': $sortdir = 'ASC'; break; } $type3 = query("SET @type3:='0'"); switch ($mode) { case "latestimages-thumbnail": case "latestimages-thumbnail-customcrop": case "latestimages-sizedimage": case "latestimages-sizedimage-maxspace": case "latestimages-fullimage": $albumWhere = ' AND ' . $albumWhere; $sortorder = $combinews_sortorder; $type1 = query("SET @type1:='news'"); $type2 = query("SET @type2:='images'"); switch ($combinews_sortorder) { case 'id': case 'date': $imagequery = "(SELECT albums.folder, images.filename, images.date, @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")"; break; case 'publishdate': $imagequery = "(SELECT albums.folder, images.filename, IFNULL(images.publishdate,images.date), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")"; case 'mtime': $imagequery = "(SELECT albums.folder, images.filename, FROM_UNIXTIME(images.mtime), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")"; break; } $result = $this->siftResults("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date " . $sortdir, $offset, $articles_per_page); break; case "latestalbums-thumbnail": case "latestalbums-thumbnail-customcrop": case "latestalbums-sizedimage": case "latestalbums-sizedimage-maxspace": case "latestalbums-fullimage": default: if (empty($show)) { $albumWhere = ' WHERE ' . $albumWhere; } else { $albumWhere = ' AND ' . $albumWhere; } $sortorder = $combinews_sortorder; $type1 = query("SET @type1:='news'"); $type2 = query("SET @type2:='albums'"); switch ($combinews_sortorder) { case 'id': case 'date': $albumquery = "(SELECT albums.folder, albums.title, albums.date, @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")"; break; case 'publishdate': $albumquery = "(SELECT albums.folder, albums.title, IFNULL(albums.publishdate,albums.date), @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t" . $show . $albumWhere . ")"; break; case 'mtime': default: $albumquery = "(SELECT albums.folder, albums.title, FROM_UNIXTIME(albums.mtime), @type2, @type3 as sticky FROM " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t" . $show . $albumWhere . ")"; break; } $result = $this->siftResults("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $albumquery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY {$stickyorder} date " . $sortdir, $offset, $articles_per_page); break; case "latestimagesbyalbum-thumbnail": case "latestimagesbyalbum-thumbnail-customcrop": case "latestimagesbyalbum-sizedimage": case "latestimagesbyalbum-sizedimage-maxspace": case "latestimagesbyalbum-fullimage": $albumWhere = ' AND ' . $albumWhere; $type1 = query("SET @type1:='news'"); $type2 = query("SET @type2:='albums'"); if (empty($combinews_sortorder) || $combinews_sortorder != "date" || $combinews_sortorder != "mtime" || $combinews_sortorder != "publishdate") { $combinews_sortorder = "date"; } $sortorder = "images." . $combinews_sortorder; switch ($combinews_sortorder) { case "date": $imagequery = "(SELECT DISTINCT DATE_FORMAT(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.date,'%Y-%m-%d'), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")"; break; case "mtime": $imagequery = "(SELECT DISTINCT FROM_UNIXTIME(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.mtime,'%Y-%m-%d'), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")"; case "publishdate": $imagequery = "(SELECT DISTINCT FROM_UNIXTIME(" . $sortorder . ",'%Y-%m-%d'), albums.folder, DATE_FORMAT(images.publishdate,'%Y-%m-%d'), @type2, @type3 as sticky FROM " . prefix('images') . " AS images, " . prefix('albums') . " AS albums\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE albums.id = images.albumid " . $imagesshow . $albumWhere . ")"; break; } $result = $this->siftResults("(SELECT title as albumname, titlelink, date, @type1 as type, sticky FROM " . prefix('news') . " " . $show . ")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tUNION\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t" . $imagequery . "\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tORDER By {$stickyorder} date " . $sortdir, $offset, $articles_per_page); break; case "latestupdatedalbums-thumbnail": case "latestupdatedalbums-thumbnail-customcrop": case "latestupdatedalbums-sizedimage": case "latestupdatedalbums-sizedimage-maxspace": case "latestupdatedalbums-fullimage": $latest = $this->getArticles($articles_per_page, NULL, true, 'date', $sortdirection); $counter = ''; foreach ($latest as $news) { $article = new ZenpageNews($news['titlelink']); if ($article->checkAccess()) { $counter++; $latestnews[$counter] = array("albumname" => $article->getTitle(), "titlelink" => $article->getTitlelink(), "date" => $article->getDateTime(), "type" => "news"); } } $albums = getAlbumStatistic($articles_per_page, "latestupdated", '', $sortdirection); $latestalbums = array(); $counter = ""; foreach ($albums as $album) { $counter++; $tempalbum = $album; $tempalbumthumb = $tempalbum->getAlbumThumbImage(); $timestamp = $tempalbum->get('mtime'); if ($timestamp == 0) { $albumdate = $tempalbum->getDateTime(); } else { $albumdate = strftime('%Y-%m-%d %H:%M:%S', $timestamp); } $latestalbums[$counter] = array("albumname" => $tempalbum->getFileName(), "titlelink" => $tempalbum->getTitle(), "date" => $albumdate, "type" => 'albums'); } //$latestalbums = array_merge($latestalbums, $item); $latest = array_merge($latestnews, $latestalbums); $result = sortMultiArray($latest, "date", $sortdirection != 'asc'); if (count($result) > $articles_per_page) { $result = array_slice($result, 0, $articles_per_page); } break; } $_zp_combiNews_cache[$published . $mode . $sticky . $sortorder . $sortdirection] = $result; return $result; }
/** * returns the mitigated album rights. * returns NULL if not a managed album */ function albumSubRights() { if (!is_null($this->subrights)) { return $this->subrights; } global $_zp_admin_album_list; if (zp_loggedin(MANAGE_ALL_ALBUM_RIGHTS)) { $this->subrights = MANAGED_OBJECT_RIGHTS_EDIT | MANAGED_OBJECT_RIGHTS_UPLOAD | MANAGED_OBJECT_RIGHTS_VIEW; return $this->subrights; } if (zp_loggedin(VIEW_UNPUBLISHED_RIGHTS)) { $base = MANAGED_OBJECT_RIGHTS_VIEW; } else { $base = NULL; } getManagedAlbumList(); if (count($_zp_admin_album_list) > 0) { $desired_folders = explode('/', $this->name); foreach ($_zp_admin_album_list as $adminalbum => $rights) { // see if it is one of the managed folders or a subfolder there of $admin_folders = explode('/', $adminalbum); $level = 0; $ok = true; foreach ($admin_folders as $folder) { if ($level >= count($desired_folders) || $folder != $desired_folders[$level]) { $ok = false; break; } $level++; } if ($ok) { $this->subrights = $rights | $base; return $this->subrights; } } } $this->subrights = $base; return $this->subrights; }
function show_debug($cmd = '') { $this->header(); echo "<p>Command: " . $cmd . "</p>"; echo "<p>Logged in: " . zp_loggedin() . "</p>"; $this->buttonsLastServerSidePage = true; $this->footer(); }