A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 3.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. $isFeed = true;
  14. require('entry.php');
  15. global $conf, $tumble;
  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 <?php echo codeName()." (".version().")"; ?></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. $rs = $tumble->getPosts("20");
  31. if ($tumble->contarRegistros()>0) {
  32. while($register = mysql_fetch_array($rs)) {
  33. $register["description"] = $register["description"];
  34. switch ($register["type"]) {
  35. case "1":
  36. $tit = ($register["title"]=="") ? $register["description"] : $register["title"];
  37. $desc = $register["description"];
  38. break;
  39. case "2":
  40. $photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
  41. $tit = ($register["description"]=="") ? "Photo" : $register["description"];
  42. $desc = "<img src=\"".$photoPath."\"/>";
  43. break;
  44. case "3":
  45. $tit = "\"".$register["description"]."\"";
  46. $tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".$register["title"]."</em>" : "";
  47. $desc = "\"".$register["description"]."\"".$tmpStr;
  48. break;
  49. case "4":
  50. $tit = ($register["title"]=="") ? $register["url"] : $register["title"];
  51. $tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".$register["description"]."</em>" : "";
  52. $desc = "<a href=\"".$register["url"]."\">".$tit."</a>".$tmpStr;
  53. break;
  54. case "5":
  55. $lines = explode("\n", $register["description"]);
  56. $line = $lines[0];
  57. $tit = ($register["title"]=="") ? $line : $register["title"];
  58. $desc = $tumble->formatConversation($register["description"]);
  59. break;
  60. case "6":
  61. $tit = ($register["description"]=="") ? "Video" : $register["description"];
  62. $desc = $tumble->getVideoPlayer($register["url"]);
  63. break;
  64. case "7":
  65. $tit = ($register["description"]=="") ? "MP3" : $register["description"];
  66. $desc = $tumble->getMp3Player($register["url"]);
  67. break;
  68. }
  69. $tit = trimString($tit);
  70. $strEnd = ($conf->urlFriendly) ? "/" : "";
  71. $url = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$register["id_post"].$strEnd;
  72. $formatedDate = gmdate("r", strtotime($register["date"]) + transform_offset($conf->offsetTime));
  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 $url;?></guid>
  79. <pubDate><?php echo $formatedDate;?></pubDate>
  80. </item>
  81. <?php
  82. }
  83. }
  84. ?>
  85. </channel>
  86. </rss>