<?php

$site= $apt->getsettings("sitetitle");
$url = $apt->getsettings("siteURL");
if(substr($url,-1) != '/'){
$url = $url . '/';
}

$cid  = intval($_GET[cat]);
$XML_limit = "10";	// عدد المواد


function xmlentities($string){
 	return str_replace ( array ( '&', '"', "'", '<', '>', '\x92' ), array ( '&amp;' , '&quot;', '&apos;' , '&lt;' , '&gt;', '&apos;' ), $string );
}

header('Content-Type: text/xml');
echo '<?xml version="1.0" encoding="windows-1256"?>'. "\r\n";
echo '<rss version="0.91">'."\r\n";
echo "<channel>\r\n";
echo "\t\t<title>".xmlentities($site)."</title>\r\n";
echo "\t\t<link>$url</link>\r\n";
echo "\t\t<description>".xmlentities("بإعتماد مجلة البوابة العربية")."</description>\r\n";

if($cid == 0)$cond = ""; else $cond = " and cat_id='$cid' ";
$result = mysql_query ("SELECT id,title,news_head FROM rafia_news
   	                             WHERE allow='yes' $cond
       	                         ORDER BY id DESC limit $XML_limit");

while ($row = mysql_fetch_array($result))
{
	$id 		= $row['id']; 
	$title 	= xmlentities($row['title']); 
	$description 	= xmlentities($row['news_head']); 
	$thelink 	= xmlentities($url."news.php?action=view&id=$id");
	
	echo "\t<item>\r\n";
	echo "\t\t<title>$title</title>\r\n";
	echo "\t\t<link>$thelink</link>\r\n";
	echo "\t\t<description>$description</description>\r\n";
	echo "\t</item>\r\n";
}
echo "</channel>\r\n";
echo "</rss>";
exit();
?>