<?php // $Header$ // Copyright( c )2002-2003, Luis Argerich, Garland Foster, Eduardo Polidor, et. al. // All Rights Reserved. See below for details and a complete list of authors. // Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See http://www.gnu.org/copyleft/lesser.html for details. // Initialization require_once '../kernel/setup_inc.php'; // Is package installed and enabled $gBitSystem->verifyPackage('articles'); require_once ARTICLES_PKG_PATH . 'BitArticle.php'; // Now check permissions to access this page $gBitSystem->verifyPermission('p_articles_read'); if (!empty($_REQUEST['article_id'])) { $param = array('article_id' => (int) $_REQUEST['article_id']); bit_redirect(BitArticle::getDisplayUrlFromHash($param)); } // Display the template $gDefaultCenter = 'bitpackage:articles/center_display_articles.tpl'; $gBitSmarty->assignByRef('gDefaultCenter', $gDefaultCenter); // Display the template $gBitSystem->display('bitpackage:kernel/dynamic.tpl', tra('Articles'), array('display_mode' => 'display'));
if (!$gBitUser->hasPermission('p_articles_read')) { require_once RSS_PKG_PATH . "rss_error.php"; } else { // check if we want to use the cache file $cacheFile = TEMP_PKG_PATH . RSS_PKG_NAME . '/' . ARTICLES_PKG_NAME . '/' . $cacheFileTail; $rss->useCached($rss_version_name, $cacheFile, $gBitSystem->getConfig('rssfeed_cache_time')); $articles = new BitArticle(); $listHash = array('status_id' => ARTICLE_STATUS_APPROVED, 'sort_mode' => 'publish_date_desc', 'max_records' => $gBitSystem->getConfig('articles_rss_max_records', 10)); $feeds = $articles->getList($listHash); // set the rss link $rss->link = ARTICLES_PKG_URI; // get all the data ready for the feed creator foreach ($feeds as $feed) { $item = new FeedItem(); $item->title = $feed['title']; $item->link = $articles->getDisplayUrlFromHash($feed); // show the full article in the feed $parseHash['content_id'] = $feed['content_id']; $parseHash['format_guid'] = $feed['format_guid']; $parseHash['data'] = preg_replace(LIBERTY_SPLIT_REGEX, "", $feed['data']); $item->description = $articles->parseData($parseHash); $item->date = (int) $feed['publish_date']; $item->source = BIT_ROOT_URI; $item->author = $feed['author_name']; $item->descriptionTruncSize = $gBitSystem->getConfig('rssfeed_truncate', 5000); $item->descriptionHtmlSyndicated = FALSE; // pass the item on to the rss feed creator $rss->addItem($item); } // finally we are ready to serve the data echo $rss->saveFeed($rss_version_name, $cacheFile);