Read API (beta version) and fixed bug on edit photo (../uploads/img.jpg)
parent
47c7bfca99
commit
9d951de593
|
|
@ -240,6 +240,7 @@ if ($user->isAdmin()) {
|
||||||
$template->mostrarPlantilla();
|
$template->mostrarPlantilla();
|
||||||
break;
|
break;
|
||||||
case "photo":
|
case "photo":
|
||||||
|
$url = str_replace("../", $conf->urlGelato."/", $url);
|
||||||
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
||||||
$output = array("2", $date, $_SESSION['user_id'], $url, $body);
|
$output = array("2", $date, $_SESSION['user_id'], $url, $body);
|
||||||
|
|
||||||
|
|
|
||||||
44
api.php
44
api.php
|
|
@ -13,11 +13,16 @@ if(!defined('entry')) define('entry',true);
|
||||||
?>
|
?>
|
||||||
<?php
|
<?php
|
||||||
header("Content-type: text/xml; charset=utf-8");
|
header("Content-type: text/xml; charset=utf-8");
|
||||||
|
|
||||||
$isFeed = true;
|
$isFeed = true;
|
||||||
$tumble = new gelato();
|
|
||||||
|
require(dirname(__FILE__)."/config.php");
|
||||||
|
|
||||||
|
include("classes/configuration.class.php");
|
||||||
$conf = new configuration();
|
$conf = new configuration();
|
||||||
|
|
||||||
|
include("classes/gelato.class.php");
|
||||||
|
$tumble = new gelato();
|
||||||
|
|
||||||
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
|
||||||
?>
|
?>
|
||||||
<gelato version="1.0">
|
<gelato version="1.0">
|
||||||
|
|
@ -61,14 +66,14 @@ if(!defined('entry')) define('entry',true);
|
||||||
<posts start="<?php echo $start; ?>" total="<?php echo $total; ?>">
|
<posts start="<?php echo $start; ?>" total="<?php echo $total; ?>">
|
||||||
<?php
|
<?php
|
||||||
while($register = mysql_fetch_array($rs)) {
|
while($register = mysql_fetch_array($rs)) {
|
||||||
$desc = $register["description"];
|
$desc = htmlspecialchars($register["description"]);
|
||||||
$url = $conf->urlGelato."/index.php?post=".$register["id_post"];
|
$url = $conf->urlGelato."/index.php?post=".$register["id_post"];
|
||||||
$formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
$formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
||||||
|
|
||||||
switch ($register["type"]) {
|
switch ($register["type"]) {
|
||||||
case "1":
|
case "1":
|
||||||
|
|
||||||
$tit = ($register["title"]=="") ? $register["description"] : $register["title"];
|
$tit = ($register["title"]=="") ? $desc : $register["title"];
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="regular" date="<?php echo $formatedDate;?>">
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="regular" date="<?php echo $formatedDate;?>">
|
||||||
|
|
@ -78,7 +83,7 @@ if(!defined('entry')) define('entry',true);
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
case "2":
|
case "2":
|
||||||
$tit = ($register["description"]=="") ? "Photo" : $register["description"];
|
$tit = ($register["description"]=="") ? "Photo" : $desc;
|
||||||
?>
|
?>
|
||||||
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="photo" date="<?php echo $formatedDate;?>">
|
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="photo" date="<?php echo $formatedDate;?>">
|
||||||
<?php
|
<?php
|
||||||
|
|
@ -107,28 +112,41 @@ if(!defined('entry')) define('entry',true);
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
case "5":
|
case "5":
|
||||||
$lines = explode("\n", $register["description"]);
|
$lines = explode("\n", $desc);
|
||||||
$line = $lines[0];
|
$line = $lines[0];
|
||||||
$tit = ($register["title"]=="") ? $line : $register["title"];
|
$tit = ($register["title"]=="") ? $line : $register["title"];
|
||||||
$desc = $tumble->formatConversation($register["description"]);
|
$desc = $tumble->formatConversation($desc);
|
||||||
?>
|
?>
|
||||||
<post id="<?php echo $register["id_post"]; ?>" url="<?php echo $url;?>" type="conversation" date="<?php echo $formatedDate;?>">
|
<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-title><?php echo $tit; ?></conversation-title>
|
||||||
<conversation-text><?php echo $register["description"]; ?></conversation-text>
|
<conversation-text><?php echo $desc; ?></conversation-text>
|
||||||
<?php echo $tumble->formatApiConversation($register["description"]); ?>
|
<?php echo $tumble->formatApiConversation($desc); ?>
|
||||||
</post>
|
</post>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
/*
|
|
||||||
case "6":
|
case "6":
|
||||||
$tit = ($register["description"]=="") ? "Video" : $register["description"];
|
$tit = ($register["description"]=="") ? "Video" : $desc;
|
||||||
$desc = $tumble->getVideoPlayer($register["url"]);
|
$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;
|
break;
|
||||||
|
|
||||||
case "7":
|
case "7":
|
||||||
$tit = ($register["description"]=="") ? "MP3" : $register["description"];
|
$tit = ($register["description"]=="") ? "Audio" : $desc;
|
||||||
$desc = $tumble->getMp3Player($register["url"]);
|
$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;
|
break;
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
$url = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
|
$url = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
|
||||||
$formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
$formatedDate = gmdate("D, d M Y H:i:s", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
||||||
|
|
|
||||||
|
|
@ -349,14 +349,14 @@ if(!defined('entry') || !entry) die('Not a valid page');
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeBadTags($source) {
|
function removeBadTags($source) {
|
||||||
$validTags ='<p><ul><li><a><abbr><acronym><blockquote><code><pre><em><i><strike><s><strong><b><br><span><div><img>';
|
$validTags ='<p><ol><ul><li><a><abbr><acronym><blockquote><code><pre><em><i><strike><s><strong><b><br><span><div><img>';
|
||||||
$source = strip_tags($source, $validTags);
|
$source = strip_tags($source, $validTags);
|
||||||
return preg_replace('/<(.*?)>/ie', "'<'.removeBadAtributes('\\1').'>'", $source);
|
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|class';
|
$badAtributes = 'javascript:|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup';
|
||||||
$sourceTag = stripslashes($sourceTag);
|
$sourceTag = stripslashes($sourceTag);
|
||||||
$sourceTag = preg_replace("/$badAtributes/i", "niceTry", $sourceTag);
|
$sourceTag = preg_replace("/$badAtributes/i", "niceTry", $sourceTag);
|
||||||
return $sourceTag;
|
return $sourceTag;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue