File: /var/www/ilya/data/www/afisha38.ru/modules/rss/index.inc
<?
define('DATE_FORMAT_RFC822','r');
header("Content-type: text/xml; charset=utf-8");
function replace_symbols($s)
{
$s = str_replace('&','&', $s);
$s = str_replace('<','<', $s);
$s = str_replace('>','>', $s);
$s = str_replace(''',"'", $s);
$s = str_replace(''',"'", $s);
return str_replace('"','"', $s);
}
$lastBuildDate=date(DATE_FORMAT_RFC822);
print "<?xml version=\"1.0\"?>\r"; ?>
<rss version="2.0">
<channel>
<title><? print SITE_TITLE; ?></title>
<link>http://<? print $url; ?></link>
<description>Обновления на сайте <? print $url; ?></description>
<pubDate><? print $lastBuildDate; ?></pubDate>
<lastBuildDate><? print $lastBuildDate; ?></lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<generator>CMS Termit</generator>
<image>
<title><? print SITE_TITLE; ?></title>
<url>http://<? print $url; ?>/i/logo_rss.gif</url>
<link>http://<? print $url; ?></link>
<width>219</width>
<height>95</height>
</image>
<language>ru</language>
<ttl>40</ttl>
<?
$result = query("SELECT * FROM `announces` ORDER BY `id` DESC LIMIT 50;");
if(mysql_num_rows($result)>0)
while($data=mysql_fetch_array($result)) {
print" <item>\r";
print" <title><![CDATA[".html_entity_decode($data['text'])."]]></title>\r";
print" <description><![CDATA[".html_entity_decode($data['text'])."]]></description>\r";
//print" <comments>".$data['url']."opinions/</comments>\r";
print" <pubDate>".date(DATE_FORMAT_RFC822, strtotime($data['datetime']))."</pubDate>\r";
//print" <guid isPermaLink=\"true\">".$data['url']."12</guid>\r";
print" <link>".$data['url']."</link>\r";
print" </item>\r";
}
?></channel>
</rss>