| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- <?
- /* ===========================
-
- gelato CMS development version
- http://www.gelatocms.com/
-
- gelato CMS is a free software licensed under GPL (General public license)
-
- =========================== */
- ?>
- <?
- header("Content-type: text/xml; charset=utf-8");
-
- require_once("classes/configuration.class.php");
- $conf = new configuration();
-
- echo "<?xml version=\"1.0\""." encoding=\"UTF-8\"?>\n";
-
- include("classes/gelato.class.php");
- $tumble = new gelato();
- $rs = $tumble->getPosts("20");
- if ($tumble->contarRegistros()>0) {
- ?>
-
- <rss version="2.0">
- <channel>
- <title><?=htmlspecialchars(replaceAccents($conf->title));?></title>
- <link><?=$conf->urlGelato;?></link>
- <description><?=htmlspecialchars(replaceAccents($conf->description));?></description>
- <generator>gelato CMS</generator>
- <image>
- <url><?=$conf->urlGelato;?>/images/information.png</url>
- <title><?=htmlspecialchars(replaceAccents($conf->description));?></title>
- <link><?=$conf->urlGelato;?></link>
- </image>
- <?
- while($register = mysql_fetch_array($rs)) {
- switch ($register["type"]) {
- case "1":
- $tit = ($register["title"]=="") ? htmlspecialchars(strip_tags($register["description"])) : htmlspecialchars($register["title"]);
- $desc = htmlspecialchars($register["description"]);
- break;
- case "2":
- $tit = ($register["description"]=="") ? "Photo" : htmlspecialchars(strip_tags($register["description"]));
- $desc = "<img src=\"".$register["url"]."\"/>";
- break;
- case "3":
- $tit = "\"".htmlspecialchars(strip_tags($register["description"]))."\"";
- $tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".htmlspecialchars($register["title"])."</em>" : "";
- $desc = "\"".htmlspecialchars($register["description"])."\"".$tmpStr;
- break;
- case "4":
- $tit = ($register["title"]=="") ? htmlspecialchars($register["url"]) : htmlspecialchars($register["title"]);
- $tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".htmlspecialchars($register["description"])."</em>" : "";
- $desc = "<a href=\"".htmlspecialchars($register["url"])."\">".$tit."</a>".$tmpStr;
- break;
- case "5":
- $lines = explode("\n", $register["description"]);
- $line = htmlspecialchars($lines[0]);
- $tit = ($register["title"]=="") ? $line : htmlspecialchars($register["title"]);
- $desc = $tumble->formatConversation(htmlspecialchars($register["description"]));
- break;
- case "6":
- $tit = ($register["description"]=="") ? "Video" : htmlspecialchars(strip_tags($register["description"]));
- $desc = $tumble->getVideoPlayer(htmlspecialchars($register["url"]));
- break;
- case "7":
- $tit = ($register["description"]=="") ? "MP3" : htmlspecialchars(strip_tags($register["description"]));
- $desc = $tumble->getMp3Player(htmlspecialchars($register["url"]));
- break;
- }
- $url = htmlspecialchars($conf->urlGelato."/index.php/post/".$register["id_post"]."/");
- $formatedDate = gmdate("D, d M Y H:i:s \G\M\T", strtotime($register["date"]));
- ?>
-
- <item>
- <title><?=replaceAccentsWithAmp($tit);?></title>
- <description><![CDATA[<?=replaceAccentsWithAmp($desc);?>]]></description>
- <link><?=$url;?></link>
- <guid isPermaLink="true"><?=$conf->urlGelato."/index.php/post/".$register["id_post"]."/";?></guid>
- <pubDate><?=$formatedDate;?></pubDate>
- </item>
-
- <?
- }
- }
- ?>
- </channel>
- </rss>
-
- <?
- function replaceAccents($texto="") {
- $texto = str_replace("Á","A", $texto);
- $texto = str_replace("É","E", $texto);
- $texto = str_replace("Í","I", $texto);
- $texto = str_replace("Ó","O", $texto);
- $texto = str_replace("Ú","U", $texto);
- $texto = str_replace("á","a", $texto);
- $texto = str_replace("é","e", $texto);
- $texto = str_replace("í","i", $texto);
- $texto = str_replace("ó","o", $texto);
- $texto = str_replace("ú","u", $texto);
- return $texto;
- }
-
- function replaceAccentsWithAmp($texto="") {
- $texto = str_replace("&Aacute;","A", $texto);
- $texto = str_replace("&Eacute;","E", $texto);
- $texto = str_replace("&Iacute;","I", $texto);
- $texto = str_replace("&Oacute;","O", $texto);
- $texto = str_replace("&Uacute;","U", $texto);
- $texto = str_replace("&aacute;","a", $texto);
- $texto = str_replace("&eacute;","e", $texto);
- $texto = str_replace("&iacute;","i", $texto);
- $texto = str_replace("&oacute;","o", $texto);
- $texto = str_replace("&uacute;","u", $texto);
- $texto = str_replace("&#39;"," ", $texto);
- return $texto;
- }
- ?>
|