<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `news2` LIMIT 1",$db), 0)==0)exit;
header("Content-type: application/rss+xml");
echo "<rss version=\"2.0\"><channel><title>Новости ".$_SERVER['SERVER_NAME']."</title>";
echo "<link>http://".$_SERVER['SERVER_NAME']."</link>";
echo "<description>Новости ".$_SERVER['SERVER_NAME']."</description>";
echo "<language>ru-RU</language><lastBuildDate>".date("r",mysql_result(mysql_query("SELECT MAX(time) FROM `news2`",$db), 0))."</lastBuildDate>";
$q=mysql_query("SELECT * FROM `news2` ORDER BY `id` DESC LIMIT $set[p_str]");
while ($post = mysql_fetch_assoc($q)){
echo "<item><title>$post[title]</title>";
if ($post['link']!=NULL){
if (!preg_match('#^https?://#',$post['link']))
echo "<link>".htmlentities("http://$_SERVER[SERVER_NAME]$post[link]", ENT_QUOTES, 'UTF-8')."</link>";
else echo "<link>".htmlentities("$post[link]", ENT_QUOTES, 'UTF-8')."</link>";}
echo "<description><![CDATA[";
echo output_text($post['msg'],true,true,false)."";
echo "]]></description><pubDate>".date("r",$post['time'])."</pubDate></item>";}
echo "</channel></rss>";
?>