diff --git a/classes/pagination.class.php b/classes/pagination.class.php index 03b56c0..e9d8e5b 100644 --- a/classes/pagination.class.php +++ b/classes/pagination.class.php @@ -13,7 +13,7 @@ Author URI: http://www.mis-algoritmos.com /*Default values*/ var $total_pages = null; var $limit = null; - var $target = ""; + var $target = ""; var $page = 1; var $adjacents = 2; var $showCounter = false; @@ -29,22 +29,22 @@ Author URI: http://www.mis-algoritmos.com /*****/ var $calculate = false; - + #Total items function items($value){$this->total_pages = intval($value);} - + #how many items to show per page function limit($value){$this->limit = intval($value);} - + #Page to sent the page value function target($value){$this->target = $value;} - + #Current page function currentPage($value){$this->page = intval($value);} - + #How many adjacent pages should be shown on each side of the current page? function adjacents($value){$this->adjacents = intval($value);} - + #show counter? function showCounter($value=""){$this->showCounter=($value===true)?true:false;} @@ -67,7 +67,7 @@ Author URI: http://www.mis-algoritmos.com } $this->urlF=$value; } - + var $pagination; function pagination(){} @@ -76,18 +76,23 @@ Author URI: http://www.mis-algoritmos.com if($this->calculate()) echo "
className\">$this->pagination
"; } + function getPagination(){ + if(!$this->calculate) + if($this->calculate()) + return "
className\">$this->pagination
"; + } function get_pagenum_link($id){ //if(strpos($this->target,'?')===false) if($this->urlF) return str_replace($this->urlF,$id,$this->target); - + else return "$this->target?$this->parameterName=$id"; - //else + //else //return "$this->target&$this->parameterName=$id"; - + } - + function calculate(){ $this->pagination = ""; $this->calculate == true; @@ -97,7 +102,7 @@ Author URI: http://www.mis-algoritmos.com echo "Especificaste un wildcard para sustituir, pero no existe en el target
"; $error = true; }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
"; + echo "Es necesario especificar en el target el comodin % para sustituir el n�mero de p�gina
"; $error = true; } if($this->total_pages == null){ @@ -109,35 +114,35 @@ Author URI: http://www.mis-algoritmos.com $error = true; } if($error)return false; - + $n = trim($this->nextT.' '.$this->nextI); $p = trim($this->prevI.' '.$this->prevT); - + /* Setup vars for query. */ - if($this->page) + if($this->page) $start = ($this->page - 1) * $this->limit; //first item to display on this page else $start = 0; //if no page var is given, set start to 0 - + /* Setup page vars for display. */ if ($this->page == 0) $this->page = 1; //if no page var is given, default to 1. $prev = $this->page - 1; //previous page is page - 1 $next = $this->page + 1; //next page is page + 1 $lastpage = ceil($this->total_pages/$this->limit); //lastpage is = total pages / items per page, rounded up. $lpm1 = $lastpage - 1; //last page minus 1 - - /* - Now we apply our rules and draw the pagination object. + + /* + Now we apply our rules and draw the pagination object. We're actually saving the code to a variable in case we want to draw it more than once. */ - + if($lastpage > 1){ //anterior button if($this->page > 1) $this->pagination .= "get_pagenum_link($prev)."\">$p"; else $this->pagination .= "$p"; - //pages + //pages if ($lastpage < 7 + ($this->adjacents * 2)){//not enough pages to bother breaking it up for ($counter = 1; $counter <= $lastpage; $counter++){ if ($counter == $this->page) diff --git a/classes/themes.class.php b/classes/themes.class.php new file mode 100644 index 0000000..40709ae --- /dev/null +++ b/classes/themes.class.php @@ -0,0 +1,114 @@ +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); + } + } +} +?> \ No newline at end of file diff --git a/entry.php b/entry.php index 85af492..fd7ba8e 100644 --- a/entry.php +++ b/entry.php @@ -55,14 +55,15 @@ if($installed) { require_once($configFile); } -require_once("classes/configuration.class.php"); -require_once("classes/textile.class.php"); -require_once("classes/gelato.class.php"); -require_once("classes/templates.class.php"); -require_once("classes/pagination.class.php"); -require_once("classes/user.class.php"); -require_once("classes/comments.class.php"); -require_once("classes/feeds.class.php"); +require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'configuration.class.php'); +require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'textile.class.php'); +require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gelato.class.php'); +require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'templates.class.php'); +require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'themes.class.php'); +require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'pagination.class.php'); +require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'user.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.'streams.class.php'); require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php'); diff --git a/index.php b/index.php index b21fe5a..fac91a7 100644 --- a/index.php +++ b/index.php @@ -17,10 +17,9 @@ if(!defined('entry'))define('entry', true); require_once('entry.php'); global $user, $tumble, $conf; -$template = new plantillas($conf->template); +$theme = new themes; // My approach to MVC - if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']); if (isset($_GET["post"])) { @@ -34,8 +33,10 @@ $template = new plantillas($conf->template); } else { $id_post = NULL; } - } - + } + + $theme->set('id_post',$id_post); + if (isset($_GET["page"])) { $page_num = $_GET["page"]; } else { @@ -45,16 +46,16 @@ $template = new plantillas($conf->template); $page_num = NULL; } } - + $gelato_includes = "\n"; $gelato_includes .= "\t\n"; $gelato_includes .= "\turlGelato."/images/favicon.ico\" />\n"; $gelato_includes .= "\turlGelato.($conf->urlFriendly?"/rss/":"/rss.php")."\"/>\n"; $gelato_includes .= "\turlGelato."/themes/".$conf->template."/style.css\"/>\n"; - $gelato_includes .= "\turlGelato."/admin/css/lightbox.css\" />\n"; + $gelato_includes .= "\turlGelato."/admin/css/lightbox.css\" />\n"; $gelato_includes .= "\t\n"; $gelato_includes .= "\t"; - + $page_title = $conf->title; $page_title_divisor = " » "; // it should be set in configuration $page_title_len = 50; // it should be set in configuration @@ -71,236 +72,212 @@ $template = new plantillas($conf->template); $page_title_data = $register["title"]; } $page_title_data = strip_tags($textile->TextileThis($page_title_data)); - if (!empty($page_title_data)) { + if (!empty($page_title_data)) { $page_title .= $page_title_divisor.stripslashes($page_title_data); } } - - $input = array("{Gelato_includes}","{Title}", "{Page_Title}", "{Description}", "{URL_Tumble}", "{Template_name}"); - $output = array($gelato_includes, $conf->title, $page_title, $conf->description, $conf->urlGelato, $conf->template); - - $template->cargarPlantilla($input, $output, "template_header"); - $template->mostrarPlantilla(); - - if ($user->isAuthenticated()) { - $input = array("{User}", "{URL_Tumble}"); - $output = array($_SESSION["user_login"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_isadmin"); - $template->mostrarPlantilla(); - } - - if (!$id_post) { + $theme->set('Gelato_includes',$gelato_includes); + $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); + + $theme->set('isAuthenticated',$user->isAuthenticated()); + if($user->isAuthenticated()){ + $theme->set('User',$_SESSION["user_login"]); + $theme->set('URL_Tumble',$conf->urlGelato); + } + + $rows = array(); + if(!$id_post){ $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); if ($tumble->contarRegistros()>0) { - $dateTmp = null; - while($register = mysql_fetch_array($rs)) { + $dateTmp = null; + while($register = mysql_fetch_assoc($rs)) { $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; } $strEnd=($conf->urlFriendly) ? "/" : ""; $permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd; - + $conversation = $register["description"]; - + $register["description"] = $register["description"]; $register["title"] = stripslashes($register["title"]); - $register["description"] = stripslashes($register["description"]); - - switch ($tumble->getType($register["id_post"])) { + $register["description"] = stripslashes($register["description"]); + + $postType = $tumble->getType($register["id_post"]); + + $row['Date_Added'] = $formatedDate; + $row['Permalink'] = $permalink; + $theme->set('postType',$postType); + + switch ($postType){ 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"); - $template->mostrarPlantilla(); + $row['Title'] = $register["title"]; + $row['Body'] = $register["description"]; break; - case "2": + case "2": $fileName = "uploads/".getFileName($register["url"]); - - $x = @getimagesize($fileName); - if ($x[0] > 500) { + + $x = @getimagesize($fileName); + if ($x[0] > 500) { $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"]; - } else { + } else { $photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]); } $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"); - $template->mostrarPlantilla(); + + $row['PhotoURL'] = $photoPath; + $row['PhotoAlt'] = strip_tags($register["description"]); + $row['Caption'] = $register["description"]; + $row['Effect'] = $effect; break; case "3": - $input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_quote"); - $template->mostrarPlantilla(); + $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"]; - $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"); - $template->mostrarPlantilla(); + + $row['URL'] = $register["url"]; + $row['Name'] = $register["title"]; + $row['Description'] = $register["description"]; break; case "5": - $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($conversation), $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_conversation"); - $template->mostrarPlantilla(); + $row['Title'] = $register["title"]; + $row['Conversation'] = $tumble->formatConversation($conversation); break; case "6": - $input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_video"); - $template->mostrarPlantilla(); + $row['Video'] = $tumble->getVideoPlayer($register["url"]); + $row['Caption'] = $register["description"]; break; case "7": - $input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_mp3"); - $template->mostrarPlantilla(); + $row['Mp3'] = $tumble->getMp3Player($register["url"]); + $row['Caption'] = $register["description"]; break; } - - + $comment = new comments(); $noComments = $comment->countComments($register["id_post"]); - + $user = new user(); $username = $user->getUserByID($register["id_user"]); - - - $input = array("{Permalink}", "{User}", "{Comments_Number}"); - $output = array($permalink, $username["name"], $noComments); - - $template->cargarPlantilla($input, $output, "template_details"); - $template->mostrarPlantilla(); + + $row['User'] = $username["name"]; + $row['Comments_Number'] = $noComments; + + $rows[] = $row; } + $theme->set('rows',$rows); + $p = new pagination; $p->Items($tumble->getPostsNumber()); $p->limit($limit); - if($conf->urlFriendly){ $p->urlFriendly('[...]'); $p->target($conf->urlGelato."/page/[...]"); }else $p->target($conf->urlGelato); - + $p->currentPage(isset($page_num) ? $page_num : 1); - $p->show(); - + $theme->set('pagination',$p->getPagination()); } else { $template->renderizaEtiqueta("No posts in this tumblelog.", "div","error"); } } else { $register = $tumble->getPost($id_post); - + $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime)); $strEnd=($conf->urlFriendly) ? "/" : ""; $permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd; - + $conversation = $register["description"]; - + $register["description"] = $register["description"]; - + $register["title"] = stripslashes($register["title"]); $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": - $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"); - $template->mostrarPlantilla(); + $row['Title'] = $register["title"]; + $row['Body'] = $register["description"]; break; case "2": $fileName = "uploads/".getFileName($register["url"]); - - $x = @getimagesize($fileName); - if ($x[0] > 500) { + + $x = @getimagesize($fileName); + if ($x[0] > 500) { $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"]; } else { $photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]); } $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"); - $template->mostrarPlantilla(); + + $row['PhotoURL'] = $photoPath; + $row['PhotoAlt'] = strip_tags($register["description"]); + $row['Caption'] = $register["description"]; + $row['Effect'] = $effect; break; case "3": - $input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_quote"); - $template->mostrarPlantilla(); + $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"]; - $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"); - $template->mostrarPlantilla(); + $row['URL'] = $register["url"]; + $row['Name'] = $register["title"]; + $row['Description'] = $register["description"]; break; case "5": - $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($conversation), $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_conversation"); - $template->mostrarPlantilla(); - break; - case "6": - $input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_video"); - $template->mostrarPlantilla(); - break; - case "7": - $input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}"); - $output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_mp3"); - $template->mostrarPlantilla(); - break; + $row['Title'] = $register["title"]; + $row['Conversation'] = $tumble->formatConversation($conversation); + 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; } - + if ($conf->allowComments) { - + $comment = new comments(); $rsComments = $comment->getComments($register["id_post"]); - + + $user = new user(); + $username = $user->getUserByID($register["id_user"]); + + $row['User'] = $username["name"]; + $textile = new Textile(); if (empty($register["title"])) { if (!empty($register["description"])) { @@ -312,31 +289,37 @@ $template = new plantillas($conf->template); $postTitle = $register["title"]; } $postTitle = strip_tags($textile->TextileThis($postTitle)); - - $input = array("{Comments_Number}", "{Post_Title}"); - $output = array($comment->countComments($register["id_post"]), $postTitle); - $template->precargarPlantillaConBloque($input, $output, "template_comments", "comments"); + $row['Post_Title'] = $postTitle; + $row['Comments_Number'] = $comment->countComments($register["id_post"]); + + $rows[] = $row; + $theme->set('rows',$rows); + + $comments = array(); while($rowComment = mysql_fetch_assoc($rsComments)) { $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "".$rowComment["username"].""; - $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"]); - $template->cargarPlantillaConBloque($input, $output, "template_comments", "comments"); + + $answers['Id_Comment'] = $rowComment["id_comment"]; + $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(); - - $input = array("{User_Cookie}", "{Email_Cookie}", "{Web_Cookie}", "{Id_Post}", "{Form_Action}", "{Date_Added}"); - $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()); - - $template->cargarPlantilla($input, $output, "template_comment_post"); - $template->mostrarPlantilla(); - + $theme->set('comments',$comments); + + $whois['User_Cookie'] = isset($_COOKIE['cookie_gel_user'])?$_COOKIE['cookie_gel_user']:''; + $whois['Email_Cookie'] = isset($_COOKIE['cookie_gel_email'])?$_COOKIE['cookie_gel_email']:''; + $whois['Web_Cookie'] = isset($_COOKIE['cookie_gel_web'])?$_COOKIE['cookie_gel_web']:''; + $whois['Id_Post'] = $register["id_post"]; + + $theme->set('Date_Added',gmmktime()); + $theme->set('Form_Action',$conf->urlGelato."/admin/comments.php"); + $theme->set('whois',$whois); } } - - $input = array("{URL_Tumble}"); - $output = array($conf->urlGelato); - - $template->cargarPlantilla($input, $output, "template_footer"); - $template->mostrarPlantilla(); -?> + + $theme->set('URL_Tumble',$conf->urlGelato); + $theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm'); +?> diff --git a/themes/tumblr/index.htm b/themes/tumblr/index.htm new file mode 100644 index 0000000..41941a0 --- /dev/null +++ b/themes/tumblr/index.htm @@ -0,0 +1,166 @@ + + + + {Gelato_includes} + {Page_Title} + + + +
+ RSS + +

