|
@@ -9,31 +9,41 @@ 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');
|
16
|
16
|
|
17
|
17
|
global $user, $conf, $tumble;
|
18
|
|
-$template = new plantillas("admin");
|
|
18
|
+#$template = new plantillas("admin");
|
|
19
|
+$theme = new themes;
|
19
|
20
|
|
20
|
21
|
$isEdition = (isset($_GET["edit"])) ? true : false;
|
21
|
22
|
$postId = ($isEdition) ? $_GET["edit"] : NULL;
|
22
|
23
|
|
23
|
|
-if ($user->isAuthenticated()) {
|
|
24
|
+$theme->set('isEdition',$isEdition);
|
|
25
|
+$theme->set('postId',$postId);
|
|
26
|
+$theme->set('pagination','');
|
|
27
|
+
|
|
28
|
+if (get_magic_quotes_gpc()) {
|
|
29
|
+ foreach($_GET as $k=>$get){
|
|
30
|
+ $_GET[$k]=stripslashes($get);
|
|
31
|
+ }
|
|
32
|
+}
|
24
|
33
|
|
|
34
|
+if ($user->isAuthenticated()) {
|
25
|
35
|
if (isset($_GET["delete"])) {
|
26
|
36
|
$tumble->deletePost($_GET['delete']);
|
27
|
37
|
header("Location: index.php?deleted=true");
|
28
|
38
|
die();
|
29
|
39
|
}
|
30
|
40
|
|
31
|
|
- if(isset($_POST["btnAdd"])) {
|
|
41
|
+ if(isset($_POST["btnAdd"])){
|
32
|
42
|
unset($_POST["btnAdd"]);
|
33
|
|
-
|
34
|
|
-
|
35
|
|
- if ($_POST["type"]=="2") { // is Photo type
|
36
|
|
- if (isset($_POST["url"]) && $_POST["url"]!="") {
|
|
43
|
+ $_POST['type'] = type2Number($_POST['type']);
|
|
44
|
+
|
|
45
|
+ if ($_POST["type"]=="2") { // is Photo type
|
|
46
|
+ if (isset($_POST["url"]) && $_POST["url"]!="") {
|
37
|
47
|
$photoName = getFileName($_POST["url"]);
|
38
|
48
|
if (!$tumble->savePhoto($_POST["url"])) {
|
39
|
49
|
header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
|
|
@@ -41,15 +51,15 @@ if ($user->isAuthenticated()) {
|
41
|
51
|
}
|
42
|
52
|
$_POST["url"] = "../uploads/".sanitizeName($photoName);
|
43
|
53
|
}
|
44
|
|
-
|
|
54
|
+
|
45
|
55
|
if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
|
46
|
56
|
$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
|
47
|
57
|
}
|
48
|
|
-
|
|
58
|
+
|
49
|
59
|
unset($_POST["photo"]);
|
50
|
60
|
unset($_POST["MAX_FILE_SIZE"]);
|
51
|
61
|
}
|
52
|
|
-
|
|
62
|
+
|
53
|
63
|
if ($_POST["type"]=="7") { // is MP3 type
|
54
|
64
|
set_time_limit(300);
|
55
|
65
|
$mp3Name = getFileName($_POST["url"]);
|
|
@@ -60,297 +70,219 @@ if ($user->isAuthenticated()) {
|
60
|
70
|
if (isMP3($remoteFileName)) {
|
61
|
71
|
$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
|
62
|
72
|
}
|
63
|
|
- }
|
64
|
|
-
|
65
|
|
- if (!get_magic_quotes_gpc()) {
|
|
73
|
+ }
|
|
74
|
+
|
|
75
|
+ if (!get_magic_quotes_gpc()) {
|
66
|
76
|
$_POST["title"] = addslashes($_POST["title"]);
|
67
|
77
|
$_POST["description"] = addslashes($_POST["description"]);
|
68
|
|
- }
|
69
|
|
-
|
|
78
|
+ }
|
|
79
|
+
|
70
|
80
|
/*
|
71
|
81
|
$textile = new Textile();
|
72
|
|
-
|
|
82
|
+
|
73
|
83
|
$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"],true));
|
74
|
84
|
$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
|
75
|
85
|
*/
|
76
|
|
-
|
|
86
|
+
|
77
|
87
|
$_POST["title"] = removeBadTags($_POST["title"],true);
|
78
|
88
|
$_POST["description"] = removeBadTags($_POST["description"]);
|
79
|
|
-
|
80
|
|
- if (isset($_POST["id_post"])) {
|
|
89
|
+
|
|
90
|
+ if (isset($_POST["id_post"]) and is_numeric($_POST["id_post"]) and $_POST["id_post"]>0) {
|
81
|
91
|
$tumble->modifyPost($_POST, $_POST["id_post"]);
|
82
|
|
- } else {
|
|
92
|
+ } else {
|
83
|
93
|
if ($tumble->addPost($_POST)) {
|
84
|
94
|
header("Location: ".$conf->urlGelato."/admin/index.php?added=true");
|
85
|
95
|
die();
|
86
|
96
|
} else {
|
87
|
|
- header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$this->merror);
|
|
97
|
+ header("Location: ".$conf->urlGelato."/admin/index.php?error=2&des=".$tumble->merror);
|
88
|
98
|
die();
|
89
|
99
|
}
|
90
|
|
- }
|
|
100
|
+ }
|
91
|
101
|
} else {
|
92
|
102
|
if ($isEdition) {
|
93
|
103
|
$post = $tumble->getPost($postId);
|
94
|
104
|
}
|
95
|
|
-
|
96
|
|
-?>
|
97
|
|
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
98
|
|
- <html xmlns="http://www.w3.org/1999/xhtml">
|
99
|
|
- <head>
|
100
|
|
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
101
|
|
- <meta name="generator" content="gelato cms <?php echo version();?>" />
|
102
|
|
- <title>gelato :: <?php echo __("control panel")?></title>
|
103
|
|
- <link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
|
104
|
|
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.js"></script>
|
105
|
|
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
|
106
|
|
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/lightbox.js"></script>
|
107
|
|
- <script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/jquery.validate.min.js"></script>
|
108
|
|
- <script language="javascript" type="text/javascript">
|
109
|
|
- $(document).ready(function(){
|
110
|
|
- $("#divMessages").fadeOut(5000,function(){
|
111
|
|
- $("#divMessages").css({display:"none"});
|
112
|
|
- });
|
113
|
|
- });
|
114
|
|
- Lightbox.fileLoadingImage = "css/images/loading.gif";
|
115
|
|
- Lightbox.fileBottomNavCloseImage = "css/images/closelabel.gif";
|
116
|
|
- </script>
|
117
|
|
-<?php
|
118
|
|
- if($conf->richText) {
|
119
|
|
-?>
|
120
|
|
- <script src="<?php echo $conf->urlGelato;?>/admin/scripts/nicEdit.js" type="text/javascript"></script>
|
121
|
|
- <script type="text/javascript">
|
122
|
|
- bkLib.onDomLoaded(nicEditors.allTextAreas);
|
123
|
|
- </script>
|
124
|
|
-<?php
|
125
|
|
- } else {
|
126
|
|
-?>
|
127
|
|
- <script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/jquery.markitup.pack.js"></script>
|
128
|
|
- <script type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/set.js"></script>
|
129
|
|
- <link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/skins/simple/style.css" />
|
130
|
|
- <link rel="stylesheet" type="text/css" href="<?php echo $conf->urlGelato;?>/admin/scripts/markitup/sets/html/style.css" />
|
131
|
|
- <script type="text/javascript" >
|
132
|
|
- $(document).ready(function() {
|
133
|
|
- $("#description").markItUp(my_html);
|
134
|
|
- });
|
135
|
|
- </script>
|
136
|
|
-<?php
|
137
|
|
- }
|
138
|
|
-?>
|
139
|
|
- <style type="text/css" media="screen">
|
140
|
|
- @import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
|
141
|
|
- @import "<?php echo $conf->urlGelato;?>/admin/css/lightbox.css";
|
142
|
|
- </style>
|
143
|
|
- </head>
|
144
|
|
-
|
145
|
|
- <body>
|
146
|
|
- <div id="div-process" style="display:none;"><?php echo __("Processing request…")?></div>
|
147
|
|
- <div id="cont">
|
148
|
|
- <div id="head">
|
149
|
|
- <h1><a href="<?php echo $conf->urlGelato;?>/admin/index.php" title="gelato :: <?php echo __("home")?>">gelato cms</a></h1>
|
150
|
|
- <ul id="nav">
|
151
|
|
- <li><a href="<?php echo $conf->urlGelato;?>/" title="<?php echo __("Take me to the tumblelog")?>"><?php echo __("View Tumblelog")?></a></li>
|
152
|
|
- <li><a href="close.php" title="Log off" ><?php echo __("Log out")?></a></li>
|
153
|
|
- </ul>
|
154
|
|
- </div>
|
155
|
|
- <div id="main">
|
156
|
|
- <div class="box">
|
157
|
|
- <ul class="menu">
|
158
|
|
- <h3><?php echo __("New Post")?></h3>
|
159
|
|
- <li<?php echo (isset($_GET["new"]) && $_GET["new"]=="conversation") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=conversation"><img src="css/images/comments.png" alt="New chat" /> <?php echo __("Chat")?></a></li>
|
160
|
|
- <li<?php echo (isset($_GET["new"]) && $_GET["new"]=="quote") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=quote"><img src="css/images/quote.png" alt="New qoute" /> <?php echo __("Quote")?></a></li>
|
161
|
|
- <li<?php echo (isset($_GET["new"]) && $_GET["new"]=="url") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=url"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li>
|
162
|
|
- <li<?php echo (isset($_GET["new"]) && $_GET["new"]=="mp3") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=mp3"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li>
|
163
|
|
- <li<?php echo (isset($_GET["new"]) && $_GET["new"]=="video") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=video"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li>
|
164
|
|
- <li<?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=photo"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li>
|
165
|
|
- <li<?php echo (isset($_GET["new"]) && $_GET["new"]=="post") ? " class=\"selected\"" : ""; echo (!isset($_GET["new"])) ? " class=\"selected\"" : ""; ?>><a href="<?php echo $conf->urlGelato;?>/admin/index.php?new=post"><img src="css/images/page.png" alt="New post" /> <?php echo __("Regular")?></a></li>
|
166
|
|
- </ul>
|
167
|
|
- <p> </p>
|
168
|
|
-<?php
|
169
|
|
- if($conf->check_version){
|
170
|
|
- $present = version();
|
171
|
|
- $lastest = _file_get_contents("http://www.gelatocms.com/vgel.txt");
|
172
|
|
- if ($present < $lastest) {
|
173
|
|
- echo "<div class=\"information\" id=\"update\">".__("A new gelato version has been released and is ready <a href=\"http://www.gelatocms.com/\">for download</a>.")."</div><br />";
|
174
|
|
- }
|
175
|
|
- }
|
176
|
|
- if (isset($_GET["deleted"])) {
|
177
|
|
- if ($_GET["deleted"]=="true") {
|
178
|
|
- echo "<div class=\"exito\" id=\"divMessages\">".__("The post has been eliminated successfully.")."</div>";
|
179
|
|
- }
|
180
|
|
- }
|
181
|
|
-
|
182
|
|
- if (isset($_GET["modified"])) {
|
183
|
|
- if ($_GET["modified"]=="true") {
|
184
|
|
- echo "<div class=\"exito\" id=\"divMessages\">".__("The post has been modified successfully.")."</div>";
|
185
|
|
- }
|
186
|
|
- }
|
187
|
|
-
|
188
|
|
- if (isset($_GET["added"])) {
|
189
|
|
- if ($_GET["added"]=="true") {
|
190
|
|
- echo "<div class=\"exito\" id=\"divMessages\">".__("The post has been added successfully.")."</div>";
|
191
|
|
- }
|
192
|
|
- }
|
193
|
|
-
|
194
|
|
- if (isset($_GET["error"])) {
|
195
|
|
- if ($_GET["error"]==2) {
|
196
|
|
- echo "<div class=\"error\"><strong>".__("Error on the database server:")." </strong>".$_GET["des"]."</div>";
|
197
|
|
- }
|
198
|
|
- }
|
199
|
|
-
|
200
|
|
- if (isset($_GET["mp3"])) {
|
201
|
|
- if ($_GET["mp3"]=="false") {
|
202
|
|
- echo "<div class=\"error\" id=\"divMessages\">".__("Not an MP3 file or an upload problem.")."</div>";
|
203
|
|
- }
|
204
|
|
- }
|
205
|
|
-
|
206
|
|
- if (isset($_GET["photo"])) {
|
207
|
|
- if ($_GET["photo"]=="false") {
|
208
|
|
- echo "<div class=\"error\" id=\"divMessages\">".__("Not a photo file or an upload problem.")."</div>";
|
209
|
|
- }
|
210
|
|
- }
|
211
|
|
-?>
|
212
|
|
- <form action="index.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" id="autosave" class="newpost">
|
213
|
|
- <fieldset>
|
214
|
|
-<?php
|
215
|
|
- if ($isEdition) {
|
216
|
|
-?>
|
217
|
|
- <input type="hidden" name="id_post" id="id_post" value="<?php echo $postId;?>" />
|
218
|
|
-<?php
|
219
|
|
- switch ($post["type"]) {
|
220
|
|
- case "1":
|
221
|
|
- $_GET["new"] = "post";
|
222
|
|
- break;
|
223
|
|
- case "2":
|
224
|
|
- $_GET["new"] = "photo";
|
225
|
|
- break;
|
226
|
|
- case "3":
|
227
|
|
- $_GET["new"] = "quote";
|
228
|
|
- break;
|
229
|
|
- case "4":
|
230
|
|
- $_GET["new"] = "url";
|
231
|
|
- break;
|
232
|
|
- case "5":
|
233
|
|
- $_GET["new"] = "conversation";
|
234
|
|
- break;
|
235
|
|
- case "6":
|
236
|
|
- $_GET["new"] = "video";
|
237
|
|
- break;
|
238
|
|
- case "7":
|
239
|
|
- $_GET["new"] = "mp3";
|
240
|
|
- break;
|
241
|
|
- }
|
242
|
|
-
|
243
|
|
- }
|
244
|
|
-
|
245
|
|
- $date = ($isEdition) ? strtotime($post["date"]) : gmmktime();
|
246
|
|
- $title = ($isEdition) ? htmlspecialchars(stripslashes($post["title"])) : "";
|
247
|
|
- $body = ($isEdition) ? stripslashes($post["description"]) : "";
|
248
|
|
- $url = ($isEdition) ? $post["url"] : "";
|
249
|
|
-
|
250
|
|
- if (!isset($_GET['new'])) $_GET['new'] = 'default';
|
251
|
|
- switch ($_GET["new"]) {
|
252
|
|
- case "post":
|
253
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
|
254
|
|
- $output = array("1", $date, $_SESSION['user_id'], $title, $body);
|
255
|
|
-
|
256
|
|
- $template->cargarPlantilla($input, $output, "template_add_post");
|
257
|
|
- $template->mostrarPlantilla();
|
258
|
|
- break;
|
259
|
|
- case "photo":
|
260
|
|
- $url = str_replace("../", $conf->urlGelato."/", $url);
|
261
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
262
|
|
- $output = array("2", $date, $_SESSION['user_id'], $url, $body);
|
263
|
|
-
|
264
|
|
- $template->cargarPlantilla($input, $output, "template_add_photo");
|
265
|
|
- $template->mostrarPlantilla();
|
266
|
|
- break;
|
267
|
|
- case "quote":
|
268
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
|
269
|
|
- $output = array("3", $date, $_SESSION['user_id'], $title, $body);
|
270
|
|
-
|
271
|
|
- $template->cargarPlantilla($input, $output, "template_add_quote");
|
272
|
|
- $template->mostrarPlantilla();
|
273
|
|
- break;
|
274
|
|
- case "url":
|
275
|
|
-
|
276
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
|
277
|
|
- $output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
|
278
|
|
-
|
279
|
|
- $template->cargarPlantilla($input, $output, "template_add_link");
|
280
|
|
- $template->mostrarPlantilla();
|
281
|
|
- break;
|
282
|
|
- case "conversation":
|
283
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
|
284
|
|
- $output = array("5", $date, $_SESSION['user_id'], $title, $body);
|
285
|
|
-
|
286
|
|
- $template->cargarPlantilla($input, $output, "template_add_conversation");
|
287
|
|
- $template->mostrarPlantilla();
|
288
|
|
- break;
|
289
|
|
- case "video":
|
290
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
291
|
|
- $output = array("6", $date, $_SESSION['user_id'], $url, $body);
|
292
|
|
-
|
293
|
|
- $template->cargarPlantilla($input, $output, "template_add_video");
|
294
|
|
- $template->mostrarPlantilla();
|
295
|
|
- break;
|
296
|
|
- case "mp3":
|
297
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
|
298
|
|
- $output = array("7", $date, $_SESSION['user_id'], $url, $body);
|
299
|
|
-
|
300
|
|
- $template->cargarPlantilla($input, $output, "template_add_mp3");
|
301
|
|
- $template->mostrarPlantilla();
|
302
|
|
- break;
|
303
|
|
- default:
|
304
|
|
- $input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
|
305
|
|
- $output = array("1", $date, $_SESSION['user_id'], $title, $body);
|
306
|
|
-
|
307
|
|
- $template->cargarPlantilla($input, $output, "template_add_post");
|
308
|
|
- $template->mostrarPlantilla();
|
309
|
|
- break;
|
310
|
|
- }
|
311
|
|
-?>
|
312
|
|
- <p>
|
313
|
|
- <span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
|
314
|
|
- <?php echo __("Some HTML allowed")?>:<br />
|
315
|
|
-
|
316
|
|
- <code>
|
317
|
|
- <strong> <em> <del> <ul> <ol> <li> <a>
|
318
|
|
- <br />
|
319
|
|
- <blockquote>
|
320
|
|
- <code> <pre> <img>
|
321
|
|
- </code>
|
322
|
|
- <br /><br />
|
323
|
|
- Bookmarklet - <a class="bookmarklet" title="<?php echo __("Drag to the Bookmarks Toolbar")?>" href="javascript:var w; setTimeout('w.focus()',100);w=window.open('<?php echo $conf->urlGelato; ?>/admin/bm.php?url='+encodeURIComponent(location.href)+'&sel='+encodeURIComponent(window.getSelection()),'bookmarklet','toolbar=0,resizable=0,status=1,width=650,height=540,dependent=yes' ); w.focus();"><?php echo __("add to gelato")?></a>
|
324
|
|
- <br /><br />
|
325
|
|
- </span>
|
326
|
|
- </p>
|
327
|
|
- <p>
|
328
|
|
- <input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" />
|
329
|
|
- </p>
|
330
|
|
- </fieldset>
|
331
|
|
- </form>
|
332
|
|
- <div class="footer-box"> </div>
|
333
|
|
- </div>
|
334
|
|
-<?php
|
335
|
|
- if (!$isEdition) {
|
336
|
|
-?>
|
337
|
|
- <div class="box">
|
338
|
|
- <ul class="menu manage">
|
339
|
|
- <h3>Manage</h3>
|
340
|
|
- <li><a href="<?php echo $conf->urlGelato;?>/admin/settings.php"><?php echo __("Settings")?></a></li>
|
341
|
|
- <li><a href="<?php echo $conf->urlGelato;?>/admin/options.php"><?php echo __("Options")?></a></li>
|
342
|
|
- <li><a href="<?php echo $conf->urlGelato;?>/admin/feeds.php"><?php echo __("Feeds")?></a></li>
|
343
|
|
- <li><a href="<?php echo $conf->urlGelato;?>/admin/admin.php"><?php echo __("Users")?></a></li>
|
344
|
|
- <li><a href="<?php echo $conf->urlGelato;?>/admin/comments.php"><?php echo __("Comments")?></a></li>
|
345
|
|
- <li class="selected"><a><?php echo __("Posts")?></a></li>
|
346
|
|
- </ul>
|
347
|
105
|
|
348
|
|
-<?php
|
349
|
|
- if (isset($_GET["page"])) {
|
350
|
|
- $page_num = $_GET["page"];
|
351
|
|
- } else {
|
352
|
|
- $page_num = NULL;
|
|
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 = $conf->urlGelato."/index.php/post/".$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;
|
353
|
281
|
}
|
|
282
|
+<<<<<<< .mine
|
|
283
|
+ $rows[] = $row;
|
|
284
|
+ }
|
|
285
|
+=======
|
354
|
286
|
|
355
|
287
|
$limit=$conf->postLimit;
|
356
|
288
|
|
|
@@ -387,84 +319,22 @@ if ($user->isAuthenticated()) {
|
387
|
319
|
} else {
|
388
|
320
|
$photoPath = $register["url"];
|
389
|
321
|
}
|
|
322
|
+>>>>>>> .r241
|
390
|
323
|
|
391
|
|
- $effect = " href=\"".str_replace("../", $conf->urlGelato."/", $register["url"])."\" rel=\"lightbox\"";
|
392
|
|
-
|
393
|
|
- $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
|
394
|
|
- $output = array($register["id_post"], $formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
|
395
|
|
-
|
396
|
|
- $template->cargarPlantilla($input, $output, "template_photo");
|
397
|
|
- $template->mostrarPlantilla();
|
398
|
|
- break;
|
399
|
|
- case "3":
|
400
|
|
- $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
|
401
|
|
- $output = array($register["id_post"], $formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
|
402
|
|
-
|
403
|
|
- $template->cargarPlantilla($input, $output, "template_quote");
|
404
|
|
- $template->mostrarPlantilla();
|
405
|
|
- break;
|
406
|
|
- case "4":
|
407
|
|
- if($conf->shorten_links){
|
408
|
|
- $register["url"] = _file_get_contents("http://api.abbrr.com/api.php?out=link&url=".$register["url"]);
|
409
|
|
- }
|
410
|
|
- $register["title"] = ($register["title"]=="")? $register["url"] : $register["title"];
|
411
|
|
- $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
|
412
|
|
- $output = array($register["id_post"], $formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
|
413
|
|
-
|
414
|
|
- $template->cargarPlantilla($input, $output, "template_url");
|
415
|
|
- $template->mostrarPlantilla();
|
416
|
|
- break;
|
417
|
|
- case "5":
|
418
|
|
- $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
|
419
|
|
- $output = array($register["id_post"], $formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
|
420
|
|
-
|
421
|
|
- $template->cargarPlantilla($input, $output, "template_conversation");
|
422
|
|
- $template->mostrarPlantilla();
|
423
|
|
- break;
|
424
|
|
- case "6":
|
425
|
|
- $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
|
426
|
|
- $output = array($register["id_post"], $formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
|
427
|
|
-
|
428
|
|
- $template->cargarPlantilla($input, $output, "template_video");
|
429
|
|
- $template->mostrarPlantilla();
|
430
|
|
- break;
|
431
|
|
- case "7":
|
432
|
|
- $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
|
433
|
|
- $output = array($register["id_post"], $formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
|
434
|
|
-
|
435
|
|
- $template->cargarPlantilla($input, $output, "template_mp3");
|
436
|
|
- $template->mostrarPlantilla();
|
437
|
|
- break;
|
438
|
|
- }
|
439
|
|
- }
|
440
|
|
-
|
441
|
|
- $p = new pagination;
|
442
|
|
- $p->items($tumble->getPostsNumber());
|
443
|
|
- $p->limit($limit);
|
444
|
|
- $p->currentPage(isset($page_num) ? $page_num : 1);
|
445
|
|
- $p->show();
|
446
|
|
-
|
447
|
|
-
|
448
|
|
- } else {
|
449
|
|
- $template->renderizaEtiqueta(__("No posts in this tumblelog."), "div","error");
|
450
|
|
- }
|
451
|
|
-
|
452
|
|
-?>
|
453
|
|
- <div class="footer-box"> </div>
|
454
|
|
- </div>
|
455
|
|
- </div>
|
456
|
|
-<?php
|
|
324
|
+ $p = new pagination;
|
|
325
|
+ $p->items($tumble->getPostsNumber());
|
|
326
|
+ $p->limit($limit);
|
|
327
|
+ $p->currentPage(isset($page_num) ? $page_num : 1);
|
|
328
|
+
|
|
329
|
+ $theme->set('pagination',$p->getPagination());
|
|
330
|
+ $theme->set('rows',$rows);
|
|
331
|
+ }else{
|
|
332
|
+ $theme->set('error',__("No posts in this tumblelog."));
|
457
|
333
|
}
|
458
|
|
-?>
|
459
|
|
- <div id="foot">
|
460
|
|
- <a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
|
461
|
|
- </div>
|
462
|
|
- </div>
|
463
|
|
- </body>
|
464
|
|
- </html>
|
465
|
|
-<?php
|
|
334
|
+ }
|
|
335
|
+ $theme->display(Absolute_Path.'admin/themes/admin/index.htm');
|
466
|
336
|
}
|
467
|
337
|
} else {
|
468
|
338
|
header("Location: ".$conf->urlGelato."/login.php");
|
469
|
339
|
}
|
470
|
|
-?>
|
|
340
|
+?>
|