A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.5KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  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. $tit = ($register["description"]=="") ? "Photo" : strip_tags($register["description"]);
  46. $desc = "<img src=\"".$register["url"]."\"/>";
  47. break;
  48. case "3":
  49. $tit = "\"".strip_tags($register["description"])."\"";
  50. $tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".$register["title"]."</em>" : "";
  51. $desc = "\"".$register["description"]."\"".$tmpStr;
  52. break;
  53. case "4":
  54. $tit = ($register["title"]=="") ? $register["url"] : $register["title"];
  55. $tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".$register["description"]."</em>" : "";
  56. $desc = "<a href=\"".$register["url"]."\">".$tit."</a>".$tmpStr;
  57. break;
  58. case "5":
  59. $lines = explode("\n", $register["description"]);
  60. $line = $lines[0];
  61. $tit = ($register["title"]=="") ? $line : $register["title"];
  62. $desc = $tumble->formatConversation($register["description"]);
  63. break;
  64. case "6":
  65. $tit = ($register["description"]=="") ? "Video" : strip_tags($register["description"]);
  66. $desc = $tumble->getVideoPlayer($register["url"]);
  67. break;
  68. case "7":
  69. $tit = ($register["description"]=="") ? "MP3" : strip_tags($register["description"]);
  70. $desc = $tumble->getMp3Player($register["url"]);
  71. break;
  72. }
  73. $tit = htmlspecialchars($tit);
  74. $url = htmlspecialchars($url);
  75. $strEnd=($conf->urlFriendly) ? "/" : "";
  76. $url = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
  77. $formatedDate = date("r", strtotime($register["date"])+transform_offset($conf->offsetTime));
  78. ?>
  79. <item>
  80. <title><?php echo $tit;?></title>
  81. <description><![CDATA[<?php echo $desc;?>]]></description>
  82. <link><?php echo $url;?></link>
  83. <guid isPermaLink="true"><?php echo $url;?></guid>
  84. <pubDate><?php echo $formatedDate;?></pubDate>
  85. </item>
  86. <?php
  87. }
  88. }
  89. ?>
  90. </channel>
  91. </rss>