A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.9KB

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