Browse Source

Fixed Notice: Undefined variable: page_title_data

pecesama 16 years ago
parent
commit
b11aaf1b4f
1 changed files with 326 additions and 324 deletions
  1. 326 324
      index.php

+ 326 - 324
index.php View File

@@ -1,325 +1,327 @@
1
-<?php
2
-if(!defined('entry'))define('entry', true);
3
- /* ===========================
4
-
5
-  gelato CMS - A PHP based tumblelog CMS
6
-  development version
7
-  http://www.gelatocms.com/
8
-
9
-  gelato CMS is a free software licensed under the GPL 2.0
10
-  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
11
-
12
-  =========================== */
13
-?>
14
-<?php
15
-
16
-// Received a valid request, better start setting globals we'll need throughout the app in entry.php
17
-require_once('entry.php');
18
-global $user, $tumble, $conf;
19
-
20
-$theme = new themes;
21
-        // My approach to MVC
22
-
23
-        if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
24
-
25
-        if (isset($_GET["post"])) {
26
-                $id_post = $_GET["post"];
27
-                if (!is_numeric($id_post) || $id_post < 1 ){
28
-                	header("Location: index.php");
29
-                }
30
-        } else {
31
-                if (isset($param_url[1]) && $param_url[1]=="post") {
32
-                        $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
33
-                } else {
34
-                        $id_post = NULL;
35
-                }
36
-        }
37
-
38
-        $theme->set('id_post',$id_post);
39
-	$theme->set('error','');
40
-
41
-        if (isset($_GET["page"])) {
42
-                $page_num = $_GET["page"];
43
-        } else {
44
-                if (isset($param_url[1]) && $param_url[1]=="page") {
45
-                        $page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
46
-                } else {
47
-                        $page_num = NULL;
48
-                }
49
-        }
50
-
51
-        $gelato_includes = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
52
-        $gelato_includes .= "\t<meta name=\"generator\" content=\"gelato  ".codeName()." (".version().")\" />\n";
53
-        $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />\n";
54
-        $gelato_includes .= "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".$conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php")."\"/>\n";
55
-        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/themes/".$conf->template."/style.css\"/>\n";
56
-        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/lightbox.css\" />\n";
57
-        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/jquery.js\"></script>\n";
58
-        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/lightbox.js\"></script>";
59
-
60
-		$page_title = $conf->title;
61
-		$page_title_divisor = " &raquo; "; // it should be set in configuration
62
-		$page_title_len = 50; // it should be set in configuration
63
-		if ($id_post) {
64
-			$register = $tumble->getPost($id_post);
65
-			$textile = new Textile();
66
-			if (empty($register["title"])) {
67
-				if (!empty($register["description"])) {
68
-					if (strlen($register["description"]) > $page_title_len) {
69
-						$page_title_data = substr($register["description"], 0, $page_title_len)."...";
70
-					}
71
-				}
72
-			} else {
73
-				$page_title_data = $register["title"];
74
-			}
75
-			$page_title_data = strip_tags($textile->TextileThis($page_title_data));
76
-			if (!empty($page_title_data)) {
77
-				$page_title .= $page_title_divisor.stripslashes($page_title_data);
78
-			}
79
-		}
80
-
81
-		$theme->set('Gelato_includes',$gelato_includes);
82
-		$theme->set('Title',$conf->title);
83
-		$theme->set('Page_Title',$page_title);
84
-		$theme->set('Description',$conf->description);
85
-		$theme->set('URL_Tumble',$conf->urlGelato);
86
-		$theme->set('Template_name',$conf->template);
87
-
88
-		$theme->set('isAuthenticated',$user->isAuthenticated());
89
-        if($user->isAuthenticated()){
90
-			$theme->set('User',$_SESSION["user_login"]);
91
-			$theme->set('URL_Tumble',$conf->urlGelato);
92
-        }
93
-
94
-		$rows = array();
95
-        if(!$id_post){
96
-                $limit=$conf->postLimit;
97
-
98
-                if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
99
-                        $from = (($page_num-1) * $limit);
100
-                } else {
101
-                        $from = 0;
102
-                }
103
-
104
-                $rs = $tumble->getPosts($limit, $from);
105
-
106
-                if ($tumble->contarRegistros()>0) {
107
-                        $dateTmp = null;
108
-                        while($register = mysql_fetch_assoc($rs)) {
109
-								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
110
-                                if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
111
-								$strEnd=($conf->urlFriendly) ? "/" : "";
112
-								$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
113
-
114
-								$conversation = $register["description"];
115
-
116
-								$register["description"] = $register["description"];
117
-
118
-                                $register["title"] = stripslashes($register["title"]);
119
-                                $register["description"] = stripslashes($register["description"]);
120
-
121
-								$postType = $tumble->getType($register["id_post"]);
122
-
123
-								$row['Date_Added'] = $formatedDate;
124
-								$row['Permalink'] = $permalink;
125
-								$row['postType'] = $postType;
126
-                                switch ($postType){
127
-                                        case "1":
128
-                                        		$row['Title'] = $register["title"];
129
-                                        		$row['Body'] = $register["description"];
130
-                                                break;
131
-                                        case "2":
132
-                                                $fileName = "uploads/".getFileName($register["url"]);
133
-
134
-                                                $x = @getimagesize($fileName);
135
-                                                if ($x[0] > 500) {
136
-													$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
137
-                                                } else {
138
-													$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
139
-                                                }
140
-
141
-												$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
142
-
143
-												$row['PhotoURL'] = $photoPath;
144
-												$row['PhotoAlt'] = strip_tags($register["description"]);
145
-												$row['Caption'] = $register["description"];
146
-												$row['Effect'] = $effect;
147
-                                                break;
148
-                                        case "3":
149
-                                        		$row['Quote'] = $register["description"];
150
-                                        		$row['Source'] = $register["title"];
151
-                                                break;
152
-                                        case "4":
153
-                                                if($conf->shorten_links){
154
-													$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
155
-												}
156
-												$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
157
-
158
-												$row['URL'] = $register["url"];
159
-												$row['Name'] = $register["title"];
160
-												$row['Description'] = $register["description"];
161
-                                                break;
162
-                                        case "5":
163
-                                        		$row['Title'] = $register["title"];
164
-                                        		$row['Conversation'] = $tumble->formatConversation($conversation);
165
-                                                break;
166
-                                        case "6":
167
-                                        		$row['Video'] = $tumble->getVideoPlayer($register["url"]);
168
-                                        		$row['Caption'] = $register["description"];
169
-                                                break;
170
-                                        case "7":
171
-                                        		$row['Mp3'] = $tumble->getMp3Player($register["url"]);
172
-                                        		$row['Caption'] = $register["description"];
173
-                                                break;
174
-                                }
175
-
176
-								$comment = new comments();
177
-								$noComments = $comment->countComments($register["id_post"]);
178
-
179
-								$user = new user();
180
-								$username = $user->getUserByID($register["id_user"]);
181
-
182
-								$row['User'] = $username["name"];
183
-								$row['Comments_Number'] = $noComments;
184
-
185
-								$rows[] = $row;
186
-                        }
187
-
188
-						$theme->set('rows',$rows);
189
-
190
-                        $p = new pagination;
191
-                        $p->Items($tumble->getPostsNumber());
192
-                        $p->limit($limit);
193
-						if($conf->urlFriendly){
194
-								$p->urlFriendly('[...]');
195
-								$p->target($conf->urlGelato."/page/[...]");
196
-							}else
197
-								$p->target($conf->urlGelato);
198
-
199
-                        $p->currentPage(isset($page_num) ? $page_num : 1);
200
-
201
-                        $theme->set('pagination',$p->getPagination());
202
-                } else {
203
-                        $theme->set('error','No posts in this tumblelog.');
204
-                }
205
-        } else {
206
-                $register = $tumble->getPost($id_post);
207
-
208
-				$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
209
-				$strEnd=($conf->urlFriendly) ? "/" : "";
210
-				$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
211
-
212
-				$conversation = $register["description"];
213
-
214
-				$register["description"] = $register["description"];
215
-
216
-				$register["title"] = stripslashes($register["title"]);
217
-                $register["description"] = stripslashes($register["description"]);
218
-
219
-				$row['Date_Added'] = $formatedDate;
220
-				$row['Permalink'] = $permalink;
221
-				$postType = $tumble->getType($register["id_post"]);
222
-				$row['postType'] = $postType;
223
-                switch ($postType) {
224
-                        case "1":
225
-								$row['Title'] = $register["title"];
226
-								$row['Body'] = $register["description"];
227
-                                break;
228
-                        case "2":
229
-                                $fileName = "uploads/".getFileName($register["url"]);
230
-
231
-                                $x = @getimagesize($fileName);
232
-                                if ($x[0] > 500) {
233
-                                        $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
234
-                                } else {
235
-										$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
236
-                                }
237
-
238
-								$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
239
-
240
-								$row['PhotoURL'] = $photoPath;
241
-								$row['PhotoAlt'] = strip_tags($register["description"]);
242
-								$row['Caption'] = $register["description"];
243
-								$row['Effect'] = $effect;
244
-                                break;
245
-                        case "3":
246
-								$row['Quote'] = $register["description"];
247
-                                $row['Source'] = $register["title"];
248
-                                break;
249
-                        case "4":
250
-                                if($conf->shorten_links){
251
-									$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
252
-								}
253
-								$row['URL'] = $register["url"];
254
-								$row['Name'] = $register["title"];
255
-								$row['Description'] = $register["description"];
256
-                                break;
257
-                        case "5":
258
-								$row['Title'] = $register["title"];
259
-								$row['Conversation'] = $tumble->formatConversation($conversation);
260
-								break;
261
-						case "6":
262
-								$row['Video'] = $tumble->getVideoPlayer($register["url"]);
263
-								$row['Caption'] = $register["description"];
264
-								break;
265
-						case "7":
266
-								$row['Mp3'] = $tumble->getMp3Player($register["url"]);
267
-								$row['Caption'] = $register["description"];
268
-								break;
269
-                }
270
-
271
-				if ($conf->allowComments) {
272
-
273
-					$comment = new comments();
274
-					$rsComments = $comment->getComments($register["id_post"]);
275
-
276
-					$user = new user();
277
-					$username = $user->getUserByID($register["id_user"]);
278
-
279
-					$row['User'] = $username["name"];
280
-
281
-					$textile = new Textile();
282
-					if (empty($register["title"])) {
283
-						if (!empty($register["description"])) {
284
-							if (strlen($register["description"]) > 30) {
285
-								$postTitle = substr($register["description"], 0, 30)."...";
286
-							}
287
-						}
288
-					} else {
289
-						$postTitle = $register["title"];
290
-					}
291
-					$postTitle = strip_tags($textile->TextileThis($postTitle));
292
-
293
-					$row['Post_Title'] = $postTitle;
294
-					$row['Comments_Number'] = $comment->countComments($register["id_post"]);
295
-
296
-					$rows[] = $row;
297
-					$theme->set('rows',$rows);
298
-
299
-					$comments = array();
300
-					while($rowComment = mysql_fetch_assoc($rsComments)) {
301
-						$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
302
-
303
-						$answers['Id_Comment'] = $rowComment["id_comment"];
304
-						$answers['Comment_Author'] = $commentAuthor;
305
-						$answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"])+transform_offset($conf->offsetTime));
306
-						$answers['Comment'] = $rowComment["content"];
307
-
308
-						$comments[] = $answers;
309
-					}
310
-					$theme->set('comments',$comments);
311
-
312
-					$whois['User_Cookie'] = isset($_COOKIE['cookie_gel_user'])?$_COOKIE['cookie_gel_user']:'';
313
-					$whois['Email_Cookie'] = isset($_COOKIE['cookie_gel_email'])?$_COOKIE['cookie_gel_email']:'';
314
-					$whois['Web_Cookie'] = isset($_COOKIE['cookie_gel_web'])?$_COOKIE['cookie_gel_web']:'';
315
-					$whois['Id_Post'] = $register["id_post"];
316
-
317
-					$theme->set('Date_Added',gmmktime());
318
-					$theme->set('Form_Action',$conf->urlGelato."/admin/comments.php");
319
-					$theme->set('whois',$whois);
320
-				}
321
-        }
322
-
323
-        $theme->set('URL_Tumble',$conf->urlGelato);
324
-		$theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm');
1
+<?php
2
+if(!defined('entry'))define('entry', true);
3
+ /* ===========================
4
+
5
+  gelato CMS - A PHP based tumblelog CMS
6
+  development version
7
+  http://www.gelatocms.com/
8
+
9
+  gelato CMS is a free software licensed under the GPL 2.0
10
+  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
11
+
12
+  =========================== */
13
+?>
14
+<?php
15
+
16
+// Received a valid request, better start setting globals we'll need throughout the app in entry.php
17
+require_once('entry.php');
18
+global $user, $tumble, $conf;
19
+
20
+$theme = new themes;
21
+        // My approach to MVC
22
+
23
+        if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
24
+
25
+        if (isset($_GET["post"])) {
26
+                $id_post = $_GET["post"];
27
+                if (!is_numeric($id_post) || $id_post < 1 ){
28
+                	header("Location: index.php");
29
+                }
30
+        } else {
31
+                if (isset($param_url[1]) && $param_url[1]=="post") {
32
+                        $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
33
+                } else {
34
+                        $id_post = NULL;
35
+                }
36
+        }
37
+
38
+        $theme->set('id_post',$id_post);
39
+	$theme->set('error','');
40
+
41
+        if (isset($_GET["page"])) {
42
+                $page_num = $_GET["page"];
43
+        } else {
44
+                if (isset($param_url[1]) && $param_url[1]=="page") {
45
+                        $page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : NULL) : NULL;
46
+                } else {
47
+                        $page_num = NULL;
48
+                }
49
+        }
50
+
51
+        $gelato_includes = "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\n";
52
+        $gelato_includes .= "\t<meta name=\"generator\" content=\"gelato  ".codeName()." (".version().")\" />\n";
53
+        $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />\n";
54
+        $gelato_includes .= "\t<link rel=\"alternate\" type=\"application/rss+xml\" title=\"RSS\" href=\"".$conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php")."\"/>\n";
55
+        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/themes/".$conf->template."/style.css\"/>\n";
56
+        $gelato_includes .= "\t<link rel=\"stylesheet\" type=\"text/css\" href=\"".$conf->urlGelato."/admin/css/lightbox.css\" />\n";
57
+        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/jquery.js\"></script>\n";
58
+        $gelato_includes .= "\t<script language=\"javascript\" type=\"text/javascript\" src=\"".$conf->urlGelato."/admin/scripts/lightbox.js\"></script>";
59
+
60
+		$page_title = $conf->title;
61
+		$page_title_divisor = " &raquo; "; // it should be set in configuration
62
+		$page_title_len = 50; // it should be set in configuration
63
+		if ($id_post) {
64
+			$register = $tumble->getPost($id_post);			
65
+			if (empty($register["title"])) {
66
+				if (!empty($register["description"])) {
67
+					if (strlen($register["description"]) > $page_title_len) {
68
+						$page_title_data = substr($register["description"], 0, $page_title_len)."...";
69
+					} else {
70
+						$page_title_data = $register["description"];
71
+					}
72
+				} else {
73
+					$page_title_data =  type2Text($register["type"]);
74
+				}
75
+			} else {
76
+				$page_title_data = $register["title"];
77
+			}			
78
+			if (!empty($page_title_data)) {
79
+				$page_title .= $page_title_divisor.stripslashes(strip_tags($page_title_data));
80
+			}
81
+		}
82
+
83
+		$theme->set('Gelato_includes',$gelato_includes);
84
+		$theme->set('Title',$conf->title);
85
+		$theme->set('Page_Title',$page_title);
86
+		$theme->set('Description',$conf->description);
87
+		$theme->set('URL_Tumble',$conf->urlGelato);
88
+		$theme->set('Template_name',$conf->template);
89
+
90
+		$theme->set('isAuthenticated',$user->isAuthenticated());
91
+        if($user->isAuthenticated()){
92
+			$theme->set('User',$_SESSION["user_login"]);
93
+			$theme->set('URL_Tumble',$conf->urlGelato);
94
+        }
95
+
96
+		$rows = array();
97
+        if(!$id_post){
98
+                $limit=$conf->postLimit;
99
+
100
+                if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
101
+                        $from = (($page_num-1) * $limit);
102
+                } else {
103
+                        $from = 0;
104
+                }
105
+
106
+                $rs = $tumble->getPosts($limit, $from);
107
+
108
+                if ($tumble->contarRegistros()>0) {
109
+                        $dateTmp = null;
110
+                        while($register = mysql_fetch_assoc($rs)) {
111
+								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
112
+                                if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
113
+								$strEnd=($conf->urlFriendly) ? "/" : "";
114
+								$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
115
+
116
+								$conversation = $register["description"];
117
+
118
+								$register["description"] = $register["description"];
119
+
120
+                                $register["title"] = stripslashes($register["title"]);
121
+                                $register["description"] = stripslashes($register["description"]);
122
+
123
+								$postType = $tumble->getType($register["id_post"]);
124
+
125
+								$row['Date_Added'] = $formatedDate;
126
+								$row['Permalink'] = $permalink;
127
+								$row['postType'] = $postType;
128
+                                switch ($postType){
129
+                                        case "1":
130
+                                        		$row['Title'] = $register["title"];
131
+                                        		$row['Body'] = $register["description"];
132
+                                                break;
133
+                                        case "2":
134
+                                                $fileName = "uploads/".getFileName($register["url"]);
135
+
136
+                                                $x = @getimagesize($fileName);
137
+                                                if ($x[0] > 500) {
138
+													$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
139
+                                                } else {
140
+													$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
141
+                                                }
142
+
143
+												$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
144
+
145
+												$row['PhotoURL'] = $photoPath;
146
+												$row['PhotoAlt'] = strip_tags($register["description"]);
147
+												$row['Caption'] = $register["description"];
148
+												$row['Effect'] = $effect;
149
+                                                break;
150
+                                        case "3":
151
+                                        		$row['Quote'] = $register["description"];
152
+                                        		$row['Source'] = $register["title"];
153
+                                                break;
154
+                                        case "4":
155
+                                                if($conf->shorten_links){
156
+													$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
157
+												}
158
+												$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
159
+
160
+												$row['URL'] = $register["url"];
161
+												$row['Name'] = $register["title"];
162
+												$row['Description'] = $register["description"];
163
+                                                break;
164
+                                        case "5":
165
+                                        		$row['Title'] = $register["title"];
166
+                                        		$row['Conversation'] = $tumble->formatConversation($conversation);
167
+                                                break;
168
+                                        case "6":
169
+                                        		$row['Video'] = $tumble->getVideoPlayer($register["url"]);
170
+                                        		$row['Caption'] = $register["description"];
171
+                                                break;
172
+                                        case "7":
173
+                                        		$row['Mp3'] = $tumble->getMp3Player($register["url"]);
174
+                                        		$row['Caption'] = $register["description"];
175
+                                                break;
176
+                                }
177
+
178
+								$comment = new comments();
179
+								$noComments = $comment->countComments($register["id_post"]);
180
+
181
+								$user = new user();
182
+								$username = $user->getUserByID($register["id_user"]);
183
+
184
+								$row['User'] = $username["name"];
185
+								$row['Comments_Number'] = $noComments;
186
+
187
+								$rows[] = $row;
188
+                        }
189
+
190
+						$theme->set('rows',$rows);
191
+
192
+                        $p = new pagination;
193
+                        $p->Items($tumble->getPostsNumber());
194
+                        $p->limit($limit);
195
+						if($conf->urlFriendly){
196
+								$p->urlFriendly('[...]');
197
+								$p->target($conf->urlGelato."/page/[...]");
198
+							}else
199
+								$p->target($conf->urlGelato);
200
+
201
+                        $p->currentPage(isset($page_num) ? $page_num : 1);
202
+
203
+                        $theme->set('pagination',$p->getPagination());
204
+                } else {
205
+                        $theme->set('error','No posts in this tumblelog.');
206
+                }
207
+        } else {
208
+                $register = $tumble->getPost($id_post);
209
+
210
+				$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
211
+				$strEnd=($conf->urlFriendly) ? "/" : "";
212
+				$permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
213
+
214
+				$conversation = $register["description"];
215
+
216
+				$register["description"] = $register["description"];
217
+
218
+				$register["title"] = stripslashes($register["title"]);
219
+                $register["description"] = stripslashes($register["description"]);
220
+
221
+				$row['Date_Added'] = $formatedDate;
222
+				$row['Permalink'] = $permalink;
223
+				$postType = $tumble->getType($register["id_post"]);
224
+				$row['postType'] = $postType;
225
+                switch ($postType) {
226
+                        case "1":
227
+								$row['Title'] = $register["title"];
228
+								$row['Body'] = $register["description"];
229
+                                break;
230
+                        case "2":
231
+                                $fileName = "uploads/".getFileName($register["url"]);
232
+
233
+                                $x = @getimagesize($fileName);
234
+                                if ($x[0] > 500) {
235
+                                        $photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
236
+                                } else {
237
+										$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
238
+                                }
239
+
240
+								$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
241
+
242
+								$row['PhotoURL'] = $photoPath;
243
+								$row['PhotoAlt'] = strip_tags($register["description"]);
244
+								$row['Caption'] = $register["description"];
245
+								$row['Effect'] = $effect;
246
+                                break;
247
+                        case "3":
248
+								$row['Quote'] = $register["description"];
249
+                                $row['Source'] = $register["title"];
250
+                                break;
251
+                        case "4":
252
+                                if($conf->shorten_links){
253
+									$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
254
+								}
255
+								$row['URL'] = $register["url"];
256
+								$row['Name'] = $register["title"];
257
+								$row['Description'] = $register["description"];
258
+                                break;
259
+                        case "5":
260
+								$row['Title'] = $register["title"];
261
+								$row['Conversation'] = $tumble->formatConversation($conversation);
262
+								break;
263
+						case "6":
264
+								$row['Video'] = $tumble->getVideoPlayer($register["url"]);
265
+								$row['Caption'] = $register["description"];
266
+								break;
267
+						case "7":
268
+								$row['Mp3'] = $tumble->getMp3Player($register["url"]);
269
+								$row['Caption'] = $register["description"];
270
+								break;
271
+                }
272
+
273
+				if ($conf->allowComments) {
274
+
275
+					$comment = new comments();
276
+					$rsComments = $comment->getComments($register["id_post"]);
277
+
278
+					$user = new user();
279
+					$username = $user->getUserByID($register["id_user"]);
280
+
281
+					$row['User'] = $username["name"];
282
+
283
+					$textile = new Textile();
284
+					if (empty($register["title"])) {
285
+						if (!empty($register["description"])) {
286
+							if (strlen($register["description"]) > 30) {
287
+								$postTitle = substr($register["description"], 0, 30)."...";
288
+							}
289
+						}
290
+					} else {
291
+						$postTitle = $register["title"];
292
+					}
293
+					$postTitle = strip_tags($textile->TextileThis($postTitle));
294
+
295
+					$row['Post_Title'] = $postTitle;
296
+					$row['Comments_Number'] = $comment->countComments($register["id_post"]);
297
+
298
+					$rows[] = $row;
299
+					$theme->set('rows',$rows);
300
+
301
+					$comments = array();
302
+					while($rowComment = mysql_fetch_assoc($rsComments)) {
303
+						$commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
304
+
305
+						$answers['Id_Comment'] = $rowComment["id_comment"];
306
+						$answers['Comment_Author'] = $commentAuthor;
307
+						$answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"])+transform_offset($conf->offsetTime));
308
+						$answers['Comment'] = $rowComment["content"];
309
+
310
+						$comments[] = $answers;
311
+					}
312
+					$theme->set('comments',$comments);
313
+
314
+					$whois['User_Cookie'] = isset($_COOKIE['cookie_gel_user'])?$_COOKIE['cookie_gel_user']:'';
315
+					$whois['Email_Cookie'] = isset($_COOKIE['cookie_gel_email'])?$_COOKIE['cookie_gel_email']:'';
316
+					$whois['Web_Cookie'] = isset($_COOKIE['cookie_gel_web'])?$_COOKIE['cookie_gel_web']:'';
317
+					$whois['Id_Post'] = $register["id_post"];
318
+
319
+					$theme->set('Date_Added',gmmktime());
320
+					$theme->set('Form_Action',$conf->urlGelato."/admin/comments.php");
321
+					$theme->set('whois',$whois);
322
+				}
323
+        }
324
+
325
+        $theme->set('URL_Tumble',$conf->urlGelato);
326
+		$theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm');
325 327
 ?>