Файл: CMS/core/modules/forum_rss.php
Строк: 139
<?php
if (!defined('CMS')) { die('Access Denied!'); }
error_reporting(0); // на всякий
$topic = $db->selectRow( "SELECT * FROM ?_forums_topics WHERE `topics_id` = ? LIMIT 1;", $id );
if ( empty($topic) || !is_array($topic) ) {
$inSes->addMessage('Ошибка! Выбранная вами тема не существует, возможно она была удалена!');
gen_red('index', '', RND);
}
if ( $config['rss_format'] != 2 ) {
$rss_content = <<<XML
<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
<channel>
<title>RSS лента сообщений форума {$config['site_name']}</title>
<link>{$config['site_url']}/forum/index.html</link>
<language>ru</language>
<description>RSS лента сообщений форума {$config['site_name']}</description>
<generator>{$config['site_name']}</generator>
XML;
} else {
$rss_content = <<<XML
<?xml version="1.0" encoding="{$config['charset']}"?>
<rss version="2.0" xmlns="http://backend.userland.com/rss2" xmlns:yandex="http://news.yandex.ru">
<channel>
<title>RSS лента сообщений форума {$config['site_name']}</title>
<link>{$config['site_url']}/forum/index.html</link>
<language>ru</language>
<description>RSS лента сообщений форума {$config['site_name']}</description>
<image>
<url>{$config['site_url']}/images/yandexlogo.gif</url>
<title>RSS лента сообщений форума {$config['site_name']}</title>
<link>{$config['site_url']}/fotum/index.html</link>
</image>
<generator>{$config['site_name']}</generator>
XML;
}
if (!empty($config['allow_offline']) || !$config['allow_rss'] ) {
$rss_content .= <<<XML
<item>
<title>RSS in offline mode</title>
<guid isPermaLink="true"></guid>
<link></link>
<description>RSS in offline mode</description>
<category>undefined</category>
<dc:creator>{$config['site_name']}</dc:creator>
<pubDate>{$config['site_name']}</pubDate>
</item>
XML;
} else {
$rows = $db->select( "SELECT * FROM ?_forums_posts WHERE `posts_topics_id` = ?
ORDER BY `posts_time` DESC LIMIT 0, ?d", $id, $config['rss_num'] );
$rss_link = $config['site_url'] . '/forum/' . gen_uri('topic', $topic['topics_id'], RND);
foreach( $rows as $row ) {
$row['posts_text'] = nl2br(bb_code($row['posts_text']));
$row['posts_text'] = str_replace('../images/smiles', $config['site_url'] . '/images/smiles', $row['posts_text']);
$row['posts_text'] = htmlspecialchars($row['posts_text']);
$rss_date = date('r', $row['posts_time']);
if ( $config['rss_format'] == 1 ) {
$rss_content .= <<<XML
<item>
<title>{$topic['topics_title']}</title>
<guid isPermaLink="true">{$rss_link}</guid>
<link>{$rss_link}</link>
<description>{$row['posts_text']}</description>
<category>Комментарии</category>
<dc:creator>{$row['posts_user']}</dc:creator>
<pubDate>{$rss_date}</pubDate>
</item>
XML;
} else if ( $config['rss_format'] == 2 ) {
$rss_content .= <<<XML
<item>
<title>{$topic['topics_title']}</title>
<link>{$rss_link}</link>
<description>{$row['posts_text']}</description>
<category>Комментарии</category>
<author>{$row['posts_user']}</author>
<pubDate>{$rss_date}</pubDate>
<yandex:full-text>{$row['posts_text']}</yandex:full-text>
</item>
XML;
} else {
$rss_content .= <<<XML
<item>
<title>{$topic['topics_title']}</title>
<guid isPermaLink="true">{$rss_link}</guid>
<link>{$rss_link}</link>
<description>{$row['posts_text']}</description>
<category>Комментарии</category>
<dc:creator>{$row['posts_user']}</dc:creator>
<pubDate>{$rss_date}</pubDate>
</item>
XML;
}
}
}
$rss_content .= <<<XML
</channel></rss>
XML;
header( 'Content-type: application/xml' );
echo $rss_content;
exit;
?>