{Title}

+ +
+ {Description} +
+ + {if {$isAuthenticated}} +
+ Hi, {User}.   + Add/Edit my posts   + Sign out +
+ {/if} + + {block {$rows} as {$row}} +
+ {$row.Date_Added} +
+ {if {$postType}==1} +
+ Permalink + +
+

{$row.Title}

+ {$row.Body} +
+
+ {elseif {$postType}==2} +
+ Permalink +
+ {$row.PhotoAlt}
+
{$row.Caption}
+
+
+ {elseif {$postType}==3} +
+ Permalink +
+ “ {$row.Quote} +
— {$row.Source}
+
+
+ {elseif {$postType}==4} +
+ Permalink + +
+ {elseif {$postType}==5} +
+ Permalink +
+ ...

{$row.Title}

+ {$row.Conversation} +
+
+ {elseif {$postType}==6} +
+ Permalink +
+ {$row.Video} +
{$row.Caption}
+
+
+ {elseif {$postType}==7} +
+ Permalink +
+ {$row.Mp3} +
{$row.Caption}
+
+
+ {/if} + +
+

Posted by {$row.User} - ( {$row.Comments_Number} ) comments

+
+ {/block} + + {if {$id_post}} +
+

{$row.Comments_Number} answers to “{$row.Post_Title}”

