* A lot of changes on Control Panel (Theme Engine).

master
Victor De la Rocha 2008-10-28 01:06:56 +00:00
parent 3471ee1993
commit c60cdef066
23 changed files with 283 additions and 846 deletions

View File

@ -9,31 +9,41 @@ if(!defined('entry'))define('entry', true);
gelato CMS is a free software licensed under the GPL 2.0 gelato CMS is a free software licensed under the GPL 2.0
Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com> Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
=========================== */ =========================== */
?> ?>
<?php <?php
require('../entry.php'); require('../entry.php');
global $user, $conf, $tumble; global $user, $conf, $tumble;
$template = new plantillas("admin"); #$template = new plantillas("admin");
$theme = new themes;
$isEdition = (isset($_GET["edit"])) ? true : false; $isEdition = (isset($_GET["edit"])) ? true : false;
$postId = ($isEdition) ? $_GET["edit"] : NULL; $postId = ($isEdition) ? $_GET["edit"] : NULL;
if ($user->isAuthenticated()) { $theme->set('isEdition',$isEdition);
$theme->set('postId',$postId);
$theme->set('pagination','');
if (get_magic_quotes_gpc()) {
foreach($_GET as $k=>$get){
$_GET[$k]=stripslashes($get);
}
}
if ($user->isAuthenticated()) {
if (isset($_GET["delete"])) { if (isset($_GET["delete"])) {
$tumble->deletePost($_GET['delete']); $tumble->deletePost($_GET['delete']);
header("Location: index.php?deleted=true"); header("Location: index.php?deleted=true");
die(); die();
} }
if(isset($_POST["btnAdd"])) { if(isset($_POST["btnAdd"])){
unset($_POST["btnAdd"]); unset($_POST["btnAdd"]);
$_POST['type'] = type2Number($_POST['type']);
if ($_POST["type"]=="2") { // is Photo type if ($_POST["type"]=="2") { // is Photo type
if (isset($_POST["url"]) && $_POST["url"]!="") { if (isset($_POST["url"]) && $_POST["url"]!="") {
$photoName = getFileName($_POST["url"]); $photoName = getFileName($_POST["url"]);
if (!$tumble->savePhoto($_POST["url"])) { if (!$tumble->savePhoto($_POST["url"])) {
header("Location: ".$conf->urlGelato."/admin/index.php?photo=false"); header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
@ -41,15 +51,15 @@ if ($user->isAuthenticated()) {
} }
$_POST["url"] = "../uploads/".sanitizeName($photoName); $_POST["url"] = "../uploads/".sanitizeName($photoName);
} }
if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) { if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']); $_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
} }
unset($_POST["photo"]); unset($_POST["photo"]);
unset($_POST["MAX_FILE_SIZE"]); unset($_POST["MAX_FILE_SIZE"]);
} }
if ($_POST["type"]=="7") { // is MP3 type if ($_POST["type"]=="7") { // is MP3 type
set_time_limit(300); set_time_limit(300);
$mp3Name = getFileName($_POST["url"]); $mp3Name = getFileName($_POST["url"]);
@ -60,297 +70,219 @@ if ($user->isAuthenticated()) {
if (isMP3($remoteFileName)) { if (isMP3($remoteFileName)) {
$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name; $_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
} }
} }
if (!get_magic_quotes_gpc()) { if (!get_magic_quotes_gpc()) {
$_POST["title"] = addslashes($_POST["title"]); $_POST["title"] = addslashes($_POST["title"]);
$_POST["description"] = addslashes($_POST["description"]); $_POST["description"] = addslashes($_POST["description"]);
} }
/* /*
$textile = new Textile(); $textile = new Textile();
$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true)); $_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true));
$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"])); $_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
*/ */
$_POST["title"] = removeBadTags($_POST["title"],true); $_POST["title"] = removeBadTags($_POST["title"],true);
$_POST["description"] = removeBadTags($_POST["description"]); $_POST["description"] = removeBadTags($_POST["description"]);
if (isset($_POST["id_post"])) { if (isset($_POST["id_post"]) and is_numeric($_POST["id_post"]) and $_POST["id_post"]>0) {
$tumble->modifyPost($_POST, $_POST["id_post"]); $tumble->modifyPost($_POST, $_POST["id_post"]);
} else { } else {
if ($tumble->addPost($_POST)) { if ($tumble->addPost($_POST)) {
header("Location: ".$conf->urlGelato."/admin/index.php?added=true"); header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
die(); die();
} else { } else {
header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$this->merror); header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$tumble->merror);
die(); die();
} }
} }
} else { } else {
if ($isEdition) { if ($isEdition) {
$post = $tumble->getPost($postId); $post = $tumble->getPost($postId);
} }
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="gelato cms <?php echo version();?>" />
<title>gelato :: <?php echo __("control panel")?></title>
<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/lightbox.js"></script>
<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.validate.min.js"></script>
<script language="javascript" type="text/javascript">
$(document).ready(function(){
$("#divMessages").fadeOut(5000,function(){
$("#divMessages").css({display:"none"});
});
});
Lightbox.fileLoadingImage = "css/images/loading.gif";
Lightbox.fileBottomNavCloseImage = "css/images/closelabel.gif";
</script>
<?php
if($conf->richText) {
?>
<script src="<?php echo $conf->urlGelato;?>/admin/scripts/nicEdit.js" type="text/javascript"></script>
<script type="text/javascript">
bkLib.onDomLoaded(nicEditors.allTextAreas);
</script>
<?php
} else {
?>
<script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/jquery.markitup.pack.js"></script>
<script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/set.js"></script>
<link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/skins/simple/style.css" />
<link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/style.css" />
<script type="text/javascript" >
$(document).ready(function() {
$("#description").markItUp(my_html);
});
</script>
<?php
}
?>
<style type="text/css" media="screen">
@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
@import "<?php echo $conf->urlGelato;?>/admin/css/lightbox.css";
</style>
</head>
<body>
<div id="div-process" style="display:none;"><?php echo __("Processing request&hellip;")?></div>
<div id="cont">
<div id="head">
<h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
<ul id="nav">
<li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("View Tumblelog")?></a></li>
<li><a href="close.php" title="Log off" ><?php echo __("Log out")?></a></li>
</ul>
</div>
<div id="main">
<div class="box">
<ul class="menu">
<h3><?php echo __("New Post")?></h3>
<li<?php echo (isset($_GET["new"]) && $_GET["new"]=="conversation") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=conversation"><img src="css/images/comments.png" alt="New chat" /> <?php echo __("Chat")?></a></li>
<li<?php echo (isset($_GET["new"]) && $_GET["new"]=="quote") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=quote"><img src="css/images/quote.png" alt="New qoute" /> <?php echo __("Quote")?></a></li>
<li<?php echo (isset($_GET["new"]) && $_GET["new"]=="url") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=url"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li>
<li<?php echo (isset($_GET["new"]) && $_GET["new"]=="mp3") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=mp3"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li>
<li<?php echo (isset($_GET["new"]) && $_GET["new"]=="video") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=video"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li>
<li<?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=photo"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li>
<li<?php echo (isset($_GET["new"]) && $_GET["new"]=="post") ? " class=\"selected\"" : ""; echo (!isset($_GET["new"])) ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=post"><img src="css/images/page.png" alt="New post" /> <?php echo __("Regular")?></a></li>
</ul>
<p>&nbsp;</p>
<?php
if($conf->check_version){
$present = version();
$lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt");
if ($present < $lastest) {
echo "<div class=\"information\" id=\"update\">".__("A new gelato version has been released and is ready <a href=\"http://www.gelatocms.com/\">for download</a>.")."</div><br />";
}
}
if (isset($_GET["deleted"])) {
if ($_GET["deleted"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The post has been eliminated successfully.")."</div>";
}
}
if (isset($_GET["modified"])) {
if ($_GET["modified"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The post has been modified successfully.")."</div>";
}
}
if (isset($_GET["added"])) {
if ($_GET["added"]=="true") {
echo "<div class=\"exito\" id=\"divMessages\">".__("The post has been added successfully.")."</div>";
}
}
if (isset($_GET["error"])) {
if ($_GET["error"]==2) {
echo "<div class=\"error\"><strong>".__("Error on the database server:")." </strong>".$_GET["des"]."</div>";
}
}
if (isset($_GET["mp3"])) {
if ($_GET["mp3"]=="false") {
echo "<div class=\"error\" id=\"divMessages\">".__("Not an MP3 file or an upload problem.")."</div>";
}
}
if (isset($_GET["photo"])) {
if ($_GET["photo"]=="false") {
echo "<div class=\"error\" id=\"divMessages\">".__("Not a photo file or an upload problem.")."</div>";
}
}
?>
<form action="index.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" id="autosave" class="newpost">
<fieldset>
<?php
if ($isEdition) {
?>
<input type="hidden" name="id_post" id="id_post" value="<?php echo $postId;?>" />
<?php
switch ($post["type"]) {
case "1":
$_GET["new"] = "post";
break;
case "2":
$_GET["new"] = "photo";
break;
case "3":
$_GET["new"] = "quote";
break;
case "4":
$_GET["new"] = "url";
break;
case "5":
$_GET["new"] = "conversation";
break;
case "6":
$_GET["new"] = "video";
break;
case "7":
$_GET["new"] = "mp3";
break;
}
}
$date = ($isEdition) ? strtotime($post["date"]) : gmmktime();
$title = ($isEdition) ? htmlspecialchars(stripslashes($post["title"])) : "";
$body = ($isEdition) ? stripslashes($post["description"]) : "";
$url = ($isEdition) ? $post["url"] : "";
if (!isset($_GET['new'])) $_GET['new'] = 'default';
switch ($_GET["new"]) {
case "post":
$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
$output = array("1", $date, $_SESSION['user_id'], $title, $body);
$template->cargarPlantilla($input, $output, "template_add_post");
$template->mostrarPlantilla();
break;
case "photo":
$url = str_replace("../", $conf->urlGelato."/", $url);
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
$output = array("2", $date, $_SESSION['user_id'], $url, $body);
$template->cargarPlantilla($input, $output, "template_add_photo");
$template->mostrarPlantilla();
break;
case "quote":
$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
$output = array("3", $date, $_SESSION['user_id'], $title, $body);
$template->cargarPlantilla($input, $output, "template_add_quote");
$template->mostrarPlantilla();
break;
case "url":
$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
$output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
$template->cargarPlantilla($input, $output, "template_add_link");
$template->mostrarPlantilla();
break;
case "conversation":
$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
$output = array("5", $date, $_SESSION['user_id'], $title, $body);
$template->cargarPlantilla($input, $output, "template_add_conversation");
$template->mostrarPlantilla();
break;
case "video":
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
$output = array("6", $date, $_SESSION['user_id'], $url, $body);
$template->cargarPlantilla($input, $output, "template_add_video");
$template->mostrarPlantilla();
break;
case "mp3":
$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
$output = array("7", $date, $_SESSION['user_id'], $url, $body);
$template->cargarPlantilla($input, $output, "template_add_mp3");
$template->mostrarPlantilla();
break;
default:
$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
$output = array("1", $date, $_SESSION['user_id'], $title, $body);
$template->cargarPlantilla($input, $output, "template_add_post");
$template->mostrarPlantilla();
break;
}
?>
<p>
<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
<?php echo __("Some HTML allowed")?>:<br />
&nbsp;&nbsp;&nbsp;&nbsp;
<code>
&lt;strong&gt; &lt;em&gt; &lt;del&gt; &lt;ul&gt; &lt;ol&gt; &lt;li&gt; &lt;a&gt;
<br />
&nbsp;&nbsp;&nbsp;&nbsp;&lt;blockquote&gt;
&lt;code&gt; &lt;pre&gt; &lt;img&gt;
</code>
<br /><br />
Bookmarklet - <a class="bookmarklet" title="<?php echo __("Drag to the Bookmarks Toolbar")?>" href="javascript:var w; setTimeout('w.focus()',100);w=window.open('<?php echo $conf->urlGelato; ?>/admin/bm.php?url='+encodeURIComponent(location.href)+'&sel='+encodeURIComponent(window.getSelection()),'bookmarklet','toolbar=0,resizable=0,status=1,width=650,height=540,dependent=yes' ); w.focus();"><?php echo __("add to gelato")?></a>
<br /><br />
</span>
</p>
<p>
<input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" />
</p>
</fieldset>
</form>
<div class="footer-box">&nbsp;</div>
</div>
<?php
if (!$isEdition) {
?>
<div class="box">
<ul class="menu manage">
<h3>Manage</h3>
<li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php"><?php echo __("Settings")?></a></li>
<li><a href="<?php echo $conf->urlGelato;?>/admin/options.php"><?php echo __("Options")?></a></li>
<li><a href="<?php echo $conf->urlGelato;?>/admin/feeds.php"><?php echo __("Feeds")?></a></li>
<li><a href="<?php echo $conf->urlGelato;?>/admin/admin.php"><?php echo __("Users")?></a></li>
<li><a href="<?php echo $conf->urlGelato;?>/admin/comments.php"><?php echo __("Comments")?></a></li>
<li class="selected"><a><?php echo __("Posts")?></a></li>
</ul>
<?php $theme->set('version',version());
if (isset($_GET["page"])) { $theme->set('conf', array(
$page_num = $_GET["page"]; 'urlGelato'=>$conf->urlGelato,
} else { 'richText'=>$conf->richText
$page_num = NULL; ));
$theme->set('new',isset($_GET['new'])?$_GET['new']:'');
$theme->set('information',false);
$theme->set('error',false);
if($conf->check_version){
$present = version();
$lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt");
if ($present < $lastest)
$theme->set('information',__("A new gelato version has been released and is ready <a href=\"http://www.gelatocms.com/\">for download</a>."));
}
$actions = array(
'deleted'=>false,
'modified'=>false,
'added'=>false
);
if(isset($_GET['deleted']) and $_GET['deleted']=='true'){
$theme->set('exito',__("The post has been eliminated successfully."));
$actions['deleted'] = true;
}
if(isset($_GET["modified"]) and $_GET["modified"]==true){
$theme->set('exito',__("The post has been modified successfully."));
$actions['modified']=true;
}
if(isset($_GET["added"]) and $_GET["added"]==true) {
$theme->set('exito',__("The post has been added successfully."));
$actions['added']=true;
}
$theme->set('action',$actions);
if (isset($_GET["error"]) and $_GET["error"]==2)
$theme->set('error',__("Error on the database server:")." </strong>".$_GET["des"]);
if (isset($_GET["mp3"]) and $_GET["mp3"]=='false')
$theme->set('error',__("Not an MP3 file or an upload problem."));
if (isset($_GET["photo"]) and $_GET["photo"]=='false')
$theme->set('error',__("Not a photo file or an upload problem."));
if ($isEdition) {
switch ($post["type"]) {
case "1": $_GET["new"] = "post"; break;
case "2": $_GET["new"] = "photo"; break;
case "3": $_GET["new"] = "quote"; break;
case "4": $_GET["new"] = "url"; break;
case "5": $_GET["new"] = "conversation"; break;
case "6": $_GET["new"] = "video"; break;
case "7": $_GET["new"] = "mp3"; break;
}
}
$date = ($isEdition) ? strtotime($post["date"]) : gmmktime();
$title = ($isEdition) ? htmlspecialchars(stripslashes($post["title"])) : "";
$body = ($isEdition) ? stripslashes($post["description"]) : "";
$url = ($isEdition) ? $post["url"] : "";
if (!isset($_GET['new'])) $_GET['new'] = 'post';
$theme->set('date',$date);
$theme->set('id_user',$_SESSION['user_id']);
$theme->set('type',$_GET["new"]);
$theme->set('editBody',$body);
switch ($_GET["new"]) {
case "post":
$theme->set('editTitle',$title);
break;
case "photo":
$url = str_replace("../", $conf->urlGelato."/", $url);
$theme->set('editUrl',$url);
break;
case "quote":
$theme->set('editTitle',$title);
break;
case "url":
$theme->set('editTitle',$title);
$theme->set('editUrl',$url);
break;
case "conversation":
$theme->set('editTitle',$title);
break;
case "video":
$theme->set('editUrl',$url);
break;
case "mp3":
$theme->set('editUrl',$url);
break;
}
if (!$isEdition){
if (isset($_GET["page"]))
$page_num = $_GET["page"];
else
$page_num = NULL;
$limit=$conf->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);
$theme->set('Posts_Number',$tumble->contarRegistros());
$rows = array();
if ($tumble->contarRegistros()>0) {
while($register = mysql_fetch_array($rs)) {
$row['postType'] = type2Text($tumble->getType($register["id_post"]));
$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
$register["title"] = stripslashes($register["title"]);
$register["description"] = stripslashes($register["description"]);
$row['Id_Post'] = $register["id_post"];
$row['Date_Added'] = $formatedDate;
$row['Permalink'] = $permalink;
switch ($tumble->getType($register["id_post"])) {
case "1":
$row['Title'] = $register["title"];
$row['Body'] = $register["description"];
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 = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
$row['PhotoURL'] = $photoPath;
$row['PhotoAlt'] = strip_tags($register["description"]);
$row['Caption'] = $register["description"];
$row['Effect'] = $effect;
break;
case "3":
$row['Quote'] = $register["description"];
$row['Source'] = $register["title"];
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"];
$row['URL'] = $register["url"];
$row['Name'] = $register["title"];
$row['Description'] = $register["description"];
break;
case "5":
$row['Title'] = $register["title"];
$row['Conversation'] = $tumble->formatConversation($register["description"]);
break;
case "6":
$row['Video'] = $tumble->getVideoPlayer($register["url"]);
$row['Caption'] = $register["description"];
break;
case "7":
$row['Mp3'] = $tumble->getMp3Player($register["url"]);
$row['Caption'] = $register["description"];
break;
} }
<<<<<<< .mine
$rows[] = $row;
}
=======
$limit=$conf->postLimit; $limit=$conf->postLimit;
@ -387,84 +319,22 @@ if ($user->isAuthenticated()) {
} else { } else {
$photoPath = $register["url"]; $photoPath = $register["url"];
} }
>>>>>>> .r241
$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\""; $p = new pagination;
$p->items($tumble->getPostsNumber());
$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}"); $p->limit($limit);
$output = array($register["id_post"], $formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato); $p->currentPage(isset($page_num) ? $page_num : 1);
$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; $theme->set('pagination',$p->getPagination());
$p->items($tumble->getPostsNumber()); $theme->set('rows',$rows);
$p->limit($limit); }else{
$p->currentPage(isset($page_num) ? $page_num : 1); $theme->set('error',__("No posts in this tumblelog."));
$p->show();
} else {
$template->renderizaEtiqueta(__("No posts in this tumblelog."), "div","error");
}
?>
<div class="footer-box">&nbsp;</div>
</div>
</div>
<?php
} }
?> }
<div id="foot"> $theme->display(Absolute_Path.'admin/themes/admin/index.htm');
<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
</div>
</div>
</body>
</html>
<?php
} }
} else { } else {
header("Location: ".$conf->urlGelato."/login.php"); header("Location: ".$conf->urlGelato."/login.php");
} }
?> ?>

View File

@ -1,35 +0,0 @@
<div>
<label for="title">Title <span class="option">(optional)</span></label><br />
<input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
</div>
<div>
<label for="description">Conversation</label>
<div style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
<span style="font-weight: bold;">Example</span><br>
<span style="font-style: italic;">
Geek: Wow an open source tumblelog CMS!!.<br>
Normal: Tumble... what??<br>
Geek: Read the wikipedia!!
</span>
</div>
<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
</div>
<input type="hidden" name="url" id="url" value="" />
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$("#autosave").validate({
rules: {
description: "required"
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.parent().children("label"))
}
});
</script>

View File

@ -1,38 +0,0 @@
<div>
<label for="title">Name <span class="option">(optional)</span></label>
<br /><input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
</div>
<div>
<label for="url">URL</label>
<br /><input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
</div>
<div>
<div id="add_link_description" style="margin-top:5px;">
<a class="linkFrm" href="#" onclick="document.getElementById('link_description').style.display = ''; document.getElementById('add_link_description').style.display = 'none'; return false;" style="font-size:11px;">Add a description</a><br /><br />
</div>
<div id="link_description" style="display:none;">
<label for="description">Description</label><br />
<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
</div>
</div>
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$("#autosave").validate({
rules: {
url: {
required: true,
url: true
}
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.prev())
}
});
</script>

View File

@ -1,35 +0,0 @@
<div>
<label for="url">MP3 URL</label>
<br /><input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
This is the MP3 file URL or a GoEar URL or an Odeo URL.<br>
<span style="font-size: 10px; font-weight: normal;">(ie. http://www.goear.com/listen.php?v=c0a2c85)</span>
</div>
</div>
<div>
<label for="description">Caption <span class="option">(optional)</span></label><br />
<textarea rows="12" cols="84" name="description" id="description" tabindex="2">{editBody}</textarea>
</div>
<input type="hidden" name="title" id="title" value="" />
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$("#autosave").validate({
rules: {
url: {
required: true,
url: true
}
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.prev())
}
});
</script>

View File

@ -1,76 +0,0 @@
<div id="photo_upload">
<label for="description">Photo</label>
<br /><input type="file" name="photo" id="photo" accept="image/gif,image/jpeg,image/jpg,image/png"/>
<div style="font-size:11px; color:#666; margin-top:5px;">
Supports JPEG, GIF and PNG.&nbsp; <strong>Max size is 10 MB.</strong>
</div>
<div style="font-size:11px; color:#666; margin-top:5px;">
<a href="#" class="linkFrm">Use a URL instead</a>
</div>
</div>
<div id="photo_url">
<label for="description">Photo URL</label>
<br /><input class="input-text" type="text" name="url" id="url" size="80" value="{editUrl}" />
<div style="font-size:11px; color:#666; margin-top:5px;">
<a href="#" class="linkFrm">Use a upload form instead</a>
</div>
</div>
<div>
<label for="description" style="display:block;">Caption <span class="option">(optional)</span></label>
<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
</div>
<input type="hidden" name="title" id="title" value="" />
<input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$('#photo_url').css('display','none');
$("#autosave").validate({
rules: {
photo: {
required: function() {
return ($('#photo_upload').css('display')!= 'none') ? true : false;
},
accept: "(jpe?g|gif|png)"
},
url: {
required: function() {
return ($('#photo_url').css('display')!= 'none') ? true : false;
},
url: true
}
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.prev())
}
});
$("#photo_upload a.linkFrm").click( function() {
$('#photo_upload').css('display','none');
$('#photo_url').css('display','block');
$('#photo').val('');
return false;
}
);
$("#photo_url a.linkFrm").click( function() {
$('#photo_url').css('display','none');
$('#photo_upload').css('display','block');
$('#url').val('');
return false;
}
);
</script>

