Added the feeds to the read api
parent
526cf4aec2
commit
fdfc498647
50
api.php
50
api.php
|
|
@ -15,13 +15,9 @@ if(!defined('entry')) define('entry',true);
|
|||
header("Content-type: text/xml; charset=utf-8");
|
||||
$isFeed = true;
|
||||
|
||||
require(dirname(__FILE__)."/config.php");
|
||||
|
||||
include("classes/configuration.class.php");
|
||||
$conf = new configuration();
|
||||
|
||||
include("classes/gelato.class.php");
|
||||
$tumble = new gelato();
|
||||
require('entry.php');
|
||||
global $user, $conf, $tumble;
|
||||
$f = new feeds();
|
||||
|
||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||
?>
|
||||
|
|
@ -34,31 +30,25 @@ if(!defined('entry')) define('entry',true);
|
|||
if (isset($_GET["type"])) { $hasType = true; } else { $hasType = false; }
|
||||
if ($total > 50) { $total = 50; }
|
||||
?>
|
||||
<tumblelog name="<?php echo $_SESSION["user_login"];?>" timezone="<?php echo $conf->offsetCity;?>" title="<?php echo $conf->title;?>"><?php echo $conf->description;?></tumblelog>
|
||||
<tumblelog name="<?php echo $_SESSION["user_login"];?>" 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 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
|
||||
switch ($hasType) {
|
||||
case "post":
|
||||
$_GET["type"] = "1";
|
||||
break;
|
||||
case "photo":
|
||||
$_GET["type"] = "2";
|
||||
break;
|
||||
case "quote":
|
||||
$_GET["type"] = "3";
|
||||
break;
|
||||
case "url":
|
||||
$_GET["type"] = "4";
|
||||
break;
|
||||
case "conversation":
|
||||
$_GET["type"] = "5";
|
||||
break;
|
||||
case "video":
|
||||
$_GET["type"] = "6";
|
||||
break;
|
||||
case "mp3":
|
||||
$_GET["type"] = "7";
|
||||
break;
|
||||
if ($hasType) {
|
||||
$postType = type2Number($_GET["type"]);
|
||||
}
|
||||
$rs = $tumble->getPosts($total, $start);
|
||||
if ($tumble->contarRegistros()>0) {
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ if(!defined('entry') || !entry) die('Not a valid page');
|
|||
?>
|
||||
<?php
|
||||
function version() {
|
||||
return "0.95";
|
||||
return "1.0";
|
||||
}
|
||||
|
||||
function codeName() {
|
||||
|
|
@ -354,11 +354,66 @@ if(!defined('entry') || !entry) die('Not a valid page');
|
|||
return preg_replace('/<(.*?)>/ie', "'<'.removeBadAtributes('\\1').'>'", $source);
|
||||
}
|
||||
|
||||
function removeBadAtributes($sourceTag)
|
||||
{
|
||||
function removeBadAtributes($sourceTag) {
|
||||
$badAtributes = 'javascript:|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup';
|
||||
$sourceTag = stripslashes($sourceTag);
|
||||
$sourceTag = preg_replace("/$badAtributes/i", "niceTry", $sourceTag);
|
||||
return $sourceTag;
|
||||
}
|
||||
|
||||
function type2Text($number) {
|
||||
$tmpStr = "";
|
||||
switch ($number) {
|
||||
case "1":
|
||||
$tmpStr = "post";
|
||||
break;
|
||||
case "2":
|
||||
$tmpStr = "photo";
|
||||
break;
|
||||
case "3":
|
||||
$tmpStr = "quote";
|
||||
break;
|
||||
case "4":
|
||||
$tmpStr = "url";
|
||||
break;
|
||||
case "5":
|
||||
$tmpStr = "conversation";
|
||||
break;
|
||||
case "6":
|
||||
$tmpStr = "video";
|
||||
break;
|
||||
case "7":
|
||||
$tmpStr = "mp3";
|
||||
break;
|
||||
}
|
||||
return $tmpStr;
|
||||
}
|
||||
|
||||
function type2Number($string) {
|
||||
$tmpStr = "";
|
||||
switch ($string) {
|
||||
case "post":
|
||||
$tmpStr = "1";
|
||||
break;
|
||||
case "photo":
|
||||
$tmpStr = "2";
|
||||
break;
|
||||
case "quote":
|
||||
$tmpStr = "3";
|
||||
break;
|
||||
case "url":
|
||||
$tmpStr = "4";
|
||||
break;
|
||||
case "conversation":
|
||||
$tmpStr = "5";
|
||||
break;
|
||||
case "video":
|
||||
$tmpStr = "6";
|
||||
break;
|
||||
case "mp3":
|
||||
$tmpStr = "7";
|
||||
break;
|
||||
}
|
||||
return $tmpStr;
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue