PHP Code:
<?PHP
/**
* /includes/rssfunctions.php
*
* The title of this file is misleading, as there are currently no functions contained here. Instead, this file outputs an RSS 2.0 feed of the AMCMS_articles table, and nothing more.
* @package /includes/rssfunctions.php
* @author Agares Media <sales@agaresmedia.com>
* @copyright Copyright (c) 2007, Agares Media. All rights reserved.
*/
require_once('./register_globals.php');
if ($RSSon == 1) {
$sql = 'SELECT primkey FROM AMCMS_games;';
$numofarticles = am_countrecords($db, $sql);
if ($numofarticles < $RSSnum) {$RSSnum = $numofarticles;}
header("Content-type: application/xml");
echo '<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom">
<channel>
<title>'.$sitetitle.'</title>
<link>http://' . $_SERVER['HTTP_HOST']. '</link>
<description>'.$metadesc.'</description>
<language>en-us</language>
<pubDate>'.date("r").'</pubDate>
<lastBuildDate>'.date("r").'</lastBuildDate>
<docs>http://' . $_SERVER['HTTP_HOST']. '/rss.php</docs>
<generator>AgaresWriter 2.1</generator>
<atom:link href="http://www.yoursite.com/rss.php" rel="self" type="application/rss+xml" />';
$pathtofile = 'http://' . $_SERVER['HTTP_HOST']. str_replace('rss.php','',$_SERVER['PHP_SELF']);
$icounter = 0;
$res = am_queries($db, " SELECT * FROM `AMCMS_games` ORDER BY primkey DESC LIMIT 0 , $RSSnum;");
while ($icounter < $RSSnum) {
if ($RSSdetail == 1) {$res[$icounter][2] = substr($res[$icounter][2], 0, 768);}
echo ' <item>
<title>'.$res[$icounter][1].'</title>';
if ($SEOFriendlyURLs == 1) {
$rplce = array("!", "@", "#", "$", "%", "^", "&", "*", "(", ")", "~", "`", "=", "+", "\\", "'", "\"", "|", ":", ";", "?", ".", ",", "/", "[", "{", "]", "}");
$newpageurl = str_replace(" ", "-", strip_tags(trim(str_replace($rplce, "", $res[$icounter][1])))) ;
echo '<guid isPermaLink="true">'.$pathtofile.''.$res[$icounter][0].'-'.$newpageurl.'.html</guid>';
} else {
echo '<guid isPermaLink="true">'.$pathtofile.'playgame/'.$res[$icounter][0].'-'.$newpageurl.'.html</guid>';
}
echo'<description><![CDATA['.strip_tags(htmlspecialchars_decode($res[$icounter][2])).'
]]></description>
<content:encoded><![CDATA['.htmlspecialchars_decode($res[$icounter][2]).'
]]></content:encoded>
<pubDate>'.date("r").'</pubDate>
</item>
';
$icounter++;
}
echo '</channel>
</rss>';
} else {
echo 'RSS feeds are disabled on this site.';
}
?>
Thanks