<?

include_once "../SYSTEM/include/functions.php";

include_once "../SYSTEM/include/mysql.php";

include_once "../SYSTEM/include/param.php";

include_once "../SYSTEM/include/sess.php";

include_once "../SYSTEM/include/theme.php";


if (mysql_result(mysql_query("SELECT COUNT(*) FROM `$mysql[pref]news` LIMIT 1",$db), 0)==0)exit;


header("Content-type: application/rss+xml");

echo "<rss version=\"2.0\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";

echo "<channel>\n";

echo "<title>$set[title]</title>\n";

echo "<link>http://".$_SERVER['SERVER_NAME']."</link>\n";

echo "<description>Новости $set[title]</description>\n";

echo "<language>ru-RU</language>\n";

echo "<webMaster>$set[mail]</webMaster>";

echo "<lastBuildDate>".date("r",mysql_result(mysql_query("SELECT MAX(time) FROM `$mysql[pref]news`",$db), 0))."</lastBuildDate>\n";



$q=mysql_query("SELECT * FROM `$mysql[pref]news` ORDER BY id DESC LIMIT $set[k_p_s];");


while ($post = mysql_fetch_array($q))

{

echo "<item>\n";

echo "<title>$post[title]</title>\n";

echo "<link>http://".$_SERVER['SERVER_NAME']."/news/index.php</link>\n";


echo "<description>\n";

echo trim(bbcode(links(stripcslashes(htmlspecialchars($post[text])))))\n";

echo "</description>\n";

echo "<pubDate>".date("r",$post['time'])."</pubDate>\n";


echo "</item>\n";

}


echo "</channel>\n";

echo "</rss>\n";

?>

