A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. header("Content-type: text/xml; charset=utf-8");
  13. require(dirname(__FILE__)."/config.php");
  14. include("classes/configuration.class.php");
  15. $isFeed = true;
  16. $conf = new configuration();
  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</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. include("classes/gelato.class.php");
  32. include("classes/textile.class.php");
  33. $tumble = new gelato();
  34. $rs = $tumble->getPosts("20");
  35. if ($tumble->contarRegistros()>0) {
  36. while($register = mysql_fetch_array($rs)) {
  37. $textile = new Textile();
  38. $register["description"] = $textile->TextileThis($register["description"]);
  39. switch ($register["type"]) {
  40. case "1":
  41. $tit = ($register["title"]=="") ? strip_tags($register["description"]) : $register["title"];
  42. $desc = $register["description"];
  43. break;
  44. case "2":
  45. $photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
  46. $tit = ($register["description"]=="") ? "Photo" : strip_tags($register["description"]);
  47. $desc = "<img src=\"".$photoPath."\"/>";
  48. break;
  49. case "3":
  50. $tit = "\"".strip_tags($register["description"])."\"";
  51. $tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".$register["title"]."</em>" : "";
  52. $desc = "\"".$register["description"]."\"".$tmpStr;
  53. break;
  54. case "4":
  55. $tit = ($register["title"]=="") ? $register["url"] : $register["title"];
  56. $tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".$register["description"]."</em>" : "";
  57. $desc = "<a href=\"".$register["url"]."\">".$tit."</a>".$tmpStr;
  58. break;
  59. case "5":
  60. $lines = explode("\n", $register["description"]);
  61. $line = $lines[0];
  62. $tit = ($register["title"]=="") ? $line : $register["title"];
  63. $desc = $tumble->formatConversation($register["description"]);
  64. break;
  65. case "6":
  66. $tit = ($register["description"]=="") ? "Video" : strip_tags($register["description"]);
  67. $desc = $tumble->getVideoPlayer($register["url"]);
  68. break;
  69. case "7":
  70. $tit = ($register["description"]=="") ? "MP3" : strip_tags($register["description"]);
  71. $desc = $tumble->getMp3Player($register["url"]);
  72. break;
  73. }
  74. $tit = htmlspecialchars($tit);
  75. $url = htmlspecialchars($url);
  76. $strEnd=($conf->urlFriendly) ? "/" : "";
  77. $url = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
  78. $formatedDate = gmdate("r", strtotime($register["date"])+transform_offset($conf->offsetTime));
  79. ?>
  80. <item>
  81. <title><?php echo $tit;?></title>
  82. <description><![CDATA[<?php echo $desc;?>]]></description>
  83. <link><?php echo $url;?></link>
  84. <guid isPermaLink="true"><?php echo $url;?></guid>
  85. <pubDate><?php echo $formatedDate;?></pubDate>
  86. </item>
  87. <?php
  88. }
  89. }
  90. ?>
  91. </channel>
  92. </rss>