152 lines
6.0 KiB
PHP
152 lines
6.0 KiB
PHP
<?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
|
|
header("Content-type: text/xml; charset=utf-8");
|
|
$isFeed = true;
|
|
|
|
require('entry.php');
|
|
global $user, $conf, $tumble;
|
|
$f = new feeds();
|
|
|
|
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
|
?>
|
|
<gelato version="1.0">
|
|
<?php
|
|
if (isset($_GET["action"]) && $_GET["action"] == "read") {
|
|
if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 0; }
|
|
if (isset($_GET["total"])) { $total = $_GET["total"]; } else { $total = 20; }
|
|
if (isset($_GET["type"])) { $hasType = true; } else { $hasType = false; }
|
|
if ($total > 50) { $total = 50; }
|
|
$user = new user();
|
|
$userData = $user->getUserByID(1);
|
|
$username = ($userData["name"] == "") ? "gelato" : $userData["name"];
|
|
?>
|
|
<tumblelog name="<?php echo $username;?>" timezone="<?php echo $conf->offsetCity;?>" title="<?php echo $conf->title;?>">
|
|
<?php
|
|
echo "\n\t".$conf->description."\n";
|
|
?>
|
|
<feeds>
|
|
<?php
|
|
$actual_feeds = $f->getFeedList();
|
|
foreach($actual_feeds as $feed){
|
|
$error_text = ($feed["error"]>0) ? "false" : "true";
|
|
?>
|
|
<feed id="<?php echo $feed["id_feed"];?>" url="<?php echo htmlspecialchars($feed["url"]);?>" import-type="<?php echo util::type2Text($feed["type"]);?>" next-update-in-seconds="<? echo $f->getNextUpdate($feed["id_feed"]);?>" title="<?php echo htmlspecialchars($feed["title"]);?>" error-text="<? echo $error_text;?>"/>
|
|
<?php
|
|
}
|
|
?>
|
|
</feeds>
|
|
</tumblelog>
|
|
|
|
<?php
|
|
if ($hasType) {
|
|
$postType = type2Number($_GET["type"]);
|
|
}
|
|
$rs = $tumble->getPosts($total, $start);
|
|
if ($db->contarRegistros()>0) {
|
|
?>
|
|
<posts start="<?php echo $start; ?>" total="<?php echo $total; ?>">
|
|
<?php
|
|
while($register = mysql_fetch_array($rs)) {
|
|
$desc = util::trimString($register["description"]);
|
|
$strEnd = ($conf->urlFriendly) ? "/" : "";
|
|
$url = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$register["id_post"].$strEnd;
|
|
$formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"]) + util::transform_offset($conf->offsetTime));
|
|
|
|
switch ($register["type"]) {
|
|
case "1":
|
|
|
|
$tit = (empty($register["title"])) ? $desc : strip_tags($register["title"]);
|
|
?>
|
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="regular" date="<?php echo $formatedDate;?>">
|
|
<regular-title><?php echo $tit;?></regular-title>
|
|
<regular-body><?php echo $desc;?></regular-body>
|
|
</post>
|
|
<?php
|
|
break;
|
|
case "2":
|
|
$tit = (empty($register["description"])) ? "Photo" : $desc;
|
|
?>
|
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="photo" date="<?php echo $formatedDate;?>">
|
|
<?php
|
|
$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
|
|
?>
|
|
<photo-caption><?php echo stripslashes($tit);?></photo-caption>
|
|
<photo-url><?php echo $photoPath;?></photo-url>
|
|
</post>
|
|
<?php
|
|
break;
|
|
case "3":
|
|
?>
|
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="quote" date="<?php echo $formatedDate;?>">
|
|
<quote-text><?php echo $desc; ?></quote-text>
|
|
<quote-source><?php echo strip_tags($register["title"]); ?></quote-source>
|
|
</post>
|
|
<?php
|
|
break;
|
|
case "4":
|
|
$tit = (empty($register["title"])) ? $register["url"] : strip_tags($register["title"]);
|
|
?>
|
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="link" date="<?php echo $formatedDate;?>">
|
|
<link-text><?php echo $tit; ?></link-text>
|
|
<link-url><?php echo $register["url"]; ?></link-url>
|
|
</post>
|
|
<?php
|
|
break;
|
|
case "5":
|
|
$lines = explode("\n", $desc);
|
|
$line = $lines[0];
|
|
$tit = (empty($register["title"])) ? trimString($line) : $register["title"];
|
|
$desc = $tumble->formatConversation($desc);
|
|
?>
|
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="conversation" date="<?php echo $formatedDate;?>">
|
|
<conversation-title><?php echo $tit; ?></conversation-title>
|
|
<conversation-text><?php echo $desc; ?></conversation-text>
|
|
<?php echo $tumble->formatApiConversation($desc); ?>
|
|
</post>
|
|
<?php
|
|
break;
|
|
case "6":
|
|
$tit = (empty($register["description"])) ? "Video" : $desc;
|
|
$desc = $tumble->getVideoPlayer($register["url"]);
|
|
?>
|
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="video" date="<?php echo $formatedDate;?>">
|
|
<video-caption><?php echo $tit; ?></video-caption>
|
|
<video-source><?php echo $register["url"]; ?></video-source>
|
|
<video-player><?php echo htmlspecialchars($desc); ?></video-player>
|
|
</post>
|
|
<?php
|
|
break;
|
|
|
|
case "7":
|
|
$tit = (empty($register["description"])) ? "Audio" : $desc;
|
|
$desc = $tumble->getMp3Player($register["url"]);
|
|
?>
|
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="audio" date="<?php echo $formatedDate;?>">
|
|
<audio-caption><?php echo $tit; ?></audio-caption>
|
|
<audio-player><?php echo htmlspecialchars($desc); ?></audio-player>
|
|
</post>
|
|
<?php
|
|
break;
|
|
|
|
}
|
|
}
|
|
?>
|
|
</posts>
|
|
<?php
|
|
}
|
|
}
|
|
?>
|
|
</gelato>
|