View File

@ -1,66 +0,0 @@
<div id="photo_upload">
</div>
<div id="photo_url">
<label for="description">Photo URL</label>
<br /><input class="input-text" type="text" name="url" id="url" size="80" value="{editUrl}" />
</div>
<div>
<label for="description" style="display:block;">Caption <span class="option">(optional)</span></label>
<br /><textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
</div>
<input type="hidden" name="title" id="title" value="" />
<input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$('#photo_upload').css('display','none');
$("#autosave").validate({
rules: {
photo: {
required: function() {
return ($('#photo_upload').css('display')!= 'none') ? true : false;
},
accept: "(jpe?g|gif|png)"
},
url: {
required: function() {
return ($('#photo_url').css('display')!= 'none') ? true : false;
},
url: true
}
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.prev())
}
});
$("#photo_upload a.linkFrm").click( function() {
$('#photo_upload').css('display','none');
$('#photo_url').css('display','block');
$('#photo').val('');
return false;
}
);
$("#photo_url a.linkFrm").click( function() {
$('#photo_url').css('display','none');
$('#photo_upload').css('display','block');
$('#url').val('');
return false;
}
);
</script>

View File

@ -1,27 +0,0 @@
<div>
<label for="title" style="display:block;">Title <span class="option">(optional)</span></label>
<br /><input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
</div>
<div>
<label for="description" style="display:block;">Body</label>
<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
</div>
<input type="hidden" name="url" id="url" value="" />
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$("#autosave").validate({
rules: {
description: "required"
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.prev())
}
});
</script>

View File

@ -1,29 +0,0 @@
<div>
<label for="description">Quote</label>
<br /><textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
</div>
<div>
<label for="title">Source <span class="option">(optional)</span></label>
<br /><input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
</div>
<input type="hidden" name="url" id="url" value="" />
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$("#autosave").validate({
rules: {
description: "required"
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.prev())
}
});
</script>

View File

@ -1,36 +0,0 @@
<div>
<label for="url">Video URL</label>
<br /><input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
This is the URL from the video sites YouTube, Vimeo, Yahoo, Daily Motion <br />
or even an Slide Share Presentation.<br />
<span style="font-size: 10px; font-weight: normal;">(ie. http://youtube.com/watch?v=HcBFLN9cli0)</span>
</div>
</div>
<div>
<label for="description">Caption <span class="option">(optional)</span></label><br />
<textarea rows="12" cols="84" name="description" id="description" tabindex="2">{editBody}</textarea>
</div>
<input type="hidden" name="title" id="title" value="" />
<input type="hidden" name="type" id="type" value="{type}" />
<input type="hidden" name="date" id="date" value="{date}" />
<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
<script>
$("#autosave").validate({
rules: {
url: {
required: true,
url: true
}
},
errorElement: "span",
errorClass: "validate_span",
errorPlacement: function(label, element) {
label.prependTo(element.prev())
}
});
</script>

View File

@ -1,8 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/comments.php?edit={Id_Comment}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/comments.php?delete={Id_Comment}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Comment_Author}</p>
</div>
<div class="post">
<p>{Comment}</p>
</div>
</div>

View File

@ -1,28 +0,0 @@
<form action="{Form_Action}" method="post" name="commentForm" id="commentForm" class="newpost">
<fieldset>
<p>
<label for="username">Name</label>
<input class="txt" name="username" id="username" value="{User}" size="22" tabindex="1" type="text" />
</p>
<p>
<label for="email">E-mail</label>
<input class="txt" name="email" id="email" value="{Email}" size="22" tabindex="2" type="text" />
</p>
<p>
<label for="web">Website</label>
<input class="txt" name="web" id="web" value="{Web}" size="22" tabindex="3" type="text" />
</p>
<p>
<label for="description">Body</label><br />
<textarea name="content" id="content" cols="50" rows="10" tabindex="4">{Comment}</textarea>
</p>
<p>
<input type="submit" value="Modify comment" name="btnAdd" id="btnAdd" tabindex="5" />
</p>
<p>
<input name="id_post" id="id_post" value="{Id_Post}" type="hidden" />
<input name="comment_date" id="comment_date" value="{Date_Added}" type="hidden" />
<input name="id_comment" id="id_comment" value="{Id_Comment}" type="hidden" />
</p>
</fieldset>
</form>

View File

@ -1,9 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Date_Added}</p>
</div>
<div class="post">
<span class="option">{Title}</span>
<div class="conversation">{Conversation}</div>
</div>
</div>

View File

@ -1,9 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Date_Added}</p>
</div>
<div class="post">
<span class="option">{Caption}</span>
<p><img src="{URL_Tumble}/admin/css/images/music.png" alt="Play song" />&nbsp;<a href="{Permalink}">Play</a></p>
</div>
</div>

View File

@ -1,9 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Date_Added}</p>
</div>
<div class="post">
<span class="option">{Caption}</span>
<p><a {Effect}><img src="{PhotoURL}" alt="{PhotoAlt}" /></a></a></p>
</div>
</div>

View File

@ -1,9 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Date_Added}</p>
</div>
<div class="post">
<span class="option">&mdash; {Source}</span>
<p><big class="quote"><a href="{Permalink}">&#147;</a></big> {Quote}</p>
</div>
</div>

View File

@ -1,9 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Date_Added}</p>
</div>
<div class="post">
<span class="option"><a href="{Permalink}">{Title}</a></span>
<p>{Body}</p>
</div>
</div>

View File

@ -1,9 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Date_Added}</p>
</div>
<div class="post">
<span class="option">&#187; <a href="{URL}">{Name}</a></span>
<p>{Description}</p>
</div>
</div>