+
    + {block {$comments} as {$comment}} +
  1. + + #   + {$comment.Comment_Author} said: + +
    + at {$comment.Date}

    + {$comment.Comment} +

    +
  2. + {/block} +
+
+ +
+

Add your comment

+ +
+

+ + +

+

+ + +

+

+ + +

+

+ +

+

+ Textile syntax is supported. +

+ +

+

+ + +

+
+
+ {else} + {pagination} + {/if} + +
+ + + \ No newline at end of file diff --git a/themes/tumblr/template_comment_post.htm b/themes/tumblr/template_comment_post.htm deleted file mode 100644 index 01065b0..0000000 --- a/themes/tumblr/template_comment_post.htm +++ /dev/null @@ -1,36 +0,0 @@ -
-

Add your comment

- -
-

- - -

-

- - -

-

- - -

-

- -

-

- Textile syntax is supported. -

- -

-

- - -

-
-
\ No newline at end of file diff --git a/themes/tumblr/template_comments.htm b/themes/tumblr/template_comments.htm deleted file mode 100644 index 59f2ba8..0000000 --- a/themes/tumblr/template_comments.htm +++ /dev/null @@ -1,17 +0,0 @@ -
-

{Comments_Number} answers to “{Post_Title}”

-
    - [bloque: comments] -
  1. - - #   - {Comment_Author} said: - -
    - at {Date}

    - {Comment} -

    -
  2. - [/bloque: comments] -
-
diff --git a/themes/tumblr/template_conversation.htm b/themes/tumblr/template_conversation.htm deleted file mode 100644 index 06f7be0..0000000 --- a/themes/tumblr/template_conversation.htm +++ /dev/null @@ -1,16 +0,0 @@ - -
- {Date_Added} -
- - -
- Permalink - - -
-

{Title}

- {Conversation} -
- -
\ No newline at end of file diff --git a/themes/tumblr/template_details.htm b/themes/tumblr/template_details.htm deleted file mode 100644 index 1714eb6..0000000 --- a/themes/tumblr/template_details.htm +++ /dev/null @@ -1,3 +0,0 @@ -
-

Posted by {User} - ( {Comments_Number} ) comments

-
\ No newline at end of file diff --git a/themes/tumblr/template_footer.htm b/themes/tumblr/template_footer.htm deleted file mode 100644 index 66ba534..0000000 --- a/themes/tumblr/template_footer.htm +++ /dev/null @@ -1,8 +0,0 @@ - - - - - \ No newline at end of file diff --git a/themes/tumblr/template_header.htm b/themes/tumblr/template_header.htm deleted file mode 100644 index 7c8d0db..0000000 --- a/themes/tumblr/template_header.htm +++ /dev/null @@ -1,23 +0,0 @@ - - - - {Gelato_includes} - {Page_Title} - - - -
- RSS - -

