diff -urN gelato/.htaccess tumblelog/.htaccess
--- gelato/.htaccess	2007-09-08 01:17:24.000000000 +0200
+++ tumblelog/.htaccess	2008-01-05 20:38:31.000000000 +0100
@@ -1,6 +1,14 @@
 <IfModule mod_rewrite.c>
 RewriteEngine On
-RewriteRule ^page/([0-9]+)/?$ index.php?page=$1 [L]
-RewriteRule ^post/([0-9]+)/?$ index.php?post=$1 [L]
-RewriteRule ^rss/?$ rss.php [L]
+RewriteRule ^page/([0-9]+)/?$ /tumblelog/index.php?page=$1 [L]
+RewriteRule ^post/([0-9]+)/?$ /tumblelog/index.php?post=$1 [L]
+RewriteRule ^rss/?$ /tumblelog/rss.php [L]
+</IfModule>
+
+# My Optimizations
+<IfModule mod_rewrite.c>
+RewriteEngine On
+RewriteRule ^rss.xml rss.php
+RewriteRule ^rss.php http://feeds.feedburner.com/TreviTumblelog/? [R] [QSA,L]
+# RewriteRule ^rss.xml http://feeds.feedburner.com/TreviTumblelog/? [R] [QSA,L]
 </IfModule>
