/**
 * Returns the sortorder of a page
 *
 * @return string
 */
function getPageSortorder()
{
    global $_zp_current_zenpage_page;
    if (is_Pages()) {
        return $_zp_current_zenpage_page->getSortOrder();
    }
    return false;
}
Ejemplo n.º 2
0
 foreach (getEnabledPlugins() as $extension) {
     $_zp_loaded_plugins[] = $extension;
     require_once SERVERPATH . "/" . ZENFOLDER . PLUGIN_FOLDER . $extension;
 }
 // Zenpage automatic hitcounter update support
 if (function_exists("is_NewsArticle") and !$_zp_loggedin) {
     if (is_NewsArticle()) {
         $hc = $_zp_current_zenpage_news->get('hitcounter') + 1;
         $_zp_current_zenpage_news->set('hitcounter', $hc);
         $_zp_current_zenpage_news->save();
     }
     if (is_NewsCategory()) {
         $catname = sanitize($_GET['category']);
         query("UPDATE " . prefix('zenpage_news_categories') . " SET `hitcounter` = `hitcounter`+1 WHERE `cat_link` = '" . $catname . "'", true);
     }
     if (is_Pages()) {
         $hc = $_zp_current_zenpage_page->get('hitcounter') + 1;
         $_zp_current_zenpage_page->set('hitcounter', $hc);
         $_zp_current_zenpage_page->save();
     }
 }
 // re-initialize video dimensions if needed
 if (isImageVideo() & !is_null($_zp_flash_player)) {
     $_zp_current_image->updateDimensions();
 }
 // Display the page itself
 if (!is_null($_zp_HTML_cache)) {
     $_zp_HTML_cache->startHTMLCache();
 }
 // Include the appropriate page for the requested object, and a 200 OK header.
 header("HTTP/1.0 200 OK");
Ejemplo n.º 3
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;
 }
/**
 * @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;
    }
}
Ejemplo n.º 5
0
 /**
  * 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, "");
 }
/**
 * 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');
}
Ejemplo n.º 7
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();
}
Ejemplo n.º 8
0
/**
 * 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;
}