|
@@ -20,38 +20,38 @@ global $user, $tumble, $conf;
|
20
|
20
|
$theme = new themes;
|
21
|
21
|
// Our first approach to MVC... our second? visit http://www.flavorphp.com
|
22
|
22
|
|
23
|
|
- if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
|
|
23
|
+ if(isset($_SERVER['PATH_INFO'])) $param_url = explode("/",$_SERVER['PATH_INFO']);
|
24
|
24
|
|
25
|
|
- if (isset($_GET["post"])) {
|
26
|
|
- $id_post = $_GET["post"];
|
27
|
|
- if (!is_numeric($id_post) || $id_post < 1 ){
|
|
25
|
+ if (isset($_GET["post"])) {
|
|
26
|
+ $id_post = $_GET["post"];
|
|
27
|
+ if (!is_numeric($id_post) || $id_post < 1 ){
|
28
|
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
|
|
- }
|
|
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
|
37
|
|
38
|
|
- $theme->set('id_post',$id_post);
|
|
38
|
+ $theme->set('id_post',$id_post);
|
39
|
39
|
$theme->set('error','');
|
40
|
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
|
|
- }
|
|
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
|
50
|
|
51
|
51
|
$feed_url = $conf->urlGelato.($conf->urlFriendly?"/rss/":"/rss.php");
|
52
|
52
|
|
53
|
|
- $gelato_includes = "<meta name=\"generator\" content=\"gelato ".codeName()." (".version().")\" />\n";
|
54
|
|
- $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
|
|
53
|
+ $gelato_includes = "<meta name=\"generator\" content=\"gelato ".codeName()." (".version().")\" />\n";
|
|
54
|
+ $gelato_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlGelato."/images/favicon.ico\" />";
|
55
|
55
|
|
56
|
56
|
$page_title = $conf->title;
|
57
|
57
|
$page_title_divisor = " » "; // it should be set in configuration
|
|
@@ -83,54 +83,53 @@ $theme = new themes;
|
83
|
83
|
$theme->set('allowComments',$conf->allowComments);
|
84
|
84
|
|
85
|
85
|
$theme->set('isAuthenticated',$user->isAuthenticated());
|
86
|
|
- if($user->isAuthenticated()){
|
|
86
|
+ if($user->isAuthenticated()){
|
87
|
87
|
$theme->set('User',$_SESSION["user_login"]);
|
88
|
88
|
$theme->set('URL_Tumble',$conf->urlGelato);
|
89
|
|
- }
|
|
89
|
+ }
|
90
|
90
|
|
91
|
91
|
$rows = array();
|
92
|
|
- if(!$id_post){
|
93
|
|
- $limit=$conf->postLimit;
|
|
92
|
+ if(!$id_post){
|
|
93
|
+ $limit=$conf->postLimit;
|
94
|
94
|
|
95
|
|
- if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
|
96
|
|
- $from = (($page_num-1) * $limit);
|
97
|
|
- } else {
|
98
|
|
- $from = 0;
|
99
|
|
- }
|
|
95
|
+ if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
|
|
96
|
+ $from = (($page_num-1) * $limit);
|
|
97
|
+ } else {
|
|
98
|
+ $from = 0;
|
|
99
|
+ }
|
100
|
100
|
|
101
|
|
- $rs = $tumble->getPosts($limit, $from);
|
|
101
|
+ $rs = $tumble->getPosts($limit, $from);
|
102
|
102
|
|
103
|
|
- if ($tumble->contarRegistros()>0) {
|
104
|
|
- $dateTmp = null;
|
105
|
|
- while($register = mysql_fetch_assoc($rs)) {
|
|
103
|
+ if ($tumble->contarRegistros()>0) {
|
|
104
|
+ $dateTmp = null;
|
|
105
|
+ while($register = mysql_fetch_assoc($rs)) {
|
106
|
106
|
$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
107
|
|
- if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
|
|
107
|
+ if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
|
108
|
108
|
|
109
|
109
|
$permalink = $tumble->getPermalink($register["id_post"]);
|
110
|
110
|
|
111
|
111
|
$conversation = $register["description"];
|
112
|
112
|
|
113
|
|
- $register["title"] = stripslashes($register["title"]);
|
114
|
|
- $register["description"] = stripslashes($register["description"]);
|
|
113
|
+ $register["title"] = stripslashes($register["title"]);
|
|
114
|
+ $register["description"] = stripslashes($register["description"]);
|
115
|
115
|
|
116
|
116
|
$row['Date_Added'] = $formatedDate;
|
117
|
117
|
$row['Permalink'] = $permalink;
|
118
|
118
|
$row['postType'] = type2Text($register["type"]);
|
119
|
119
|
|
120
|
|
- switch ($register['type']){
|
121
|
|
- case "1":
|
122
|
|
- $row['Title'] = $register["title"];
|
123
|
|
- $row['Body'] = $register["description"];
|
124
|
|
- break;
|
125
|
|
- case "2":
|
126
|
|
- $fileName = "uploads/".getFileName($register["url"]);
|
127
|
|
-
|
128
|
|
- $x = @getimagesize($fileName);
|
129
|
|
- if ($x[0] > 500) {
|
|
120
|
+ switch ($register['type']){
|
|
121
|
+ case "1":
|
|
122
|
+ $row['Title'] = $register["title"];
|
|
123
|
+ $row['Body'] = $register["description"];
|
|
124
|
+ break;
|
|
125
|
+ case "2":
|
|
126
|
+ $fileName = "uploads/".getFileName($register["url"]);
|
|
127
|
+ $x = @getimagesize($fileName);
|
|
128
|
+ if ($x[0] > 500) {
|
130
|
129
|
$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
|
131
|
|
- } else {
|
|
130
|
+ } else {
|
132
|
131
|
$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
|
133
|
|
- }
|
|
132
|
+ }
|
134
|
133
|
|
135
|
134
|
$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
|
136
|
135
|
|
|
@@ -138,13 +137,13 @@ $theme = new themes;
|
138
|
137
|
$row['PhotoAlt'] = strip_tags($register["description"]);
|
139
|
138
|
$row['Caption'] = $register["description"];
|
140
|
139
|
$row['Effect'] = $effect;
|
141
|
|
- break;
|
142
|
|
- case "3":
|
143
|
|
- $row['Quote'] = $register["description"];
|
144
|
|
- $row['Source'] = $register["title"];
|
145
|
|
- break;
|
|
140
|
+ break;
|
|
141
|
+ case "3":
|
|
142
|
+ $row['Quote'] = $register["description"];
|
|
143
|
+ $row['Source'] = $register["title"];
|
|
144
|
+ break;
|
146
|
145
|
case "4":
|
147
|
|
- if($conf->shorten_links){
|
|
146
|
+ if($conf->shorten_links){
|
148
|
147
|
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
|
149
|
148
|
}
|
150
|
149
|
$register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
|
|
@@ -152,20 +151,20 @@ $theme = new themes;
|
152
|
151
|
$row['URL'] = $register["url"];
|
153
|
152
|
$row['Name'] = $register["title"];
|
154
|
153
|
$row['Description'] = $register["description"];
|
155
|
|
- break;
|
156
|
|
- case "5":
|
157
|
|
- $row['Title'] = $register["title"];
|
158
|
|
- $row['Conversation'] = $tumble->formatConversation($conversation);
|
159
|
|
- break;
|
160
|
|
- case "6":
|
161
|
|
- $row['Video'] = $tumble->getVideoPlayer($register["url"]);
|
162
|
|
- $row['Caption'] = $register["description"];
|
163
|
|
- break;
|
164
|
|
- case "7":
|
165
|
|
- $row['Mp3'] = $tumble->getMp3Player($register["url"]);
|
166
|
|
- $row['Caption'] = $register["description"];
|
167
|
|
- break;
|
168
|
|
- }
|
|
154
|
+ break;
|
|
155
|
+ case "5":
|
|
156
|
+ $row['Title'] = $register["title"];
|
|
157
|
+ $row['Conversation'] = $tumble->formatConversation($conversation);
|
|
158
|
+ break;
|
|
159
|
+ case "6":
|
|
160
|
+ $row['Video'] = $tumble->getVideoPlayer($register["url"]);
|
|
161
|
+ $row['Caption'] = $register["description"];
|
|
162
|
+ break;
|
|
163
|
+ case "7":
|
|
164
|
+ $row['Mp3'] = $tumble->getMp3Player($register["url"]);
|
|
165
|
+ $row['Caption'] = $register["description"];
|
|
166
|
+ break;
|
|
167
|
+ }
|
169
|
168
|
|
170
|
169
|
$comment = new comments();
|
171
|
170
|
$noComments = $comment->countComments($register["id_post"]);
|
|
@@ -182,23 +181,23 @@ $theme = new themes;
|
182
|
181
|
$trigger->call('post_content');
|
183
|
182
|
$theme->set('rows',$rows);
|
184
|
183
|
|
185
|
|
- $p = new pagination;
|
186
|
|
- $p->Items($tumble->getPostsNumber());
|
187
|
|
- $p->limit($limit);
|
|
184
|
+ $p = new pagination;
|
|
185
|
+ $p->Items($tumble->getPostsNumber());
|
|
186
|
+ $p->limit($limit);
|
188
|
187
|
if($conf->urlFriendly){
|
189
|
188
|
$p->urlFriendly('[...]');
|
190
|
189
|
$p->target($conf->urlGelato."/page/[...]");
|
191
|
|
- }else
|
|
190
|
+ }else{
|
192
|
191
|
$p->target($conf->urlGelato);
|
|
192
|
+ }
|
193
|
193
|
|
194
|
|
- $p->currentPage(isset($page_num) ? $page_num : 1);
|
195
|
|
-
|
196
|
|
- $theme->set('pagination',$p->getPagination());
|
197
|
|
- } else {
|
198
|
|
- $theme->set('error','No posts in this tumblelog.');
|
199
|
|
- }
|
200
|
|
- } else {
|
201
|
|
- $register = $tumble->getPost($id_post);
|
|
194
|
+ $p->currentPage(isset($page_num) ? $page_num : 1);
|
|
195
|
+ $theme->set('pagination',$p->getPagination());
|
|
196
|
+ } else {
|
|
197
|
+ $theme->set('error','No posts in this tumblelog.');
|
|
198
|
+ }
|
|
199
|
+ } else {
|
|
200
|
+ $register = $tumble->getPost($id_post);
|
202
|
201
|
|
203
|
202
|
$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
204
|
203
|
$permalink = $tumble->getPermalink($register["id_post"]);
|
|
@@ -208,26 +207,26 @@ $theme = new themes;
|
208
|
207
|
$register["description"] = $register["description"];
|
209
|
208
|
|
210
|
209
|
$register["title"] = stripslashes($register["title"]);
|
211
|
|
- $register["description"] = stripslashes($register["description"]);
|
|
210
|
+ $register["description"] = stripslashes($register["description"]);
|
212
|
211
|
|
213
|
212
|
$row['Date_Added'] = $formatedDate;
|
214
|
213
|
$row['Permalink'] = $permalink;
|
215
|
214
|
$row['postType'] = type2Text($register["type"]);
|
216
|
215
|
|
217
|
|
- switch ($register['type']) {
|
218
|
|
- case "1":
|
|
216
|
+ switch ($register['type']) {
|
|
217
|
+ case "1":
|
219
|
218
|
$row['Title'] = $register["title"];
|
220
|
219
|
$row['Body'] = $register["description"];
|
221
|
|
- break;
|
222
|
|
- case "2":
|
223
|
|
- $fileName = "uploads/".getFileName($register["url"]);
|
|
220
|
+ break;
|
|
221
|
+ case "2":
|
|
222
|
+ $fileName = "uploads/".getFileName($register["url"]);
|
224
|
223
|
|
225
|
|
- $x = @getimagesize($fileName);
|
226
|
|
- if ($x[0] > 500) {
|
|
224
|
+ $x = @getimagesize($fileName);
|
|
225
|
+ if ($x[0] > 500) {
|
227
|
226
|
$photoPath = $conf->urlGelato."/classes/imgsize.php?w=500&img=".$register["url"];
|
228
|
|
- } else {
|
|
227
|
+ } else {
|
229
|
228
|
$photoPath = str_replace("../", $conf->urlGelato."/", $register["url"]);
|
230
|
|
- }
|
|
229
|
+ }
|
231
|
230
|
|
232
|
231
|
$effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
|
233
|
232
|
|
|
@@ -235,20 +234,20 @@ $theme = new themes;
|
235
|
234
|
$row['PhotoAlt'] = strip_tags($register["description"]);
|
236
|
235
|
$row['Caption'] = $register["description"];
|
237
|
236
|
$row['Effect'] = $effect;
|
238
|
|
- break;
|
239
|
|
- case "3":
|
|
237
|
+ break;
|
|
238
|
+ case "3":
|
240
|
239
|
$row['Quote'] = $register["description"];
|
241
|
|
- $row['Source'] = $register["title"];
|
242
|
|
- break;
|
243
|
|
- case "4":
|
244
|
|
- if($conf->shorten_links){
|
|
240
|
+ $row['Source'] = $register["title"];
|
|
241
|
+ break;
|
|
242
|
+ case "4":
|
|
243
|
+ if($conf->shorten_links){
|
245
|
244
|
$register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
|
246
|
245
|
}
|
247
|
246
|
$row['URL'] = $register["url"];
|
248
|
247
|
$row['Name'] = $register["title"];
|
249
|
248
|
$row['Description'] = $register["description"];
|
250
|
|
- break;
|
251
|
|
- case "5":
|
|
249
|
+ break;
|
|
250
|
+ case "5":
|
252
|
251
|
$row['Title'] = $register["title"];
|
253
|
252
|
$row['Conversation'] = $tumble->formatConversation($conversation);
|
254
|
253
|
break;
|
|
@@ -313,6 +312,6 @@ $theme = new themes;
|
313
|
312
|
$theme->set('rows',$rows);
|
314
|
313
|
}
|
315
|
314
|
|
316
|
|
- $theme->set('URL_Tumble',$conf->urlGelato);
|
|
315
|
+ $theme->set('URL_Tumble',$conf->urlGelato);
|
317
|
316
|
$theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm');
|
318
|
317
|
?>
|