A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.8KB

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