|
|
@@ -11,7 +11,9 @@
|
|
11
|
11
|
<?
|
|
12
|
12
|
require_once('../config.php');
|
|
13
|
13
|
include("../classes/user.class.php");
|
|
|
14
|
+include("../classes/pagination.php");
|
|
14
|
15
|
include("../classes/gelato.class.php");
|
|
|
16
|
+include("../classes/textile.class.php");
|
|
15
|
17
|
include("../classes/templates.class.php");
|
|
16
|
18
|
require_once("../classes/configuration.class.php");
|
|
17
|
19
|
|
|
|
@@ -88,6 +90,7 @@ if ($user->isAdmin()) {
|
|
88
|
90
|
<link rel="shortcut icon" href="<?=$conf->urlGelato;?>/images/favicon.ico" />
|
|
89
|
91
|
<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/tools.js"></script>
|
|
90
|
92
|
<script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/mootools.js"></script>
|
|
|
93
|
+ <script language="javascript" type="text/javascript" src="<?=$conf->urlGelato;?>/admin/scripts/slimbox.js"></script>
|
|
91
|
94
|
<script type="text/javascript">
|
|
92
|
95
|
<!--
|
|
93
|
96
|
function exit(el, path) {
|
|
|
@@ -107,7 +110,6 @@ if ($user->isAdmin()) {
|
|
107
|
110
|
contenedor = new Fx.Style('divMessages', 'opacity', {duration: 5000, onComplete:
|
|
108
|
111
|
function() {
|
|
109
|
112
|
document.getElementById('divMessages').style.display="none";
|
|
110
|
|
- document.getElementById('pMessages').style.display="none";
|
|
111
|
113
|
}
|
|
112
|
114
|
});
|
|
113
|
115
|
contenedor.custom(1,0);
|
|
|
@@ -116,6 +118,7 @@ if ($user->isAdmin()) {
|
|
116
|
118
|
</script>
|
|
117
|
119
|
<style type="text/css" media="screen">
|
|
118
|
120
|
@import "<?=$conf->urlGelato;?>/admin/css/style.css";
|
|
|
121
|
+ @import "<?=$conf->urlGelato;?>/admin/css/slimbox.css";
|
|
119
|
122
|
</style>
|
|
120
|
123
|
</head>
|
|
121
|
124
|
|
|
|
@@ -126,56 +129,56 @@ if ($user->isAdmin()) {
|
|
126
|
129
|
<h1><a href="<?=$conf->urlGelato;?>/admin/index.php" title="gelato :: home">gelato cms</a></h1>
|
|
127
|
130
|
<ul id="nav">
|
|
128
|
131
|
<li><a href="<?=$conf->urlGelato;?>/" title="Take me to the tumblelog">View Tumblelog</a></li>
|
|
129
|
|
- <li><a href="close.php" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
|
|
130
|
|
- </ul>
|
|
|
132
|
+ <li><a href="close.php" title="Log off" onclick="return exit('div-process','<?=$conf->urlGelato;?>/admin/ajax.php?action=close');">Log out</a></li>
|
|
|
133
|
+ </ul>
|
|
131
|
134
|
</div>
|
|
132
|
135
|
<div id="main">
|
|
133
|
136
|
<div class="box">
|
|
134
|
137
|
<ul class="menu">
|
|
135
|
|
- <h3>New Post</h3>
|
|
136
|
|
- <li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=conversation"><img src="css/images/comments.png" alt="New chat" /> Chat</a></li>
|
|
137
|
|
- <li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=quote"><img src="css/images/comments.png" alt="New qoute" /> Quote</a></li>
|
|
138
|
|
- <li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=url"><img src="css/images/world.png" alt="New link" /> Link</a></li>
|
|
139
|
|
- <li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=mp3"><img src="css/images/music.png" alt="New audio" /> Audio</a></li>
|
|
140
|
|
- <li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=video"><img src="css/images/film.png" alt="New video" /> Video</a></li>
|
|
141
|
|
- <li><a href="<?=$conf->urlGelato;?>/admin/index.php?new=photo"><img src="css/images/image.png" alt="New picture" /> Picture</a></li>
|
|
142
|
|
- <li class="selected"><a href="<?=$conf->urlGelato;?>/admin/index.php?new=post"><img src="css/images/page_white_text.png" alt="New post" /> Regular</a></li>
|
|
|
138
|
+ <h3>New Post</h3>
|
|
|
139
|
+ <li <? echo ($_GET["new"]=="conversation") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=conversation"><img src="css/images/comments.png" alt="New chat" /> Chat</a></li>
|
|
|
140
|
+ <li <? echo ($_GET["new"]=="quote") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=quote"><img src="css/images/quote.png" alt="New qoute" /> Quote</a></li>
|
|
|
141
|
+ <li <? echo ($_GET["new"]=="url") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=url"><img src="css/images/world.png" alt="New link" /> Link</a></li>
|
|
|
142
|
+ <li <? echo ($_GET["new"]=="mp3") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=mp3"><img src="css/images/music.png" alt="New audio" /> Audio</a></li>
|
|
|
143
|
+ <li <? echo ($_GET["new"]=="video") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=video"><img src="css/images/film.png" alt="New video" /> Video</a></li>
|
|
|
144
|
+ <li <? echo ($_GET["new"]=="photo") ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=photo"><img src="css/images/image.png" alt="New picture" /> Picture</a></li>
|
|
|
145
|
+ <li <? echo ($_GET["new"]=="post") ? "class=\"selected\"" : ""; echo (!isset($_GET["new"])) ? "class=\"selected\"" : ""; ?>><a href="<?=$conf->urlGelato;?>/admin/index.php?new=post"><img src="css/images/page.png" alt="New post" /> Regular</a></li>
|
|
143
|
146
|
</ul>
|
|
144
|
|
-
|
|
|
147
|
+ <p> </p>
|
|
145
|
148
|
<?
|
|
146
|
149
|
if (isset($_GET["deleted"])) {
|
|
147
|
150
|
if ($_GET["deleted"]=="true") {
|
|
148
|
|
- echo "<p id=\"pMessages\"> </p><div class=\"exito\" id=\"divMessages\">The article has been eliminated successfully.</div>";
|
|
|
151
|
+ echo "<div class=\"exito\" id=\"divMessages\">The article has been eliminated successfully.</div>";
|
|
149
|
152
|
}
|
|
150
|
153
|
}
|
|
151
|
154
|
|
|
152
|
155
|
if (isset($_GET["modified"])) {
|
|
153
|
156
|
if ($_GET["modified"]=="true") {
|
|
154
|
|
- echo "<p id=\"pMessages\"> </p><div class=\"exito\" id=\"divMessages\">The article has been modified successfully.</div>";
|
|
|
157
|
+ echo "<div class=\"exito\" id=\"divMessages\">The article has been modified successfully.</div>";
|
|
155
|
158
|
}
|
|
156
|
159
|
}
|
|
157
|
160
|
|
|
158
|
161
|
if (isset($_GET["added"])) {
|
|
159
|
162
|
if ($_GET["added"]=="true") {
|
|
160
|
|
- echo "<p id=\"pMessages\"> </p><div class=\"exito\" id=\"divMessages\">The article has been added successfully.</div>";
|
|
|
163
|
+ echo "<div class=\"exito\" id=\"divMessages\">The article has been added successfully.</div>";
|
|
161
|
164
|
}
|
|
162
|
165
|
}
|
|
163
|
166
|
|
|
164
|
167
|
if (isset($_GET["error"])) {
|
|
165
|
168
|
if ($_GET["error"]==2) {
|
|
166
|
|
- echo "<p id=\"pMessages\"> </p><div class=\"error\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
|
|
|
169
|
+ echo "<div class=\"error\"><strong>Error on the database server: </strong>".$_GET["des"]."</div>";
|
|
167
|
170
|
}
|
|
168
|
171
|
}
|
|
169
|
172
|
|
|
170
|
173
|
if (isset($_GET["mp3"])) {
|
|
171
|
174
|
if ($_GET["mp3"]=="false") {
|
|
172
|
|
- echo "<p id=\"pMessages\"> </p><div class=\"error\" id=\"divMessages\">Not an MP3 file or an upload problem.</div>";
|
|
|
175
|
+ echo "<div class=\"error\" id=\"divMessages\">Not an MP3 file or an upload problem.</div>";
|
|
173
|
176
|
}
|
|
174
|
177
|
}
|
|
175
|
178
|
|
|
176
|
179
|
if (isset($_GET["photo"])) {
|
|
177
|
180
|
if ($_GET["photo"]=="false") {
|
|
178
|
|
- echo "<p id=\"pMessages\"> </p><div class=\"error\" id=\"divMessages\">Not a photo file or an upload problem.</div>";
|
|
|
181
|
+ echo "<div class=\"error\" id=\"divMessages\">Not a photo file or an upload problem.</div>";
|
|
179
|
182
|
}
|
|
180
|
183
|
}
|
|
181
|
184
|
?>
|
|
|
@@ -242,9 +245,7 @@ if ($user->isAdmin()) {
|
|
242
|
245
|
}
|
|
243
|
246
|
?>
|
|
244
|
247
|
<p>
|
|
245
|
|
- <input class="btn" type="submit" name="btnAdd" value="Create post" />
|
|
246
|
|
- <a href="#" onclick="if (confirm('Cancel editing this post? All changes will be lost.'))
|
|
247
|
|
- {location.href='index.php';}; return false;">Cancel</a>
|
|
|
248
|
+ <input class="btn" type="submit" name="btnAdd" value="Create post" />
|
|
248
|
249
|
</p>
|
|
249
|
250
|
</fieldset>
|
|
250
|
251
|
</form>
|
|
|
@@ -259,28 +260,104 @@ if ($user->isAdmin()) {
|
|
259
|
260
|
<li><a href="<?=$conf->urlGelato;?>/admin/admin.php">Users</a></li>
|
|
260
|
261
|
<li class="selected"><a href="#">Posts</a></li>
|
|
261
|
262
|
</ul>
|
|
|
263
|
+
|
|
|
264
|
+<?
|
|
|
265
|
+ if (isset($_GET["page"])) {
|
|
|
266
|
+ $page_num = $_GET["page"];
|
|
|
267
|
+ } else {
|
|
|
268
|
+ $page_num = NULL;
|
|
|
269
|
+ }
|
|
262
|
270
|
|
|
263
|
|
- <div class="entry">
|
|
264
|
|
- <div class="info"><form class="compact"><input type="submit" value="Edit" /> <input type="submit" value="Delete" /></form>
|
|
265
|
|
- <p>25/05 Regular Post (0 Comments) </p>
|
|
266
|
|
- </div>
|
|
267
|
|
- <div class="post">
|
|
268
|
|
- <span class="option">(no title)</span>
|
|
269
|
|
- <p>I just discovered Gelato</p>
|
|
270
|
|
- </div>
|
|
271
|
|
- </div>
|
|
272
|
|
-
|
|
273
|
|
- <div class="entry">
|
|
274
|
|
- <div class="info"><form class="compact"><input type="submit" value="Edit" /> <input type="submit" value="Delete" /></form>
|
|
275
|
|
- <p>25/05 Regular Post (0 Comments) </p>
|
|
276
|
|
- </div>
|
|
277
|
|
- <div class="post">
|
|
278
|
|
- <h4>One with a title</h4>
|
|
279
|
|
- <p>Another entry, this one has some varations in the content, even dares
|
|
280
|
|
- to be in two lines.</p>
|
|
281
|
|
- </div>
|
|
282
|
|
- </div>
|
|
|
271
|
+ $limit=$conf->postLimit;
|
|
|
272
|
+
|
|
|
273
|
+ if(isset($page_num) && is_numeric($page_num) && $page_num>0) { // Is defined the page and is numeric?
|
|
|
274
|
+ $from = (($page_num-1) * $limit);
|
|
|
275
|
+ } else {
|
|
|
276
|
+ $from = 0;
|
|
|
277
|
+ }
|
|
|
278
|
+
|
|
|
279
|
+ $rs = $tumble->getPosts($limit, $from);
|
|
|
280
|
+
|
|
|
281
|
+ if ($tumble->contarRegistros()>0) {
|
|
|
282
|
+ while($register = mysql_fetch_array($rs)) {
|
|
|
283
|
+ $formatedDate = date("M d", strtotime($register["date"]));
|
|
|
284
|
+ $permalink = $conf->urlGelato."/index.php/post/".$register["id_post"]."/";
|
|
|
285
|
+
|
|
|
286
|
+ $textile = new Textile;
|
|
|
287
|
+ $register["description"] = $textile->process(str_replace(""", "\"", $register["description"]));
|
|
|
288
|
+
|
|
|
289
|
+ switch ($tumble->getType($register["id_post"])) {
|
|
|
290
|
+ case "1":
|
|
|
291
|
+ $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Body}", "{URL_Tumble}");
|
|
|
292
|
+ $output = array($register["id_post"], $formatedDate, $permalink, $register["title"], $register["description"], $conf->urlGelato);
|
|
|
293
|
+
|
|
|
294
|
+ $template->cargarPlantilla($input, $output, "template_regular_post");
|
|
|
295
|
+ $template->mostrarPlantilla();
|
|
|
296
|
+ break;
|
|
|
297
|
+ case "2":
|
|
|
298
|
+ $fileName = "../uploads/".getFileName($register["url"]);
|
|
|
299
|
+
|
|
|
300
|
+ $x = @getimagesize($fileName);
|
|
|
301
|
+ if ($x[0] > 100) {
|
|
|
302
|
+ $photoPath = $conf->urlGelato."/classes/imgsize.php?w=100&img=".$register["url"];
|
|
|
303
|
+ } else {
|
|
|
304
|
+ $photoPath = $register["url"];
|
|
|
305
|
+ }
|
|
|
306
|
+
|
|
|
307
|
+ $effect = " style=\"cursor: pointer;\" onclick=\"Lightbox.show('".$register["url"]."', '".strip_tags($register["description"])."');\" ";
|
|
|
308
|
+
|
|
|
309
|
+ $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{PhotoURL}", "{PhotoAlt}", "{Caption}", "{Effect}", "{URL_Tumble}");
|
|
|
310
|
+ $output = array($register["id_post"], $formatedDate, $permalink, $photoPath, strip_tags($register["description"]), $register["description"], $effect, $conf->urlGelato);
|
|
|
311
|
+
|
|
|
312
|
+ $template->cargarPlantilla($input, $output, "template_photo");
|
|
|
313
|
+ $template->mostrarPlantilla();
|
|
|
314
|
+ break;
|
|
|
315
|
+ case "3":
|
|
|
316
|
+ $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Quote}", "{Source}", "{URL_Tumble}");
|
|
|
317
|
+ $output = array($register["id_post"], $formatedDate, $permalink, $register["description"], $register["title"], $conf->urlGelato);
|
|
|
318
|
+
|
|
|
319
|
+ $template->cargarPlantilla($input, $output, "template_quote");
|
|
|
320
|
+ $template->mostrarPlantilla();
|
|
|
321
|
+ break;
|
|
|
322
|
+ case "4":
|
|
|
323
|
+ $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{URL}", "{Name}", "{Description}", "{URL_Tumble}");
|
|
|
324
|
+ $output = array($register["id_post"], $formatedDate, $permalink, $register["url"], $register["title"], $register["description"], $conf->urlGelato);
|
|
|
325
|
+
|
|
|
326
|
+ $template->cargarPlantilla($input, $output, "template_url");
|
|
|
327
|
+ $template->mostrarPlantilla();
|
|
|
328
|
+ break;
|
|
|
329
|
+ case "5":
|
|
|
330
|
+ $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Title}", "{Conversation}", "{URL_Tumble}");
|
|
|
331
|
+ $output = array($register["id_post"], $formatedDate, $permalink, $register["title"], $tumble->formatConversation($register["description"]), $conf->urlGelato);
|
|
|
332
|
+
|
|
|
333
|
+ $template->cargarPlantilla($input, $output, "template_conversation");
|
|
|
334
|
+ $template->mostrarPlantilla();
|
|
|
335
|
+ break;
|
|
|
336
|
+ case "6":
|
|
|
337
|
+ $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Video}", "{Caption}", "{URL_Tumble}");
|
|
|
338
|
+ $output = array($register["id_post"], $formatedDate, $permalink, $tumble->getVideoPlayer($register["url"]), $register["description"], $conf->urlGelato);
|
|
|
339
|
+
|
|
|
340
|
+ $template->cargarPlantilla($input, $output, "template_video");
|
|
|
341
|
+ $template->mostrarPlantilla();
|
|
|
342
|
+ break;
|
|
|
343
|
+ case "7":
|
|
|
344
|
+ $input = array("{Id_Post}", "{Date_Added}", "{Permalink}", "{Mp3}", "{Caption}", "{URL_Tumble}");
|
|
|
345
|
+ $output = array($register["id_post"], $formatedDate, $permalink, $tumble->getMp3Player($register["url"]), $register["description"], $conf->urlGelato);
|
|
|
346
|
+
|
|
|
347
|
+ $template->cargarPlantilla($input, $output, "template_mp3");
|
|
|
348
|
+ $template->mostrarPlantilla();
|
|
|
349
|
+ break;
|
|
|
350
|
+ }
|
|
|
351
|
+ }
|
|
|
352
|
+
|
|
|
353
|
+ echo pagination($tumble->getPostsNumber(), $limit, isset($page_num) ? $page_num : 1, "index.php", 2);
|
|
|
354
|
+
|
|
|
355
|
+
|
|
|
356
|
+ } else {
|
|
|
357
|
+ $template->renderizaEtiqueta("No posts in this tumblelog.", "div","error");
|
|
|
358
|
+ }
|
|
283
|
359
|
|
|
|
360
|
+?>
|
|
284
|
361
|
<div class="footer-box"> </div>
|
|
285
|
362
|
</div>
|
|
286
|
363
|
</div>
|