|
@@ -1,325 +1,325 @@
|
1
|
|
-<?php
|
2
|
|
-
|
3
|
|
-/* ===========================
|
4
|
|
-
|
5
|
|
- Sorbet CMS - A PHP based tumblelog CMS forked from Gelato CMS
|
6
|
|
-
|
7
|
|
- Sorbet CMS is a free software licensed under the GPL 3.0
|
8
|
|
-
|
9
|
|
- =========================== */
|
10
|
|
-
|
11
|
|
-if (!defined('entry')) {
|
12
|
|
- define('entry', true);
|
13
|
|
-}
|
14
|
|
-
|
15
|
|
-// Received a valid request
|
16
|
|
-require_once "entry.php";
|
17
|
|
-global $user, $tumble, $conf;
|
18
|
|
-
|
19
|
|
-$theme = new themes;
|
20
|
|
-
|
21
|
|
-$util_class = new util();
|
22
|
|
- // Our first approach to MVC... our second? visit http://www.flavorphp.com
|
23
|
|
-
|
24
|
|
- if (isset($_SERVER['PATH_INFO'])) {
|
25
|
|
- $param_url = explode("/", $_SERVER['PATH_INFO']);
|
26
|
|
- }
|
27
|
|
-
|
28
|
|
- if (isset($_GET["post"])) {
|
29
|
|
- $id_post = $_GET["post"];
|
30
|
|
- if (!is_numeric($id_post) || $id_post < 1) {
|
31
|
|
- header("Location: index.php");
|
32
|
|
- }
|
33
|
|
- } else {
|
34
|
|
- if (isset($param_url[1]) && $param_url[1]=="post") {
|
35
|
|
- $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null;
|
36
|
|
- } else {
|
37
|
|
- $id_post = null;
|
38
|
|
- }
|
39
|
|
- }
|
40
|
|
-
|
41
|
|
- $theme->set('id_post', $id_post);
|
42
|
|
- $theme->set('error', '');
|
43
|
|
-
|
44
|
|
- if (isset($_GET["page"])) {
|
45
|
|
- $page_num = $_GET["page"];
|
46
|
|
- } else {
|
47
|
|
- if (isset($param_url[1]) && $param_url[1]=="page") {
|
48
|
|
- $page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null;
|
49
|
|
- } else {
|
50
|
|
- $page_num = null;
|
51
|
|
- }
|
52
|
|
- }
|
53
|
|
-
|
54
|
|
- $feed_url = $conf->urlSorbet.($conf->urlFriendly?"/rss/":"/rss.php");
|
55
|
|
-
|
56
|
|
-
|
57
|
|
-
|
58
|
|
- $sorbet_includes = "<meta name=\"generator\" content=\"sorbet ".$util_class -> codeName()." (".$util_class -> version().")\" />\n";
|
59
|
|
- $sorbet_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlSorbet."/images/favicon.ico\" />";
|
60
|
|
-
|
61
|
|
- $page_title = $conf->title;
|
62
|
|
- $page_title_divisor = " - "; // it should be set in configuration
|
63
|
|
- $page_title_len = 50; // it should be set in configuration
|
64
|
|
- if ($id_post) {
|
65
|
|
- $register = $tumble->getPost($id_post);
|
66
|
|
- if (empty($register["title"])) {
|
67
|
|
- if (!empty($register["description"])) {
|
68
|
|
- $page_title_data = $util_class->trimString($register["description"], $page_title_len);
|
69
|
|
- } else {
|
70
|
|
- $page_title_data = $util_class->type2Text($register["type"]);
|
71
|
|
- }
|
72
|
|
- } else {
|
73
|
|
- $page_title_data = $register["title"];
|
74
|
|
- }
|
75
|
|
- if (!empty($page_title_data)) {
|
76
|
|
- $page_title .= $page_title_divisor.stripslashes($page_title_data);
|
77
|
|
- }
|
78
|
|
- }
|
79
|
|
-
|
80
|
|
- $trigger->call('sorbet_includes');
|
81
|
|
- $theme->set('rssFeed', $feed_url);
|
82
|
|
- $theme->set('Sorbet_includes', $sorbet_includes);
|
83
|
|
- $theme->set('Title', $conf->title);
|
84
|
|
- $theme->set('Page_Title', $page_title);
|
85
|
|
- $theme->set('Description', $conf->description);
|
86
|
|
- $theme->set('URL_Tumble', $conf->urlSorbet);
|
87
|
|
- $theme->set('Template_name', $conf->template);
|
88
|
|
- $theme->set('allowComments', $conf->allowComments);
|
89
|
|
-
|
90
|
|
- $theme->set('isAuthenticated', $user->isAuthenticated());
|
91
|
|
- if ($user->isAuthenticated()) {
|
92
|
|
- $theme->set('User', $_SESSION["user_login"]);
|
93
|
|
- $theme->set('URL_Tumble', $conf->urlSorbet);
|
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 ($db->contarRegistros()>0) {
|
109
|
|
- $dateTmp = null;
|
110
|
|
- while ($register = $rs->fetch()) {
|
111
|
|
- $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
|
112
|
|
- if ($dateTmp != null && $formatedDate == $dateTmp) {
|
113
|
|
- $formatedDate = "";
|
114
|
|
- } else {
|
115
|
|
- $dateTmp = $formatedDate;
|
116
|
|
- }
|
117
|
|
-
|
118
|
|
- $permalink = $tumble->getPermalink($register["id_post"]);
|
119
|
|
-
|
120
|
|
- $conversation = $register["description"];
|
121
|
|
-
|
122
|
|
- $register["title"] = stripslashes($register["title"]);
|
123
|
|
- $register["description"] = stripslashes($register["description"]);
|
124
|
|
-
|
125
|
|
- $row['Date_Added'] = $formatedDate;
|
126
|
|
- $row['Permalink'] = $permalink;
|
127
|
|
- $row['postType'] = $util_class->type2Text($register["type"]);
|
128
|
|
-
|
129
|
|
- switch ($register['type']) {
|
130
|
|
- case "1":
|
131
|
|
- $row['Title'] = $register["title"];
|
132
|
|
- $row['Body'] = $register["description"];
|
133
|
|
- break;
|
134
|
|
- case "2":
|
135
|
|
- $fileName = "uploads/".$util_class->getFileName($register["url"]);
|
136
|
|
- $x = @getimagesize($fileName);
|
137
|
|
- if ($x[0] > 500) {
|
138
|
|
- $photoPath = $conf->urlSorbet."/classes/imgsize.php?w=500&img=".$register["url"];
|
139
|
|
- } else {
|
140
|
|
- $photoPath = str_replace("../", $conf->urlSorbet."/", $register["url"]);
|
141
|
|
- }
|
142
|
|
-
|
143
|
|
- $effect = " href=\"".str_replace("../", $conf->urlSorbet."/", $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"] = $util_class->_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
|
|
- $trigger->call('post_content');
|
191
|
|
- $theme->set('rows', $rows);
|
192
|
|
-
|
193
|
|
- $p = new pagination;
|
194
|
|
- $p->Items($tumble->getPostsNumber());
|
195
|
|
- $p->limit($limit);
|
196
|
|
- if ($conf->urlFriendly) {
|
197
|
|
- $p->urlFriendly('[...]');
|
198
|
|
- $p->target($conf->urlSorbet."/page/[...]");
|
199
|
|
- } else {
|
200
|
|
- $p->target($conf->urlSorbet);
|
201
|
|
- }
|
202
|
|
-
|
203
|
|
- $p->currentPage(isset($page_num) ? $page_num : 1);
|
204
|
|
- $theme->set('pagination', $p->getPagination());
|
205
|
|
- } else {
|
206
|
|
- $theme->set('error', 'No posts in this tumblelog.');
|
207
|
|
- }
|
208
|
|
- } else {
|
209
|
|
- $register = $tumble->getPost($id_post);
|
210
|
|
-
|
211
|
|
- $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
|
212
|
|
- $permalink = $tumble->getPermalink($register["id_post"]);
|
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
|
|
- $row['postType'] = $util_class->type2Text($register["type"]);
|
224
|
|
-
|
225
|
|
- switch ($register['type']) {
|
226
|
|
- case "1":
|
227
|
|
- $row['Title'] = $register["title"];
|
228
|
|
- $row['Body'] = $register["description"];
|
229
|
|
- break;
|
230
|
|
- case "2":
|
231
|
|
- $fileName = "uploads/".$util_class->getFileName($register["url"]);
|
232
|
|
-
|
233
|
|
- $x = @getimagesize($fileName);
|
234
|
|
- if ($x[0] > 500) {
|
235
|
|
- $photoPath = $conf->urlSorbet."/classes/imgsize.php?w=500&img=".$register["url"];
|
236
|
|
- } else {
|
237
|
|
- $photoPath = str_replace("../", $conf->urlSorbet."/", $register["url"]);
|
238
|
|
- }
|
239
|
|
-
|
240
|
|
- $effect = " href=\"".str_replace("../", $conf->urlSorbet."/", $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"] = $util_class->_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
|
|
- $user = new user();
|
274
|
|
- $username = $user->getUserByID($register["id_user"]);
|
275
|
|
-
|
276
|
|
- $row["User"] = $username["name"];
|
277
|
|
-
|
278
|
|
- if (empty($register["title"])) {
|
279
|
|
- if (!empty($register["description"])) {
|
280
|
|
- $postTitle = $util_class->trimString($register["description"]);
|
281
|
|
- } else {
|
282
|
|
- $postTitle = $util_class->type2Text($register["type"]);
|
283
|
|
- }
|
284
|
|
- } else {
|
285
|
|
- $postTitle = $register["title"];
|
286
|
|
- }
|
287
|
|
-
|
288
|
|
- $row["Post_Title"] = $postTitle;
|
289
|
|
-
|
290
|
|
- $comment = new comments();
|
291
|
|
- $row["Comments_Number"] = $comment->countComments($register["id_post"]);
|
292
|
|
-
|
293
|
|
- if ($conf->allowComments) {
|
294
|
|
- $rsComments = $comment->getComments($register["id_post"]);
|
295
|
|
- $comments = array();
|
296
|
|
- while ($rowComment = $rsComments->fetch()) {
|
297
|
|
- $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
|
298
|
|
-
|
299
|
|
- $answers['Id_Comment'] = $rowComment["id_comment"];
|
300
|
|
- $answers['Comment_Author'] = $commentAuthor;
|
301
|
|
- $answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"]) + $util_class->transform_offset($conf->offsetTime));
|
302
|
|
- $answers['Comment'] = nl2br($rowComment["content"]);
|
303
|
|
-
|
304
|
|
- $comments[] = $answers;
|
305
|
|
- }
|
306
|
|
- $theme->set('comments', $comments);
|
307
|
|
-
|
308
|
|
- $whois['User_Cookie'] = isset($_COOKIE['cookie_sor_user'])?$_COOKIE['cookie_sor_user']:'';
|
309
|
|
- $whois['Email_Cookie'] = isset($_COOKIE['cookie_sor_email'])?$_COOKIE['cookie_sor_email']:'';
|
310
|
|
- $whois['Web_Cookie'] = isset($_COOKIE['cookie_sor_web'])?$_COOKIE['cookie_sor_web']:'';
|
311
|
|
- $whois['Id_Post'] = $register["id_post"];
|
312
|
|
-
|
313
|
|
- $theme->set('Date_Added', time());
|
314
|
|
- $theme->set('Form_Action', $conf->urlSorbet."/admin/comments.php");
|
315
|
|
- $theme->set('whois', $whois);
|
316
|
|
- }
|
317
|
|
-
|
318
|
|
- $rows[] = $row;
|
319
|
|
-
|
320
|
|
- $trigger->call('post_content');
|
321
|
|
- $theme->set('rows', $rows);
|
322
|
|
- }
|
323
|
|
-
|
324
|
|
- $theme->set('URL_Tumble', $conf->urlSorbet);
|
325
|
|
- $theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm');
|
|
1
|
+<?php
|
|
2
|
+
|
|
3
|
+/* ===========================
|
|
4
|
+
|
|
5
|
+ Sorbet CMS - A PHP based tumblelog CMS forked from Gelato CMS
|
|
6
|
+
|
|
7
|
+ Sorbet CMS is a free software licensed under the GPL 3.0
|
|
8
|
+
|
|
9
|
+ =========================== */
|
|
10
|
+
|
|
11
|
+if (!defined('entry')) {
|
|
12
|
+ define('entry', true);
|
|
13
|
+}
|
|
14
|
+
|
|
15
|
+// Received a valid request
|
|
16
|
+require_once "entry.php";
|
|
17
|
+global $user, $tumble, $conf;
|
|
18
|
+
|
|
19
|
+$theme = new themes;
|
|
20
|
+
|
|
21
|
+$util_class = new util();
|
|
22
|
+ // Our first approach to MVC... our second? visit http://www.flavorphp.com
|
|
23
|
+
|
|
24
|
+ if (isset($_SERVER['PATH_INFO'])) {
|
|
25
|
+ $param_url = explode("/", $_SERVER['PATH_INFO']);
|
|
26
|
+ }
|
|
27
|
+
|
|
28
|
+ if (isset($_GET["post"])) {
|
|
29
|
+ $id_post = $_GET["post"];
|
|
30
|
+ if (!is_numeric($id_post) || $id_post < 1) {
|
|
31
|
+ header("Location: index.php");
|
|
32
|
+ }
|
|
33
|
+ } else {
|
|
34
|
+ if (isset($param_url[1]) && $param_url[1]=="post") {
|
|
35
|
+ $id_post = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null;
|
|
36
|
+ } else {
|
|
37
|
+ $id_post = null;
|
|
38
|
+ }
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ $theme->set('id_post', $id_post);
|
|
42
|
+ $theme->set('error', '');
|
|
43
|
+
|
|
44
|
+ if (isset($_GET["page"])) {
|
|
45
|
+ $page_num = $_GET["page"];
|
|
46
|
+ } else {
|
|
47
|
+ if (isset($param_url[1]) && $param_url[1]=="page") {
|
|
48
|
+ $page_num = (isset($param_url[2])) ? ((is_numeric($param_url[2])) ? $param_url[2] : null) : null;
|
|
49
|
+ } else {
|
|
50
|
+ $page_num = null;
|
|
51
|
+ }
|
|
52
|
+ }
|
|
53
|
+
|
|
54
|
+ $feed_url = $conf->urlSorbet.($conf->urlFriendly?"/rss/":"/rss.php");
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+ $sorbet_includes = "<meta name=\"generator\" content=\"sorbet ".$util_class -> codeName()." (".$util_class -> version().")\" />\n";
|
|
59
|
+ $sorbet_includes .= "\t<link rel=\"shortcut icon\" href=\"".$conf->urlSorbet."/images/favicon.ico\" />";
|
|
60
|
+
|
|
61
|
+ $page_title = $conf->title;
|
|
62
|
+ $page_title_divisor = " - "; // it should be set in configuration
|
|
63
|
+ $page_title_len = 50; // it should be set in configuration
|
|
64
|
+ if ($id_post) {
|
|
65
|
+ $register = $tumble->getPost($id_post);
|
|
66
|
+ if (empty($register["title"])) {
|
|
67
|
+ if (!empty($register["description"])) {
|
|
68
|
+ $page_title_data = $util_class->trimString($register["description"], $page_title_len);
|
|
69
|
+ } else {
|
|
70
|
+ $page_title_data = $util_class->type2Text($register["type"]);
|
|
71
|
+ }
|
|
72
|
+ } else {
|
|
73
|
+ $page_title_data = $register["title"];
|
|
74
|
+ }
|
|
75
|
+ if (!empty($page_title_data)) {
|
|
76
|
+ $page_title .= $page_title_divisor.stripslashes($page_title_data);
|
|
77
|
+ }
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ $trigger->call('sorbet_includes');
|
|
81
|
+ $theme->set('rssFeed', $feed_url);
|
|
82
|
+ $theme->set('Sorbet_includes', $sorbet_includes);
|
|
83
|
+ $theme->set('Title', $conf->title);
|
|
84
|
+ $theme->set('Page_Title', $page_title);
|
|
85
|
+ $theme->set('Description', $conf->description);
|
|
86
|
+ $theme->set('URL_Tumble', $conf->urlSorbet);
|
|
87
|
+ $theme->set('Template_name', $conf->template);
|
|
88
|
+ $theme->set('allowComments', $conf->allowComments);
|
|
89
|
+
|
|
90
|
+ $theme->set('isAuthenticated', $user->isAuthenticated());
|
|
91
|
+ if ($user->isAuthenticated()) {
|
|
92
|
+ $theme->set('User', $_SESSION["user_login"]);
|
|
93
|
+ $theme->set('URL_Tumble', $conf->urlSorbet);
|
|
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 ($db->contarRegistros()>0) {
|
|
109
|
+ $dateTmp = null;
|
|
110
|
+ while ($register = $rs->fetch()) {
|
|
111
|
+ $formatedDate = gmdate("M d Y", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
|
|
112
|
+ if ($dateTmp != null && $formatedDate == $dateTmp) {
|
|
113
|
+ $formatedDate = "";
|
|
114
|
+ } else {
|
|
115
|
+ $dateTmp = $formatedDate;
|
|
116
|
+ }
|
|
117
|
+
|
|
118
|
+ $permalink = $tumble->getPermalink($register["id_post"]);
|
|
119
|
+
|
|
120
|
+ $conversation = $register["description"];
|
|
121
|
+
|
|
122
|
+ $register["title"] = stripslashes($register["title"]);
|
|
123
|
+ $register["description"] = stripslashes($register["description"]);
|
|
124
|
+
|
|
125
|
+ $row['Date_Added'] = $formatedDate;
|
|
126
|
+ $row['Permalink'] = $permalink;
|
|
127
|
+ $row['postType'] = $util_class->type2Text($register["type"]);
|
|
128
|
+
|
|
129
|
+ switch ($register['type']) {
|
|
130
|
+ case "1":
|
|
131
|
+ $row['Title'] = $register["title"];
|
|
132
|
+ $row['Body'] = $register["description"];
|
|
133
|
+ break;
|
|
134
|
+ case "2":
|
|
135
|
+ $fileName = "uploads/".$util_class->getFileName($register["url"]);
|
|
136
|
+ $x = @getimagesize($fileName);
|
|
137
|
+ if ($x[0] > 500) {
|
|
138
|
+ $photoPath = $conf->urlSorbet."/classes/imgsize.php?w=500&img=".$register["url"];
|
|
139
|
+ } else {
|
|
140
|
+ $photoPath = str_replace("../", $conf->urlSorbet."/", $register["url"]);
|
|
141
|
+ }
|
|
142
|
+
|
|
143
|
+ $effect = " href=\"".str_replace("../", $conf->urlSorbet."/", $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"] = $util_class->_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
|
+ $trigger->call('post_content');
|
|
191
|
+ $theme->set('rows', $rows);
|
|
192
|
+
|
|
193
|
+ $p = new pagination;
|
|
194
|
+ $p->Items($tumble->getPostsNumber());
|
|
195
|
+ $p->limit($limit);
|
|
196
|
+ if ($conf->urlFriendly) {
|
|
197
|
+ $p->urlFriendly('[...]');
|
|
198
|
+ $p->target($conf->urlSorbet."/page/[...]");
|
|
199
|
+ } else {
|
|
200
|
+ $p->target($conf->urlSorbet);
|
|
201
|
+ }
|
|
202
|
+
|
|
203
|
+ $p->currentPage(isset($page_num) ? $page_num : 1);
|
|
204
|
+ $theme->set('pagination', $p->getPagination());
|
|
205
|
+ } else {
|
|
206
|
+ $theme->set('error', 'No posts in this tumblelog.');
|
|
207
|
+ }
|
|
208
|
+ } else {
|
|
209
|
+ $register = $tumble->getPost($id_post);
|
|
210
|
+
|
|
211
|
+ $formatedDate = gmdate("M d", strtotime($register["date"]) + $util_class->transform_offset($conf->offsetTime));
|
|
212
|
+ $permalink = $tumble->getPermalink($register["id_post"]);
|
|
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
|
+ $row['postType'] = $util_class->type2Text($register["type"]);
|
|
224
|
+
|
|
225
|
+ switch ($register['type']) {
|
|
226
|
+ case "1":
|
|
227
|
+ $row['Title'] = $register["title"];
|
|
228
|
+ $row['Body'] = $register["description"];
|
|
229
|
+ break;
|
|
230
|
+ case "2":
|
|
231
|
+ $fileName = "uploads/".$util_class->getFileName($register["url"]);
|
|
232
|
+
|
|
233
|
+ $x = @getimagesize($fileName);
|
|
234
|
+ if ($x[0] > 500) {
|
|
235
|
+ $photoPath = $conf->urlSorbet."/classes/imgsize.php?w=500&img=".$register["url"];
|
|
236
|
+ } else {
|
|
237
|
+ $photoPath = str_replace("../", $conf->urlSorbet."/", $register["url"]);
|
|
238
|
+ }
|
|
239
|
+
|
|
240
|
+ $effect = " href=\"".str_replace("../", $conf->urlSorbet."/", $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"] = $util_class->_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
|
+ $user = new user();
|
|
274
|
+ $username = $user->getUserByID($register["id_user"]);
|
|
275
|
+
|
|
276
|
+ $row["User"] = $username["name"];
|
|
277
|
+
|
|
278
|
+ if (empty($register["title"])) {
|
|
279
|
+ if (!empty($register["description"])) {
|
|
280
|
+ $postTitle = $util_class->trimString($register["description"]);
|
|
281
|
+ } else {
|
|
282
|
+ $postTitle = $util_class->type2Text($register["type"]);
|
|
283
|
+ }
|
|
284
|
+ } else {
|
|
285
|
+ $postTitle = $register["title"];
|
|
286
|
+ }
|
|
287
|
+
|
|
288
|
+ $row["Post_Title"] = $postTitle;
|
|
289
|
+
|
|
290
|
+ $comment = new comments();
|
|
291
|
+ $row["Comments_Number"] = $comment->countComments($register["id_post"]);
|
|
292
|
+
|
|
293
|
+ if ($conf->allowComments) {
|
|
294
|
+ $rsComments = $comment->getComments($register["id_post"]);
|
|
295
|
+ $comments = array();
|
|
296
|
+ while ($rowComment = $rsComments->fetch()) {
|
|
297
|
+ $commentAuthor = ($rowComment["web"]=="") ? $rowComment["username"] : "<a href=\"".$rowComment["web"]."\" rel=\"external\">".$rowComment["username"]."</a>";
|
|
298
|
+
|
|
299
|
+ $answers['Id_Comment'] = $rowComment["id_comment"];
|
|
300
|
+ $answers['Comment_Author'] = $commentAuthor;
|
|
301
|
+ $answers['Date'] = gmdate("d.m.y", strtotime($rowComment["comment_date"]) + $util_class->transform_offset($conf->offsetTime));
|
|
302
|
+ $answers['Comment'] = nl2br($rowComment["content"]);
|
|
303
|
+
|
|
304
|
+ $comments[] = $answers;
|
|
305
|
+ }
|
|
306
|
+ $theme->set('comments', $comments);
|
|
307
|
+
|
|
308
|
+ $whois['User_Cookie'] = isset($_COOKIE['cookie_sor_user'])?$_COOKIE['cookie_sor_user']:'';
|
|
309
|
+ $whois['Email_Cookie'] = isset($_COOKIE['cookie_sor_email'])?$_COOKIE['cookie_sor_email']:'';
|
|
310
|
+ $whois['Web_Cookie'] = isset($_COOKIE['cookie_sor_web'])?$_COOKIE['cookie_sor_web']:'';
|
|
311
|
+ $whois['Id_Post'] = $register["id_post"];
|
|
312
|
+
|
|
313
|
+ $theme->set('Date_Added', time());
|
|
314
|
+ $theme->set('Form_Action', $conf->urlSorbet."/admin/comments.php");
|
|
315
|
+ $theme->set('whois', $whois);
|
|
316
|
+ }
|
|
317
|
+
|
|
318
|
+ $rows[] = $row;
|
|
319
|
+
|
|
320
|
+ $trigger->call('post_content');
|
|
321
|
+ $theme->set('rows', $rows);
|
|
322
|
+ }
|
|
323
|
+
|
|
324
|
+ $theme->set('URL_Tumble', $conf->urlSorbet);
|
|
325
|
+ $theme->display(Absolute_Path.'themes/'.$conf->template.'/index.htm');
|