A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.4KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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. $tumble = new gelato();
  33. $rs = $tumble->getPosts("20");
  34. if ($tumble->contarRegistros()>0) {
  35. while($register = mysql_fetch_array($rs)) {
  36. $register["description"] = $register["description"];
  37. switch ($register["type"]) {
  38. case "1":
  39. $tit = ($register["title"]=="") ? $register["description"] : $register["title"];
  40. $desc = $register["description"];
  41. break;
  42. case "2":
  43. $photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
  44. $tit = ($register["description"]=="") ? "Photo" : $register["description"];
  45. $desc = "<img src=\"".$photoPath."\"/>";
  46. break;
  47. case "3":
  48. $tit = "\"".$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" : $register["description"];
  65. $desc = $tumble->getVideoPlayer($register["url"]);
  66. break;
  67. case "7":
  68. $tit = ($register["description"]=="") ? "MP3" : $register["description"];
  69. $desc = $tumble->getMp3Player($register["url"]);
  70. break;
  71. }
  72. $tit = strip_tags($tit);
  73. //$url = htmlspecialchars($url);
  74. $strEnd=($conf->urlFriendly) ? "/" : "";
  75. $url = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
  76. $formatedDate = gmdate("r", strtotime($register["date"])+transform_offset($conf->offsetTime));
  77. ?>
  78. <item>
  79. <title><?php echo $tit;?></title>
  80. <description><![CDATA[<?php echo $desc;?>]]></description>
  81. <link><?php echo $url;?></link>
  82. <guid isPermaLink="true"><?php echo $url;?></guid>
  83. <pubDate><?php echo $formatedDate;?></pubDate>
  84. </item>
  85. <?php
  86. }
  87. }
  88. ?>
  89. </channel>
  90. </rss>