Beispiel #1
0
/**
 * Prints a form for posting comments
 *
 * @param bool $showcomments defaults to true for showing list of comments
 * @param string $addcommenttext alternate text for "Add a comment:"
 * @param bool $addheader set true to display comment count header
 * @param string $comment_commententry_mod use to add styles, classes to the comment form div
 * @param bool $desc_order default false, set to true to change the comment order to descending ( = newest to oldest)
 */
function printCommentForm($showcomments = true, $addcommenttext = NULL, $addheader = true, $comment_commententry_mod = '', $desc_order = false)
{
    global $_zp_gallery_page, $_zp_current_admin_obj, $_zp_current_comment, $_zp_captcha, $_zp_authority, $_zp_HTML_cache, $_zp_current_image, $_zp_current_album, $_zp_current_page, $_zp_current_article;
    if (getOption('email_new_comments')) {
        $email_list = $_zp_authority->getAdminEmail();
        if (empty($email_list)) {
            setOption('email_new_comments', 0);
        }
    }
    if (is_null($addcommenttext)) {
        $addcommenttext = '<h3>' . gettext('Add a comment:') . '</h3>';
    }
    switch ($_zp_gallery_page) {
        case 'album.php':
            if (!getOption('comment_form_albums')) {
                return;
            }
            $obj = $_zp_current_album;
            break;
        case 'image.php':
            if (!getOption('comment_form_images')) {
                return;
            }
            $obj = $_zp_current_image;
            break;
        case 'pages.php':
            if (!getOption('comment_form_pages')) {
                return;
            }
            $obj = $_zp_current_page;
            break;
        case 'news.php':
            if (!getOption('comment_form_articles') || !is_NewsArticle()) {
                return;
            }
            $obj = $_zp_current_article;
            break;
        default:
            return;
            break;
    }
    $comments_open = $obj->getCommentsAllowed();
    ?>
	<!-- printCommentForm -->
	<div id="commentcontent">
		<?php 
    $num = getCommentCount();
    if ($showcomments) {
        if ($num == 0) {
            if ($addheader) {
                echo '<h3 class="empty">' . gettext('No Comments') . '</h3>';
            }
            $display = '';
        } else {
            if ($addheader) {
                echo '<h3>' . sprintf(ngettext('%u Comment', '%u Comments', $num), $num) . '</h3>';
            }
            if (getOption('comment_form_toggle')) {
                ?>
					<div id="comment_toggle"><!-- place holder for toggle button --></div>
					<script type="text/javascript">
						// <!-- <![CDATA[
						function toggleComments(hide) {
							if (hide) {
								$('div.comment').hide();
								$('.Pagination').hide();
								$('#comment_toggle').html('<button class="button buttons" onclick="toggleComments(false);"><?php 
                echo gettext('show comments');
                ?>
</button>');
							} else {
								$('div.comment').show();
								$('.Pagination').show();
								$('#comment_toggle').html('<button class="button buttons" onclick="toggleComments(true);"><?php 
                echo gettext('hide comments');
                ?>
</button>');
							}
						}
						$(document).ready(function () {
							toggleComments(window.location.hash.search(/#zp_comment_id_/));
						});
						// ]]> -->
					</script>
					<?php 
                $display = ' style="display:none"';
            } else {
                $display = '';
            }
        }
        $hideoriginalcomments = '';
        if (getOption('comment_form_pagination') && COMMENTS_PER_PAGE < $num) {
            $hideoriginalcomments = ' style="display:none"';
            // hide original comment display to be replaced by jQuery pagination
        }
        if (getOption('comment_form_pagination') && COMMENTS_PER_PAGE < $num) {
            ?>
				<div class="Pagination"></div><!-- this is the jquery pagination nav placeholder -->
				<div id="Commentresult"></div>
				<?php 
        }
        ?>
			<div id="comments"<?php 
        echo $hideoriginalcomments;
        ?>
>
				<?php 
        while (next_comment($desc_order)) {
            if (!getOption('comment_form_showURL')) {
                $_zp_current_comment['website'] = '';
            }
            ?>
					<div class="comment" <?php 
            echo $display;
            ?>
>
						<div class="commentinfo">
							<h4 id="zp_comment_id_<?php 
            echo $_zp_current_comment['id'];
            ?>
"><?php 
            printCommentAuthorLink();
            ?>
: <?php 
            echo gettext('on');
            ?>
 <?php 
            echo getCommentDateTime();
            printEditCommentLink(gettext('Edit'), ', ', '');
            ?>
</h4>
						</div><!-- class "commentinfo" -->
						<div class="commenttext"><?php 
            echo html_encodeTagged(getCommentBody(), false);
            ?>
</div><!-- class "commenttext" -->
					</div><!-- class "comment" -->
					<?php 
        }
        ?>
			</div><!-- id "comments" -->
			<?php 
    }
    if (getOption('comment_form_pagination') && COMMENTS_PER_PAGE < $num) {
        ?>
			<div class="Pagination"></div><!-- this is the jquery pagination nav placeholder -->
			<?php 
    }
    ?>
		<!-- Comment Box -->
		<?php 
    if ($comments_open) {
        if (MEMBERS_ONLY_COMMENTS && !zp_loggedin(POST_COMMENT_RIGHTS)) {
            echo gettext('Only registered users may post comments.');
        } else {
            $disabled = array('name' => '', 'website' => '', 'anon' => '', 'private' => '', 'comment' => '', 'street' => '', 'city' => '', 'state' => '', 'country' => '', 'postal' => '');
            $stored = array_merge(array('email' => '', 'custom' => ''), $disabled, getCommentStored());
            $custom = getSerializedArray($stored['custom']);
            foreach ($custom as $key => $value) {
                if (!empty($value)) {
                    $stored[$key] = $value;
                }
            }
            foreach ($stored as $key => $value) {
                $disabled[$key] = false;
            }
            if (zp_loggedin()) {
                if (extensionEnabled('userAddressFields')) {
                    $address = userAddressFields::getCustomData($_zp_current_admin_obj);
                    foreach ($address as $key => $value) {
                        if (!empty($value)) {
                            $disabled[$key] = true;
                            $stored[$key] = $value;
                        }
                    }
                }
                $name = $_zp_current_admin_obj->getName();
                if (!empty($name)) {
                    $stored['name'] = $name;
                    $disabled['name'] = ' disabled="disabled"';
                } else {
                    $user = $_zp_current_admin_obj->getUser();
                    if (!empty($user)) {
                        $stored['name'] = $user;
                        $disabled['name'] = ' disabled="disabled"';
                    }
                }
                $email = $_zp_current_admin_obj->getEmail();
                if (!empty($email)) {
                    $stored['email'] = $email;
                    $disabled['email'] = ' disabled="disabled"';
                }
                if (!empty($address['website'])) {
                    $stored['website'] = $address['website'];
                    $disabled['website'] = ' disabled="disabled"';
                }
            }
            $data = zp_apply_filter('comment_form_data', array('data' => $stored, 'disabled' => $disabled));
            $disabled = $data['disabled'];
            $stored = $data['data'];
            foreach ($data as $check) {
                foreach ($check as $v) {
                    if ($v) {
                        $_zp_HTML_cache->disable();
                        //	shouldn't cache partially filled in pages
                        break 2;
                    }
                }
            }
            if (!empty($addcommenttext)) {
                echo $addcommenttext;
            }
            ?>
				<div id="commententry" <?php 
            echo $comment_commententry_mod;
            ?>
>
					<?php 
            $theme = getCurrentTheme();
            $form = getPlugin('comment_form/comment_form.php', $theme);
            require $form;
            ?>
				</div><!-- id="commententry" -->
				<?php 
        }
    } else {
        ?>
			<div id="commententry">
				<h3><?php 
        echo gettext('Closed for comments.');
        ?>
</h3>
			</div><!-- id="commententry" -->
			<?php 
    }
    ?>
	</div><!-- id="commentcontent" -->
	<?php 
    if (getOption('comment_form_rss') && getOption('RSS_comments')) {
        ?>
		<br clear="all" />
		<?php 
        if (class_exists('RSS')) {
            switch ($_zp_gallery_page) {
                case "image.php":
                    printRSSLink("Comments-image", "", gettext("Subscribe to comments"), "");
                    break;
                case "album.php":
                    printRSSLink("Comments-album", "", gettext("Subscribe to comments"), "");
                    break;
                case "news.php":
                    printRSSLink("Comments-news", "", gettext("Subscribe to comments"), "");
                    break;
                case "pages.php":
                    printRSSLink("Comments-page", "", gettext("Subscribe to comments"), "");
                    break;
            }
        }
    }
    ?>
	<!-- end printCommentForm -->
	<?php 
}
/**
 * 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;
    }
}
Beispiel #3
0
        if (getTags()) {
            echo gettext('<strong>Tags:</strong>');
        }
        printTags('links', '', 'taglist', ', ');
        ?>
				<br style="clear:both;" /><br />
			</div>
			<?php 
    }
}
?>
  	</div>
		</div>
		<div id="tools">
		<?php 
if (!is_NewsArticle()) {
    if (hasPrevPage()) {
        ?>
			<a href="<?php 
        echo getPrevNewsPageURL();
        ?>
"><span class="prev"></span></a>
			<?php 
    } else {
        ?>
				<span class="prev-disabled"></span>
			<?php 
    }
    ?>
	
Beispiel #4
0
/**
 * @deprecated
 * @since 1.4.6
 */
function zenpageOpenedForComments()
{
    deprecated_functions::notify(gettext("use the object’s getCommentsAllowed() method"));
    global $_zp_current_zenpage_news, $_zp_current_zenpage_page;
    if (is_NewsArticle()) {
        $obj = $_zp_current_zenpage_news;
    }
    if (is_Pages()) {
        $obj = $_zp_current_zenpage_page;
    }
    return $obj->getCommentsAllowed();
}
Beispiel #5
0
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;
}
Beispiel #6
0
if (getOption('show_archive')) {
    printCustomPageURL(gettext('Archive View'), 'archive', '', ' | ');
}
if (extensionEnabled('user_login-out')) {
    printUserLogin_out(' | ', '', 2);
}
if (!zp_loggedin() && extensionEnabled('register_user')) {
    printRegisterURL(gettext('Register'), ' | ');
}
?>
		</div>

		<div id="zpcredit">
			<?php 
printZenphotoLink(getOption('css_style'));
if ($_zp_gallery_page == 'image.php' || $_zp_gallery_page == 'album.php' && getOption('use_galleriffic') && getNumImages() > 0 || $_zenpage_enabled && is_NewsArticle()) {
    ?>
				<img id="icon-help" src="<?php 
    echo $_zp_themeroot;
    ?>
/images/help.png" title="<?php 
    echo gettext('You can browse with the arrows keys of your keyboard');
    ?>
" alt="help" />
				<?php 
}
?>
		</div> <!-- END #zpcredit-->
	</div>	<!-- END #foot-left -->
</div>		<!-- END #FOOTER -->
</div>			<!-- END #PAGE -->
/**
 * Prints a context sensitive menu of all pages as a unordered html list
 *
 * @param string $option The mode for the menu:
 * 												"list" context sensitive toplevel plus sublevel pages,
 * 												"list-top" only top level pages,
 * 												"omit-top" only sub level pages
 * 												"list-sub" lists only the current pages direct offspring
 * @param string $mode 'pages' or 'categories'
 * @param bool $counter Only $mode = 'categories': Count the articles in each category
 * @param string $css_id CSS id of the top level list
 * @param string $css_class_topactive class of the active item in the top level list
 * @param string $css_class CSS class of the sub level list(s)
 * @param string $$css_class_active CSS class of the sub level list(s)
 * @param string $indexname insert the name (default "Gallery Index") how you want to call the link to the gallery index, insert "" (default) if you don't use it, it is not printed then.
 * @param int $showsubs Set to depth of sublevels that should be shown always. 0 by default. To show all, set to a true! Only valid if option=="list".
 * @param bool $startlist set to true to output the UL tab (false automatically if you use 'omit-top' or 'list-sub')
 * @param int $limit truncation limit display strings
 * @return string
 */
function printNestedMenu($option = 'list', $mode = NULL, $counter = TRUE, $css_id = NULL, $css_class_topactive = NULL, $css_class = NULL, $css_class_active = NULL, $indexname = NULL, $showsubs = 0, $startlist = true, $limit = NULL)
{
    global $_zp_zenpage, $_zp_gallery_page, $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_current_category;
    if (is_null($limit)) {
        $limit = MENU_TRUNCATE_STRING;
    }
    if ($css_id != "") {
        $css_id = " id='" . $css_id . "'";
    }
    if ($css_class_topactive != "") {
        $css_class_topactive = " class='" . $css_class_topactive . "'";
    }
    if ($css_class != "") {
        $css_class = " class='" . $css_class . "'";
    }
    if ($css_class_active != "") {
        $css_class_active = " class='" . $css_class_active . "'";
    }
    if ($showsubs === true) {
        $showsubs = 9999999999.0;
    }
    switch ($mode) {
        case 'pages':
            $items = $_zp_zenpage->getPages();
            $currentitem_id = getPageID();
            if (is_object($_zp_current_zenpage_page)) {
                $currentitem_parentid = $_zp_current_zenpage_page->getParentID();
            } else {
                $currentitem_parentid = NULL;
            }
            $currentitem_sortorder = getPageSortorder();
            break;
        case 'categories':
        case 'allcategories':
            $items = $_zp_zenpage->getAllCategories();
            if (is_object($_zp_current_category) && $mode == 'categories') {
                $currentitem_sortorder = $_zp_current_category->getSortOrder();
                $currentitem_id = $_zp_current_category->getID();
                $currentitem_parentid = $_zp_current_category->getParentID();
            } else {
                $currentitem_sortorder = NULL;
                $currentitem_id = NULL;
                $currentitem_parentid = NULL;
            }
            break;
    }
    // don't highlight current pages or foldout if in search mode as next_page() sets page context
    if (in_context(ZP_SEARCH) && $mode == 'pages') {
        // categories are not searched
        $css_class_topactive = "";
        $css_class_active = "";
        rem_context(ZP_ZENPAGE_PAGE);
    }
    if (0 == count($items) + (int) ($mode == 'allcategories')) {
        return;
    }
    // nothing to do
    $startlist = $startlist && !($option == 'omit-top' || $option == 'list-sub');
    if ($startlist) {
        echo "<ul{$css_id}>";
    }
    // if index link and if if with count
    if (!empty($indexname)) {
        if ($limit) {
            $display = shortenContent($indexname, $limit, MENU_TRUNCATE_INDICATOR);
        } else {
            $display = $indexname;
        }
        switch ($mode) {
            case 'pages':
                if ($_zp_gallery_page == "index.php") {
                    echo "<li {$css_class_topactive}>" . html_encode($display) . "</li>";
                } else {
                    echo "<li><a href='" . html_encode(getGalleryIndexURL()) . "' title='" . html_encode($indexname) . "'>" . html_encode($display) . "</a></li>";
                }
                break;
            case 'categories':
            case 'allcategories':
                if ($_zp_gallery_page == "news.php" && !is_NewsCategory() && !is_NewsArchive() && !is_NewsArticle()) {
                    echo "<li {$css_class_topactive}>" . html_encode($display);
                } else {
                    echo "<li><a href=\"" . html_encode(getNewsIndexURL()) . "\" title=\"" . html_encode($indexname) . "\">" . html_encode($display) . "</a>";
                }
                if ($counter) {
                    if (in_context(ZP_ZENPAGE_NEWS_CATEGORY) && $mode == 'categories') {
                        $totalcount = count($_zp_current_category->getArticles(0));
                    } else {
                        save_context();
                        rem_context(ZP_ZENPAGE_NEWS_DATE);
                        $totalcount = count($_zp_zenpage->getArticles(0));
                        restore_context();
                    }
                    echo ' <span style="white-space:nowrap;"><small>(' . sprintf(ngettext('%u article', '%u articles', $totalcount), $totalcount) . ')</small></span>';
                }
                echo "</li>\n";
                break;
        }
    }
    $baseindent = max(1, count(explode("-", $currentitem_sortorder)));
    $indent = 1;
    $open = array($indent => 0);
    $parents = array(NULL);
    $order = explode('-', $currentitem_sortorder);
    $mylevel = count($order);
    $myparentsort = array_shift($order);
    for ($c = 0; $c <= $mylevel; $c++) {
        $parents[$c] = NULL;
    }
    foreach ($items as $item) {
        switch ($mode) {
            case 'pages':
                $catcount = 1;
                //	so page items all show.
                $pageobj = new ZenpagePage($item['titlelink']);
                $itemtitle = $pageobj->getTitle();
                $itemsortorder = $pageobj->getSortOrder();
                $itemid = $pageobj->getID();
                $itemparentid = $pageobj->getParentID();
                $itemtitlelink = $pageobj->getTitlelink();
                $itemurl = $pageobj->getLink();
                $count = '';
                break;
            case 'categories':
            case 'allcategories':
                $catobj = new ZenpageCategory($item['titlelink']);
                $itemtitle = $catobj->getTitle();
                $itemsortorder = $catobj->getSortOrder();
                $itemid = $catobj->getID();
                $itemparentid = $catobj->getParentID();
                $itemtitlelink = $catobj->getTitlelink();
                $itemurl = $catobj->getLink();
                $catcount = count($catobj->getArticles());
                if ($counter) {
                    $count = ' <span style="white-space:nowrap;"><small>(' . sprintf(ngettext('%u article', '%u articles', $catcount), $catcount) . ')</small></span>';
                } else {
                    $count = '';
                }
                break;
        }
        if ($catcount) {
            $level = max(1, count(explode('-', $itemsortorder)));
            $process = $level <= $showsubs && $option == "list" || ($option == 'list' || $option == 'list-top') && $level == 1 || ($option == 'list' || $option == 'omit-top' && $level > 1) && ($itemid == $currentitem_id || $itemparentid == $currentitem_id || $level < $mylevel && $level > 1 && strpos($itemsortorder, $myparentsort) === 0 || $level == $mylevel && $currentitem_parentid == $itemparentid) || $option == 'list-sub' && $itemparentid == $currentitem_id;
            if ($process) {
                if ($level > $indent) {
                    echo "\n" . str_pad("\t", $indent, "\t") . "<ul{$css_class}>\n";
                    $indent++;
                    $parents[$indent] = NULL;
                    $open[$indent] = 0;
                } else {
                    if ($level < $indent) {
                        $parents[$indent] = NULL;
                        while ($indent > $level) {
                            if ($open[$indent]) {
                                $open[$indent]--;
                                echo "</li>\n";
                            }
                            $indent--;
                            echo str_pad("\t", $indent, "\t") . "</ul>\n";
                        }
                    } else {
                        // level == indent, have not changed
                        if ($open[$indent]) {
                            // level = indent
                            echo str_pad("\t", $indent, "\t") . "</li>\n";
                            $open[$indent]--;
                        } else {
                            echo "\n";
                        }
                    }
                }
                if ($open[$indent]) {
                    // close an open LI if it exists
                    echo "</li>\n";
                    $open[$indent]--;
                }
                echo str_pad("\t", $indent - 1, "\t");
                $open[$indent]++;
                $parents[$indent] = $itemid;
                if ($level == 1) {
                    // top level
                    $class = $css_class_topactive;
                } else {
                    $class = $css_class_active;
                }
                if (!is_null($_zp_current_zenpage_page)) {
                    $gettitle = $_zp_current_zenpage_page->getTitle();
                    $getname = $_zp_current_zenpage_page->getTitlelink();
                } else {
                    if (!is_null($_zp_current_category)) {
                        $gettitle = $_zp_current_category->getTitle();
                        $getname = $_zp_current_category->getTitlelink();
                    } else {
                        $gettitle = '';
                        $getname = '';
                    }
                }
                $current = "";
                if ($itemtitlelink == $getname && !in_context(ZP_SEARCH)) {
                    switch ($mode) {
                        case 'pages':
                            if ($_zp_gallery_page == 'pages.php') {
                                $current = $class;
                            }
                            break;
                        case 'categories':
                        case 'allcategories':
                            if ($_zp_gallery_page == 'news.php') {
                                $current = $class;
                            }
                            break;
                    }
                }
                if ($limit) {
                    $itemtitle = shortenContent($itemtitle, $limit, MENU_TRUNCATE_INDICATOR);
                }
                echo "<li><a {$current} href=\"" . html_encode($itemurl) . "\" title=\"" . html_encode(getBare($itemtitle)) . "\">" . html_encode($itemtitle) . "</a>" . $count;
            }
        }
    }
    // cleanup any hanging list elements
    while ($indent > 1) {
        if ($open[$indent]) {
            echo "</li>\n";
            $open[$indent]--;
        }
        $indent--;
        echo str_pad("\t", $indent, "\t") . "</ul>";
    }
    if ($open[$indent]) {
        echo "</li>\n";
        $open[$indent]--;
    } else {
        echo "\n";
    }
    if ($startlist) {
        echo "</ul>\n";
    }
}
/**
 * Returns if comments are open for this news article or page (TRUE or FALSE)
 *
 * @return bool
 */
function zenpageOpenedForComments()
{
    global $_zp_current_zenpage_news, $_zp_current_zenpage_page;
    if (is_NewsArticle()) {
        $obj = $_zp_current_zenpage_news;
    }
    if (is_Pages()) {
        $obj = $_zp_current_zenpage_page;
    }
    return $obj->get('commentson');
}
 /**
  * Prints the RDF trackback url information for external clients to autodiscover.
  * This code is invisible and within comments on the theme page.
  *
  * For theme usage.
  *
  */
 function printTrackbackRDF()
 {
     global $_zp_current_zenpage_news, $_zp_current_zenpage_page, $_zp_current_album, $_zp_current_image;
     // check if Zenpage is there...
     if (getOption('zp_plugin_zenpage')) {
         if (is_NewsArticle()) {
             $trackback = $this->getTrackbackURL($_zp_current_zenpage_news);
             $title = getNewsTitle();
             $permalink = $this->getPermalinkURL($_zp_current_zenpage_news, $host);
         }
         if (is_Pages()) {
             $trackback = $this->getTrackbackURL($_zp_current_zenpage_page);
             $title = getPageTitle();
             $permalink = $this->getPermalinkURL($_zp_current_zenpage_page);
         }
     }
     if (in_context(ZP_ALBUM)) {
         $trackback = $this->getTrackbackURL($_zp_current_album);
         $title = getAlbumTitle();
         $permalink = $this->getPermalinkURL($_zp_current_album);
     }
     if (in_context(ZP_IMAGE)) {
         $trackback = $this->getTrackbackURL($_zp_current_image);
         $title = getImageTitle();
         $permalink = $this->getPermalinkURL($_zp_current_image);
     }
     echo $this->rdf_autodiscover("", $title, "", $permalink, $trackback, "");
 }
Beispiel #10
0
/**
 * @deprecated
 * @since 1.4.6
 *
 */
function openedForComments()
{
    deprecated_functions::notify(gettext("use the object’s getCommentsAllowed() method"));
    global $_zp_gallery_page, $_zp_current_image, $_zp_current_album, $_zp_current_zenpage_page, $_zp_current_zenpage_news;
    switch ($_zp_gallery_page) {
        case 'album.php':
            return $_zp_current_album->getCommentsAllowed();
        case 'image.php':
            return $_zp_current_image->getCommentsAllowed();
        case 'pages.php':
            return $_zp_current_zenpage_page->getCommentsAllowed();
        case 'news.php':
            if (is_NewsArticle()) {
                $_zp_current_zenpage_news->getCommentsAllowed();
            }
    }
    return false;
}
Beispiel #11
0
    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&amp;edit&amp;titlelink=" . html_encode($_zp_current_article->getTitleLink()) . "&amp;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();
                    ?>
&amp;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&amp;add\">" . gettext("Add Article") . "</a></li>";
            }
            $redirect .= '&amp;title=' . urlencode($_zp_current_article->getTitlelink());
        } else {
            if (!empty($_zp_current_category)) {
                $redirect .= '&amp;category=' . $_zp_current_category->getTitlelink();
            }
        }
        return $redirect;
    }
