Browse Source

Fixed apostrophe's bug

pecesama 18 years ago
parent
commit
c6321c7d34
3 changed files with 254 additions and 245 deletions
  1. 5 2
      admin/index.php
  2. 1 1
      classes/functions.php
  3. 248 242
      index.php

+ 5 - 2
admin/index.php View File

@@ -236,8 +236,8 @@ if ($user->isAdmin()) {
236 236
 							}
237 237
 							
238 238
 							$date = ($isEdition) ? strtotime($post["date"]) : time();
239
-							$title = ($isEdition) ? $post["title"] : "";
240
-							$body = ($isEdition) ? $post["description"] : "";
239
+							$title = ($isEdition) ? stripslashes($post["title"]) : "";
240
+							$body = ($isEdition) ? stripslashes($post["description"]) : "";
241 241
 							$url = ($isEdition) ? $post["url"] : "";
242 242
 							
243 243
 							switch ($_GET["new"]) {
@@ -347,6 +347,9 @@ if ($user->isAdmin()) {
347 347
 							$textile = new Textile;
348 348
 							$register["description"] = $textile->process($register["description"]);
349 349
 							
350
+							$register["title"] = stripslashes($register["title"]);
351
+							$register["description"] = stripslashes($register["description"]);
352
+							
350 353
 							switch ($tumble->getType($register["id_post"])) {
351 354
 								case "1":
352 355
 									$input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");

+ 1 - 1
classes/functions.php View File

@@ -197,7 +197,7 @@
197 197
 					return false;
198 198
 				}
199 199
 		
200
-				$f = fsockopen($data['host'], ($data['port']) ? $data['port'] : 80, $e1, $e2, 3);
200
+				$f = @fsockopen($data['host'], ($data['port']) ? $data['port'] : 80, $e1, $e2, 3);
201 201
 				if (!$f) {
202 202
 					return false;
203 203
 				}

+ 248 - 242
index.php View File

@@ -10,253 +10,259 @@
10 10
   =========================== */
11 11
 ?>
12 12
 <?php
13
-	// My approach to MVC
14
-	
15
-	$configFile = dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
16
-	
17
-	if (!file_exists($configFile)) {
18
-		$mensaje = "
19
-			<h3 class=\"important\">Error reading configuration file</h3>			
20
-			<p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
21
-			<p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
22
-		die($mensaje);	
23
-	} else {
24
-		require(dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
25
-	}	
26
-	
27
-	include("classes/configuration.class.php");
28
-	include("classes/textile.class.php");
29
-	include("classes/gelato.class.php");	
30
-	include("classes/templates.class.php");
31
-	include("classes/pagination.class.php");
32
-	include("classes/user.class.php");
33
-		
34
-	$user = new user();
35
-	$conf = new configuration();
36
-	$tumble = new gelato();
37
-	$template = new plantillas($conf->template);
13
+        // My approach to MVC
14
+        
15
+        $configFile = dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
16
+        
17
+        if (!file_exists($configFile)) {
18
+                $mensaje = "
19
+                        <h3 class=\"important\">Error reading configuration file</h3>                   
20
+                        <p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
21
+                        <p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
22
+                die($mensaje);  
23
+        } else {
24
+                require(dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
25
+        }       
26
+        
27
+        include("classes/configuration.class.php");
28
+        include("classes/textile.class.php");
29
+        include("classes/gelato.class.php");    
30
+        include("classes/templates.class.php");
31
+        include("classes/pagination.class.php");
32
+        include("classes/user.class.php");
33
+                
34
+        $user = new user();
35
+        $conf = new configuration();
36
+        $tumble = new gelato();
37
+        $template = new plantillas($conf->template);
38 38
 
39
-	if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
39
+        if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
40 40
 
41
-	if (isset($_GET["post"])) {
42
-		$id_post = $_GET["post"];
43
-	} else {
44
-		if (isset($param_url[1]) && $param_url[1]=="post") {
45
-			$id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
46
-		} else {
47
-			$id_post = NULL;
48
-		}
49
-	}
50
-	
51
-	if (isset($_GET["page"])) {
52
-		$page_num = $_GET["page"];
53
-	} else {
54
-		if (isset($param_url[1]) && $param_url[1]=="page") {
55
-			$page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
56
-		} else {
57
-			$page_num = NULL;
58
-		}
59
-	}
60
-	
61
-	$gelato_includes = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
62
-	$gelato_includes .= "\t<meta name=\"generator\" content=\"gelato cms ".version()."\" />\n";
63
-	$gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />\n";
64
-	$gelato_includes .= "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".$conf->urlGelato."/rss.php\"/>\n";
65
-	$gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/themes/".$conf->template."/style.css\"/>\n";
66
-	$gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/slimbox.css\" />\n";	
67
-	$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/mootools.js\"></script>\n";
68
-	$gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/slimbox.js\"></script>";
69
-	
70
-	$input = array("{Gelato_includes}","{Title}", "{Description}", "{URL_Tumble}", "{Template_name}");
71
-	$output = array($gelato_includes, $conf->title, $conf->description, $conf->urlGelato, $conf->template);
72
-	
73
-	$template->cargarPlantilla($input, $output, "template_header");
74
-	$template->mostrarPlantilla();
75
-	
76
-	if ($user->isAdmin()) {	
77
-		$input = array("{User}", "{URL_Tumble}");
78
-		$output = array($_SESSION["user_login"], $conf->urlGelato);
79
-		
80
-		$template->cargarPlantilla($input, $output, "template_isadmin");
81
-		$template->mostrarPlantilla();
82
-	}
83
-	
84
-	if (!$id_post) {
41
+        if (isset($_GET["post"])) {
42
+                $id_post = $_GET["post"];
43
+        } else {
44
+                if (isset($param_url[1]) && $param_url[1]=="post") {
45
+                        $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
46
+                } else {
47
+                        $id_post = NULL;
48
+                }
49
+        }
50
+        
51
+        if (isset($_GET["page"])) {
52
+                $page_num = $_GET["page"];
53
+        } else {
54
+                if (isset($param_url[1]) && $param_url[1]=="page") {
55
+                        $page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
56
+                } else {
57
+                        $page_num = NULL;
58
+                }
59
+        }
60
+        
61
+        $gelato_includes = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
62
+        $gelato_includes .= "\t<meta name=\"generator\" content=\"gelato cms ".version()."\" />\n";
63
+        $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />\n";
64
+        $gelato_includes .= "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".$conf->urlGelato."/rss.php\"/>\n";
65
+        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/themes/".$conf->template."/style.css\"/>\n";
66
+        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/slimbox.css\" />\n";    
67
+        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/mootools.js\"></script>\n";
68
+        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/slimbox.js\"></script>";
69
+        
70
+        $input = array("{Gelato_includes}","{Title}", "{Description}", "{URL_Tumble}", "{Template_name}");
71
+        $output = array($gelato_includes, $conf->title, $conf->description, $conf->urlGelato, $conf->template);
72
+        
73
+        $template->cargarPlantilla($input, $output, "template_header");
74
+        $template->mostrarPlantilla();
75
+        
76
+        if ($user->isAdmin()) { 
77
+                $input = array("{User}", "{URL_Tumble}");
78
+                $output = array($_SESSION["user_login"], $conf->urlGelato);
79
+                
80
+                $template->cargarPlantilla($input, $output, "template_isadmin");
81
+                $template->mostrarPlantilla();
82
+        }
83
+        
84
+        if (!$id_post) {
85 85
 
86
-		$limit=$conf->postLimit;
87
-	
88
-		if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
89
-			$from = (($page_num-1) * $limit);
90
-		} else {
91
-			$from = 0;
92
-		}
93
-	
94
-		$rs = $tumble->getPosts($limit, $from);
86
+                $limit=$conf->postLimit;
87
+        
88
+                if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
89
+                        $from = (($page_num-1) * $limit);
90
+                } else {
91
+                        $from = 0;
92
+                }
93
+        
94
+                $rs = $tumble->getPosts($limit, $from);
95 95
 
96
-		if ($tumble->contarRegistros()>0) {
97
-			$fecha = null;		
98
-			while($register = mysql_fetch_array($rs)) {			
99
-				$formatedDate = date("M d", strtotime($register["date"]));
100
-				if ( $fecha != null && $formatedDate == $fecha ) { $formatedDate = ""; } else { $fecha = $formatedDate; }
101
-				$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
102
-				
103
-				$textile = new Textile; 				
104
-				$register["description"] = $textile->process($register["description"]);
105
-				
106
-				switch ($tumble->getType($register["id_post"])) {
107
-					case "1":
108
-						$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
109
-						$output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
110
-											
111
-						$template->cargarPlantilla($input, $output, "template_regular_post");
112
-						$template->mostrarPlantilla();
113
-						break;
114
-					case "2":						
115
-						$fileName = "uploads/".getFileName($register["url"]);
116
-						
117
-						$x = @getimagesize($fileName);						
118
-						if ($x[0] > 500) {							
119
-							$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
120
-						} else {
121
-							$photoPath = $register["url"];
122
-						}
123
-						
124
-						$effect = " onclick=\"Lightbox.show('".$register["url"]."', '".strip_tags($register["description"])."');\" ";
125
-						
126
-						$input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
127
-						$output = array($formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
128
-						
129
-						$template->cargarPlantilla($input, $output, "template_photo");
130
-						$template->mostrarPlantilla();							   
131
-						break;
132
-					case "3":
133
-						$input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
134
-						$output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
135
-						
136
-						$template->cargarPlantilla($input, $output, "template_quote");
137
-						$template->mostrarPlantilla();
138
-						break;
139
-					case "4":
140
-						$input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
141
-						$output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
142
-						
143
-						$template->cargarPlantilla($input, $output, "template_url");
144
-						$template->mostrarPlantilla();
145
-						break;
146
-					case "5":
147
-						$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
148
-						$output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
149
-						
150
-						$template->cargarPlantilla($input, $output, "template_conversation");
151
-						$template->mostrarPlantilla();
152
-						break;
153
-					case "6":
154
-						$input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
155
-						$output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
156
-						
157
-						$template->cargarPlantilla($input, $output, "template_video");
158
-						$template->mostrarPlantilla();
159
-						break;
160
-					case "7":
161
-						$input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
162
-						$output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
163
-						
164
-						$template->cargarPlantilla($input, $output, "template_mp3");
165
-						$template->mostrarPlantilla();
166
-						break;
167
-				}
168
-			}
96
+                if ($tumble->contarRegistros()>0) {
97
+                        $fecha = null;          
98
+                        while($register = mysql_fetch_array($rs)) {
99
+                                $formatedDate = date("M d", strtotime($register["date"]));
100
+                                if ( $fecha != null && $formatedDate == $fecha ) { $formatedDate = ""; } else { $fecha = $formatedDate; }
101
+                                $permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
102
+                                
103
+                                $textile = new Textile;                                 
104
+                                $register["description"] = $textile->process($register["description"]);
169 105
 
170
-			$p = new pagination;
171
-			$p->Items($tumble->getPostsNumber());
172
-			$p->limit($limit);
173
-			
174
-			$p->urlFriendly('[...]');
175
-			$p->target($conf->urlGelato."/index.php/page/[...]/");
176
-			
177
-			$p->currentPage(isset($page_num) ? $page_num : 1);
178
-			$p->show();
106
+                                $register["title"] = stripslashes($register["title"]);
107
+                                $register["description"] = stripslashes($register["description"]);
179 108
 
109
+                                switch ($tumble->getType($register["id_post"])) {
110
+                                        case "1":
111
+                                                $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
112
+                                                $output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
113
+                                                                                        
114
+                                                $template->cargarPlantilla($input, $output, "template_regular_post");
115
+                                                $template->mostrarPlantilla();
116
+                                                break;
117
+                                        case "2":                                               
118
+                                                $fileName = "uploads/".getFileName($register["url"]);
119
+                                                
120
+                                                $x = @getimagesize($fileName);                                          
121
+                                                if ($x[0] > 500) {                                                      
122
+                                                        $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
123
+                                                } else {
124
+                                                        $photoPath = $register["url"];
125
+                                                }
126
+                                                
127
+                                                $effect = " onclick=\"Lightbox.show('".$register["url"]."', '".strip_tags($register["description"])."');\" ";
128
+                                                
129
+                                                $input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
130
+                                                $output = array($formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
131
+                                                
132
+                                                $template->cargarPlantilla($input, $output, "template_photo");
133
+                                                $template->mostrarPlantilla();                                                     
134
+                                                break;
135
+                                        case "3":
136
+                                                $input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
137
+                                                $output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
138
+                                                
139
+                                                $template->cargarPlantilla($input, $output, "template_quote");
140
+                                                $template->mostrarPlantilla();
141
+                                                break;
142
+                                        case "4":
143
+                                                $input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
144
+                                                $output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
145
+                                                
146
+                                                $template->cargarPlantilla($input, $output, "template_url");
147
+                                                $template->mostrarPlantilla();
148
+                                                break;
149
+                                        case "5":
150
+                                                $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
151
+                                                $output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
152
+                                                
153
+                                                $template->cargarPlantilla($input, $output, "template_conversation");
154
+                                                $template->mostrarPlantilla();
155
+                                                break;
156
+                                        case "6":
157
+                                                $input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
158
+                                                $output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
159
+                                                
160
+                                                $template->cargarPlantilla($input, $output, "template_video");
161
+                                                $template->mostrarPlantilla();
162
+                                                break;
163
+                                        case "7":
164
+                                                $input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
165
+                                                $output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
166
+                                                
167
+                                                $template->cargarPlantilla($input, $output, "template_mp3");
168
+                                                $template->mostrarPlantilla();
169
+                                                break;
170
+                                }
171
+                        }
180 172
 
181
-		} else {
182
-			$template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");
183
-		}
184
-	} else {
185
-		$register = $tumble->getPost($id_post);
186
-		
187
-		$formatedDate = date("M d", strtotime($register["date"]));
188
-		$permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
189
-		
190
-		$textile = new Textile;
191
-		$register["description"] = $textile->process($register["description"]);
192
-		
193
-		switch ($tumble->getType($register["id_post"])) {
194
-			case "1":
195
-				$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
196
-				$output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
197
-									
198
-				$template->cargarPlantilla($input, $output, "template_regular_post");
199
-				$template->mostrarPlantilla();
200
-				break;
201
-			case "2":
202
-				$fileName = "uploads/".getFileName($register["url"]);
203
-						
204
-				$x = @getimagesize($fileName);						
205
-				if ($x[0] > 500) {					
206
-					$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
207
-				} else {
208
-					$photoPath = $register["url"];
209
-				}
210
-				
211
-				$effect = " onclick=\"Lightbox.show('".$register["url"]."', '".strip_tags($register["description"])."');\" ";
212
-						
213
-				$input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
214
-				$output = array($formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
215
-				
216
-				$template->cargarPlantilla($input, $output, "template_photo");
217
-				$template->mostrarPlantilla();							   
218
-				break;
219
-			case "3":
220
-				$input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
221
-				$output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
222
-				
223
-				$template->cargarPlantilla($input, $output, "template_quote");
224
-				$template->mostrarPlantilla();
225
-				break;
226
-			case "4":
227
-				$input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
228
-				$output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
229
-				
230
-				$template->cargarPlantilla($input, $output, "template_url");
231
-				$template->mostrarPlantilla();
232
-				break;
233
-			case "5":
234
-				$input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
235
-				$output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
236
-				
237
-				$template->cargarPlantilla($input, $output, "template_conversation");
238
-				$template->mostrarPlantilla();
239
-				break;
240
-			case "6":
241
-				$input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
242
-				$output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
243
-				
244
-				$template->cargarPlantilla($input, $output, "template_video");
245
-				$template->mostrarPlantilla();
246
-				break;
247
-			case "7":
248
-				$input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
249
-				$output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
173
+                        $p = new pagination;
174
+                        $p->Items($tumble->getPostsNumber());
175
+                        $p->limit($limit);
176
+                        
177
+                        $p->urlFriendly('[...]');
178
+                        $p->target($conf->urlGelato."/index.php/page/[...]/");
179
+                        
180
+                        $p->currentPage(isset($page_num) ? $page_num : 1);
181
+                        $p->show();
182
+
183
+
184
+                } else {
185
+                        $template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");
186
+                }
187
+        } else {
188
+                $register = $tumble->getPost($id_post);
189
+                
190
+                $formatedDate = date("M d", strtotime($register["date"]));
191
+                $permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
192
+                
193
+                $textile = new Textile;
194
+                $register["description"] = $textile->process($register["description"]);
250 195
 				
251
-				$template->cargarPlantilla($input, $output, "template_mp3");
252
-				$template->mostrarPlantilla();
253
-				break;
254
-		}
255
-	}
256
-	
257
-	$input = array("{URL_Tumble}");
258
-	$output = array($conf->urlGelato);
259
-	
260
-	$template->cargarPlantilla($input, $output, "template_footer");
261
-	$template->mostrarPlantilla();
262
-?> 
196
+				$register["title"] = stripslashes($register["title"]);
197
+                $register["description"] = stripslashes($register["description"]);
198
+                
199
+                switch ($tumble->getType($register["id_post"])) {
200
+                        case "1":
201
+                                $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
202
+                                $output = array($formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
203
+                                                                        
204
+                                $template->cargarPlantilla($input, $output, "template_regular_post");
205
+                                $template->mostrarPlantilla();
206
+                                break;
207
+                        case "2":
208
+                                $fileName = "uploads/".getFileName($register["url"]);
209
+                                                
210
+                                $x = @getimagesize($fileName);                                          
211
+                                if ($x[0] > 500) {                                      
212
+                                        $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
213
+                                } else {
214
+                                        $photoPath = $register["url"];
215
+                                }
216
+                                
217
+                                $effect = " onclick=\"Lightbox.show('".$register["url"]."', '".strip_tags($register["description"])."');\" ";
218
+                                                
219
+                                $input = array("{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
220
+                                $output = array($formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
221
+                                
222
+                                $template->cargarPlantilla($input, $output, "template_photo");
223
+                                $template->mostrarPlantilla();                                                     
224
+                                break;
225
+                        case "3":
226
+                                $input = array("{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
227
+                                $output = array($formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
228
+                                
229
+                                $template->cargarPlantilla($input, $output, "template_quote");
230
+                                $template->mostrarPlantilla();
231
+                                break;
232
+                        case "4":
233
+                                $input = array("{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
234
+                                $output = array($formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
235
+                                
236
+                                $template->cargarPlantilla($input, $output, "template_url");
237
+                                $template->mostrarPlantilla();
238
+                                break;
239
+                        case "5":
240
+                                $input = array("{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
241
+                                $output = array($formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
242
+                                
243
+                                $template->cargarPlantilla($input, $output, "template_conversation");
244
+                                $template->mostrarPlantilla();
245
+                                break;
246
+                        case "6":
247
+                                $input = array("{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
248
+                                $output = array($formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
249
+                                
250
+                                $template->cargarPlantilla($input, $output, "template_video");
251
+                                $template->mostrarPlantilla();
252
+                                break;
253
+                        case "7":
254
+                                $input = array("{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
255
+                                $output = array($formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
256
+                                
257
+                                $template->cargarPlantilla($input, $output, "template_mp3");
258
+                                $template->mostrarPlantilla();
259
+                                break;
260
+                }
261
+        }
262
+        
263
+        $input = array("{URL_Tumble}");
264
+        $output = array($conf->urlGelato);
265
+        
266
+        $template->cargarPlantilla($input, $output, "template_footer");
267
+        $template->mostrarPlantilla();
268
+?>