A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. if (!defined('entry')) {
  3. define('entry', true);
  4. }
  5. /* ===========================
  6. Sorbet CMS - A PHP based tumblelog CMS forked from Gelato CMS
  7. Sorbet CMS is a free software licensed under the GPL 3.0
  8. =========================== */
  9. ?>
  10. <?php
  11. require('entry.php');
  12. $trigger->call('feed_header');
  13. header("Content-type: text/xml; charset=utf-8");
  14. $isFeed = true;
  15. global $conf, $tumble;
  16. $util_class = new util();
  17. echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  18. ?>
  19. <rss version="2.0">
  20. <channel>
  21. <title><?php echo htmlspecialchars($conf->title);?></title>
  22. <link><?php echo $conf->urlSorbet;?></link>
  23. <description><?php echo htmlspecialchars($conf->description);?></description>
  24. <generator>Sorbet CMS <?php echo $util_class->codeName()." (".$util_class->version().")"; ?></generator>
  25. <image>
  26. <url><?php echo $conf->urlSorbet;?>/images/information.png</url>
  27. <title><?php echo htmlspecialchars($conf->description);?></title>
  28. <link><?php echo $conf->urlSorbet;?></link>
  29. </image>
  30. <?php
  31. $rs = $tumble->getPosts("20");
  32. if ($db->contarRegistros()>0) {
  33. while ($register = $rs->fetch()) {
  34. $register["description"] = $register["description"];
  35. switch ($register["type"]) {
  36. case "1":
  37. $tit = ($register["title"]=="") ? $register["description"] : $register["title"];
  38. $desc = $register["description"];
  39. break;
  40. case "2":
  41. $photoPath = str_replace("../", $conf->urlSorbet."/", $register["url"]);
  42. $tit = ($register["description"]=="") ? "Photo" : $register["description"];
  43. $desc = "<img src=\"".$photoPath."\"/>";
  44. break;
  45. case "3":
  46. $tit = "\"".$register["description"]."\"";
  47. $tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".$register["title"]."</em>" : "";
  48. $desc = "\"".$register["description"]."\"".$tmpStr;
  49. break;
  50. case "4":
  51. $tit = ($register["title"]=="") ? $register["url"] : $register["title"];
  52. $tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".$register["description"]."</em>" : "";
  53. $desc = "<a href=\"".$register["url"]."\">".$tit."</a>".$tmpStr;
  54. break;
  55. case "5":
  56. $lines = explode("\n", $register["description"]);
  57. $line = $lines[0];
  58. $tit = ($register["title"]=="") ? $line : $register["title"];
  59. $desc = $tumble->formatConversation($register["description"]);
  60. break;
  61. case "6":
  62. $tit = ($register["description"]=="") ? "Video" : $register["description"];
  63. $desc = $tumble->getVideoPlayer($register["url"]);
  64. break;
  65. case "7":
  66. $tit = ($register["description"]=="") ? "MP3" : $register["description"];
  67. $desc = $tumble->getMp3Player($register["url"]);
  68. break;
  69. }
  70. $tit = $util_class->trimString($tit);
  71. $strEnd = ($conf->urlFriendly) ? "/" : "";
  72. $url = $tumble->getPermalink($register["id_post"]);
  73. $formatedDate = gmdate("r", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime)); ?>
  74. <item>
  75. <title><?php echo $tit; ?></title>
  76. <description><![CDATA[<?php echo $desc; ?>]]></description>
  77. <link><?php echo $url; ?></link>
  78. <guid isPermaLink="true"><?php echo $url; ?></guid>
  79. <pubDate><?php echo $formatedDate; ?></pubDate>
  80. </item>
  81. <?php
  82. }
  83. }
  84. ?>
  85. </channel>
  86. </rss>