Beispiel #12
0
</h5>
					<?php 
            printAllNewsCategories(gettext('All News'), true, '', 'menu-active', true, 'submenu', 'menu-active');
            ?>
					<?php 
        }
        ?>
					<?php 
    }
    ?>
				</div>
			</div>
		</div>
		
		<?php 
    if (function_exists('printCommentForm') && is_NewsArticle()) {
        ?>
		<div id="comments-page" class="wrap clearfix">
			<div class="inner">
				<div class="comments-sidebar pad">
					<?php 
        if (function_exists('printRating')) {
            ?>
					<div id="rating" class="block"><?php 
            printRating();
            ?>
</div>
					<?php 
        }
        ?>
				</div>
Beispiel #13
0
        ?>
		<?php 
        if (hasPrevImage()) {
            ?>
var prevURL = "<?php 
            echo getPrevImageURL();
            $PrevURL = true;
            ?>
";<?php 
        }
        ?>
	<?php 
    } else {
        ?>
		<?php 
        if ($_zenpage_enabled && is_NewsArticle()) {
            ?>
			<?php 
            if (getNextNewsURL()) {
                $article_url = getNextNewsURL();
                ?>
var nextURL = "<?php 
                echo html_decode($article_url['link']);
                $NextURL = true;
                ?>
";<?php 
            }
            ?>
			<?php 
            if (getPrevNewsURL()) {
                $article_url = getPrevNewsURL();
Beispiel #14
0
if ($_zp_gallery_page == 'archive.php') {
    echo " | " . gettext('Archive View');
}
if ($_zp_gallery_page == 'password.php') {
    echo " | " . gettext('Password Required...');
}
if ($_zp_gallery_page == '404.php') {
    echo " | " . gettext('404 Not Found...');
}
if ($_zp_gallery_page == 'search.php') {
    echo " | " . gettext('Search: ') . html_encode(getSearchWords());
}
if ($_zp_gallery_page == 'news.php') {
    echo " | " . gettext('News');
}
if ($_zp_gallery_page == 'news.php' && is_NewsArticle()) {
    echo " | " . getBareNewsTitle();
}
?>
	
	</title>
	<?php 
if (getOption('zp_plugin_reCaptcha')) {
    ?>
	<script>
		var RecaptchaOptions = {
			theme : <?php 
    if ($zpgal_contrast == 'dark') {
        echo '\'blackglass\'';
    } else {
        echo '\'white\'';
Beispiel #15
0
    /**
     *
     * 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&amp;mobileTheme=' . $enable;
                        break;
                    case 'album.php':
                        $link = pathurlencode($_zp_current_album->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        break;
                    case 'image.php':
                        $link = pathurlencode($_zp_current_image->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        break;
                    case 'news.php':
                        if (is_NewsArticle()) {
                            $link = html_encode($_zp_current_zenpage_news->getLink(null)) . '&amp;mobileTheme=' . $enable;
                        } else {
                            if (is_NewsCategory()) {
                                $link = html_encode($_zp_current_category->getLink(null)) . '&amp;mobileTheme=' . $enable;
                            } else {
                                $link = html_encode(getNewsIndexURL()) . '&amp;mobileTheme=' . $enable;
                            }
                        }
                        break;
                    case 'pages.php':
                        $link = html_encode($_zp_current_zenpage_page->getLink()) . '&amp;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>';
            }
        }
    }
Beispiel #16
0
/**
 * "invents" a menu item for the current page (for when one does not exist)
 * Adds the item to the current menuset and modifies its "parent" as needed
 *
 * returns a contrived sort_order for the item.
 *
 * @param string $menuset
 * @param string $visibility
 * return string
 */
function inventMenuItem($menuset, $visibility)
{
    global $_zp_gallery_page, $_zp_current_album, $_zp_current_image, $_zp_current_search, $_menu_manager_items, $_zp_current_article, $_zp_current_page;
    $currentkey = $insertpoint = NULL;
    $newitems = array();
    switch ($_zp_gallery_page) {
        case 'image.php':
            $name = '';
            if (in_context(ZP_SEARCH_LINKED) && !in_context(ZP_ALBUM_LINKED)) {
                $dynamic = $_zp_current_search->getDynamicAlbum();
                if (empty($dynamic)) {
                    //	smple search
                    foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                        if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                            $insertpoint = $item['sort_order'];
                            $currentkey = $insertpoint . '-9999';
                            break;
                        }
                    }
                }
            } else {
                $name = $_zp_current_album->name;
            }
            if (!empty($name)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'album' && $item['title'] == $name) {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            }
            if (!empty($currentkey)) {
                $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'image', 'include_li' => true, 'title' => $_zp_current_image->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
            }
            break;
        case 'news.php':
            if (in_context(ZP_SEARCH_LINKED)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            } else {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'newsindex') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        break;
                    }
                }
            }
            if (!empty($currentkey)) {
                if (is_NewsArticle()) {
                    $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'article', 'include_li' => true, 'title' => $_zp_current_article->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
                } else {
                    $currentkey = false;
                    // not a news page, must be the index?
                }
            }
            break;
        case 'pages.php':
            if (in_context(ZP_SEARCH_LINKED)) {
                foreach ($_menu_manager_items[$menuset][$visibility] as $key => $item) {
                    if ($item['type'] == 'custompage' && $item['link'] == 'search') {
                        $insertpoint = $item['sort_order'];
                        $currentkey = $insertpoint . '-9999';
                        $item = array('id' => 9999, 'sort_order' => $currentkey, 'parentid' => $item['id'], 'type' => 'page', 'include_li' => true, 'title' => $_zp_current_page->getTitle(), 'show' => 1, 'link' => '', 'menuset' => $menuset);
                        break;
                    }
                }
            }
            break;
    }
    if (!empty($currentkey)) {
        foreach ($_menu_manager_items[$menuset][$visibility] as $key => $olditem) {
            $newitems[$key] = $olditem;
            if ($olditem['sort_order'] == $insertpoint) {
                $newitems[$currentkey] = $item;
            }
        }
        $_menu_manager_items[$menuset][$visibility] = $newitems;
    }
    return $currentkey;
}
Beispiel #17
0
 /**
  * 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_zenpage_news, $_zp_current_category;
    if (is_NewsPage()) {
        $page = '';
        if (is_NewsArticle()) {
            $page = $_zp_current_zenpage_news->getNewsLoopPage();
        }
        printNewsIndexURL(NULL, '', '', $page);
    }
    if (is_Pages() || is_NewsCategory()) {
        $parentitems = array();
        if (is_Pages()) {
            $parentitems = $_zp_current_zenpage_page->getParents();
        }
        if (is_NewsCategory()) {
            $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>';
            }
        }
    }
}
Beispiel #19
0
					<?php 
    }
    ?>
					<?php 
}
?>
 
				</div>
				<div id="sidebar"<?php 
if ($zpmin_switch) {
    echo ' class="switch"';
}
?>
>
					<?php 
if (is_NewsArticle() && getNewsExtraContent()) {
    ?>
					<div class="sidebar-divide">
						<div class="extra-content"><?php 
    printNewsExtraContent();
    ?>
</div>
					</div>
					<?php 
}
?>
					<?php 
include "inc-sidemenu.php";
?>
					<?php 
if (function_exists('printCommentForm')) {
/**
 * @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;
    }
}
Beispiel #21
0
        ?>
			</div>
			<?php 
    }
    ?>
			<h3><?php 
    printNewsIndexURL(gettext('News'));
    printCurrentNewsCategory(' » ' . gettext('Category') . ' : ');
    printCurrentNewsArchive(' » ');
    ?>
</h3>
		</div>

	<?php 
    // single news article
    if (is_NewsArticle()) {
        ?>
		<div id="news" class="clearfix">
			<h3><?php 
        printNewsTitle();
        ?>
</h3>
			<div class="newsarticlecredit">
				<?php 
        printNewsDate();
        printNewsCategories(', ', gettext(' | '), 'hor-list');
        ?>
			</div>
			<?php 
        if (getNewsExtraContent()) {
            ?>
/**
 * 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;
}