A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.4KB

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