<?php
header ('Content-Type: text/xml');
require 'config_rss.php';
print '<?xml version="1.0" encoding="windows-1251"?>
<rss version="2.0">
<channel>
	<title>Форум Тушинского Хомяка</title>
	<link>'.$path_refer.'index.php?link=forum</link>
	<description><![CDATA[]]></description>
	<language>ru</language>
	<pubDate>'.rss_time($date_action,1).'</pubDate>
	<generator>Helena</generator>
	<ttl>1</ttl>';
$q = "SELECT id,id_user,text,date_action,id_tema FROM forum_text2 WHERE date_action > '".$date_rss."' && moder = 0 && show_section != 2 && show_clan = 0 ORDER BY date_action desc";
if ($result = $db->sql_query($q))
{
 while ($row = $db->sql_fetchrow($result))
 {
    @$id_forum     = $row['id'];
    @$text_forum   = substr($row['text'],0,200);
    @$tema_forum   = $row['id_tema'];
    @$name_forum   = user_info("nik","WHERE id = '".$row['id_user']."'");
    @$date_forum   = rss_time($row['date_action'],1);

    @$head_forum      = forum_tema("name","WHERE id = '".$tema_forum."'");
    @$id_name_forum   = forum_tema("id_name","WHERE id = '".$tema_forum."'");
    @$count_mes_forum = forum_tema("count_mes","WHERE id = '".$tema_forum."'");

 if (forum_text("id","WHERE status = 1 && id_tema = '".$tema_forum."'") > 0){
    $number_page  = @ceil(($count_mes_forum-1)/$FORUM['page_text']);
 } else {
    $number_page  = @ceil($count_mes_forum/$FORUM['page_text']);
 }

 if (user_info($nik2,'order_mod','nik') == 2 or $number_page == ''){
    $number_page   = 1;
 }

print '
<item>
<title>'.$head_forum.'</title>
<link>'.$path_refer.'index?link=forum&amp;f='.$id_name_forum.'&amp;t='.$tema_forum.'&amp;page='.$number_page.'#'.$id_forum.'</link>
<pubDate>'.$date_forum.'</pubDate>
<description><![CDATA['.$text_forum.' ...]]></description>
<category domain="'.$path_refer.'index?link=forum&amp;f='.$id_name_forum.'&amp;t='.$tema_forum.'&amp;page='.$number_page.'#'.$id_forum.'"><![CDATA['.$head_forum.']]></category>
<author><![CDATA['.$name_forum.']]></author>
<guid isPermaLink="false">'.$path_refer.'index?link=forum&amp;f='.$id_name_forum.'&amp;t='.$tema_forum.'&amp;page='.$number_page.'#'.$id_forum.'</guid>
</item>';
 }
}
print '</channel>
</rss>';
?>
