| 33 |
*/ |
*/ |
| 34 |
function feedFrontpage( $showFeed ) { |
function feedFrontpage( $showFeed ) { |
| 35 |
global $database, $mainframe; |
global $database, $mainframe; |
| 36 |
global $mosConfig_live_site, $mosConfig_offset, $mosConfig_sef, $mosConfig_absolute_path; |
global $mosConfig_live_site, $mosConfig_offset, $mosConfig_absolute_path; |
| 37 |
|
|
| 38 |
// pull id of syndication component |
// pull id of syndication component |
| 39 |
$query = "SELECT a.id" |
$query = "SELECT a.id" |
| 40 |
. "\n FROM #__components AS a" |
. "\n FROM #__components AS a" |
| 41 |
. "\n WHERE a.name = 'Syndicate'" |
. "\n WHERE a.name = 'Syndicate'" |
| 42 |
; |
; |
| 43 |
$database->setQuery( $query ); |
$components = $database->doSQLget( $query, 'mosComponent' ); |
| 44 |
$id = $database->loadResult(); |
if (isset($components[0])) $component = $components[0]; |
| 45 |
|
else return; |
| 46 |
|
|
| 47 |
// load syndication parameters |
// load syndication parameters |
|
$component = new mosComponent( $database ); |
|
|
$component->load( $id ); |
|
| 48 |
$params =& new mosParameters( $component->params ); |
$params =& new mosParameters( $component->params ); |
| 49 |
|
|
| 50 |
|
$query = "SELECT id FROM #__modules WHERE published=1 AND module='mod_rssfeed'"; |
| 51 |
|
$database->setQuery($query); |
| 52 |
|
if (!$database->loadResult()) { |
| 53 |
|
mosNotAuth(); |
| 54 |
|
return; |
| 55 |
|
} |
| 56 |
|
|
| 57 |
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
$now = date( 'Y-m-d H:i:s', time() + $mosConfig_offset * 60 * 60 ); |
| 58 |
$iso = split( '=', _ISO ); |
$iso = split( '=', _ISO ); |
| 59 |
|
|
| 96 |
} |
} |
| 97 |
} else { |
} else { |
| 98 |
// set filename for rss feeds |
// set filename for rss feeds |
| 99 |
$info[ 'file' ] = strtolower( str_replace( '.', '', $info[ 'feed' ] ) ); |
$info[ 'file' ] = getFeedType( $info[ 'feed' ] ); |
| 100 |
$info[ 'file' ] = $mosConfig_absolute_path .'/cache/'. $info[ 'file' ] .'.xml'; |
if (!$info['file']) return; |
| 101 |
} |
} |
| 102 |
|
|
| 103 |
// load feed creator class |
// load feed creator class |
| 126 |
$rss->image = $image; |
$rss->image = $image; |
| 127 |
} |
} |
| 128 |
|
|
|
/* |
|
|
testing to extend Syndication capabilities |
|
|
$join = ''; |
|
|
$_and = ''; |
|
|
$content = $info['content']; |
|
|
switch ( $info['content' ] ) { |
|
|
case 0: |
|
|
$_and = "\n AND a.sectionid != '0'"; |
|
|
$orderby = 'a.sectionid, a.ordering'; |
|
|
break; |
|
|
|
|
|
case -1: |
|
|
$join = "\n INNER JOIN #__content_frontpage AS f ON f.content_id = a.id"; |
|
|
$orderby = 'f.ordering'; |
|
|
break; |
|
|
|
|
|
default: |
|
|
$_and = "\n AND a.sectionid = '$content'"; |
|
|
$_and .= "\n AND a.sectionid != '0'"; |
|
|
$orderby = 'a.ordering'; |
|
|
break; |
|
|
} |
|
|
*/ |
|
| 129 |
// Determine ordering for sql |
// Determine ordering for sql |
| 130 |
switch ( strtolower( $info[ 'orderby' ] ) ) { |
switch ( strtolower( $info[ 'orderby' ] ) ) { |
| 131 |
case 'date': |
case 'date': |
| 228 |
// save feed file |
// save feed file |
| 229 |
$rss->saveFeed( $info[ 'feed' ], $info[ 'file' ], $showFeed ); |
$rss->saveFeed( $info[ 'feed' ], $info[ 'file' ], $showFeed ); |
| 230 |
} |
} |
| 231 |
|
|
| 232 |
|
function getFeedType ($rawfeed) { |
| 233 |
|
global $mosConfig_absolute_path; |
| 234 |
|
$feed = mosGetParam ($_GET, 'feed', 'RSS2.0'); |
| 235 |
|
$feed = strtolower(str_replace('.', '', $feed)); |
| 236 |
|
$legal = array ('rss20', 'rss10', 'rss091', 'atom03', 'opml'); |
| 237 |
|
if (in_array($feed, $legal)) return $mosConfig_absolute_path.'/cache/'.$feed.'.xml'; |
| 238 |
|
else { |
| 239 |
|
mosNotAuth(); |
| 240 |
|
return ''; |
| 241 |
|
} |
| 242 |
|
} |
| 243 |
|
|
| 244 |
?> |
?> |