bug fix
parent
4056b676eb
commit
67e1a2cd5f
101
api.php
101
api.php
|
|
@ -17,8 +17,8 @@ if(!defined('entry')) define('entry',true);
|
||||||
require('entry.php');
|
require('entry.php');
|
||||||
global $user, $conf, $tumble;
|
global $user, $conf, $tumble;
|
||||||
$f = new feeds();
|
$f = new feeds();
|
||||||
|
|
||||||
$theme = new themes;
|
$theme = new themes;
|
||||||
|
|
||||||
if (isset($_GET["action"]) && $_GET["action"] == "read") {
|
if (isset($_GET["action"]) && $_GET["action"] == "read") {
|
||||||
if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 0; }
|
if (isset($_GET["start"])) { $start = $_GET["start"]; } else { $start = 0; }
|
||||||
|
|
@ -27,82 +27,83 @@ if(!defined('entry')) define('entry',true);
|
||||||
if ($total > 50) { $total = 50; }
|
if ($total > 50) { $total = 50; }
|
||||||
$user = new user();
|
$user = new user();
|
||||||
$userData = $user->getUserByID(1);
|
$userData = $user->getUserByID(1);
|
||||||
$username = ($userData["name"] == "") ? "gelato" : $userData["name"];
|
$username = ($userData["name"] == "") ? "gelato" : $userData["name"];
|
||||||
|
|
||||||
$theme->set("username",$username);
|
$theme->set("username",$username);
|
||||||
$theme->set("conf",array(
|
$theme->set("conf",array(
|
||||||
"offsetCity"=>$conf->offsetCity,
|
"offsetCity"=>$conf->offsetCity,
|
||||||
"title"=>$conf->title,
|
"title"=>$conf->title,
|
||||||
"description"=>$conf->description
|
"description"=>$conf->description
|
||||||
));
|
));
|
||||||
|
|
||||||
$feeds = array();
$actual_feeds = $f->getFeedList();
|
$feeds = array();
|
||||||
|
$actual_feeds = $f->getFeedList();
|
||||||
foreach($actual_feeds as $feed){
|
foreach($actual_feeds as $feed){
|
||||||
$error_text = ($feed["error"]>0) ? "false" : "true";
|
$error_text = ($feed["error"]>0) ? "false" : "true";
|
||||||
$feed['url'] = htmlspecialchars($feed['url']);
|
$feed['url'] = htmlspecialchars($feed['url']);
|
||||||
$feed['type'] = util::type2Text($feed['type']);
|
$feed['type'] = util::type2Text($feed['type']);
|
||||||
$feed['getNextUpdate'] = $f->getNextUpdate($feed['id_feed']);
|
$feed['getNextUpdate'] = $f->getNextUpdate($feed['id_feed']);
|
||||||
$feed['title'] = htmlspecialchars($feed['title']);
|
$feed['title'] = htmlspecialchars($feed['title']);
|
||||||
$feed['error_text'] = $error_text;
|
$feed['error_text'] = $error_text;
|
||||||
$feeds[] = $feed;
|
$feeds[] = $feed;
|
||||||
}
|
}
|
||||||
|
|
||||||
$theme->set("feeds",$feeds);
|
$theme->set("feeds",$feeds);
|
||||||
|
|
||||||
if ($hasType) {
|
if ($hasType) {
|
||||||
$postType = type2Number($_GET["type"]);
|
$postType = type2Number($_GET["type"]);
|
||||||
}
|
}
|
||||||
$rs = $tumble->getPosts($total, $start);
|
$rs = $tumble->getPosts($total, $start);
|
||||||
|
|
||||||
$totalRegistros = $db->contarRegistros();
|
|
||||||
$theme->set("totalRegistros",$totalRegistros);
|
|
||||||
|
|
||||||
if ($db->contarRegistros()>0) {
|
$totalRegistros = $db->contarRegistros();
|
||||||
$theme->set("start",$start);
|
$theme->set("totalRegistros",$totalRegistros);
|
||||||
$theme->set("total",$total);
|
|
||||||
|
if ($db->contarRegistros()>0) {
|
||||||
while($post = mysql_fetch_assoc($rs)){
|
$theme->set("start",$start);
|
||||||
|
$theme->set("total",$total);
|
||||||
|
|
||||||
|
while($post = mysql_fetch_assoc($rs)){
|
||||||
$post['desc'] = util::trimString($post["description"]);
|
$post['desc'] = util::trimString($post["description"]);
|
||||||
$strEnd = ($conf->urlFriendly) ? "/" : "";
|
$strEnd = ($conf->urlFriendly) ? "/" : "";
|
||||||
$post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd;
|
$post['url'] = $conf->urlGelato.($conf->urlFriendly ? "/post/" : "/index.php?post=").$post["id_post"].$strEnd;
|
||||||
$post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime));
|
$post['formatedDate'] = gmdate("D, d M Y H:i:s", strtotime($post["date"]) + util::transform_offset($conf->offsetTime));
|
||||||
|
|
||||||
$post['type'] = util::type2Text($post["type"]);
|
$post["type"] = util::type2Text($post["type"]);
|
||||||
|
|
||||||
switch ($post["type"]) {
|
switch ($post["type"]) {
|
||||||
case "post":
|
case "post":
|
||||||
$post['tit'] = (empty($post["title"])) ? $desc : strip_tags($post["title"]);
|
$post['tit'] = (empty($post["title"])) ? $post['desc'] : strip_tags($post["title"]);
|
||||||
break;
|
break;
|
||||||
case "photo":
|
case "photo":
|
||||||
$post['photoPath'] = str_replace("../", $conf->urlGelato."/", $post["url"]);
|
$post['photoPath'] = str_replace("../", $conf->urlGelato."/", $post["url"]);
|
||||||
$post['tit'] = stripslashes(((empty($post["description"])) ? "Photo" : $post['desc']));
|
$post['tit'] = stripslashes(((empty($post["description"])) ? "Photo" : $post['desc']));
|
||||||
break;
|
break;
|
||||||
case "quote":
|
case "quote":
|
||||||
$post['title'] = strip_tags($post["title"]);
|
$post['title'] = strip_tags($post["title"]);
|
||||||
break;
|
break;
|
||||||
case "url":
|
case "url":
|
||||||
$post['tit'] = (empty($post["title"])) ? $post["url"] : strip_tags($post["title"]);
|
$post['tit'] = (empty($post["title"])) ? $post["url"] : strip_tags($post["title"]);
|
||||||
break;
|
break;
|
||||||
case "conversation":
|
case "conversation":
|
||||||
$lines = explode("\n", $desc);
|
$lines = explode("\n", $post['desc']);
|
||||||
$line = $lines[0];
|
$line = $lines[0];
|
||||||
$post['tit'] = (empty($post["title"])) ? trimString($line) : $post["title"];
|
$post['tit'] = (empty($post["title"])) ? trimString($line) : $post["title"];
|
||||||
$post['desc'] = $tumble->formatConversation($desc);
|
$post['desc'] = $tumble->formatConversation($post['desc']);
|
||||||
$post['descAPIFormat'] = $tumble->formatConversation($desc);
|
$post['descAPIFormat'] = $tumble->formatConversation($post['desc']);
|
||||||
break;
|
break;
|
||||||
case "video":
|
case "video":
|
||||||
$post['tit'] = (empty($post["description"])) ? "Video" : $desc;
|
$post['tit'] = (empty($post["description"])) ? "Video" : $post['desc'];
|
||||||
$post['desc'] = htmlspecialchars($tumble->getVideoPlayer($post["url"]));
|
$post['desc'] = htmlspecialchars($tumble->getVideoPlayer($post["url"]));
|
||||||
break;
|
break;
|
||||||
case "mp3":
|
case "mp3":
|
||||||
$post['tit'] = (empty($post["description"])) ? "Audio" : $desc;
|
$post['tit'] = (empty($post["description"])) ? "Audio" : $post['desc'];
|
||||||
$desc = htmlspecialchars($tumble->getMp3Player($post["url"]));
|
$post['desc'] = htmlspecialchars($tumble->getMp3Player($post["url"]));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
$posts[] = $post;
|
$posts[] = $post;
|
||||||
}
|
}
|
||||||
$theme->set("posts",$posts);
|
$theme->set("posts",$posts);
|
||||||
}
|
}
|
||||||
$theme->display(Absolute_Path.'admin/themes/admin/api.xml');
|
$theme->display(Absolute_Path.'admin/themes/admin/api.xml');
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue