* Added themes class from Flavor (Converted to PHP4).

* Changed plantillas.class.php by themes.class.php on public zone.
* Added new tumblr template in only one file.
* deleted parts of old tumblr theme.
master
Victor De la Rocha 2008-10-25 09:39:45 +00:00
parent c7fd8be234
commit d4f4e72049
18 changed files with 462 additions and 400 deletions

View File

@ -76,6 +76,11 @@ Author URI: http://www.mis-algoritmos.com
if($this->calculate()) if($this->calculate())
echo "<div class=\"$this->className\">$this->pagination</div>"; echo "<div class=\"$this->className\">$this->pagination</div>";
} }
function getPagination(){
if(!$this->calculate)
if($this->calculate())
return "<div class=\"$this->className\">$this->pagination</div>";
}
function get_pagenum_link($id){ function get_pagenum_link($id){
//if(strpos($this->target,'?')===false) //if(strpos($this->target,'?')===false)
if($this->urlF) if($this->urlF)
@ -97,7 +102,7 @@ Author URI: http://www.mis-algoritmos.com
echo "Especificaste un wildcard para sustituir, pero no existe en el target<br />"; echo "Especificaste un wildcard para sustituir, pero no existe en el target<br />";
$error = true; $error = true;
}elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){ }elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){
echo "Es necesario especificar en el target el comodin % para sustituir el número de página<br />"; echo "Es necesario especificar en el target el comodin % para sustituir el n<EFBFBD>mero de p<>gina<br />";
$error = true; $error = true;
} }
if($this->total_pages == null){ if($this->total_pages == null){

114
classes/themes.class.php Normal file
View File

@ -0,0 +1,114 @@
<?php
/*
Class name: Themes
Class autor: Victor De la Rocha http//mis-algoritmos.com/themes-class
Email: vyk2rr [at] gmail [dot] com
*/
class themes{
var $registry;
var $path;
var $l10n;
var $output;
var $vars=array(); //variable para apilar las variables que se asignan a la plantilla
function themes(){
#$this->l10n = l10n::getInstance();
}
function set($name, $value){
$this->vars[$name] = $value;
return true;
}
function remove($name) {
unset($this->vars[$name]);
return true;
}
//obtiene el contenido del tema ya con todos los valores sutituidos en las variables.
function fetch($file){
$this->exec($file);
return $this->output;
}
//muestra el contenido del tema ya con todos los valroes sustituidos en las variables.
function display($file){
$this->exec($file);
echo $this->output;
}
//corre el proceso de sustitucion de valores en las variables del theme y retorna todo en la variable $this->output para ser devuelto por: fetch o display
function exec($file){
$this->file = $file;
$output = file_get_contents($file);
$this->output = $output;
$this->registrar_vars();
$this->__();
$this->eval_control_structures();
//evaluate All as PHP code
ob_start();eval($this->output);
$this->output = ob_get_clean();
}
function eval_control_structures(){
//finding IFs sentences and converting to php code
$this->output = "echo \"".addslashes($this->output)."\";";
$this->output = preg_replace_callback("/{if ([^}]+)}/",create_function('$arr','return "\";if(".stripslashes($arr[1])."){echo\"";'),$this->output);
$this->output = preg_replace("/{else}/","\";}else{echo\"",$this->output);
$this->output = preg_replace_callback("/{elseif ([^}]+)}/",create_function('$arr','return "\";}elseif(".stripslashes($arr[1])."){echo\"";'),$this->output);
$this->output = preg_replace("/{\/if}/","\";} echo \"",$this->output);
//finding FOREACHs or BLOCKs sentences and converting to php code
$this->output = preg_replace_callback("/{block ([^}]+) as ([^}]+)=>[\$]([^}]+)}/",create_function('$arr','return "\";foreach(".stripslashes($arr[1])." as ".stripslashes($arr[2])."=>\$this->vars[\'".stripslashes($arr[3])."\']){echo\"";'),$this->output);
$this->output = preg_replace_callback("/{block ([^}]+) as ([^}]+)}/",create_function('$arr','return "\";foreach(".stripslashes($arr[1])." as ".stripslashes($arr[2])."){echo\"";'),$this->output);
$this->output = preg_replace("/{\/block}/","\";} echo \"",$this->output);
//Converting the $this->vars[\'variable\'] format to {$this->vars['variable']}
$this->output = preg_replace("/[\$]this->vars\[\\\'([^ \.\\\]+)\\\'\]\[\\\'([^ \.\\\]+)\\\'\]/","{\$this->vars['$1']['$2']}",$this->output);
$this->output = preg_replace("/[\$]this->vars\[\\\'([^ \.\\\]+)\\\'\]/","{\$this->vars['$1']}",$this->output);
//Converting the {__(\'word\')} format to {__('word')}
#$this->output = preg_replace("/[\$]this->vars\[\\\'([^ \.\\\]+)\\\'\]/","{\$this->vars['$1']}",$this->output);
}
//sustituye las variables en el output del template
function registrar_vars(){
foreach($this->vars as $k=>$v){
//pre($this->vars);
if(is_array($v)){
//Si es un arreglo, se intenta procesar un nivel mas adentro para sustituir en el theme por lo que tenga: nombredearreglo.dato
foreach($v as $_k=>$_v)
if(!is_array($_v))
$this->output = str_replace('{'.$k.'.'.$_k.'}',$_v,$this->output);
}else{
// sustituimos directamente las variables {$variable}
$this->output = str_replace('{'.$k.'}',$v,$this->output);
}
}
//replacing {$key} format by $this->vars['key']
//replacing {$array.key} format by $this->vars['array']['key']
$patrones = array(
'/{\$([^ \.}]+)}/s',
'/{\$([^ \.}]+)\.([^ \.}]+)}/s'
);
$reemplazos = array(
"\$this->vars['$1']",
"\$this->vars['$1']['$2']"
);
$this->output = preg_replace($patrones, $reemplazos, $this->output);
}
//Utiliza gettext
function __(){
$patron = "/{__\((?:'|\")([^\)]+?)(?:'|\")\)}/s";
preg_match_all($patron,$this->output,$out);
foreach($out[1] as $k=>$v){
$this->output = str_replace("{__('$v')}",$this->l10n->__($v),$this->output);
}
}
}
?>

View File

@ -55,14 +55,15 @@ if($installed) {
require_once($configFile); require_once($configFile);
} }
require_once("classes/configuration.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'configuration.class.php');
require_once("classes/textile.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'textile.class.php');
require_once("classes/gelato.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gelato.class.php');
require_once("classes/templates.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'templates.class.php');
require_once("classes/pagination.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'themes.class.php');
require_once("classes/user.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'pagination.class.php');
require_once("classes/comments.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'user.class.php');
require_once("classes/feeds.class.php"); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'comments.class.php');
require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'feeds.class.php');
require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'mysql_connection.class.php'); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'mysql_connection.class.php');
require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'streams.class.php'); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'streams.class.php');
require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php'); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php');

209
index.php
View File

@ -17,10 +17,9 @@ if(!defined('entry'))define('entry', true);
require_once('entry.php'); require_once('entry.php');
global $user, $tumble, $conf; global $user, $tumble, $conf;
$template = new plantillas($conf->template); $theme = new themes;
// My approach to MVC // My approach to MVC
if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']); if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
if (isset($_GET["post"])) { if (isset($_GET["post"])) {
@ -36,6 +35,8 @@ $template = new plantillas($conf->template);
} }
} }
$theme->set('id_post',$id_post);
if (isset($_GET["page"])) { if (isset($_GET["page"])) {
$page_num = $_GET["page"]; $page_num = $_GET["page"];
} else { } else {
@ -76,22 +77,21 @@ $template = new plantillas($conf->template);
} }
} }
$input = array("{Gelato_includes}","{Title}", "{Page_Title}", "{Description}", "{URL_Tumble}", "{Template_name}"); $theme->set('Gelato_includes',$gelato_includes);
$output = array($gelato_includes, $conf->title, $page_title, $conf->description, $conf->urlGelato, $conf->template); $theme->set('Title',$conf->title);
$theme->set('Page_Title',$page_title);
$theme->set('Description',$conf->description);
$theme->set('URL_Tumble',$conf->urlGelato);
$theme->set('Template_name',$conf->template);
$template->cargarPlantilla($input, $output, "template_header"); $theme->set('isAuthenticated',$user->isAuthenticated());
$template->mostrarPlantilla(); if($user->isAuthenticated()){
$theme->set('User',$_SESSION["user_login"]);
if ($user->isAuthenticated()) { $theme->set('URL_Tumble',$conf->urlGelato);
$input = array("{User}", "{URL_Tumble}");
$output = array($_SESSION["user_login"], $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_isadmin");
$template->mostrarPlantilla();
} }
if (!$id_post) { $rows = array();
if(!$id_post){
$limit=$conf->postLimit; $limit=$conf->postLimit;
if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric? if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
@ -104,7 +104,7 @@ $template = new plantillas($conf->template);
if ($tumble->contarRegistros()>0) { if ($tumble->contarRegistros()>0) {
$dateTmp = null; $dateTmp = null;
while($register = mysql_fetch_array($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; }
$strEnd=($conf->urlFriendly) ? "/" : ""; $strEnd=($conf->urlFriendly) ? "/" : "";
@ -117,13 +117,16 @@ $template = new plantillas($conf->template);
$register["title"] = stripslashes($register["title"]); $register["title"] = stripslashes($register["title"]);
$register["description"] = stripslashes($register["description"]); $register["description"] = stripslashes($register["description"]);
switch ($tumble->getType($register["id_post"])) { $postType = $tumble->getType($register["id_post"]);
case "1":
$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
$output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato, );
$template->cargarPlantilla($input, $output, "template_regular_post"); $row['Date_Added'] = $formatedDate;
$template->mostrarPlantilla(); $row['Permalink'] = $permalink;
$theme->set('postType',$postType);
switch ($postType){
case "1":
$row['Title'] = $register["title"];
$row['Body'] = $register["description"];
break; break;
case "2": case "2":
$fileName = "uploads/".getFileName($register["url"]); $fileName = "uploads/".getFileName($register["url"]);
@ -137,72 +140,56 @@ $template = new plantillas($conf->template);
$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\""; $effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
$input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}"); $row['PhotoURL'] = $photoPath;
$output = array($formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato); $row['PhotoAlt'] = strip_tags($register["description"]);
$row['Caption'] = $register["description"];
$template->cargarPlantilla($input, $output, "template_photo"); $row['Effect'] = $effect;
$template->mostrarPlantilla();
break; break;
case "3": case "3":
$input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}"); $row['Quote'] = $register["description"];
$output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato); $row['Source'] = $register["title"];
$template->cargarPlantilla($input, $output, "template_quote");
$template->mostrarPlantilla();
break; break;
case "4": case "4":
if($conf->shorten_links){ if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]); $register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
} }
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"]; $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
$input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
$output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_url"); $row['URL'] = $register["url"];
$template->mostrarPlantilla(); $row['Name'] = $register["title"];
$row['Description'] = $register["description"];
break; break;
case "5": case "5":
$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}"); $row['Title'] = $register["title"];
$output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($conversation), $conf->urlGelato); $row['Conversation'] = $tumble->formatConversation($conversation);
$template->cargarPlantilla($input, $output, "template_conversation");
$template->mostrarPlantilla();
break; break;
case "6": case "6":
$input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}"); $row['Video'] = $tumble->getVideoPlayer($register["url"]);
$output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato); $row['Caption'] = $register["description"];
$template->cargarPlantilla($input, $output, "template_video");
$template->mostrarPlantilla();
break; break;
case "7": case "7":
$input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}"); $row['Mp3'] = $tumble->getMp3Player($register["url"]);
$output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato); $row['Caption'] = $register["description"];
$template->cargarPlantilla($input, $output, "template_mp3");
$template->mostrarPlantilla();
break; break;
} }
$comment = new comments(); $comment = new comments();
$noComments = $comment->countComments($register["id_post"]); $noComments = $comment->countComments($register["id_post"]);
$user = new user(); $user = new user();
$username = $user->getUserByID($register["id_user"]); $username = $user->getUserByID($register["id_user"]);
$row['User'] = $username["name"];
$row['Comments_Number'] = $noComments;
$input = array("{Permalink}", "{User}", "{Comments_Number}"); $rows[] = $row;
$output = array($permalink, $username["name"], $noComments);
$template->cargarPlantilla($input, $output, "template_details");
$template->mostrarPlantilla();
} }
$theme->set('rows',$rows);
$p = new pagination; $p = new pagination;
$p->Items($tumble->getPostsNumber()); $p->Items($tumble->getPostsNumber());
$p->limit($limit); $p->limit($limit);
if($conf->urlFriendly){ if($conf->urlFriendly){
$p->urlFriendly('[...]'); $p->urlFriendly('[...]');
$p->target($conf->urlGelato."/page/[...]"); $p->target($conf->urlGelato."/page/[...]");
@ -210,9 +197,8 @@ $template = new plantillas($conf->template);
$p->target($conf->urlGelato); $p->target($conf->urlGelato);
$p->currentPage(isset($page_num) ? $page_num : 1); $p->currentPage(isset($page_num) ? $page_num : 1);
$p->show();
$theme->set('pagination',$p->getPagination());
} else { } else {
$template->renderizaEtiqueta("No posts in this tumblelog.", "div","error"); $template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");
} }
@ -230,13 +216,14 @@ $template = new plantillas($conf->template);
$register["title"] = stripslashes($register["title"]); $register["title"] = stripslashes($register["title"]);
$register["description"] = stripslashes($register["description"]); $register["description"] = stripslashes($register["description"]);
switch ($tumble->getType($register["id_post"])) { $row['Date_Added'] = $formatedDate;
$row['Permalink'] = $permalink;
$postType = $tumble->getType($register["id_post"]);
$theme->set('postType',$postType);
switch ($postType) {
case "1": case "1":
$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}"); $row['Title'] = $register["title"];
$output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato); $row['Body'] = $register["description"];
$template->cargarPlantilla($input, $output, "template_regular_post");
$template->mostrarPlantilla();
break; break;
case "2": case "2":
$fileName = "uploads/".getFileName($register["url"]); $fileName = "uploads/".getFileName($register["url"]);
@ -249,50 +236,35 @@ $template = new plantillas($conf->template);
} }
$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\""; $effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
$input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
$output = array($formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
$template->cargarPlantilla($input, $output, "template_photo"); $row['PhotoURL'] = $photoPath;
$template->mostrarPlantilla(); $row['PhotoAlt'] = strip_tags($register["description"]);
$row['Caption'] = $register["description"];
$row['Effect'] = $effect;
break; break;
case "3": case "3":
$input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}"); $row['Quote'] = $register["description"];
$output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato); $row['Source'] = $register["title"];
$template->cargarPlantilla($input, $output, "template_quote");
$template->mostrarPlantilla();
break; break;
case "4": case "4":
if($conf->shorten_links){ if($conf->shorten_links){
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]); $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"];
$input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}"); $row['Name'] = $register["title"];
$output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato); $row['Description'] = $register["description"];
$template->cargarPlantilla($input, $output, "template_url");
$template->mostrarPlantilla();
break; break;
case "5": case "5":
$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}"); $row['Title'] = $register["title"];
$output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($conversation), $conf->urlGelato); $row['Conversation'] = $tumble->formatConversation($conversation);
$template->cargarPlantilla($input, $output, "template_conversation");
$template->mostrarPlantilla();
break; break;
case "6": case "6":
$input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}"); $row['Video'] = $tumble->getVideoPlayer($register["url"]);
$output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato); $row['Caption'] = $register["description"];
$template->cargarPlantilla($input, $output, "template_video");
$template->mostrarPlantilla();
break; break;
case "7": case "7":
$input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}"); $row['Mp3'] = $tumble->getMp3Player($register["url"]);
$output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato); $row['Caption'] = $register["description"];
$template->cargarPlantilla($input, $output, "template_mp3");
$template->mostrarPlantilla();
break; break;
} }
@ -301,6 +273,11 @@ $template = new plantillas($conf->template);
$comment = new comments(); $comment = new comments();
$rsComments = $comment->getComments($register["id_post"]); $rsComments = $comment->getComments($register["id_post"]);
$user = new user();
$username = $user->getUserByID($register["id_user"]);
$row['User'] = $username["name"];
$textile = new Textile(); $textile = new Textile();
if (empty($register["title"])) { if (empty($register["title"])) {
if (!empty($register["description"])) { if (!empty($register["description"])) {
@ -313,30 +290,36 @@ $template = new plantillas($conf->template);
} }
$postTitle = strip_tags($textile->TextileThis($postTitle)); $postTitle = strip_tags($textile->TextileThis($postTitle));
$input = array("{Comments_Number}", "{Post_Title}"); $row['Post_Title'] = $postTitle;
$output = array($comment->countComments($register["id_post"]), $postTitle); $row['Comments_Number'] = $comment->countComments($register["id_post"]);
$template->precargarPlantillaConBloque($input, $output, "template_comments", "comments");
$rows[] = $row;
$theme->set('rows',$rows);
$comments = array();
while($rowComment = mysql_fetch_assoc($rsComments)) { while($rowComment = mysql_fetch_assoc($rsComments)) {
$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>"; $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
$input = array("{Id_Comment}", "{Comment_Author}", "{Date}", "{Comment}");
$output = array($rowComment["id_comment"], $commentAuthor, gmdate("d.m.y", strtotime($rowComment["comment_date"])+transform_offset($conf->offsetTime)), $rowComment["content"]); $answers['Id_Comment'] = $rowComment["id_comment"];
$template->cargarPlantillaConBloque($input, $output, "template_comments", "comments"); $answers['Comment_Author'] = $commentAuthor;
$answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"])+transform_offset($conf->offsetTime));
$answers['Comment'] = $rowComment["content"];
$comments[] = $answers;
} }
$template->mostrarPlantillaConBloque(); $theme->set('comments',$comments);
$input = array("{User_Cookie}", "{Email_Cookie}", "{Web_Cookie}", "{Id_Post}", "{Form_Action}", "{Date_Added}"); $whois['User_Cookie'] = isset($_COOKIE['cookie_gel_user'])?$_COOKIE['cookie_gel_user']:'';
$output = array(isset($_COOKIE['cookie_gel_user'])?$_COOKIE['cookie_gel_user']:'', isset($_COOKIE['cookie_gel_email'])?$_COOKIE['cookie_gel_email']:'', isset($_COOKIE['cookie_gel_web'])?$_COOKIE['cookie_gel_web']:'', $register["id_post"], $conf->urlGelato."/admin/comments.php", gmmktime()); $whois['Email_Cookie'] = isset($_COOKIE['cookie_gel_email'])?$_COOKIE['cookie_gel_email']:'';
$whois['Web_Cookie'] = isset($_COOKIE['cookie_gel_web'])?$_COOKIE['cookie_gel_web']:'';
$template->cargarPlantilla($input, $output, "template_comment_post"); $whois['Id_Post'] = $register["id_post"];
$template->mostrarPlantilla();
$theme->set('Date_Added',gmmktime());
$theme->set('Form_Action',$conf->urlGelato."/admin/comments.php");
$theme->set('whois',$whois);
} }
} }
$input = array("{URL_Tumble}"); $theme->set('URL_Tumble',$conf->urlGelato);
$output = array($conf->urlGelato); $theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm');
$template->cargarPlantilla($input, $output, "template_footer");
$template->mostrarPlantilla();
?> ?>

166
themes/tumblr/index.htm Normal file
View File

@ -0,0 +1,166 @@
<!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" xml:lang="en" lang="en">
<head>
{Gelato_includes}
<title>{Page_Title}</title>
<!--[if IE]>
<style type="text/css">
div.post div.quote span.quote big.quote {
line-height: 40px;
}
</style>
<![endif]-->
</head>
<body>
<div id="container">
<a href="{URL_Tumble}/rss.php"><img src="{URL_Tumble}/themes/{Template_name}/img/rss.gif" id="rss" alt="RSS" title="RSS" /></a>
<h1><a href="{URL_Tumble}/">{Title}</a></h1>
<div id="description">
{Description}
</div>
{if {$isAuthenticated}}
<div style="padding:4px; border:solid 2px #bbb; display:inline; background-color:#ddd; position:absolute; top:3px; right:3px;">
<b>Hi, {User}.</b>&nbsp;&nbsp;
<a target="_top" href="{URL_Tumble}/admin/index.php">Add/Edit my posts</a>&nbsp;&nbsp;
<a target="_top" href="{URL_Tumble}/admin/close.php">Sign out</a>
</div>
{/if}
{block {$rows} as {$row}}
<div class="date">
{$row.Date_Added}
</div>
{if {$postType}==1}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="regular">
<h2><a href="{$row.Permalink}">{$row.Title}</a></h2>
{$row.Body}
</div>
</div>
{elseif {$postType}==2}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="photo">
<a {$row.Effect}><img src="{$row.PhotoURL}" alt="{$row.PhotoAlt}" /></a><br/>
<div class="caption">{$row.Caption}</div>
</div>
</div>
{elseif {$postType}==3}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="quote">
<span class="quote"><big class="quote"><a href="{$row.Permalink}">&#147;</a></big> {$row.Quote}</span>
<div class="source">&mdash; {$row.Source}</div>
</div>
</div>
{elseif {$postType}==4}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="link">
&#187; <a href="{$row.URL}">{$row.Name}</a>
<div class="description">{$row.Description}</div>
</div>
</div>
{elseif {$postType}==5}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="conversation">
...<h2><a href="{$row.Permalink}">{$row.Title}</a></h2>
{$row.Conversation}
</div>
</div>
{elseif {$postType}==6}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video">
{$row.Video}
<div class="caption">{$row.Caption}</div>
</div>
</div>
{elseif {$postType}==7}
<div class="post">
<a href="{$row.Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video">
{$row.Mp3}
<div class="caption">{$row.Caption}</div>
</div>
</div>
{/if}
<div class="totalComments">
<h3>Posted by {$row.User} - <a href="{$row.Permalink}#comments">( {$row.Comments_Number} ) comments</a></h3>
</div>
{/block}
{if {$id_post}}
<div class="containerComments">
<h3 id="comments">{$row.Comments_Number} answers to &#8220;{$row.Post_Title}&#8221;</h3>
<ol class="commentlist">
{block {$comments} as {$comment}}
<li class="alt" id="comment-{$comment.Id_Comment}">
<cite>
<a href="#comment-{$comment.Id_Comment}" title="Comment permalink">#</a>&nbsp;&nbsp;
{$comment.Comment_Author} said:
</cite>
<br />
<span class="timestampComment"> at {$comment.Date}</span><br /><br />
{$comment.Comment}
<br /><br />
</li>
{/block}
</ol>
</div>
<div class="containerFormComments">
<h3 id="respond">Add your comment</h3>
<form action="{Form_Action}" method="post" name="commentForm" id="commentForm">
<p>
<label for="username">
<small>Name:</small>
</label>
<input name="username" id="username" value="{whois.User_Cookie}" size="22" tabindex="1" type="text" />
</p>
<p>
<label for="email">
<small>E-mail:</small>
</label>
<input name="email" id="email" value="{whois.Email_Cookie}" size="22" tabindex="2" type="text" />
</p>
<p>
<label for="web">
<small>Website:</small>
</label>
<input name="web" id="web" value="{whois.Web_Cookie}" size="22" tabindex="3" type="text" />
</p>
<p>
<textarea name="content" id="content" cols="100" rows="10" tabindex="4"></textarea>
</p>
<p>
<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"><a href="http://hobix.com/textile/">Textile</a> syntax is supported.</span>
<p>
<input type="submit" value="Add 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" />
</p>
</form>
</div>
{else}
{pagination}
{/if}
</div>
<div id="footer">
subscribe via <a href="{URL_Tumble}/rss.php">rss</a> &nbsp;/&nbsp;
powered by <a href="http://www.gelatocms.com/">gelato cms</a>
</div>
</body>
</html>

View File

@ -1,36 +0,0 @@
<div class="containerFormComments">
<h3 id="respond">Add your comment</h3>
<form action="{Form_Action}" method="post" name="commentForm" id="commentForm">
<p>
<label for="username">
<small>Name:</small>
</label>
<input name="username" id="username" value="{User_Cookie}" size="22" tabindex="1" type="text" />
</p>
<p>
<label for="email">
<small>E-mail:</small>
</label>
<input name="email" id="email" value="{Email_Cookie}" size="22" tabindex="2" type="text" />
</p>
<p>
<label for="web">
<small>Website:</small>
</label>
<input name="web" id="web" value="{Web_Cookie}" size="22" tabindex="3" type="text" />
</p>
<p>
<textarea name="content" id="content" cols="100" rows="10" tabindex="4"></textarea>
</p>
<p>
<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"><a href="http://hobix.com/textile/">Textile</a> syntax is supported.</span>
<p>
<input type="submit" value="Add 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" />
</p>
</form>
</div>

View File

@ -1,17 +0,0 @@
<div class="containerComments">
<h3 id="comments">{Comments_Number} answers to &#8220;{Post_Title}&#8221;</h3>
<ol class="commentlist">
[bloque: comments]
<li class="alt" id="comment-{Id_Comment}">
<cite>
<a href="#comment-{Id_Comment}" title="Comment permalink">#</a>&nbsp;&nbsp;
{Comment_Author} said:
</cite>
<br />
<span class="timestampComment"> at {Date}</span><br /><br />
{Comment}
<br /><br />
</li>
[/bloque: comments]
</ol>
</div>

View File

@ -1,16 +0,0 @@
<div class="date">
{Date_Added}
</div>
<div class="post">
<a href="{Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="conversation">
<h2><a href="{Permalink}">{Title}</a></h2>
{Conversation}
</div>
</div>

View File

@ -1,3 +0,0 @@
<div class="totalComments">
<h3>Posted by {User} - <a href="{Permalink}#comments">( {Comments_Number} ) comments</a></h3>
</div>

View File

@ -1,8 +0,0 @@
</div>
<div id="footer">
subscribe via <a href="{URL_Tumble}/rss.php">rss</a> &nbsp;/&nbsp;
powered by <a href="http://www.gelatocms.com/">gelato cms</a>
</div>
</body>
</html>

View File

@ -1,23 +0,0 @@
<!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" xml:lang="en" lang="en">
<head>
{Gelato_includes}
<title>{Page_Title}</title>
<!--[if IE]>
<style type="text/css">
div.post div.quote span.quote big.quote {
line-height: 40px;
}
</style>
<![endif]-->
</head>
<body>
<div id="container">
<a href="{URL_Tumble}/rss.php"><img src="{URL_Tumble}/themes/{Template_name}/img/rss.gif" id="rss" alt="RSS" title="RSS" /></a>
<h1><a href="{URL_Tumble}/">{Title}</a></h1>
<div id="description">
{Description}
</div>

View File

@ -1,5 +0,0 @@
<div style="padding:4px; border:solid 2px #bbb; display:inline; background-color:#ddd; position:absolute; top:3px; right:3px;">
<b>Hi, {User}.</b>&nbsp;&nbsp;
<a target="_top" href="{URL_Tumble}/admin/index.php">Add/Edit my posts</a>&nbsp;&nbsp;
<a target="_top" href="{URL_Tumble}/admin/close.php">Sign out</a>
</div>

View File

@ -1,16 +0,0 @@
<div class="date">
{Date_Added}
</div>
<div class="post">
<a href="{Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video">
{Mp3}
<div class="caption">{Caption}</div>
</div>
</div>

View File

@ -1,20 +0,0 @@
<div class="date">
{Date_Added}
</div>
<div class="post">
<a href="{Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="photo">
<a {Effect}><img src="{PhotoURL}" alt="{PhotoAlt}" /></a><br/>
<div class="caption">{Caption}</div>
</div>
</div>

View File

@ -1,18 +0,0 @@
<div class="date">
{Date_Added}
</div>
<div class="post">
<a href="{Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="quote">
<span class="quote">
<big class="quote"><a href="{Permalink}">&#147;</a></big> {Quote}
</span>
<div class="source">&mdash; {Source}</div>
</div>
</div>

View File

@ -1,13 +0,0 @@
<div class="date">
{Date_Added}
</div>
<div class="post">
<a href="{Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="regular">
<h2><a href="{Permalink}">{Title}</a></h2>
{Body}
</div>
</div>

View File

@ -1,16 +0,0 @@
<div class="date">
{Date_Added}
</div>
<div class="post">
<a href="{Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="link">
&#187; <a href="{URL}">{Name}</a>
<div class="description">{Description}</div>
</div>
</div>

View File

@ -1,16 +0,0 @@
<div class="date">
{Date_Added}
</div>
<div class="post">
<a href="{Permalink}"><img src="{URL_Tumble}/themes/tumblr/img/link.gif" class="permalink" alt="Permalink"/></a>
<div class="video">
{Video}
<div class="caption">{Caption}</div>
</div>
</div>