|
@@ -9,7 +9,7 @@ if(!defined('entry'))define('entry', true);
|
9
|
9
|
gelato CMS is a free software licensed under the GPL 2.0
|
10
|
10
|
Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
|
11
|
11
|
|
12
|
|
- =========================== */
|
|
12
|
+ =========================== */
|
13
|
13
|
?>
|
14
|
14
|
<?php
|
15
|
15
|
require('../entry.php');
|
|
@@ -23,319 +23,282 @@ $postId = ($isEdition) ? $_GET["edit"] : NULL;
|
23
|
23
|
|
24
|
24
|
$theme->set('isEdition',$isEdition);
|
25
|
25
|
$theme->set('postId',$postId);
|
26
|
|
-$theme->set('pagination','');
|
|
26
|
+$theme->set('pagination','');
|
27
|
27
|
|
28
|
28
|
if (get_magic_quotes_gpc()) {
|
29
|
|
- foreach($_GET as $k=>$get){
|
30
|
|
- $_GET[$k]=stripslashes($get);
|
31
|
|
- }
|
32
|
|
-}
|
|
29
|
+ foreach($_GET as $k=>$get){
|
|
30
|
+ $_GET[$k]=stripslashes($get);
|
|
31
|
+ }
|
|
32
|
+}
|
33
|
33
|
|
34
|
34
|
if ($user->isAuthenticated()) {
|
35
|
|
- if (isset($_GET["delete"])) {
|
36
|
|
- $tumble->deletePost($_GET['delete']);
|
37
|
|
- header("Location: index.php?deleted=true");
|
38
|
|
- die();
|
39
|
|
- }
|
40
|
|
-
|
41
|
|
- if(isset($_POST["btnAdd"])){
|
42
|
|
- unset($_POST["btnAdd"]);
|
43
|
|
- $_POST['type'] = type2Number($_POST['type']);
|
44
|
|
-
|
45
|
|
- if ($_POST["type"]=="2") { // is Photo type
|
46
|
|
- if (isset($_POST["url"]) && $_POST["url"]!="") {
|
47
|
|
- $photoName = getFileName($_POST["url"]);
|
48
|
|
- if (!$tumble->savePhoto($_POST["url"])) {
|
49
|
|
- header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
|
50
|
|
- die();
|
51
|
|
- }
|
52
|
|
- $_POST["url"] = "../uploads/".sanitizeName($photoName);
|
53
|
|
- }
|
54
|
|
-
|
55
|
|
- if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
|
56
|
|
- $_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
|
57
|
|
- }
|
58
|
|
-
|
59
|
|
- unset($_POST["photo"]);
|
60
|
|
- unset($_POST["MAX_FILE_SIZE"]);
|
61
|
|
- }
|
62
|
|
-
|
63
|
|
- if ($_POST["type"]=="7") { // is MP3 type
|
64
|
|
- set_time_limit(300);
|
65
|
|
- $mp3Name = getFileName($_POST["url"]);
|
66
|
|
- if (!$tumble->saveMP3($_POST["url"])) {
|
67
|
|
- header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false");
|
68
|
|
- die();
|
69
|
|
- }
|
70
|
|
- if (isMP3($remoteFileName)) {
|
71
|
|
- $_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
|
72
|
|
- }
|
73
|
|
- }
|
74
|
|
-
|
75
|
|
- if (!get_magic_quotes_gpc()) {
|
76
|
|
- $_POST["title"] = addslashes($_POST["title"]);
|
77
|
|
- $_POST["description"] = addslashes($_POST["description"]);
|
78
|
|
- }
|
79
|
|
-
|
80
|
|
- /*
|
81
|
|
- $textile = new Textile();
|
82
|
|
-
|
83
|
|
- $_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true));
|
84
|
|
- $_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
|
85
|
|
- */
|
86
|
|
-
|
87
|
|
- $_POST["title"] = removeBadTags($_POST["title"],true);
|
88
|
|
- $_POST["description"] = removeBadTags($_POST["description"]);
|
89
|
|
-
|
90
|
|
- if (isset($_POST["id_post"]) and is_numeric($_POST["id_post"]) and $_POST["id_post"]>0) {
|
91
|
|
- $tumble->modifyPost($_POST, $_POST["id_post"]);
|
92
|
|
- } else {
|
93
|
|
- if ($tumble->addPost($_POST)) {
|
94
|
|
- header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
|
95
|
|
- die();
|
96
|
|
- } else {
|
97
|
|
- header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$tumble->merror);
|
98
|
|
- die();
|
99
|
|
- }
|
100
|
|
- }
|
101
|
|
- } else {
|
102
|
|
- if ($isEdition) {
|
103
|
|
- $post = $tumble->getPost($postId);
|
104
|
|
- }
|
105
|
|
-
|
106
|
|
- $theme->set('version',version());
|
107
|
|
- $theme->set('conf', array(
|
108
|
|
- 'urlGelato'=>$conf->urlGelato,
|
109
|
|
- 'richText'=>$conf->richText
|
110
|
|
- ));
|
111
|
|
- $theme->set('new',isset($_GET['new'])?$_GET['new']:'');
|
112
|
|
- $theme->set('information',false);
|
113
|
|
- $theme->set('error',false);
|
114
|
|
-
|
115
|
|
- if($conf->check_version){
|
116
|
|
- $present = version();
|
117
|
|
- $lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt");
|
118
|
|
- if ($present < $lastest)
|
119
|
|
- $theme->set('information',__("A new gelato version has been released and is ready <a href=\"http://www.gelatocms.com/\">for download</a>."));
|
120
|
|
- }
|
121
|
|
-
|
122
|
|
- $actions = array(
|
123
|
|
- 'deleted'=>false,
|
124
|
|
- 'modified'=>false,
|
125
|
|
- 'added'=>false
|
126
|
|
- );
|
127
|
|
-
|
128
|
|
- if(isset($_GET['deleted']) and $_GET['deleted']=='true'){
|
129
|
|
- $theme->set('exito',__("The post has been eliminated successfully."));
|
130
|
|
- $actions['deleted'] = true;
|
131
|
|
- }
|
132
|
|
-
|
133
|
|
- if(isset($_GET["modified"]) and $_GET["modified"]==true){
|
134
|
|
- $theme->set('exito',__("The post has been modified successfully."));
|
135
|
|
- $actions['modified']=true;
|
136
|
|
- }
|
137
|
|
-
|
138
|
|
- if(isset($_GET["added"]) and $_GET["added"]==true) {
|
139
|
|
- $theme->set('exito',__("The post has been added successfully."));
|
140
|
|
- $actions['added']=true;
|
141
|
|
- }
|
142
|
|
-
|
143
|
|
- $theme->set('action',$actions);
|
144
|
|
-
|
145
|
|
- if (isset($_GET["error"]) and $_GET["error"]==2)
|
146
|
|
- $theme->set('error',__("Error on the database server:")." </strong>".$_GET["des"]);
|
147
|
|
-
|
148
|
|
- if (isset($_GET["mp3"]) and $_GET["mp3"]=='false')
|
149
|
|
- $theme->set('error',__("Not an MP3 file or an upload problem."));
|
150
|
|
-
|
151
|
|
- if (isset($_GET["photo"]) and $_GET["photo"]=='false')
|
152
|
|
- $theme->set('error',__("Not a photo file or an upload problem."));
|
153
|
|
-
|
154
|
|
- if ($isEdition) {
|
155
|
|
- switch ($post["type"]) {
|
156
|
|
- case "1": $_GET["new"] = "post"; break;
|
157
|
|
- case "2": $_GET["new"] = "photo"; break;
|
158
|
|
- case "3": $_GET["new"] = "quote"; break;
|
159
|
|
- case "4": $_GET["new"] = "url"; break;
|
160
|
|
- case "5": $_GET["new"] = "conversation"; break;
|
161
|
|
- case "6": $_GET["new"] = "video"; break;
|
162
|
|
- case "7": $_GET["new"] = "mp3"; break;
|
163
|
|
- }
|
164
|
|
- }
|
165
|
|
-
|
166
|
|
- $date = ($isEdition) ? strtotime($post["date"]) : gmmktime();
|
167
|
|
- $title = ($isEdition) ? htmlspecialchars(stripslashes($post["title"])) : "";
|
168
|
|
- $body = ($isEdition) ? stripslashes($post["description"]) : "";
|
169
|
|
- $url = ($isEdition) ? $post["url"] : "";
|
170
|
|
-
|
171
|
|
- if (!isset($_GET['new'])) $_GET['new'] = 'post';
|
172
|
|
-
|
173
|
|
- $theme->set('date',$date);
|
174
|
|
- $theme->set('id_user',$_SESSION['user_id']);
|
175
|
|
- $theme->set('type',$_GET["new"]);
|
176
|
|
- $theme->set('editBody',$body);
|
177
|
|
-
|
178
|
|
- switch ($_GET["new"]) {
|
179
|
|
- case "post":
|
180
|
|
- $theme->set('editTitle',$title);
|
181
|
|
- break;
|
182
|
|
- case "photo":
|
183
|
|
- $url = str_replace("../", $conf->urlGelato."/", $url);
|
184
|
|
- $theme->set('editUrl',$url);
|
185
|
|
- break;
|
186
|
|
- case "quote":
|
187
|
|
- $theme->set('editTitle',$title);
|
188
|
|
- break;
|
189
|
|
- case "url":
|
190
|
|
- $theme->set('editTitle',$title);
|
191
|
|
- $theme->set('editUrl',$url);
|
192
|
|
- break;
|
193
|
|
- case "conversation":
|
194
|
|
- $theme->set('editTitle',$title);
|
195
|
|
- break;
|
196
|
|
- case "video":
|
197
|
|
- $theme->set('editUrl',$url);
|
198
|
|
- break;
|
199
|
|
- case "mp3":
|
200
|
|
- $theme->set('editUrl',$url);
|
201
|
|
- break;
|
202
|
|
- }
|
203
|
|
-
|
204
|
|
- if (!$isEdition){
|
205
|
|
- if (isset($_GET["page"]))
|
206
|
|
- $page_num = $_GET["page"];
|
207
|
|
- else
|
208
|
|
- $page_num = NULL;
|
209
|
|
-
|
210
|
|
- $limit=$conf->postLimit;
|
211
|
|
-
|
212
|
|
- if(isset($page_num) && is_numeric($page_num) && $page_num>0)// Is defined the page and is numeric?
|
213
|
|
- $from = (($page_num-1) * $limit);
|
214
|
|
- else
|
215
|
|
- $from = 0;
|
216
|
|
-
|
217
|
|
- $rs = $tumble->getPosts($limit, $from);
|
218
|
|
- $theme->set('Posts_Number',$tumble->contarRegistros());
|
219
|
|
-
|
220
|
|
- $rows = array();
|
221
|
|
- if ($tumble->contarRegistros()>0) {
|
222
|
|
- while($register = mysql_fetch_array($rs)) {
|
223
|
|
- $row['postType'] = type2Text($tumble->getType($register["id_post"]));
|
224
|
|
-
|
225
|
|
- $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
226
|
|
- $permalink = $tumble->getPermalink($register["id_post"]);
|
227
|
|
-
|
228
|
|
- $register["title"] = stripslashes($register["title"]);
|
229
|
|
- $register["description"] = stripslashes($register["description"]);
|
230
|
|
-
|
231
|
|
- $row['Id_Post'] = $register["id_post"];
|
232
|
|
- $row['Date_Added'] = $formatedDate;
|
233
|
|
- $row['Permalink'] = $permalink;
|
234
|
|
-
|
235
|
|
- switch ($tumble->getType($register["id_post"])) {
|
236
|
|
- case "1":
|
237
|
|
- $row['Title'] = $register["title"];
|
238
|
|
- $row['Body'] = $register["description"];
|
239
|
|
- break;
|
240
|
|
- case "2":
|
241
|
|
- $fileName = "../uploads/".getFileName($register["url"]);
|
242
|
|
-
|
243
|
|
- $x = @getimagesize($fileName);
|
244
|
|
- if ($x[0] > 100)
|
245
|
|
- $photoPath = $conf->urlGelato."/classes/imgsize.php?w=100&img=".$register["url"];
|
246
|
|
- else
|
247
|
|
- $photoPath = $register["url"];
|
248
|
|
-
|
249
|
|
- $effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
|
250
|
|
-
|
251
|
|
- $row['PhotoURL'] = $photoPath;
|
252
|
|
- $row['PhotoAlt'] = strip_tags($register["description"]);
|
253
|
|
- $row['Caption'] = $register["description"];
|
254
|
|
- $row['Effect'] = $effect;
|
255
|
|
- break;
|
256
|
|
- case "3":
|
257
|
|
- $row['Quote'] = $register["description"];
|
258
|
|
- $row['Source'] = $register["title"];
|
259
|
|
- break;
|
260
|
|
- case "4":
|
261
|
|
- if($conf->shorten_links)
|
262
|
|
- $register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
|
263
|
|
- $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
|
264
|
|
-
|
265
|
|
- $row['URL'] = $register["url"];
|
266
|
|
- $row['Name'] = $register["title"];
|
267
|
|
- $row['Description'] = $register["description"];
|
268
|
|
- break;
|
269
|
|
- case "5":
|
270
|
|
- $row['Title'] = $register["title"];
|
271
|
|
- $row['Conversation'] = $tumble->formatConversation($register["description"]);
|
272
|
|
- break;
|
273
|
|
- case "6":
|
274
|
|
- $row['Video'] = $tumble->getVideoPlayer($register["url"]);
|
275
|
|
- $row['Caption'] = $register["description"];
|
276
|
|
- break;
|
277
|
|
- case "7":
|
278
|
|
- $row['Mp3'] = $tumble->getMp3Player($register["url"]);
|
279
|
|
- $row['Caption'] = $register["description"];
|
280
|
|
- break;
|
281
|
|
- }
|
282
|
|
-
|
283
|
|
- $rows[] = $row;
|
284
|
|
- }
|
285
|
|
-
|
286
|
|
-
|
287
|
|
- $limit=$conf->postLimit;
|
288
|
|
-
|
289
|
|
- if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
|
290
|
|
- $from = (($page_num-1) * $limit);
|
291
|
|
- } else {
|
292
|
|
- $from = 0;
|
293
|
|
- }
|
294
|
|
-
|
295
|
|
- $rs = $tumble->getPosts($limit, $from);
|
296
|
|
-
|
297
|
|
- if ($tumble->contarRegistros()>0) {
|
298
|
|
- while($register = mysql_fetch_array($rs)) {
|
299
|
|
- $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
300
|
|
- $permalink = $tumble->getPermalink($register["id_post"]);
|
301
|
|
- $register["title"] = stripslashes($register["title"]);
|
302
|
|
- $register["description"] = stripslashes($register["description"]);
|
303
|
|
-
|
304
|
|
- switch ($tumble->getType($register["id_post"])) {
|
305
|
|
- case "1":
|
306
|
|
- $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
|
307
|
|
- $output = array($register["id_post"], $formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
|
308
|
|
-
|
309
|
|
- $template->cargarPlantilla($input, $output, "template_regular_post");
|
310
|
|
- $template->mostrarPlantilla();
|
311
|
|
- break;
|
312
|
|
- case "2":
|
313
|
|
- $fileName = "../uploads/".getFileName($register["url"]);
|
314
|
|
-
|
315
|
|
- $x = @getimagesize($fileName);
|
316
|
|
- if ($x[0] > 100) {
|
317
|
|
- $photoPath = $conf->urlGelato."/classes/imgsize.php?w=100&img=".$register["url"];
|
318
|
|
- } else {
|
319
|
|
- $photoPath = $register["url"];
|
320
|
|
- }
|
321
|
|
- }
|
322
|
|
- }
|
323
|
|
- }
|
324
|
|
-
|
325
|
|
- $p = new pagination;
|
326
|
|
- $p->items($tumble->getPostsNumber());
|
327
|
|
- $p->limit($limit);
|
328
|
|
- $p->currentPage(isset($page_num) ? $page_num : 1);
|
329
|
|
-
|
330
|
|
- $theme->set('pagination',$p->getPagination());
|
331
|
|
- $theme->set('rows',$rows);
|
332
|
|
- }else{
|
333
|
|
- $theme->set('error',__("No posts in this tumblelog."));
|
334
|
|
- }
|
335
|
|
- }
|
336
|
|
- $theme->display(Absolute_Path.'admin/themes/admin/index.htm');
|
337
|
|
- }
|
|
35
|
+ if (isset($_GET["delete"])) {
|
|
36
|
+ $tumble->deletePost($_GET['delete']);
|
|
37
|
+ header("Location: index.php?deleted=true");
|
|
38
|
+ die();
|
|
39
|
+ }
|
|
40
|
+
|
|
41
|
+ if(isset($_POST["btnAdd"])){
|
|
42
|
+ unset($_POST["btnAdd"]);
|
|
43
|
+ $_POST['type'] = type2Number($_POST['type']);
|
|
44
|
+
|
|
45
|
+ if ($_POST["type"]=="2") { // is Photo type
|
|
46
|
+ if (isset($_POST["url"]) && $_POST["url"]!="") {
|
|
47
|
+ $photoName = getFileName($_POST["url"]);
|
|
48
|
+ if (!$tumble->savePhoto($_POST["url"])) {
|
|
49
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
|
|
50
|
+ die();
|
|
51
|
+ }
|
|
52
|
+ $_POST["url"] = "../uploads/".sanitizeName($photoName);
|
|
53
|
+ }
|
|
54
|
+
|
|
55
|
+ if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
|
|
56
|
+ $_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
|
|
57
|
+ }
|
|
58
|
+
|
|
59
|
+ unset($_POST["photo"]);
|
|
60
|
+ unset($_POST["MAX_FILE_SIZE"]);
|
|
61
|
+ }
|
|
62
|
+
|
|
63
|
+ if ($_POST["type"]=="7") { // is MP3 type
|
|
64
|
+ set_time_limit(300);
|
|
65
|
+ $mp3Name = getFileName($_POST["url"]);
|
|
66
|
+ if (!$tumble->saveMP3($_POST["url"])) {
|
|
67
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?mp3=false");
|
|
68
|
+ die();
|
|
69
|
+ }
|
|
70
|
+ if (isMP3($remoteFileName)) {
|
|
71
|
+ $_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
|
|
72
|
+ }
|
|
73
|
+ }
|
|
74
|
+
|
|
75
|
+ if (!get_magic_quotes_gpc()) {
|
|
76
|
+ $_POST["title"] = addslashes($_POST["title"]);
|
|
77
|
+ $_POST["description"] = addslashes($_POST["description"]);
|
|
78
|
+ }
|
|
79
|
+
|
|
80
|
+ /*
|
|
81
|
+ $textile = new Textile();
|
|
82
|
+
|
|
83
|
+ $_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true));
|
|
84
|
+ $_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
|
|
85
|
+ */
|
|
86
|
+
|
|
87
|
+ $_POST["title"] = removeBadTags($_POST["title"],true);
|
|
88
|
+ $_POST["description"] = removeBadTags($_POST["description"]);
|
|
89
|
+
|
|
90
|
+ if (isset($_POST["id_post"]) and is_numeric($_POST["id_post"]) and $_POST["id_post"]>0) {
|
|
91
|
+ $tumble->modifyPost($_POST, $_POST["id_post"]);
|
|
92
|
+ } else {
|
|
93
|
+ if ($tumble->addPost($_POST)) {
|
|
94
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
|
|
95
|
+ die();
|
|
96
|
+ } else {
|
|
97
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$tumble->merror);
|
|
98
|
+ die();
|
|
99
|
+ }
|
|
100
|
+ }
|
|
101
|
+ } else {
|
|
102
|
+ if ($isEdition) {
|
|
103
|
+ $post = $tumble->getPost($postId);
|
|
104
|
+ }
|
|
105
|
+
|
|
106
|
+ $theme->set('version',version());
|
|
107
|
+ $theme->set('conf', array(
|
|
108
|
+ 'urlGelato'=>$conf->urlGelato,
|
|
109
|
+ 'richText'=>$conf->richText
|
|
110
|
+ ));
|
|
111
|
+ $theme->set('new',isset($_GET['new'])?$_GET['new']:'');
|
|
112
|
+ $theme->set('information',false);
|
|
113
|
+ $theme->set('error',false);
|
|
114
|
+
|
|
115
|
+ if($conf->check_version){
|
|
116
|
+ $present = version();
|
|
117
|
+ $lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt");
|
|
118
|
+ if ($present < $lastest)
|
|
119
|
+ $theme->set('information',__("A new gelato version has been released and is ready <a href=\"http://www.gelatocms.com/\">for download</a>."));
|
|
120
|
+ }
|
|
121
|
+
|
|
122
|
+ $actions = array(
|
|
123
|
+ 'deleted'=>false,
|
|
124
|
+ 'modified'=>false,
|
|
125
|
+ 'added'=>false
|
|
126
|
+ );
|
|
127
|
+
|
|
128
|
+ if(isset($_GET['deleted']) and $_GET['deleted']=='true'){
|
|
129
|
+ $theme->set('exito',__("The post has been eliminated successfully."));
|
|
130
|
+ $actions['deleted'] = true;
|
|
131
|
+ }
|
|
132
|
+
|
|
133
|
+ if(isset($_GET["modified"]) and $_GET["modified"]==true){
|
|
134
|
+ $theme->set('exito',__("The post has been modified successfully."));
|
|
135
|
+ $actions['modified']=true;
|
|
136
|
+ }
|
|
137
|
+
|
|
138
|
+ if(isset($_GET["added"]) and $_GET["added"]==true) {
|
|
139
|
+ $theme->set('exito',__("The post has been added successfully."));
|
|
140
|
+ $actions['added']=true;
|
|
141
|
+ }
|
|
142
|
+
|
|
143
|
+ $theme->set('action',$actions);
|
|
144
|
+
|
|
145
|
+ if (isset($_GET["error"]) and $_GET["error"]==2)
|
|
146
|
+ $theme->set('error',__("Error on the database server:")." </strong>".$_GET["des"]);
|
|
147
|
+
|
|
148
|
+ if (isset($_GET["mp3"]) and $_GET["mp3"]=='false')
|
|
149
|
+ $theme->set('error',__("Not an MP3 file or an upload problem."));
|
|
150
|
+
|
|
151
|
+ if (isset($_GET["photo"]) and $_GET["photo"]=='false')
|
|
152
|
+ $theme->set('error',__("Not a photo file or an upload problem."));
|
|
153
|
+
|
|
154
|
+ if ($isEdition) {
|
|
155
|
+ switch ($post["type"]) {
|
|
156
|
+ case "1": $_GET["new"] = "post"; break;
|
|
157
|
+ case "2": $_GET["new"] = "photo"; break;
|
|
158
|
+ case "3": $_GET["new"] = "quote"; break;
|
|
159
|
+ case "4": $_GET["new"] = "url"; break;
|
|
160
|
+ case "5": $_GET["new"] = "conversation"; break;
|
|
161
|
+ case "6": $_GET["new"] = "video"; break;
|
|
162
|
+ case "7": $_GET["new"] = "mp3"; break;
|
|
163
|
+ }
|
|
164
|
+ }
|
|
165
|
+
|
|
166
|
+ $date = ($isEdition) ? strtotime($post["date"]) : gmmktime();
|
|
167
|
+ $title = ($isEdition) ? htmlspecialchars(stripslashes($post["title"])) : "";
|
|
168
|
+ $body = ($isEdition) ? stripslashes($post["description"]) : "";
|
|
169
|
+ $url = ($isEdition) ? $post["url"] : "";
|
|
170
|
+
|
|
171
|
+ if (!isset($_GET['new'])) $_GET['new'] = 'post';
|
|
172
|
+
|
|
173
|
+ $theme->set('date',$date);
|
|
174
|
+ $theme->set('id_user',$_SESSION['user_id']);
|
|
175
|
+ $theme->set('type',$_GET["new"]);
|
|
176
|
+ $theme->set('editBody',$body);
|
|
177
|
+
|
|
178
|
+ switch ($_GET["new"]) {
|
|
179
|
+ case "post":
|
|
180
|
+ $theme->set('editTitle',$title);
|
|
181
|
+ break;
|
|
182
|
+ case "photo":
|
|
183
|
+ $url = str_replace("../", $conf->urlGelato."/", $url);
|
|
184
|
+ $theme->set('editUrl',$url);
|
|
185
|
+ break;
|
|
186
|
+ case "quote":
|
|
187
|
+ $theme->set('editTitle',$title);
|
|
188
|
+ break;
|
|
189
|
+ case "url":
|
|
190
|
+ $theme->set('editTitle',$title);
|
|
191
|
+ $theme->set('editUrl',$url);
|
|
192
|
+ break;
|
|
193
|
+ case "conversation":
|
|
194
|
+ $theme->set('editTitle',$title);
|
|
195
|
+ break;
|
|
196
|
+ case "video":
|
|
197
|
+ $theme->set('editUrl',$url);
|
|
198
|
+ break;
|
|
199
|
+ case "mp3":
|
|
200
|
+ $theme->set('editUrl',$url);
|
|
201
|
+ break;
|
|
202
|
+ }
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+ if (!$isEdition){
|
|
206
|
+ if (isset($_GET["page"]))
|
|
207
|
+ $page_num = $_GET["page"];
|
|
208
|
+ else
|
|
209
|
+ $page_num = NULL;
|
|
210
|
+
|
|
211
|
+ $limit=$conf->postLimit;
|
|
212
|
+
|
|
213
|
+ if(isset($page_num) && is_numeric($page_num) && $page_num>0)// Is defined the page and is numeric?
|
|
214
|
+ $from = (($page_num-1) * $limit);
|
|
215
|
+ else
|
|
216
|
+ $from = 0;
|
|
217
|
+
|
|
218
|
+ $rs = $tumble->getPosts($limit, $from);
|
|
219
|
+ $theme->set('Posts_Number',$tumble->contarRegistros());
|
|
220
|
+
|
|
221
|
+ $rows = array();
|
|
222
|
+ if ($tumble->contarRegistros()>0) {
|
|
223
|
+ while($register = mysql_fetch_array($rs)) {
|
|
224
|
+ $row['postType'] = type2Text($tumble->getType($register["id_post"]));
|
|
225
|
+
|
|
226
|
+ $formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
|
|
227
|
+ $strEnd=($conf->urlFriendly) ? "/" : "";
|
|
228
|
+ $permalink = $conf->urlGelato.($conf->urlFriendly?"/post/":"/index.php?post=").$register["id_post"].$strEnd;
|
|
229
|
+
|
|
230
|
+ $register["title"] = stripslashes($register["title"]);
|
|
231
|
+ $register["description"] = stripslashes($register["description"]);
|
|
232
|
+
|
|
233
|
+ $row['Id_Post'] = $register["id_post"];
|
|
234
|
+ $row['Date_Added'] = $formatedDate;
|
|
235
|
+ $row['Permalink'] = $permalink;
|
|
236
|
+
|
|
237
|
+ switch ($tumble->getType($register["id_post"])) {
|
|
238
|
+ case "1":
|
|
239
|
+ $row['Title'] = $register["title"];
|
|
240
|
+ $row['Body'] = $register["description"];
|
|
241
|
+ break;
|
|
242
|
+ case "2":
|
|
243
|
+ $fileName = "../uploads/".getFileName($register["url"]);
|
|
244
|
+
|
|
245
|
+ $x = @getimagesize($fileName);
|
|
246
|
+ if ($x[0] > 100)
|
|
247
|
+ $photoPath = $conf->urlGelato."/classes/imgsize.php?w=100&img=".$register["url"];
|
|
248
|
+ else
|
|
249
|
+ $photoPath = $register["url"];
|
|
250
|
+
|
|
251
|
+ $effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
|
|
252
|
+
|
|
253
|
+ $row['PhotoURL'] = $photoPath;
|
|
254
|
+ $row['PhotoAlt'] = strip_tags($register["description"]);
|
|
255
|
+ $row['Caption'] = $register["description"];
|
|
256
|
+ $row['Effect'] = $effect;
|
|
257
|
+ break;
|
|
258
|
+ case "3":
|
|
259
|
+ $row['Quote'] = $register["description"];
|
|
260
|
+ $row['Source'] = $register["title"];
|
|
261
|
+ break;
|
|
262
|
+ case "4":
|
|
263
|
+ if($conf->shorten_links)
|
|
264
|
+ $register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
|
|
265
|
+ $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
|
|
266
|
+
|
|
267
|
+ $row['URL'] = $register["url"];
|
|
268
|
+ $row['Name'] = $register["title"];
|
|
269
|
+ $row['Description'] = $register["description"];
|
|
270
|
+ break;
|
|
271
|
+ case "5":
|
|
272
|
+ $row['Title'] = $register["title"];
|
|
273
|
+ $row['Conversation'] = $tumble->formatConversation($register["description"]);
|
|
274
|
+ break;
|
|
275
|
+ case "6":
|
|
276
|
+ $row['Video'] = $tumble->getVideoPlayer($register["url"]);
|
|
277
|
+ $row['Caption'] = $register["description"];
|
|
278
|
+ break;
|
|
279
|
+ case "7":
|
|
280
|
+ $row['Mp3'] = $tumble->getMp3Player($register["url"]);
|
|
281
|
+ $row['Caption'] = $register["description"];
|
|
282
|
+ break;
|
|
283
|
+ }
|
|
284
|
+
|
|
285
|
+ $rows[] = $row;
|
|
286
|
+ }
|
|
287
|
+
|
|
288
|
+ $p = new pagination;
|
|
289
|
+ $p->items($tumble->getPostsNumber());
|
|
290
|
+ $p->limit($limit);
|
|
291
|
+ $p->currentPage(isset($page_num) ? $page_num : 1);
|
|
292
|
+
|
|
293
|
+ $theme->set('pagination',$p->getPagination());
|
|
294
|
+ $theme->set('rows',$rows);
|
|
295
|
+ }else{
|
|
296
|
+ $theme->set('error',__("No posts in this tumblelog."));
|
|
297
|
+ }
|
|
298
|
+ }
|
|
299
|
+ $theme->display(Absolute_Path.'admin/themes/admin/index.htm');
|
|
300
|
+ }
|
338
|
301
|
} else {
|
339
|
|
- header("Location: ".$conf->urlGelato."/login.php");
|
|
302
|
+ header("Location: ".$conf->urlGelato."/login.php");
|
340
|
303
|
}
|
341
|
|
-?>
|
|
304
|
+?>
|