A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. <?php
  2. if(!defined('entry')) define('entry',true);
  3. /* ===========================
  4. gelato CMS - A PHP based tumblelog CMS
  5. development version
  6. http://www.gelatocms.com/
  7. gelato CMS is a free software licensed under the GPL 2.0
  8. Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
  9. =========================== */
  10. ?>
  11. <?php
  12. require('entry.php');
  13. $trigger->call('feed_header');
  14. header("Content-type: text/xml; charset=utf-8");
  15. $isFeed = true;
  16. global $conf, $tumble;
  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->urlGelato;?></link>
  23. <description><?php echo htmlspecialchars($conf->description);?></description>
  24. <generator>gelato CMS <?php echo util::codeName()." (".util::version().")"; ?></generator>
  25. <image>
  26. <url><?php echo $conf->urlGelato;?>/images/information.png</url>
  27. <title><?php echo htmlspecialchars($conf->description);?></title>
  28. <link><?php echo $conf->urlGelato;?></link>
  29. </image>
  30. <?php
  31. $rs = $tumble->getPosts("20");
  32. if ($db->contarRegistros()>0) {
  33. while($register = mysql_fetch_array($rs)) {
  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->urlGelato."/", $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::trimString($tit);
  71. $strEnd = ($conf->urlFriendly) ? "/" : "";
  72. $url = $tumble->getPermalink($register["id_post"]);
  73. $formatedDate = gmdate("r", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
  74. ?>
  75. <item>
  76. <title><?php echo $tit;?></title>
  77. <description><![CDATA[<?php echo $desc;?>]]></description>
  78. <link><?php echo $url;?></link>
  79. <guid isPermaLink="true"><?php echo $url;?></guid>
  80. <pubDate><?php echo $formatedDate;?></pubDate>
  81. </item>
  82. <?php
  83. }
  84. }
  85. ?>
  86. </channel>
  87. </rss>