<?

header('Content-type: application/xml');

#
# SETTING
include $_SERVER['DOCUMENT_ROOT'].'/_functions/functions_mysql.php';
include $_SERVER['DOCUMENT_ROOT'].'/_functions/functions_site.php';
include $_SERVER['DOCUMENT_ROOT'].'/_config/constants.php';
include $_SERVER['DOCUMENT_ROOT'].'/_vedisite/vedisite/vedisite_constants.php';
# SETTING
#

print '<?xml version="1.0" encoding="windows-1251"?>';

?>
<rss version="2.0">
 <channel>
  <title>������ �������� ������</title>
  <link>http://www.rusathletics.com/</link>
  <description>������� ���������� � ������� ������ ��������</description>
  <image>
   <url>http://www.rusathletics.com/im/logo_100100.gif</url>
   <title>������ �������� ������</title>
   <link>http://www.rusathletics.com/</link>
  </image><?

$result = mysql_query('
SELECT DISTINCT t.id, t.rname, t.xzab, t.xtxt, t.xhref, t.xphoto, DATE_FORMAT(t.xcreated, \'%a, %d %b %Y %H:%i:%s +0300\') AS fxcreated  
FROM '.DB_PRE.'news t, '.DB_PRE.'news_links l 
WHERE t.id>0 AND t.xparent=0 AND t.xhistory=0 AND t.xl_4_4=5 AND t.xshow=0 AND t.id=l.tid AND l.xshow=0 AND l.xl_4_10 IN (12, 14, 15, 18)
ORDER BY t.xdate DESC, t.xorder DESC, t.id DESC 
LIMIT 20
');

while ( $row = mysql_fetch_assoc($result) ) {

$row['xzab'] = trim($row['xzab']);
$row['xphoto'] = rawurldecode( $row['xphoto'] );

print '
<item>+
 <title>'.trim(html_entity_decode(strip_tags($row['rname']))).'</title>
 <link>http://www.rusathletics.com/nov/news.'.$row['id'].'.htm</link>
 <description><![CDATA['.$row['xzab'].']]></description>
 <category>�������</category>
 <pubDate>'.$row['fxcreated'].'</pubDate>
 <xphoto>_'.$row['xphoto'].'_</xphoto>
 <fulltext><![CDATA['.$row['xzab'].'<br /><br />
'.trim($row['xtxt']).']]></fulltext>';

$length = filesize($_SERVER['DOCUMENT_ROOT'].str_replace('http://'.$_SERVER['HTTP_HOST'], '', $row['xphoto'])); 
if ( $length > 0 ) { print '
 <enclosure url="http://'.$_SERVER['HTTP_HOST'].str_replace('http://'.$_SERVER['HTTP_HOST'], '', $row['xphoto']).'" length="'.$length.'" type="image/jpeg" />'; }

print '
</item>';

}

mysql_free_result($result);

?>

</channel>
</rss>