This repository has been archived by the owner on Apr 14, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrss.php
97 lines (87 loc) · 3.32 KB
/
rss.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
<?php
if(!defined('entry')) define('entry',true);
/* ===========================
gelato CMS - A PHP based tumblelog CMS
development version
http://www.gelatocms.com/
gelato CMS is a free software licensed under the GPL 2.0
Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
=========================== */
?>
<?php
require('entry.php');
$trigger->call('feed_header');
header("Content-type: text/xml; charset=utf-8");
$isFeed = true;
global $conf, $tumble;
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
?>
<rss version="2.0">
<channel>
<title><?php echo htmlspecialchars($conf->title);?></title>
<link><?php echo $conf->urlGelato;?></link>
<description><?php echo htmlspecialchars($conf->description);?></description>
<generator>gelato CMS <?php echo util::codeName()." (".util::version().")"; ?></generator>
<image>
<url><?php echo $conf->urlGelato;?>/images/information.png</url>
<title><?php echo htmlspecialchars($conf->description);?></title>
<link><?php echo $conf->urlGelato;?></link>
</image>
<?php
$rs = $tumble->getPosts("20");
if ($db->contarRegistros()>0) {
while($register = mysql_fetch_array($rs)) {
$register["description"] = $register["description"];
switch ($register["type"]) {
case "1":
$tit = ($register["title"]=="") ? $register["description"] : $register["title"];
$desc = $register["description"];
break;
case "2":
$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
$tit = ($register["description"]=="") ? "Photo" : $register["description"];
$desc = "<img src=\"".$photoPath."\"/>";
break;
case "3":
$tit = "\"".$register["description"]."\"";
$tmpStr = ($register["title"]!="") ? "<br /><br /> - <em>".$register["title"]."</em>" : "";
$desc = "\"".$register["description"]."\"".$tmpStr;
break;
case "4":
$tit = ($register["title"]=="") ? $register["url"] : $register["title"];
$tmpStr = ($register["description"]!="") ? "<br /><br /> - <em>".$register["description"]."</em>" : "";
$desc = "<a href=\"".$register["url"]."\">".$tit."</a>".$tmpStr;
break;
case "5":
$lines = explode("\n", $register["description"]);
$line = $lines[0];
$tit = ($register["title"]=="") ? $line : $register["title"];
$desc = $tumble->formatConversation($register["description"]);
break;
case "6":
$tit = ($register["description"]=="") ? "Video" : $register["description"];
$desc = $tumble->getVideoPlayer($register["url"]);
break;
case "7":
$tit = ($register["description"]=="") ? "MP3" : $register["description"];
$desc = $tumble->getMp3Player($register["url"]);
break;
}
$tit = util::trimString($tit);
$strEnd = ($conf->urlFriendly) ? "/" : "";
$url = $tumble->getPermalink($register["id_post"]);
$formatedDate = gmdate("r", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
?>
<item>
<title><?php echo $tit;?></title>
<description><![CDATA[<?php echo $desc;?>]]></description>
<link><?php echo $url;?></link>
<guid isPermaLink="true"><?php echo $url;?></guid>
<pubDate><?php echo $formatedDate;?></pubDate>
</item>
<?php
}
}
?>
</channel>
</rss>