View File

@ -1,9 +0,0 @@
<div class="entry">
<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
<p>{Date_Added}</p>
</div>
<div class="post">
<span class="option">{Caption}</span>
<p><img src="{URL_Tumble}/admin/css/images/film.png" alt="Watch video" />&nbsp;<a href="{Permalink}">Watch</a></p>
</div>
</div>

View File

@ -1,5 +1,5 @@
<?php <?php
if(!defined('entry') || !entry) die('Not a valid page'); if(!defined('entry') || !entry) die('Not a valid page');
/* =========================== /* ===========================
gelato CMS - A PHP based tumblelog CMS gelato CMS - A PHP based tumblelog CMS
@ -17,12 +17,12 @@ require_once("functions.php");
class gelato extends Conexion_Mysql { class gelato extends Conexion_Mysql {
var $conf; var $conf;
function gelato() { function gelato() {
parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password); parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
$this->conf = new configuration(); $this->conf = new configuration();
} }
function saveSettings($fieldsArray) { function saveSettings($fieldsArray) {
if ($this->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) { if ($this->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) {
header("Location: ".$this->conf->urlGelato."/admin/settings.php?modified=true"); header("Location: ".$this->conf->urlGelato."/admin/settings.php?modified=true");
@ -32,24 +32,24 @@ class gelato extends Conexion_Mysql {
die(); die();
} }
} }
function saveOption($value, $name) { function saveOption($value, $name) {
$sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1"; $sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1";
if ($this->ejecutarConsulta($sqlStr)) { if ($this->ejecutarConsulta($sqlStr)) {
return true; return true;
} else { } else {
return true; return true;
} }
} }
function addPost($fieldsArray) { function addPost($fieldsArray) {
if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) { if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
function modifyPost($fieldsArray, $id_post) { function modifyPost($fieldsArray, $id_post) {
if ($this->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) { if ($this->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) {
header("Location: ".$this->conf->urlGelato."/admin/index.php?modified=true"); header("Location: ".$this->conf->urlGelato."/admin/index.php?modified=true");
@ -59,31 +59,31 @@ class gelato extends Conexion_Mysql {
die(); die();
} }
} }
function deletePost($idPost) { function deletePost($idPost) {
$this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost); $this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost);
} }
function getPosts($limit="10", $from="0") { function getPosts($limit="10", $from="0") {
$sqlStr = "select * from ".$this->conf->tablePrefix."data ORDER BY date DESC LIMIT $from,$limit"; $sqlStr = "select * from ".$this->conf->tablePrefix."data ORDER BY date DESC LIMIT $from,$limit";
$this->ejecutarConsulta($sqlStr); $this->ejecutarConsulta($sqlStr);
return $this->mid_consulta; return $this->mid_consulta;
} }
function getPost($id="") { function getPost($id="") {
$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id); $this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
return mysql_fetch_array($this->mid_consulta); return mysql_fetch_array($this->mid_consulta);
} }
function getPostsNumber() { function getPostsNumber() {
$this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data"); $this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
$row = mysql_fetch_assoc($this->mid_consulta); $row = mysql_fetch_assoc($this->mid_consulta);
return $row['total']; return $row['total'];
} }
function getType($id) { function getType($id) {
if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) { if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
if ($this->contarRegistros()>0) { if ($this->contarRegistros()>0) {
while($registro = mysql_fetch_array($this->mid_consulta)) { while($registro = mysql_fetch_array($this->mid_consulta)) {
return $registro[0]; return $registro[0];
} }
@ -92,55 +92,55 @@ class gelato extends Conexion_Mysql {
return "0"; return "0";
} }
} }
function formatConversation($text) { function formatConversation($text) {
$formatedText = ""; $formatedText = "";
$odd=true; $odd=true;
$lines = explode("\n", $text); $lines = explode("\n", $text);
$formatedText .= "<ul>\n"; $formatedText .= "<ul>\n";
foreach ($lines as $line) { foreach ($lines as $line) {
$pos = strpos($line, ":") + 1; $pos = strpos($line, ":") + 1;
$label = substr($line, 0, $pos); $label = substr($line, 0, $pos);
$desc = substr($line, $pos, strlen($line)); $desc = substr($line, $pos, strlen($line));
if ($odd) { if ($odd) {
$cssClass = "odd"; $cssClass = "odd";
} else { } else {
$cssClass = "even"; $cssClass = "even";
} }
$odd=!$odd; $odd=!$odd;
$formatedText .= " <li class=\"".$cssClass."\">\n"; $formatedText .= " <li class=\"".$cssClass."\">\n";
$formatedText .= " <span class=\"label\">".$label."</span>\n"; $formatedText .= " <span class=\"label\">".$label."</span>\n";
$formatedText .= " ".$desc."\n"; $formatedText .= " ".$desc."\n";
$formatedText .= " </li>\n"; $formatedText .= " </li>\n";
} }
$formatedText .= "</ul>\n"; $formatedText .= "</ul>\n";
return $formatedText; return $formatedText;
} }
function formatApiConversation($text) { function formatApiConversation($text) {
$formatedText = ""; $formatedText = "";
$lines = explode("\n", $text); $lines = explode("\n", $text);
foreach ($lines as $line) { foreach ($lines as $line) {
$pos = strpos($line, ":") + 1; $pos = strpos($line, ":") + 1;
$name = substr($line, 0, $pos-1); $name = substr($line, 0, $pos-1);
$label = substr($line, 0, $pos); $label = substr($line, 0, $pos);
$desc = substr($line, $pos, strlen($line)); $desc = substr($line, $pos, strlen($line));
$formatedText .= "<conversation-line name=\"".$name."\" label=\"".$label."\">".$desc."</conversation-line>\n"; $formatedText .= "<conversation-line name=\"".$name."\" label=\"".$label."\">".$desc."</conversation-line>\n";
} }
return $formatedText; return $formatedText;
} }
function saveMP3($remoteFileName) { function saveMP3($remoteFileName) {
if (getMP3File($remoteFileName)) { if (getMP3File($remoteFileName)) {
return true; return true;
@ -148,15 +148,15 @@ class gelato extends Conexion_Mysql {
return false; return false;
} }
} }
function savePhoto($remoteFileName) { function savePhoto($remoteFileName) {
if (getPhotoFile($remoteFileName)) { if (getPhotoFile($remoteFileName)) {
return true; return true;
} else { } else {
return false; return false;
} }
} }
function getVideoPlayer($url) { function getVideoPlayer($url) {
if (isYoutubeVideo($url)) { if (isYoutubeVideo($url)) {
$id_video = getYoutubeVideoUrl($url); $id_video = getYoutubeVideoUrl($url);
@ -178,7 +178,7 @@ class gelato extends Conexion_Mysql {
return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\"><param name=\"movie\" value=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\"><param name=\"movie\" value=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} else { } else {
return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video or SlideShare)"; return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video or SlideShare)";
} }
} }
function getMp3Player($url) { function getMp3Player($url) {
if (isMP3($url)) { if (isMP3($url)) {
@ -190,7 +190,7 @@ class gelato extends Conexion_Mysql {
return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://media.odeo.com/flash/odeo_player.swf?v=3\" width=\"366\" height=\"75\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"type=audio&amp;id=".getOdeoCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n"; return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://media.odeo.com/flash/odeo_player.swf?v=3\" width=\"366\" height=\"75\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"type=audio&amp;id=".getOdeoCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
} else { } else {
return "This URL is not an MP3 file."; return "This URL is not an MP3 file.";
} }
} }
function getPermalink($post_id){ function getPermalink($post_id){
@ -200,5 +200,13 @@ class gelato extends Conexion_Mysql {
$out .= $post_id.$strEnd; $out .= $post_id.$strEnd;
return $out; return $out;
} }
}
?> function getPermalink($post_id){
$strEnd = ($this->conf->urlFriendly) ? "/" : "";
$out = $this->conf->urlGelato;
$out .= ($this->conf->urlFriendly) ? "/post/" : "/index.php?post=";
$out .= $post_id.$strEnd;
return $out;
}
}
?>

View File

@ -122,12 +122,12 @@ class Conexion_Mysql {
$sqlValues .= "'$valor',"; $sqlValues .= "'$valor',";
} }
} }
$cols = rtrim($cols, ',').')'; $cols = rtrim($cols, ',').')';
$sqlValues = rtrim($sqlValues, ',').')'; $sqlValues = rtrim($sqlValues, ',').')';
// inserta los valores en la DB // inserta los valores en la DB
$sql = "INSERT INTO $tabla $cols VALUES $sqlValues"; $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
return $this->ejecutarConsulta($sql); return $this->ejecutarConsulta($sql);
} }
/** /**
@ -291,4 +291,4 @@ class Conexion_Mysql {
return $value; return $value;
} }
} //fin de la Clase conexion_mysql } //fin de la Clase conexion_mysql
?> ?>

View File

@ -110,4 +110,4 @@ class themes{
} }
} }
} }
?> ?>

View File

@ -81,6 +81,6 @@ if($installed){
$feeds = new feeds(); $feeds = new feeds();
$feeds->updateFeeds(); $feeds->updateFeeds();
unset($feeds); unset($feeds);
} }
?> ?>

View File

@ -107,7 +107,7 @@ $theme = new themes;
while($register = mysql_fetch_assoc($rs)) { while($register = mysql_fetch_assoc($rs)) {
$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; } if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
$permalink = $tumble->getPermalink($register["id_post"]); $permalink = $tumble->getPermalink($register["id_post"]);
$conversation = $register["description"]; $conversation = $register["description"];