A tumblelog CMS built on AJAX, PHP and MySQL.

rss.php 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?
  2. /* ===========================
  3. gelato CMS development version
  4. http://www.gelatocms.com/
  5. gelato CMS is a free software licensed under GPL (General public license)
  6. =========================== */
  7. ?>
  8. <?
  9. header("Content-type: text/xml; charset=utf-8");
  10. require_once("classes/configuration.class.php");
  11. $conf = new configuration();
  12. echo "<?xml version=\"1.0\""." encoding=\"UTF-8\"?>\n";
  13. include("classes/gelato.class.php");
  14. $tumble = new gelato();
  15. $rs = $tumble->getPosts("20");
  16. if ($tumble->contarRegistros()>0) {
  17. ?>
  18. <rss version="2.0">
  19. <channel>
  20. <title><?=htmlspecialchars(replaceAccents($conf->title));?></title>
  21. <link><?=$conf->urlGelato;?></link>
  22. <description><?=htmlspecialchars(replaceAccents($conf->description));?></description>
  23. <language>EN</language>
  24. <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  25. <generator>gelato CMS</generator>
  26. <image>
  27. <url><?=$conf->urlGelato;?>/images/information.png</url>
  28. <title><?=htmlspecialchars(replaceAccents($conf->description));?></title>
  29. <link><?=$conf->urlGelato;?></link>
  30. </image>
  31. <?
  32. while($register = mysql_fetch_array($rs)) {
  33. $tit = ($register["title"]=="") ? htmlspecialchars($register["url"]) : htmlspecialchars($register["title"]);
  34. $desc = htmlspecialchars($register["description"]);
  35. $url = htmlspecialchars($conf->urlGelato."/index.php/post/".$register["id_post"]."/");
  36. $formatedDate = gmdate("D, d M Y H:i:s \G\M\T", strtotime($register["date"]));
  37. ?>
  38. <item>
  39. <title><?=$tit;?></title>
  40. <link><?=$url;?></link>
  41. <description><?=$desc;?></description>
  42. <pubDate><?=$formatedDate;?></pubDate>
  43. <category>system:unfiled</category>
  44. <guid isPermaLink="true"><?=$conf->urlGelato."/index.php/post/".$register["id_post"]."/";?></guid>
  45. </item>
  46. <?
  47. }
  48. }
  49. ?>
  50. </channel>
  51. </rss>
  52. <?
  53. function replaceAccents($texto="") {
  54. $texto = str_replace("&Aacute;","A", $texto);
  55. $texto = str_replace("&Eacute;","E", $texto);
  56. $texto = str_replace("&Iacute;","I", $texto);
  57. $texto = str_replace("&Oacute;","O", $texto);
  58. $texto = str_replace("&Uacute;","U", $texto);
  59. $texto = str_replace("&aacute;","a", $texto);
  60. $texto = str_replace("&eacute;","e", $texto);
  61. $texto = str_replace("&iacute;","i", $texto);
  62. $texto = str_replace("&oacute;","o", $texto);
  63. $texto = str_replace("&uacute;","u", $texto);
  64. return $texto;
  65. }
  66. ?>