diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2006-12-09 23:07:17 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2006-12-09 23:07:17 +0000 |
| commit | 184922533d1878e45d115d652e4f85e85785b792 (patch) | |
| tree | af5da0ffbbdb12a0d5827ab9ddf9c438dcabd283 /fisheye_rss.php | |
| parent | 8c0ed12f102f3a9e999b1cd73b0a9db0c306ca49 (diff) | |
| download | fisheye-184922533d1878e45d115d652e4f85e85785b792.tar.gz fisheye-184922533d1878e45d115d652e4f85e85785b792.tar.bz2 fisheye-184922533d1878e45d115d652e4f85e85785b792.zip | |
add generic image rss feed - doesn't fully take permissions into account yet
Diffstat (limited to 'fisheye_rss.php')
| -rw-r--r-- | fisheye_rss.php | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/fisheye_rss.php b/fisheye_rss.php new file mode 100644 index 0000000..bf20486 --- /dev/null +++ b/fisheye_rss.php @@ -0,0 +1,65 @@ +<?php +/** + * @version $Header: /cvsroot/bitweaver/_bit_fisheye/fisheye_rss.php,v 1.1 2006/12/09 23:07:17 squareing Exp $ + * @package fisheye + * @subpackage functions + */ + +/** + * Initialization + */ +require_once( "../bit_setup_inc.php" ); +require_once( RSS_PKG_PATH."rss_inc.php" ); +require_once( FISHEYE_PKG_PATH."FisheyeImage.php" ); + +$gBitSystem->verifyPackage( 'fisheye' ); +$gBitSystem->verifyPackage( 'rss' ); +$gBitSystem->verifyFeature( 'fisheye_rss' ); + +$rss->title = $gBitSystem->getConfig( 'fisheye_rss_title', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'Image Galleries' ) ); +$rss->description = $gBitSystem->getConfig( 'fisheye_rss_description', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'RSS Feed' ) ); + +// check permission to view fisheye images +if( !$gBitUser->hasPermission( 'p_fisheye_view_page' ) ) { + 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.'/'.FISHEYE_PKG_NAME.'_'.$rss_version_name.'.xml'; + $rss->useCached( $rss_version_name, $cacheFile ); // use cached version if age < 1 hour + + $listHash = array( + 'max_records' => $gBitSystem->getConfig( 'fisheye_rss_max_records', 10 ), + 'sort_mode' => 'last_modified_desc', + 'gallery_id' => !empty( $_REQUEST['gallery_id'] ) ? $_REQUEST['gallery_id'] : NULL, + 'user_id' => !empty( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : NULL, + ); + + $fisheye = new FisheyeImage(); + $feeds = $fisheye->getList( $listHash ); + + // set the rss link + $rss->link = 'http://'.$_SERVER['HTTP_HOST'].FISHEYE_PKG_URL; + + // get all the data ready for the feed creator + foreach( $feeds as $feed ) { + $item = new FeedItem(); + $item->title = $feed['title']; + $item->link = $feed['display_url']; + $item->description = '<img src="'.str_replace( '/avatar.jpg', '/medium.jpg', $feed['thumbnail_url'] ).'" />'; + $item->description .= '<br />'.$feed['data']; + + $item->date = ( int )$feed['last_modified']; + $item->source = 'http://'.$_SERVER['HTTP_HOST'].BIT_ROOT_URL; + $item->author = $gBitUser->getDisplayName( FALSE, $feed ); + + $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 ); +} +?> |
