Created
September 23, 2009 05:38
-
-
Save dennyhalim/191751 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?PHP | |
require_once("./includes/corefunctions.php"); | |
// Load the AMCMS3 functions^M | |
require_once("./includes/db.php"); | |
// Get the database configuration settings & connect to DB.^M | |
require_once("./includes/config.php"); | |
// Load the admin's preferences | |
/** | |
* /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 <[email protected]> | |
* @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:media="http://search.yahoo.com/mrss/" | |
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']. '/rssgames.php</docs> | |
<generator>AgaresWriter 2.1</generator> | |
<atom:link href="http://' . $_SERVER['HTTP_HOST']. '/rssgames.php" rel="self" type="application/rss+xml" />'; | |
$pathtofile = 'http://' . $_SERVER['HTTP_HOST']. str_replace('rssgames.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.'flash-arcade-game.php?gameid='.$res[$icounter][0].'</guid>'; | |
} | |
echo'<description><![CDATA[<img src="'.$pathtofile.'arcade/img/'.$res[$icounter][14].'" /><br />'.strip_tags(htmlspecialchars_decode($res[$icounter][2])).' | |
]]></description> | |
<content:encoded><![CDATA[<img src="'.$pathtofile.'arcade/img/'.$res[$icounter][14].'" /><br />'.htmlspecialchars_decode($res[$icounter][2]).' | |
]]></content:encoded> | |
<pubDate>'.date("r").'</pubDate> | |
<media:thumbnail url="'.$pathtofile.'arcade/img/'.$res[$icounter][14].'" /> | |
<enclosure url="'.$pathtofile.'arcade/img/'.$res[$icounter][14].'" type="image/jpeg" /> | |
</item> | |
'; | |
$icounter++; | |
} | |
echo '</channel> | |
</rss>'; | |
} else { | |
echo 'RSS feeds are disabled on this site.'; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment