A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.3KB

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