<?php 
header('Content-type: text/xml'); 

include('../functions/config.php');
include('../functions/top.php');
include('../functions/functions.php');
include('../class/mediacentre.php');
$_GET['type']=isset($_GET['type'])?$_GET['type']:'news';


$web_root = $_SERVER['SERVER_NAME'].$_SERVER['PHP_SELF'];
$web_root = str_replace("/rss/mediacentre.xml", "", $web_root);
$web_root = "http://$web_root";
?>
<rss version="2.0">
<channel>
<title><?php echo SITE_TITLE ?></title>
<description></description>
<link><?php echo $web_root ?></link>
<?php
$q="SELECT id,type,url,title,description,content,lastUpdated FROM mediacentre WHERE type=".qs($_GET['type'])." AND state=1 ORDER BY lastUpdated DESC LIMIT 0,15";
$req=mysql_query($q);
while($data = mysql_fetch_assoc($req))
{
	$i=new mediacentre($data);		
	echo'
		 <item>
			<title>'.$i->title.'</title>
			<description> '.$i->description.'</description>
			<link>'.$web_root.'/'.$i->link.'</link>
			<guid>'.$web_root.'/'.$i->link.'</guid>
			<pubDate>'. strftime( "%a, %d %b %Y %T %Z" , $i->lastUpdated).'</pubDate>
		 </item>  
	';
} 
?> 



</channel>
</rss>