Просмотр файла forum/rss.php

Размер файла: 1.75Kb
  1. <?
  2.  
  3. include '../engine/includes/start.php';
  4. require_once('includes/functions.php');
  5. Core::get('text.class', 'classes');
  6.  
  7. if (!$topic){
  8. include H.'engine/includes/head.php';
  9. echo Core::msg_show('Отсутствует идентификатор темы!<br /><a href="index.php">Форум</a>');
  10. include H . 'engine/includes/foot.php';
  11. }
  12.  
  13. $sql->query("SELECT * FROM `forum_topics` WHERE `id` = '$topic' LIMIT 1 ");
  14.  
  15. if (!$sql->num_rows()){
  16. include H . 'engine/includes/head.php';
  17. echo Core::msg_show('Такой темы не существует!<br /><a href="index.php">Форум</a>');
  18. include H . 'engine/includes/foot.php';
  19. }
  20.  
  21. $topicRes = $sql->fetch();
  22.  
  23. header('content-type: application/rss+xml');
  24. echo '<?xml version="1.0" encoding="UTF-8"?>
  25. <rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel>
  26. <title>'.text::output($topicRes['name']).'</title>
  27. <link>'.$_SERVER['HTTP_HOST'].'</link>
  28. <description>'.$_SERVER['HTTP_HOST'].'-форум</description>
  29. <language>ru-RU</language> ';
  30.  
  31. $date = $sql->query("SELECT `time` FROM `forum_posts` WHERE `refid` = '$topic' ORDER BY `time` DESC LIMIT 1 ")->fetch();
  32.  
  33. $sql->query("SELECT `forum_posts`.*, `forum_posts`.`id` AS `pid`, `user`.`nick` FROM `forum_posts` LEFT JOIN `user` ON `forum_posts`.`user_id` = `user`.`id` WHERE `forum_posts`.`refid` = '$topic' ORDER BY `forum_posts`.`time` DESC LIMIT 10 ");
  34.  
  35.  
  36. echo '
  37. <item>
  38. <title>'.Core::time($date['time']).'</title>
  39. <link>/forum/index.php?topic='.$topic.'&amp;page=end</link>
  40. <description><![CDATA[';
  41.  
  42. while ($res = $sql->fetch()){
  43. echo '<b>'.$res['nick'].'</b> '.Core::time($res['time']).'<br />
  44. ' .text::output($res['text']).'<br />';
  45. }
  46. echo ']]></description><pubDate>'.Core::time($date['time']).'</pubDate>
  47. </item>';
  48.  
  49. echo '</channel></rss>';