A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /* ===========================
  3. gelato CMS development version
  4. http://www.gelatocms.com/
  5. gelato CMS is a free software licensed under GPL (General public license)
  6. =========================== */
  7. ?>
  8. <?php
  9. header("Content-type: text/xml; charset=utf-8");
  10. require(dirname(__FILE__)."/config.php");
  11. include("classes/configuration.class.php");
  12. $conf = new configuration();
  13. echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  14. ?>
  15. <rss version="2.0">
  16. <channel>
  17. <title><?php echo htmlspecialchars($conf->title);?></title>
  18. <link><?php echo $conf->urlGelato;?></link>
  19. <description><?php echo htmlspecialchars($conf->description);?></description>
  20. <generator>gelato CMS</generator>
  21. <image>
  22. <url><?php echo $conf->urlGelato;?>/images/information.png</url>
  23. <title><?php echo htmlspecialchars($conf->description);?></title>
  24. <link><?php echo $conf->urlGelato;?></link>
  25. </image>
  26. <?php
  27. include("classes/gelato.class.php");
  28. include("classes/textile.class.php");
  29. $tumble = new gelato();
  30. $rs = $tumble->getPosts("20");
  31. if ($tumble->contarRegistros()>0) {
  32. while($register = mysql_fetch_array($rs)) {
  33. $textile = new Textile;
  34. $register["description"] = $textile->process($register["description"]);
  35. switch ($register["type"]) {
  36. case "1":
  37. $tit = ($register["title"]=="") ? strip_tags($register["description"]) : $register["title"];
  38. $desc = $register["description"];
  39. break;
  40. case "2":
  41. $tit = ($register["description"]=="") ? "Photo" : strip_tags($register["description"]);
  42. $desc = "<img src=\"".$register["url"]."\"/>";
  43. break;
  44. case "3":
  45. $tit = "\"".strip_tags($register["description"])."\"";
  46. $tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".$register["title"]."</em>" : "";
  47. $desc = "\"".$register["description"]."\"".$tmpStr;
  48. break;
  49. case "4":
  50. $tit = ($register["title"]=="") ? $register["url"] : $register["title"];
  51. $tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".$register["description"]."</em>" : "";
  52. $desc = "<a href=\"".$register["url"]."\">".$tit."</a>".$tmpStr;
  53. break;
  54. case "5":
  55. $lines = explode("\n", $register["description"]);
  56. $line = $lines[0];
  57. $tit = ($register["title"]=="") ? $line : $register["title"];
  58. $desc = $tumble->formatConversation($register["description"]);
  59. break;
  60. case "6":
  61. $tit = ($register["description"]=="") ? "Video" : strip_tags($register["description"]);
  62. $desc = $tumble->getVideoPlayer($register["url"]);
  63. break;
  64. case "7":
  65. $tit = ($register["description"]=="") ? "MP3" : strip_tags($register["description"]);
  66. $desc = $tumble->getMp3Player($register["url"]);
  67. break;
  68. }
  69. $url = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
  70. $formatedDate = gmdate("D, d M Y H:i:s \G\M\T", strtotime($register["date"]));
  71. ?>
  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 $conf->urlGelato."/index.php/post/".$register["id_post"]."/";?></guid>
  77. <pubDate><?php echo $formatedDate;?></pubDate>
  78. </item>
  79. <?php
  80. }
  81. }
  82. ?>
  83. </channel>
  84. </rss>