diff options
| author | Max Kremmel <xing@synapse.plus.com> | 2007-03-31 15:54:14 +0000 |
|---|---|---|
| committer | Max Kremmel <xing@synapse.plus.com> | 2007-03-31 15:54:14 +0000 |
| commit | 65a6ecbd758c331a851ae5ac12abed135abe0334 (patch) | |
| tree | 0e2741a679966a1a711580ac50290bf09b17bb24 /boards_rss.php | |
| parent | 9806e9356f7ee3793510747d52313bd79eff0f7e (diff) | |
| download | boards-65a6ecbd758c331a851ae5ac12abed135abe0334.tar.gz boards-65a6ecbd758c331a851ae5ac12abed135abe0334.tar.bz2 boards-65a6ecbd758c331a851ae5ac12abed135abe0334.zip | |
rename bitboards to boards
Diffstat (limited to 'boards_rss.php')
| -rw-r--r-- | boards_rss.php | 98 |
1 files changed, 98 insertions, 0 deletions
diff --git a/boards_rss.php b/boards_rss.php new file mode 100644 index 0000000..f2fdb61 --- /dev/null +++ b/boards_rss.php @@ -0,0 +1,98 @@ +<?php +/** + * @version $Header: /cvsroot/bitweaver/_bit_boards/boards_rss.php,v 1.1 2007/03/31 15:54:13 squareing Exp $ + * @package boards + * @subpackage functions + */ + +/** + * Initialization + */ +require_once( "../bit_setup_inc.php" ); +require_once( RSS_PKG_PATH."rss_inc.php" ); +require_once( BOARDS_PKG_PATH."BitBoard.php" ); +require_once( BOARDS_PKG_PATH."BitBoardTopic.php" ); + +$gBitSystem->verifyPackage( 'boards' ); +$gBitSystem->verifyPackage( 'rss' ); + +if(!empty($_REQUEST['u'])) { + $gBitUser->login($_REQUEST['u'],$_REQUEST['p']); +} + +$board = new BitBoard($_REQUEST['b']); +$board->load(); +$board->parseData(); + +$rss->title = $board->getField( 'title' )." Feed"; +if ($gBitUser->isRegistered()) { + $rss->title = $rss->title. " (".$gBitUser->getDisplayName().")"; +} + +$rss->description = $board->getField( 'parsed_data' ); +$rss->link = 'http://'.$_SERVER['HTTP_HOST'].$board->getDisplayUrl(); + +// check if we want to use the cache file +$cacheFile = TEMP_PKG_PATH.RSS_PKG_NAME.'/'.BOARDS_PKG_NAME.'_'.$version.'.xml'; +$rss->useCached( $rss_version_name, $cacheFile, $gBitSystem->getConfig( 'rssfeed_cache_time' )); + +$topic = new BitBoardTopic(); +$pParamHash = array(); +$pParamHash['b'] =$_REQUEST['b']; +$pParamHash['find'] =''; +//TODO allow proper sort order +$pParamHash['sort_mode'] = "llc_last_modified_desc"; +$max_records = $gBitSystem->getConfig( 'boards_rss_max_records', 10 ); +$pParamHash['offset'] = 0; +$feeds = $topic->getList( $pParamHash ); + +// get all the data ready for the feed creator +foreach( $feeds as $feed ) { + /* + echo "<pre>"; + var_dump($feed); + //*/ + $item = new FeedItem(); + $item->title = $feed['title']; + if ($gBitUser->isRegistered()) { + if (!empty($feed['track']['on'])&&$feed['track']['mod']) { + $item->title = "[NEW] " .$item->title; + } + } + if( !empty( $feed['th_sticky'] ) ) { + $item->title = "[!] " .$item->title; + } + if( !empty( $feed['th_locked'] ) ) { + $item->title = "[#] " .$item->title; + } + $item->link = 'http://'.$_SERVER['HTTP_HOST'].$feed['url']; + $data = BitBoard::getBoard($feed['llc_content_id']); + + $item->description = $data['data']; + + //TODO allow proper sort order + //$item->date = ( int )$feed['event_date']; + + $item->date = ( int )$feed['llc_last_modified']; + $item->source = 'http://'.$_SERVER['HTTP_HOST'].BIT_ROOT_URL; + + $user = new BitUser($feed['llc_user_id']); + $user->load(); + + $item->author = $user->getDisplayName();//$gBitUser->getDisplayName( FALSE, array( 'user_id' => $feed['modifier_user_id'] ) ); + $item->authorEmail = $user->mInfo['email']; + + $item->descriptionTruncSize = $gBitSystem->getConfig( 'rssfeed_truncate', 1000 ); + $item->descriptionHtmlSyndicated = FALSE; + /* + var_dump($item); + echo "</pre>"; + die(); + //*/ + // 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 ); +?> |
