<?
include 'db.php';
include 'functions.php';
$db = new db();

// Latest Submissions
$latest_submissions = $db->fetch("(SELECT id,title,description,run_date,views,'pictures' as ctype,insert_time FROM content_pictures WHERE run_date<=CURDATE()) UNION ALL(SELECT id,title,description,run_date,views,'games' as ctype,insert_time FROM content_games WHERE run_date<=CURDATE()) UNION ALL (SELECT id,title,description,run_date,views,'videos' as ctype,insert_time FROM content_videos WHERE run_date<=CURDATE()) UNION ALL (SELECT id,title,description,run_date,views,'evideos' as ctype,insert_time FROM content_evideos WHERE run_date<=CURDATE()) ORDER BY run_date DESC LIMIT 25");
header("Content-Type: application/xml; charset=ISO-8859-1");
?>
<? echo "<?xml version=\"1.0\"?>"; ?>
<rss version="2.0">
  <channel>
    <title>Neenja - Daily Entertaining Media</title>
    <link>http://www.neenja.com/</link>
    <description>Daily Media Entertainment</description>
    <language>en-us</language>
    <webMaster>webmaster@neenja.com</webMaster>
<?
foreach($latest_submissions as $submission) {
	echo "<item>\n";
	echo "<title>" . htmlentities($submission["title"]) . "</title>\n";
	echo "<link>http://www.neenja.com" . titleToUrl($submission["title"], $submission["ctype"], $submission["id"]) . "</link>\n";
	echo "<description>" . $submission["description"] . "</description>\n";
	echo "<image><url>http://www.neenja.com/content/thumbs/" . $submission["ctype"] . "/" . $submission["id"] . ".gif</url></image>\n";
	echo "<pubDate>" . $submission["run_date"] . "</pubDate>\n";
	echo "</item>\n";
}
?>
  </channel>
</rss>