=========================== */
?>
isAdmin()) {
if (isset($_GET["delete"])) {
$tumble->deletePost($_GET['delete']);
header("Location: index.php?deleted=true");
die();
}
if(isset($_POST["btnAdd"])) {
unset($_POST["btnAdd"]);
if ($_POST["type"]=="2") { // is Photo type
if (isset($_POST["url"]) && $_POST["url"]!="") {
$photoName = getFileName($_POST["url"]);
if (!$tumble->savePhoto($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
die();
}
$_POST["url"] = "../uploads/".$photoName;
}
if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
}
unset($_POST["photo"]);
unset($_POST["MAX_FILE_SIZE"]);
}
if ($_POST["type"]=="7") { // is MP3 type
set_time_limit(300);
$mp3Name = getFileName($_POST["url"]);
if (!$tumble->saveMP3($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false");
die();
}
if (isMP3($remoteFileName)) {
$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
}
}
if (!get_magic_quotes_gpc()) {
$_POST["title"] = addslashes($_POST["title"]);
$_POST["description"] = addslashes($_POST["description"]);
}
$_POST["title"] = strip_tags($_POST["title"]);
$_POST["description"] = strip_tags($_POST["description"]);
if (isset($_POST["id_post"])) {
$tumble->modifyPost($_POST, $_POST["id_post"]);
} else {
if ($tumble->addPost($_POST)) {
header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
die();
} else {
header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$this->merror);
die();
}
}
} else {
if ($isEdition) {
$post = $tumble->getPost($postId);
}
?>
".__("A new gelato version has been released and is ready
for download.")."
";
}
if (isset($_GET["deleted"])) {
if ($_GET["deleted"]=="true") {
echo "
".__("The post has been eliminated successfully.")."
";
}
}
if (isset($_GET["modified"])) {
if ($_GET["modified"]=="true") {
echo "
".__("The post has been modified successfully.")."
";
}
}
if (isset($_GET["added"])) {
if ($_GET["added"]=="true") {
echo "
".__("The post has been added successfully.")."
";
}
}
if (isset($_GET["error"])) {
if ($_GET["error"]==2) {
echo "
".__("Error on the database server:")." ".$_GET["des"]."
";
}
}
if (isset($_GET["mp3"])) {
if ($_GET["mp3"]=="false") {
echo "
".__("Not an MP3 file or an upload problem.")."
";
}
}
if (isset($_GET["photo"])) {
if ($_GET["photo"]=="false") {
echo "
".__("Not a photo file or an upload problem.")."
";
}
}
?>
postLimit;
if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
$from = (($page_num-1) * $limit);
} else {
$from = 0;
}
$rs = $tumble->getPosts($limit, $from);
if ($tumble->contarRegistros()>0) {
while($register = mysql_fetch_array($rs)) {
$formatedDate = date("M d", strtotime($register["date"]));
$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
$textile = new Textile();
$register["description"] = $textile->TextileThis($register["description"]);
$register["title"] = stripslashes($register["title"]);
$register["description"] = stripslashes($register["description"]);
switch ($tumble->getType($register["id_post"])) {
case "1":
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_regular_post");
$template->mostrarPlantilla();
break;
case "2":
$fileName = "../uploads/".getFileName($register["url"]);
$x = @getimagesize($fileName);
if ($x[0] > 100) {
$photoPath = $conf->urlGelato."/classes/imgsize.php?w=100&img=".$register["url"];
} else {
$photoPath = $register["url"];
}
$effect = " style=\"cursor: pointer;\" onclick=\"Lightbox.show('".$register["url"]."', '".strip_tags($register["description"])."');\" ";
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_photo");
$template->mostrarPlantilla();
break;
case "3":
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_quote");
$template->mostrarPlantilla();
break;
case "4":
if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
}
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_url");
$template->mostrarPlantilla();
break;
case "5":
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_conversation");
$template->mostrarPlantilla();
break;
case "6":
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_video");
$template->mostrarPlantilla();
break;
case "7":
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
$output = array($register["id_post"], $formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_mp3");
$template->mostrarPlantilla();
break;
}
}
$p = new pagination;
$p->items($tumble->getPostsNumber());
$p->limit($limit);
$p->currentPage(isset($page_num) ? $page_num : 1);
$p->show();
} else {
$template->renderizaEtiqueta(__("No posts in this tumblelog."), "div","error");
}
?>
urlGelato."/login.php");
}
?>