fisheye
[ class tree: fisheye ] [ index: fisheye ] [ all elements ]

Source for file fisheye_rss.php

Documentation is available at fisheye_rss.php

  1. <?php
  2. /**
  3.  * @version $Header$
  4.  * @package fisheye
  5.  * @subpackage functions
  6.  */
  7.  
  8. /**
  9.  * Initialization
  10.  */
  11. require_once( "../kernel/setup_inc.php" );
  12.  
  13. $gBitSystem->verifyPackage( 'fisheye' );
  14. $gBitSystem->verifyPackage( 'rss' );
  15. $gBitSystem->verifyFeature( 'fisheye_rss' );
  16.  
  17. require_once( FISHEYE_PKG_PATH."FisheyeImage.php" );
  18. require_once( RSS_PKG_PATH."rss_inc.php" );
  19.  
  20. $rss->title = $gBitSystem->getConfig( 'fisheye_rss_title', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'Image Galleries' ) );
  21. $rss->description = $gBitSystem->getConfig( 'fisheye_rss_description', $gBitSystem->getConfig( 'site_title' ).' - '.tra( 'RSS Feed' ) );
  22.  
  23. // check permission to view fisheye images
  24. if( !$gBitUser->hasPermission( 'p_fisheye_view' ) ) {
  25.     require_once( RSS_PKG_PATH."rss_error.php" );
  26. } else {
  27.     $listHash = array(
  28.         'max_records' => $gBitSystem->getConfig( 'fisheye_rss_max_records', 10 ),
  29.         'sort_mode'   => 'last_modified_desc',
  30.         'gallery_id'  => !empty( $_REQUEST['gallery_id'] ) ? $_REQUEST['gallery_id'] : NULL,
  31.         'user_id'     => !empty( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : NULL,
  32.     );
  33.  
  34.     // check if we want to use the cache file
  35.     $cacheFile = TEMP_PKG_PATH.RSS_PKG_NAME.'/'.FISHEYE_PKG_NAME.'/'."g{$listHash['gallery_id']}u{$listHash['user_id']}".$cacheFileTail;
  36.     $rss->useCached( $rss_version_name, $cacheFile, $gBitSystem->getConfig( 'rssfeed_cache_time' ));
  37.  
  38.     // if we have a gallery we can work with - load it
  39.     if( @BitBase::verifyId( $_REQUEST['gallery_id'] ) ) {
  40.         $gallery = new FisheyeGallery( $_REQUEST['gallery_id'] );
  41.         $gallery->load();
  42.         $rss->title .= " - {$gallery->getTitle()}";
  43.     }
  44.  
  45.     $fisheye = new FisheyeImage();
  46.     $feeds = $fisheye->getList( $listHash );
  47.  
  48.     // set the rss link
  49.     $rss->link = 'http://'.$_SERVER['HTTP_HOST'].FISHEYE_PKG_URL;
  50.  
  51.     global $gBitSystem;
  52.     // get all the data ready for the feed creator
  53.     foreach( $feeds as $feed ) {
  54.         $item               = new FeedItem();
  55.         $item->title        = $feed['title'];
  56.         $item->link         = $feed['display_url'];
  57.         $item->description  = '<a href="'.$feed['display_url'].'"><img src="'.$feed['thumbnail_url'].'" /></a>';
  58.         $item->description .= '<p>'.$feed['data'].'</p>';
  59.  
  60.         $item->date         = ( int )$feed['last_modified'];
  61.         $item->source       = 'http://'.$_SERVER['HTTP_HOST'].BIT_ROOT_URL;
  62.         $item->author       = $gBitUser->getDisplayName( FALSE, $feed );
  63.  
  64.         $item->descriptionTruncSize = $gBitSystem->getConfig( 'rssfeed_truncate', 5000 );
  65.         $item->descriptionHtmlSyndicated = FALSE;
  66.  
  67.         // pass the item on to the rss feed creator
  68.         $rss->addItem( $item );
  69.     }
  70.  
  71.     // finally we are ready to serve the data
  72.     echo $rss->saveFeed( $rss_version_name, $cacheFile );
  73. }
  74. ?>

Documentation generated on Wed, 29 Jul 2015 13:56:35 +0000 by phpDocumentor 1.5.0-lsces