{Title}

- -
- {Description} -
\ No newline at end of file diff --git a/themes/tumblr/template_isadmin.htm b/themes/tumblr/template_isadmin.htm deleted file mode 100644 index 1497af4..0000000 --- a/themes/tumblr/template_isadmin.htm +++ /dev/null @@ -1,5 +0,0 @@ -
- Hi, {User}.   - Add/Edit my posts   - Sign out -
\ No newline at end of file diff --git a/themes/tumblr/template_mp3.htm b/themes/tumblr/template_mp3.htm deleted file mode 100644 index 073bc31..0000000 --- a/themes/tumblr/template_mp3.htm +++ /dev/null @@ -1,16 +0,0 @@ - -
- {Date_Added} -
- - -
- Permalink - - -
- {Mp3} -
{Caption}
-
- -
\ No newline at end of file diff --git a/themes/tumblr/template_photo.htm b/themes/tumblr/template_photo.htm deleted file mode 100644 index 80cc65a..0000000 --- a/themes/tumblr/template_photo.htm +++ /dev/null @@ -1,20 +0,0 @@ - -
- {Date_Added} -
- - -
- Permalink - - - -
- {PhotoAlt}
- -
{Caption}
- -
- - -
\ No newline at end of file diff --git a/themes/tumblr/template_quote.htm b/themes/tumblr/template_quote.htm deleted file mode 100644 index 3265a32..0000000 --- a/themes/tumblr/template_quote.htm +++ /dev/null @@ -1,18 +0,0 @@ - -
- {Date_Added} -
- - -
- Permalink - - -
- - “ {Quote} - -
— {Source}
-
- -
\ No newline at end of file diff --git a/themes/tumblr/template_regular_post.htm b/themes/tumblr/template_regular_post.htm deleted file mode 100644 index fdca816..0000000 --- a/themes/tumblr/template_regular_post.htm +++ /dev/null @@ -1,13 +0,0 @@ - -
- {Date_Added} -
- -
- Permalink - -
-

{Title}

- {Body} -
-
\ No newline at end of file diff --git a/themes/tumblr/template_url.htm b/themes/tumblr/template_url.htm deleted file mode 100644 index 02849b3..0000000 --- a/themes/tumblr/template_url.htm +++ /dev/null @@ -1,16 +0,0 @@ - -
- {Date_Added} -
- - -
- Permalink - - - - -
\ No newline at end of file diff --git a/themes/tumblr/template_video.htm b/themes/tumblr/template_video.htm deleted file mode 100644 index c3fa163..0000000 --- a/themes/tumblr/template_video.htm +++ /dev/null @@ -1,16 +0,0 @@ - -
- {Date_Added} -
- - -
- Permalink - - -
- {Video} -
{Caption}
-
- -
\ No newline at end of file