<?php
header("Content-type: application/xhtml+xml");
echo '<?xml version="1.0" ?><?xml-stylesheet href="includes/css/rss2full.xsl" type="text/xsl" media="screen"?><?xml-stylesheet href="includes/css/itemcontent.css" type="text/css" media="screen"?>' . "\n";
echo '<rss version="2.0">' . "\n";
echo '<channel>' . "\n";
echo '<title>UTOPY: News and Press Releases</title>' . "\n";
echo '<link>http://www.utopy.com/</link>' . "\n";
echo '<description></description>' . "\n";
echo '<language>en-us</language>' . "\n";
echo '<docs>http://backend.userland.com/rss</docs>' . "\n";
echo '<lastBuildDate>' . date("D, d M Y h:i:s T") . '</lastBuildDate>' . "\n";

// DB Info
include ("config.php");

// Make a MySQL Connection
mysql_connect($config['db_hostname'], $config['db_username'], $config['db_password']) or die(mysql_error());
mysql_select_db($config['db_name']) or die(mysql_error());

// Get all the data from the "news" table
//$result = mysql_query("SELECT * FROM cms_module_news WHERE news_category_id = '2' ORDER BY news_id DESC") 
//or die(mysql_error());

$result = mysql_query("SELECT * FROM cms_module_news ORDER BY news_id DESC") 
or die(mysql_error());

while($row = mysql_fetch_array($result)) {

	// Print out the content
	echo "\n";
	echo '<item>' . "\n";
	$curr_title = htmlentities($row['news_title'], ENT_NOQUOTES);
	echo '<title>' . htmlentities($curr_title, ENT_NOQUOTES) . '</title>' . "\n";
	echo '<description>' . htmlentities($row['news_data'], ENT_NOQUOTES) . '</description>' . "\n";
	echo '<link>' . 'http://utopy.clients.edeninteractive.com/index.php?mact=News,cntnt01,detail,0&amp;cntnt01articleid=' . $row['news_id'] . '&amp;cntnt01returnid=124' . '</link>' . "\n";
	echo '<guid>' . 'http://utopy.clients.edeninteractive.com/index.php?mact=News,cntnt01,detail,0&amp;cntnt01articleid=' . $row['news_id'] . '&amp;cntnt01returnid=124' . '</guid>' . "\n";
	echo '<pubDate>' . date("D, d M Y h:i:s T", strtotime($row['create_date'])) . '</pubDate>' .  "\n";
	echo '</item>' . "\n";
	echo "\n";

} // while

echo '</channel>' . "\n";
echo '</rss>' . "\n";

?>
