<?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=library</link>
	<description><![CDATA[]]></description>
	<language>ru</language>
	<pubDate>'.rss_time($date_action,1).'</pubDate>
	<generator>Helena</generator>
	<ttl>1</ttl>';
$q = "SELECT id,text,head,name,date,anonce FROM news WHERE date > '".$date_rss."' && moder = 0 && show_section != 2 && show_clan = 0 ORDER BY date desc";
if ($result = $db->sql_query($q))
{
 while ($row = $db->sql_fetchrow($result))
 {
    @$id_library     = $row['id'];
    @$text_library   = substr($row['text'],0,200);
    @$anonce_library = $row['anonce'];
    @$head_library   = $row['head'];
    @$name_library   = $row['name'];
    @$date_library   = rss_time($row['date'],1);

      if (strlen($anonce_library) > 5){
         $description_library = $anonce_library;
      } else {
         $description_library = $text_library;
      }

print '<item>
		<title>'.$head_library.'</title>
		<link>'.$path_refer.'index.php?news_read='.$id_library.'</link>
		<pubDate>'.$date_library.'</pubDate>
		<description><![CDATA['.$description_library.' ...]]></description>
		<category domain="'.$path_refer.'index.php?news_read='.$id_library.'"><![CDATA['.$head_library.']]></category>
		<author><![CDATA['.$name_library.']]></author>
		<guid isPermaLink="false">'.$path_refer.'index.php?news_read='.$id_library.'</guid>
	</item>';
 }
}
print '</channel>
</rss>';
?>