\ No newline at end of file
diff -urN gelato/all-posts.php tumblelog/all-posts.php
--- gelato/all-posts.php	1970-01-01 01:00:00.000000000 +0100
+++ tumblelog/all-posts.php	2008-01-05 20:29:09.000000000 +0100
@@ -0,0 +1,91 @@
+<?php
+if(!defined('entry')) define('entry',true);
+/* ===========================
+
+  gelato CMS - A PHP based tumblelog CMS
+  0.90 version
+  http://www.gelatocms.com/
+
+  gelato CMS is a free software licensed under the GPL 2.0
+  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
+
+  =========================== */
+?>
+<?php
+        // My approach to MVC
+        
+        $configFile = dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
+        
+        if (!file_exists($configFile)) {
+                $mensaje = "
+                        <h3 class=\"important\">Error reading configuration file</h3>                   
+                        <p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
+                        <p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
+                die($mensaje);  
+        } else {
+                require(dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
+        }       
+        
+        include("classes/configuration.class.php");
+        include("classes/textile.class.php");
+        include("classes/gelato.class.php");    
+        include("classes/templates.class.php");
+        include("classes/pagination.class.php");
+        include("classes/user.class.php");
+                
+        $user = new user();
+        $conf = new configuration();
+        $tumble = new gelato();
+        $template = new plantillas($conf->template);
+        $textile = new Textile();
+
+        if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
+
+        $gelato_includes = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
+        $gelato_includes .= "\t<meta name=\"generator\" content=\"gelato cms ".version()."\" />\n";
+        $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />\n";
+        $gelato_includes .= "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"http://feeds.feedburner.com/TreviTumblelog\"/>\n";
+        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/themes/".$conf->template."/style.css\"/>\n";
+        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/slimbox.css\" />\n";    
+        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/mootools.js\"></script>\n";
+        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/slimbox.js\"></script>";
+
+	$page_title = "All my tumble-posts!";
+
+        $input = array("{Gelato_includes}","{Title}", "{Page_Title}", "{Description}", "{URL_Tumble}", "{Template_name}");
+        $output = array($gelato_includes, $conf->title, $conf->title." » ".$page_title, $conf->description, $conf->urlGelato, $conf->template);
+        
+        $template->cargarPlantilla($input, $output, "template_header");
+        $template->mostrarPlantilla();
+        
+        if ($user->isAdmin()) { 
+                $input = array("{User}", "{URL_Tumble}");
+                $output = array($_SESSION["user_login"], $conf->urlGelato);
+                
+                $template->cargarPlantilla($input, $output, "template_isadmin");
+                $template->mostrarPlantilla();
+        }
+        
+        $rs = $tumble->getPosts($tumble->getPostsNumber());
+	if ($tumble->contarRegistros()>0) {
+		while($register = mysql_fetch_array($rs)) {
+			$url = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
+			$title = strip_tags($textile->TextileThis(stripslashes($register["title"])));
+			$body = "\n<li><a href=\"$url\">$title</a></li>".$body;
+		}
+		$body = "\n<ul>".$body."</ul>\n";
+	} else {
+		$template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");
+	}
+
+	$input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
+        $output = array(date("d F Y"), date("H:i"), $conf->urlGelato.$_SERVER['SCRIPT_NAME'], $page_title, $body, $conf->urlGelato);
+	$template->cargarPlantilla($input, $output, "template_regular_post");
+	$template->mostrarPlantilla();
+         
+        $input = array("{URL_Tumble}");
+        $output = array($conf->urlGelato);
+        
+        $template->cargarPlantilla($input, $output, "template_footer");
+        $template->mostrarPlantilla();
+?> 
diff -urN gelato/index.php tumblelog/index.php
--- gelato/index.php	2007-10-25 23:45:00.000000000 +0200
+++ tumblelog/index.php	2008-01-05 22:01:14.000000000 +0100
@@ -55,8 +55,28 @@
         $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/jquery.js\"></script>\n";
         $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/lightbox.js\"></script>";
         
-        $input = array("{Gelato_includes}","{Title}", "{Description}", "{URL_Tumble}", "{Template_name}");
-        $output = array($gelato_includes, $conf->title, $conf->description, $conf->urlGelato, $conf->template);
+        $page_title = $conf->title;
+	$page_title_divisor = " » "; // it should be set in configuration
+	$page_title_len = 75; // it should be set in configuration
+	if ($id_post) {
+		$register = $tumble->getPost($id_post);
+		$textile = new Textile();
+		if (empty($register["title"])) {
+			if (!empty($register["description"]))
+				$page_title_data = $register["description"];
+		} else {
+			$page_title_data = $register["title"];
+		}
+		$page_title_data = strip_tags($textile->TextileThis($page_title_data));
+		if (!empty($page_title_data)) {
+			if (strlen($page_title_data) > $page_title_len)
+				$page_title_data = substr($page_title_data, 0, $page_title_len)."...";
+			$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();
@@ -84,21 +104,22 @@
                 if ($tumble->contarRegistros()>0) {
                         $dateTmp = null;          
                         while($register = mysql_fetch_array($rs)) {
-								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
-                                if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
+								$formatedDate = gmdate("d F Y", strtotime($register["date"])+transform_offset($conf->offsetTime));
+								$formatedTime = date("H:i", 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;
                                 
 								$textile = new Textile();				
 								$register["description"] = $textile->TextileThis($register["description"]);
 
-                                $register["title"] = stripslashes($register["title"]);
+                                $register["title"] = strip_tags($textile->TextileThis(stripslashes($register["title"])));
                                 $register["description"] = stripslashes($register["description"]);
 
                                 switch ($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);
+                                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
+                                                $output = array($formatedDate, $formatedTime, $permalink, $register["title"], $register["description"], $conf->urlGelato);
                                                                                         
                                                 $template->cargarPlantilla($input, $output, "template_regular_post");
                                                 $template->mostrarPlantilla();
@@ -115,15 +136,15 @@
 
 												$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);
+                                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
+                                                $output = array($formatedDate, $formatedTime, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
                                                 
                                                 $template->cargarPlantilla($input, $output, "template_photo");
                                                 $template->mostrarPlantilla();                                                     
                                                 break;
                                         case "3":
-                                                $input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
-                                                $output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
+                                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
+                                                $output = array($formatedDate, $formatedTime, $permalink, $register["description"], $register["title"], $conf->urlGelato);
                                                 
                                                 $template->cargarPlantilla($input, $output, "template_quote");
                                                 $template->mostrarPlantilla();
@@ -133,29 +154,29 @@
 													$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);
+												$input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
+                                                $output = array($formatedDate, $formatedTime, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
                                                 
                                                 $template->cargarPlantilla($input, $output, "template_url");
                                                 $template->mostrarPlantilla();
                                                 break;
                                         case "5":
-                                                $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
-                                                $output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
+                                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
+                                                $output = array($formatedDate, $formatedTime, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $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);
+                                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
+                                                $output = array($formatedDate, $formatedTime, $permalink, $tumble->getVideoPlayer($register["url"]),  strip_tags($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);
+                                                $output = array($formatedDate, $formatedTime, $permalink, $tumble->getMp3Player($register["url"]),  strip_tags($register["description"]), $conf->urlGelato);
                                                 
                                                 $template->cargarPlantilla($input, $output, "template_mp3");
                                                 $template->mostrarPlantilla();
@@ -183,20 +204,22 @@
         } else {
                 $register = $tumble->getPost($id_post);
                 
-				$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
+				$formatedDate = date("d F Y", strtotime($register["date"])+transform_offset($conf->offsetTime));
+				$formatedTime = date("H:i", strtotime($register["date"])+transform_offset($conf->offsetTime));
+
 				$strEnd=($conf->urlFriendly) ? "/" : "";
 				$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
                 
 				$textile = new Textile();				
 				$register["description"] = $textile->TextileThis($register["description"]);
 				
-				$register["title"] = stripslashes($register["title"]);
+				$register["title"] = strip_tags($textile->TextileThis(stripslashes($register["title"])));
                 $register["description"] = stripslashes($register["description"]);
                 
                 switch ($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);
+                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
+                                $output = array($formatedDate, $formatedTime, $permalink, $register["title"], $register["description"], $conf->urlGelato);
                                                                         
                                 $template->cargarPlantilla($input, $output, "template_regular_post");
                                 $template->mostrarPlantilla();
@@ -212,15 +235,15 @@
                                 }
 
 								$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);
+                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
+                                $output = array($formatedDate, $formatedTime, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
                                 
                                 $template->cargarPlantilla($input, $output, "template_photo");
                                 $template->mostrarPlantilla();                                                     
                                 break;
                         case "3":
-                                $input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
-                                $output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
+                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
+                                $output = array($formatedDate, $formatedTime, $permalink, $register["description"], $register["title"], $conf->urlGelato);
                                 
                                 $template->cargarPlantilla($input, $output, "template_quote");
                                 $template->mostrarPlantilla();
@@ -230,29 +253,29 @@
 									$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);
+								$input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
+                                $output = array($formatedDate, $formatedTime, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
                                 
                                 $template->cargarPlantilla($input, $output, "template_url");
                                 $template->mostrarPlantilla();
                                 break;
                         case "5":
-                                $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
-                                $output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
+                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
+                                $output = array($formatedDate, $formatedTime, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $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);
+                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
+                                $output = array($formatedDate, $formatedTime, $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);
+                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
+                                $output = array($formatedDate, $formatedTime, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
                                 
                                 $template->cargarPlantilla($input, $output, "template_mp3");
                                 $template->mostrarPlantilla();
@@ -273,8 +296,8 @@
 						print_r($rowComment);
 						echo "</pre>";*/
 						$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"]);
+						$input = array("{Id_Comment}", "{Comment_Author}", "{Date}", "{Time}", "{Comment}");
+						$output = array($rowComment["id_comment"], $commentAuthor, date("d F Y", strtotime($rowComment["comment_date"])), date("H:i", strtotime($rowComment["comment_date"])), nl2br(stripslashes($rowComment["content"])));
 						$template->cargarPlantillaConBloque($input, $output, "template_comments", "commen                        $input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
-                                                $output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
+                                                $input = array("{Date_Added}", "{Time_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
+                                                $output = array($formatedDate, $formatedTime, $permalink, $tumble->getVideoPlayer($register["url"]),  strip_tags($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);
+                                                $output = array($formatedDate, $formatedTime, $permalink, $tumble->getMp3Player($register["url"]),  strip_tags($register["description"]), $conf->urlGelato);
                                                 
--- gelato/admin/comments.php	2007-10-08 23:10:42.000000000 +0200
+++ tumblelog/admin/comments.php	2008-01-05 23:06:49.000000000 +0100
@@ -42,7 +42,7 @@
 		$_POST["ip_user"] = $_SERVER["REMOTE_ADDR"];
 		
 		if ($comment->addComment($_POST)) {
-			header("Location: ".$conf->urlGelato."/index.php/post/".$_POST["id_post"]);
+			header("Location: ".$conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$_POST["id_post"].$strEnd);
 			die();
 		}
 	}		
@@ -159,7 +159,7 @@
 									$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"]." | ".$rowComment["email"]  : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a> | ".$rowComment["email"];
 									
 									$input = array("{Permalink}", "{URL_Tumble}", "{Id_Comment}", "{Comment_Author}", "{Comment}");				
-									$output = array($conf->urlGelato."/index.php/post/".$rowComment["id_post"]."#comment-".$rowComment["id_comment"], $conf->urlGelato, $rowComment["id_comment"], $commentAuthor, $rowComment["content"]);
+									$output = array($conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$rowComment["id_post"].$strEnd."#comment-".$rowComment["id_comment"], $conf->urlGelato, $rowComment["id_comment"], $commentAuthor, $rowComment["content"]);
 									
 									$template->cargarPlantilla($input, $output, "template_comment");
 									$template->mostrarPlantilla();
--- gelato/admin/index.php	2007-10-09 00:17:52.000000000 +0200
+++ tumblelog/admin/index.php	2008-01-06 16:52:51.000000000 +0100
@@ -325,7 +325,7 @@
 					if ($tumble->contarRegistros()>0) {				
 						while($register = mysql_fetch_array($rs)) {			
 							$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
-							$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";							
+							$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;							
 							
 							$textile = new Textile();				
 							$register["description"] = $textile->TextileThis($register["description"]);
--- gelato/classes/comments.class.php	2007-09-16 23:22:42.000000000 +0200
+++ tumblelog/classes/comments.class.php	2008-01-06 14:01:26.000000000 +0100
@@ -28,9 +28,10 @@
 	}
 	
 	function generateCookie($fieldsArray) {
-		setcookie("cookie_gel_user", $fieldsArray["username"], time() + 30000000);
-		setcookie("cookie_gel_email", $fieldsArray["email"], time() + 30000000);
-		setcookie("cookie_gel_web", $fieldsArray["web"], time() + 30000000);
+		$path = dirname(dirname($_SERVER['SCRIPT_NAME']."../"));
+		setcookie("cookie_gel_user", $fieldsArray["username"], time() + 30000000, $path);
+		setcookie("cookie_gel_email", $fieldsArray["email"], time() + 30000000, $path);
+		setcookie("cookie_gel_web", $fieldsArray["web"], time() + 30000000, $path);
 	}
 	
 	function isSpam($fieldsArray) {
--- gelato/entry.php	2007-10-05 00:06:26.000000000 +0200
+++ tumblelog/entry.php	2008-01-06 16:05:04.000000000 +0100
@@ -44,6 +44,7 @@
 require_once("classes/user.class.php");
 require_once("classes/comments.class.php");
 require_once("classes/feeds.class.php");
+require_once("classes/akismet.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 -urN gelato/classes/akismet.class.php tumblelog/classes/akismet.class.php
--- gelato/classes/akismet.class.php	1970-01-01 01:00:00.000000000 +0100
+++ tumblelog/classes/akismet.class.php	2008-01-06 16:06:06.000000000 +0100
@@ -0,0 +1,356 @@
+<?php
+if(!defined('entry') || !entry) die('Not a valid page');
+/**
+ * 01.26.2006 12:29:28est
+ * 
+ * Akismet PHP4 class
+ * 
+ * <b>Usage</b>
+ * <code>
+ *    $comment = array(
+ *           'author'    => 'viagra-test-123',
+ *           'email'     => 'test@example.com',
+ *           'website'   => 'http://www.example.com/',
+ *           'body'      => 'This is a test comment',
+ *           'permalink' => 'http://yourdomain.com/yourblogpost.url',
+ *        );
+ *
+ *    $akismet = new Akismet('http://www.yourdomain.com/', 'YOUR_WORDPRESS_API_KEY', $comment);
+ *
+ *    if($akismet->isError()) {
+ *        echo"Couldn't connected to Akismet server!";
+ *    } else {
+ *        if($akismet->isSpam()) {
+ *            echo"Spam detected";
+ *        } else {
+ *            echo"yay, no spam!";
+ *        }
+ *    }
+ * </code>
+ * 
+ * @author Bret Kuhns {@link www.miphp.net}
+ * @link http://www.miphp.net/blog/view/php4_akismet_class/
+ * @version 0.3.3
+ * @license http://www.opensource.org/licenses/mit-license.php MIT License
+ */
+
+
+
+// Error constants
+define("AKISMET_SERVER_NOT_FOUND",	0);
+define("AKISMET_RESPONSE_FAILED",	1);
+define("AKISMET_INVALID_KEY",		2);
+
+
+
+// Base class to assist in error handling between Akismet classes
+class AkismetObject {
+	var $errors = array();
+	
+	
+	/**
+	 * Add a new error to the errors array in the object
+	 *
+	 * @param	String	$name	A name (array key) for the error
+	 * @param	String	$string	The error message
+	 * @return void
+	 */ 
+	// Set an error in the object
+	function setError($name, $message) {
+		$this->errors[$name] = $message;
+	}
+	
+
+	/**
+	 * Return a specific error message from the errors array
+	 *
+	 * @param	String	$name	The name of the error you want
+	 * @return mixed	Returns a String if the error exists, a false boolean if it does not exist
+	 */
+	function getError($name) {
+		if($this->isError($name)) {
+			return $this->errors[$name];
+		} else {
+			return false;
+		}
+	}
+	
+	
+	/**
+	 * Return all errors in the object
+	 *
+	 * @return String[]
+	 */ 
+	function getErrors() {
+		return (array)$this->errors;
+	}
+	
+	
+	/**
+	 * Check if a certain error exists
+	 *
+	 * @param	String	$name	The name of the error you want
+	 * @return boolean
+	 */ 
+	function isError($name) {
+		return isset($this->errors[$name]);
+	}
+	
+	
+	/**
+	 * Check if any errors exist
+	 *
+	 * @return boolean
+	 */
+	function errorsExist() {
+		return (count($this->errors) > 0);
+	}
+	
+	
+}
+
+
+
+
+
+// Used by the Akismet class to communicate with the Akismet service
+class AkismetHttpClient extends AkismetObject {
+	var $akismetVersion = '1.1';
+	var $con;
+	var $host;
+	var $port;
+	var $apiKey;
+	var $blogUrl;
+	var $errors = array();
+	
+	
+	// Constructor
+	function AkismetHttpClient($host, $blogUrl, $apiKey, $port = 80) {
+		$this->host = $host;
+		$this->port = $port;
+		$this->blogUrl = $blogUrl;
+		$this->apiKey = $apiKey;
+	}
+	
+	
+	// Use the connection active in $con to get a response from the server and return that response
+	function getResponse($request, $path, $type = "post", $responseLength = 1160) {
+		$this->_connect();
+		
+		if($this->con && !$this->isError(AKISMET_SERVER_NOT_FOUND)) {
+			$request  = 
+					strToUpper($type)." /{$this->akismetVersion}/$path HTTP/1.1\r\n" .
+					"Host: ".((!empty($this->apiKey)) ? $this->apiKey."." : null)."{$this->host}\r\n" .
+					"Content-Type: application/x-www-form-urlencoded; charset=utf-8\r\n" .
+					"Content-Length: ".strlen($request)."\r\n" .
+					"User-Agent: Akismet PHP4 Class\r\n" .
+					"\r\n" .
+					$request
+				;
+			$response = "";
+
+			@fwrite($this->con, $request);
+
+			while(!feof($this->con)) {
+				$response .= @fgets($this->con, $responseLength);
+			}
+
+			$response = explode("\r\n\r\n", $response, 2);
+			return $response[1];
+		} else {
+			$this->setError(AKISMET_RESPONSE_FAILED, "The response could not be retrieved.");
+		}
+		
+		$this->_disconnect();
+	}
+	
+	
+	// Connect to the Akismet server and store that connection in the instance variable $con
+	function _connect() {
+		if(!($this->con = @fsockopen($this->host, $this->port))) {
+			$this->setError(AKISMET_SERVER_NOT_FOUND, "Could not connect to akismet server.");
+		}
+	}
+	
+	
+	// Close the connection to the Akismet server
+	function _disconnect() {
+		@fclose($this->con);
+	}
+	
+	
+}
+
+
+
+
+
+// The controlling class. This is the ONLY class the user should instantiate in
+// order to use the Akismet service!
+class Akismet extends AkismetObject {
+	var $apiPort = 80;
+	var $akismetServer = 'rest.akismet.com';
+	var $akismetVersion = '1.1';
+	var $http;
+	
+	var $ignore = array(
+			'HTTP_COOKIE',
+			'HTTP_X_FORWARDED_FOR',
+			'HTTP_X_FORWARDED_HOST',
+			'HTTP_MAX_FORWARDS',
+			'HTTP_X_FORWARDED_SERVER',
+			'REDIRECT_STATUS',
+			'SERVER_PORT',
+			'PATH',
+			'DOCUMENT_ROOT',
+			'SERVER_ADMIN',
+			'QUERY_STRING',
+			'PHP_SELF',
+			'argv'
+		);
+	
+	var $blogUrl = "";
+	var $apiKey  = "";
+	var $comment = array();
+	
+	
+	/**
+	 * Constructor
+	 * 
+	 * Set instance variables, connect to Akismet, and check API key
+	 * 
+	 * @param	String	$blogUrl	The URL to your own blog
+	 * @param 	String	$apiKey		Your wordpress API key
+	 * @param 	String[]	$comment	A formatted comment array to be examined by the Akismet service
+	 */
+	function Akismet($blogUrl, $apiKey, $comment) {
+		$this->blogUrl = $blogUrl;
+		$this->apiKey  = $apiKey;
+		
+		// Populate the comment array with information needed by Akismet
+		$this->comment = $comment;
+		$this->_formatCommentArray();
+		
+		if(!isset($this->comment['user_ip'])) {
+			$this->comment['user_ip'] = ($_SERVER['REMOTE_ADDR'] != getenv('SERVER_ADDR')) ? $_SERVER['REMOTE_ADDR'] : getenv('HTTP_X_FORWARDED_FOR');
+		}
+		if(!isset($this->comment['user_agent'])) {
+			$this->comment['user_agent'] = $_SERVER['HTTP_USER_AGENT'];
+		}
+		if(!isset($this->comment['referrer'])) {
+			$this->comment['referrer'] = $_SERVER['HTTP_REFERER'];
+		}
+		$this->comment['blog'] = $blogUrl;
+		
+		// Connect to the Akismet server and populate errors if they exist
+		$this->http = new AkismetHttpClient($this->akismetServer, $blogUrl, $apiKey);
+		if($this->http->errorsExist()) {
+			$this->errors = array_merge($this->errors, $this->http->getErrors());
+		}
+		
+		// Check if the API key is valid
+		if(!$this->_isValidApiKey($apiKey)) {
+			$this->setError(AKISMET_INVALID_KEY, "Your Akismet API key is not valid.");
+		}
+	}
+	
+	
+	/**
+	 * Query the Akismet and determine if the comment is spam or not
+	 * 
+	 * @return	boolean
+	 */
+	function isSpam() {
+		$response = $this->http->getResponse($this->_getQueryString(), 'comment-check');
+		
+		return ($response == "true");
+	}
+	
+	
+	/**
+	 * Submit this comment as an unchecked spam to the Akismet server
+	 * 
+	 * @return	void
+	 */
+	function submitSpam() {
+		$this->http->getResponse($this->_getQueryString(), 'submit-spam');
+	}
+	
+	
+	/**
+	 * Submit a false-positive comment as "ham" to the Akismet server
+	 *
+	 * @return	void
+	 */
+	function submitHam() {
+		$this->http->getResponse($this->_getQueryString(), 'submit-ham');
+	}
+	
+	
+	/**
+	 * Check with the Akismet server to determine if the API key is valid
+	 *
+	 * @access	Protected
+	 * @param	String	$key	The Wordpress API key passed from the constructor argument
+	 * @return	boolean
+	 */
+	function _isValidApiKey($key) {
+		$keyCheck = $this->http->getResponse("key=".$this->apiKey."&blog=".$this->blogUrl, 'verify-key');
+			
+		return ($keyCheck == "valid");
+	}
+	
+	
+	/**
+	 * Format the comment array in accordance to the Akismet API
+	 *
+	 * @access	Protected
+	 * @return	void
+	 */
+	function _formatCommentArray() {
+		$format = array(
+				'type' => 'comment_type',
+				'author' => 'comment_author',
+				'email' => 'comment_author_email',
+				'website' => 'comment_author_url',
+				'body' => 'comment_content'
+			);
+		
+		foreach($format as $short => $long) {
+			if(isset($this->comment[$short])) {
+				$this->comment[$long] = $this->comment[$short];
+				unset($this->comment[$short]);
+			}
+		}
+	}
+	
+	
+	/**
+	 * Build a query string for use with HTTP requests
+	 *
+	 * @access	Protected
+	 * @return	String
+	 */
+	function _getQueryString() {
+		foreach($_SERVER as $key => $value) {
+			if(!in_array($key, $this->ignore)) {
+				if($key == 'REMOTE_ADDR') {
+					$this->comment[$key] = $this->comment['user_ip'];
+				} else {
+					$this->comment[$key] = $value;
+				}
+			}
+		}
+
+		$query_string = '';
+
+		foreach($this->comment as $key => $data) {
+			$query_string .= $key . '=' . urlencode(stripslashes($data)) . '&';
+		}
+
+		return $query_string;
+	}
+	
+	
+}
+?>
--- gelato/classes/comments.class.php	2007-09-16 23:22:42.000000000 +0200
+++ tumblelog/classes/comments.class.php	2008-01-06 16:29:33.000000000 +0100
@@ -34,14 +34,41 @@
 	}
 	
 	function isSpam($fieldsArray) {
-		if (preg_match( "/^\d+$/", $fieldsArray["username"])) { return true; } 
-		elseif (trim($fieldsArray["content"]) == "") { return true; } 
-		elseif (preg_match( "/^\d+$/", $fieldsArray["content"])) { return true; } 
-		elseif (strtolower($fieldsArray["content"]) == strtolower($fieldsArray["username"])) { return true; } 
-		elseif (preg_match("#^<strong>[^.]+\.\.\.</strong>#", $fieldsArray["content"])) { return true; } 
-		elseif (3 <= preg_match_all("/a href=/", strtolower($fieldsArray["content"]), $matches)) { return true; } 
-		elseif ($this->isBadWord($fieldsArray["content"])) { return true; } 
-		else { return false; }
+		$useAkismet = 1; // TODO: $conf->useAkismet
+		if ($useAkismet) {
+			$WordPressAPIKey =  'Your API Key Here'; //TODO: $conf->akismetKey
+			$comment = array(
+			'author'    => $fieldsArray["username"],
+			'email'     => $fieldsArray["email"],
+			'website'   => $fieldsArray["web"],
+			'body'      => $fieldsArray["content"],
+			'permalink' => $conf->urlGelato.
+					($conf->urlFriendly?"/post/":"/index.php?post=").
+					$fieldsArray["id_post"].$strEnd,
+			);
+ 
+			$akismet = new Akismet($conf->urlGelato, $WordPressAPIKey, $comment);
+ 
+			if($akismet->errorsExist()) {
+				$useAkismet = false;
+			} else {
+				if($akismet->isSpam()) {
+					return true;
+				} else {
+					return false;
+				}
+			}
+		}
+		if (!$useAkismet) {
+			if (preg_match( "/^\d+$/", $fieldsArray["username"])) { return true; } 
+			elseif (trim($fieldsArray["content"]) == "") { return true; } 
+			elseif (preg_match( "/^\d+$/", $fieldsArray["content"])) { return true; } 
+			elseif (strtolower($fieldsArray["content"]) == strtolower($fieldsArray["username"])) { return true; } 
+			elseif (preg_match("#^<strong>[^.]+\.\.\.</strong>#", $fieldsArray["content"])) { return true; } 
+			elseif (3 <= preg_match_all("/a href=/", strtolower($fieldsArray["content"]), $matches)) { return true; } 
+			elseif ($this->isBadWord($fieldsArray["content"])) { return true; } 
+			else { return false; }
+		}
 	}
 	
 	function isBadWord($str="") {
