View file forum/rss.php

File size: 3.45Kb
<?php
#-----------------------------------------------------#
#          ********* ROTORCMS *********               #
#              Made by  :  VANTUZ                     #
#               E-mail  :  [email protected]         #
#                 Site  :  http://pizdec.ru           #
#             WAP-Site  :  http://visavi.net          #
#                  ICQ  :  36-44-66                   #
#  Вы не имеете право вносить изменения в код скрипта #
#        для его дальнейшего распространения          #
#-----------------------------------------------------#	
require_once ('../includes/start.php');
require_once ('../includes/functions.php');
require_once ('../includes/header.php');
include_once ('../themes/' . $config['themes'] . '/index.php');

if (isset($_GET['tid'])) {
    $tid = abs(intval($_GET['tid']));
} else {
    $tid = 0;
} 

show_title('site.png', 'Сообщения форума');

$querytopic = DB :: $dbh -> query("SELECT * FROM `topics` WHERE `topics_id`=? LIMIT 1;", array($tid));
$topic = $querytopic -> fetch();

if (!empty($topic)) {
    ob_implicit_flush();
    ob_end_clean();
    ob_clean();
    header("Content-type:application/rss+xml; charset=utf-8");
    echo '<?xml version="1.0" encoding="utf-8"?>';
    echo '<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel>';
    echo '<title>Сообщения - ' . $topic['topics_title'] . '</title>';
    echo '<link>' . $config['home'] . '</link>';
    echo '<description>Сообщения RSS - ' . $config['title'] . '</description>';
    echo '<image><url>' . $config['logotip'] . '</url>';
    echo '<title>Сообщения - ' . $topic['topics_title'] . '</title>';
    echo '<link>' . $config['home'] . '</link></image>';
    echo '<language>ru</language>';
    echo '<copyright>' . $config['copy'] . '</copyright>';
    echo '<managingEditor>' . $config['emails'] . ' (' . $config['nickname'] . ')</managingEditor>';
    echo '<webMaster>' . $config['emails'] . ' (' . $config['nickname'] . ')</webMaster>';
    echo '<lastBuildDate>' . date("r", SITETIME) . '</lastBuildDate>';

    $querypost = DB :: $dbh -> query("SELECT * FROM `posts` WHERE `posts_topics_id`=? ORDER BY `posts_time` DESC LIMIT 15;", array($tid));

    while ($data = $querypost -> fetch()) {
        $data['posts_text'] = bb_code($data['posts_text']);
        $data['posts_text'] = str_replace('../images/smiles', $config['home'] . '/images/smiles', $data['posts_text']);
        $data['posts_text'] = htmlspecialchars($data['posts_text']);

        echo '<item><title>' . $topic['topics_title'] . '</title><link>' . $config['home'] . '/forum/topic.php?tid=' . $topic['topics_id'] . '</link>';
        echo '<description>' . $data['posts_text'] . ' </description><author>' . nickname($data['posts_user']) . '</author>';
        echo '<pubDate>' . date("r", $data['posts_time']) . '</pubDate><category>Комментарии</category><guid>' . $config['home'] . '/forum/topic.php?tid=' . $topic['topics_id'] . '&amp;pid=' . $data['posts_id'] . '</guid></item>';
    } 

    echo '</channel></rss>';
    ob_end_flush();
    exit;
} else {
    show_error('Ошибка! Выбранная вами тема не существует, возможно она была удалена!');
} 

echo '<img src="../images/img/reload.gif" alt="image" /> <a href="index.php?' . SID . '">К форумам</a>';

include_once ('../themes/' . $config['themes'] . '/foot.php');

?>