summaryrefslogtreecommitdiff
path: root/articles_rss.php
diff options
context:
space:
mode:
authorMax Kremmel <xing@synapse.plus.com>2005-10-29 10:02:03 +0000
committerMax Kremmel <xing@synapse.plus.com>2005-10-29 10:02:03 +0000
commita8163cf825ba4f49c2e05a02d099868cc734450b (patch)
tree461e99f8870c793071986cfc79b7e88d87519905 /articles_rss.php
parent4cbe5be245fe71fe763c6497150d9e2894c19f01 (diff)
downloadarticles-a8163cf825ba4f49c2e05a02d099868cc734450b.tar.gz
articles-a8163cf825ba4f49c2e05a02d099868cc734450b.tar.bz2
articles-a8163cf825ba4f49c2e05a02d099868cc734450b.zip
clean up rss stuff further and return more data - parsed data for articles, blogs and wiki
Diffstat (limited to 'articles_rss.php')
-rw-r--r--articles_rss.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/articles_rss.php b/articles_rss.php
index eacf91f..91b501b 100644
--- a/articles_rss.php
+++ b/articles_rss.php
@@ -6,33 +6,36 @@ require_once( ARTICLES_PKG_PATH."BitArticle.php" );
$gBitSystem->verifyPackage( 'articles' );
$gBitSystem->verifyPackage( 'rss' );
-$rss->title = $gBitSystem->getPreference( 'title_rss_articles', $gBitSystem->mPrefs['siteTitle'] );
+$rss->title = $gBitSystem->getPreference( 'title_rss_articles', $gBitSystem->mPrefs['siteTitle'].' - '.tra( 'Articles' ) );
$rss->description = $gBitSystem->getPreference( 'desc_rss_articles', $gBitSystem->mPrefs['siteTitle'].' - '.tra( 'RSS Feed' ) );
// check permission to view articles
if( !$gBitUser->hasPermission( 'bit_p_read_article' ) ) {
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.'_'.$version.'.xml';
+ $rss->useCached( $cacheFile ); // use cached version if age < 1 hour
+
$articles = new BitArticle();
$listHash = array(
'sort_mode' => 'publish_date_desc',
'max_records' => $gBitSystem->getPreference( 'max_rss_articles', 10 ),
);
$feeds = $articles->getList( $listHash );
- $feeds = $feeds['data'];
// get all the data ready for the feed creator
- foreach( $feeds as $feed ) {
+ foreach( $feeds['data'] as $feed ) {
$item = new FeedItem();
$item->title = $feed['title'];
- $item->link = 'http://'.$_SERVER['HTTP_HOST'].BIT_ROOT_URL.$articles->getDisplayUrl( $feed['title'] );
- $item->description = $feed['data'];
+ $item->link = BIT_BASE_URI.$articles->getDisplayUrl( $feed['title'] );
+ $item->description = $feed['parsed_data'];
- $item->date = (int) $feed['publish_date'];
+ $item->date = ( int )$feed['publish_date'];
$item->source = 'http://'.$_SERVER['HTTP_HOST'].BIT_ROOT_URL;
$item->author = $feed['author_name'];
- $item->descriptionTruncSize = $gBitSystem->getPreference( 'rssfeed_truncate', 500 );
+ $item->descriptionTruncSize = $gBitSystem->getPreference( 'rssfeed_truncate', 1000 );
$item->descriptionHtmlSyndicated = FALSE;
// pass the item on to the rss feed creator
@@ -40,8 +43,6 @@ if( !$gBitUser->hasPermission( 'bit_p_read_article' ) ) {
}
// finally we are ready to serve the data
- $cacheFile = TEMP_PKG_PATH.'rss/articles_'.$version.'.xml';
- $rss->useCached( $cacheFile ); // use cached version if age < 1 hour
echo $rss->saveFeed( $rss_version_name, $cacheFile );
}
?>