瀏覽代碼

* A lot of changes on Control Panel (Theme Engine).

Victor De la Rocha 15 年之前
父節點
當前提交
c60cdef066

+ 225 - 355
admin/index.php 查看文件

@@ -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&hellip;")?></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>&nbsp;</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
-										&nbsp;&nbsp;&nbsp;&nbsp;
316
-										<code>
317
-										&lt;strong&gt; &lt;em&gt; &lt;del&gt; &lt;ul&gt;  &lt;ol&gt;  &lt;li&gt; &lt;a&gt;
318
-										<br />
319
-										&nbsp;&nbsp;&nbsp;&nbsp;&lt;blockquote&gt;
320
-                                        &lt;code&gt; &lt;pre&gt; &lt;img&gt;
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">&nbsp;</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">&nbsp;</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
+?>

+ 0 - 35
admin/themes/admin/template_add_conversation.htm 查看文件

@@ -1,35 +0,0 @@
1
-		<div>
2
-			<label for="title">Title <span class="option">(optional)</span></label><br />
3
-			<input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
4
-		</div>
5
-		
6
-		<div>
7
-			<label for="description">Conversation</label>
8
-			<div style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;">
9
-				<span style="font-weight: bold;">Example</span><br>
10
-				<span style="font-style: italic;">
11
-					Geek: Wow an open source tumblelog CMS!!.<br>
12
-					Normal: Tumble... what??<br>
13
-					Geek: Read the wikipedia!!
14
-				</span>
15
-			</div>
16
-			<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>
17
-		</div>
18
-
19
-		<input type="hidden" name="url" id="url" value="" />
20
-		<input type="hidden" name="type" id="type" value="{type}" />
21
-		<input type="hidden" name="date" id="date" value="{date}" />
22
-		<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
23
-
24
-	<script>
25
-		$("#autosave").validate({
26
-			rules: {
27
-				description: "required"
28
-			},
29
-			errorElement: "span",
30
-			errorClass: "validate_span", 
31
-			errorPlacement: function(label, element) { 
32
-				label.prependTo(element.parent().children("label"))
33
-			} 
34
-		});
35
-	</script>

+ 0 - 38
admin/themes/admin/template_add_link.htm 查看文件

@@ -1,38 +0,0 @@
1
-			
2
-			<div>
3
-				<label for="title">Name <span class="option">(optional)</span></label>			
4
-				<br /><input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
5
-			</div>
6
-			<div>
7
-				<label for="url">URL</label>			
8
-				<br /><input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
9
-			</div>
10
-			<div>
11
-				<div id="add_link_description" style="margin-top:5px;">
12
-					<a class="linkFrm" href="#" onclick="document.getElementById('link_description').style.display = ''; document.getElementById('add_link_description').style.display = 'none'; return false;" style="font-size:11px;">Add a description</a><br /><br />
13
-				</div>								
14
-				<div id="link_description" style="display:none;">
15
-					<label for="description">Description</label><br />								
16
-					<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
17
-				</div>
18
-			</div>
19
-			<input type="hidden" name="type" id="type" value="{type}" />
20
-			<input type="hidden" name="date" id="date" value="{date}" />
21
-			<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
22
-
23
-
24
-	<script>
25
-		$("#autosave").validate({
26
-			rules: {
27
-				url: {
28
-					required: true,
29
-					url: true
30
-				}
31
-			},
32
-			errorElement: "span",
33
-			errorClass: "validate_span", 
34
-			errorPlacement: function(label, element) { 
35
-				label.prependTo(element.prev())
36
-			} 
37
-		});
38
-	</script>

+ 0 - 35
admin/themes/admin/template_add_mp3.htm 查看文件

@@ -1,35 +0,0 @@
1
-									
2
-		<div>
3
-			<label for="url">MP3 URL</label>			
4
-			<br /><input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
5
-			<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
6
-				This is the MP3 file URL or a GoEar URL or an Odeo URL.<br>
7
-				<span style="font-size: 10px; font-weight: normal;">(ie. http://www.goear.com/listen.php?v=c0a2c85)</span>
8
-			</div>
9
-		</div>								
10
-		<div>
11
-			<label for="description">Caption <span class="option">(optional)</span></label><br />
12
-			<textarea rows="12" cols="84" name="description" id="description" tabindex="2">{editBody}</textarea>											
13
-		</div>
14
-
15
-		<input type="hidden" name="title" id="title" value="" />
16
-		<input type="hidden" name="type" id="type" value="{type}" />
17
-		<input type="hidden" name="date" id="date" value="{date}" />
18
-		<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
19
-
20
-
21
-	<script>
22
-		$("#autosave").validate({
23
-			rules: {
24
-				url: {
25
-					required: true,
26
-					url: true
27
-				}
28
-			},
29
-			errorElement: "span",
30
-			errorClass: "validate_span", 
31
-			errorPlacement: function(label, element) { 
32
-				label.prependTo(element.prev())
33
-			} 
34
-		});
35
-	</script>

+ 0 - 76
admin/themes/admin/template_add_photo.htm 查看文件

@@ -1,76 +0,0 @@
1
-
2
-
3
-	<div id="photo_upload">
4
-		<label for="description">Photo</label>												
5
-		<br /><input type="file" name="photo" id="photo" accept="image/gif,image/jpeg,image/jpg,image/png"/>
6
-		<div style="font-size:11px; color:#666; margin-top:5px;">
7
-			Supports JPEG, GIF and PNG.&nbsp; <strong>Max size is 10 MB.</strong>
8
-		</div>
9
-		<div style="font-size:11px; color:#666; margin-top:5px;">
10
-			<a href="#" class="linkFrm">Use a URL instead</a>								
11
-		</div>
12
-	</div>
13
-
14
-	<div id="photo_url">
15
-		<label for="description">Photo URL</label>
16
-		<br /><input class="input-text" type="text" name="url" id="url" size="80" value="{editUrl}" />
17
-		<div style="font-size:11px; color:#666; margin-top:5px;">
18
-			<a href="#" class="linkFrm">Use a upload form instead</a>
19
-		</div>
20
-	</div>
21
-
22
-	<div>
23
-		<label for="description" style="display:block;">Caption <span class="option">(optional)</span></label>
24
-		<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
25
-	</div>
26
-
27
-	<input type="hidden" name="title" id="title" value="" />
28
-	<input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
29
-	<input type="hidden" name="type" id="type" value="{type}" />
30
-	<input type="hidden" name="date" id="date" value="{date}" />
31
-	<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
32
-
33
-
34
-
35
-
36
-	<script>
37
-		$('#photo_url').css('display','none');
38
-		$("#autosave").validate({
39
-			rules: {				
40
-				photo: { 
41
-					required:  function() {
42
- 						return ($('#photo_upload').css('display')!= 'none') ? true : false;
43
-  					},
44
-					accept: "(jpe?g|gif|png)" 
45
-				},
46
- 				url: { 
47
-					required:  function() {
48
- 						return ($('#photo_url').css('display')!= 'none') ? true : false;
49
-  					},
50
-					url: true
51
-				}
52
-			},
53
-			errorElement: "span",
54
-			errorClass: "validate_span", 
55
-			errorPlacement: function(label, element) { 
56
-				label.prependTo(element.prev())
57
-			}			 
58
-		});
59
-
60
-		$("#photo_upload a.linkFrm").click( function() {
61
-				$('#photo_upload').css('display','none');				
62
-				$('#photo_url').css('display','block'); 
63
-				$('#photo').val(''); 
64
-				return false;
65
-			} 
66
-		);
67
-		
68
-		$("#photo_url a.linkFrm").click( function() {
69
-				$('#photo_url').css('display','none');				
70
-				$('#photo_upload').css('display','block'); 
71
-				$('#url').val(''); 
72
-				return false;
73
-			} 
74
-		);
75
-
76
-	</script>

+ 0 - 66
admin/themes/admin/template_add_photo_bm.htm 查看文件

@@ -1,66 +0,0 @@
1
-
2
-
3
-	<div id="photo_upload">
4
-		
5
-	</div>
6
-
7
-	<div id="photo_url">
8
-		<label for="description">Photo URL</label>
9
-		<br /><input class="input-text" type="text" name="url" id="url" size="80" value="{editUrl}" />
10
-	</div>
11
-
12
-	<div>
13
-		<label for="description" style="display:block;">Caption <span class="option">(optional)</span></label>
14
-		<br /><textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
15
-	</div>
16
-
17
-	<input type="hidden" name="title" id="title" value="" />
18
-	<input type="hidden" name="MAX_FILE_SIZE" value="10485760" />
19
-	<input type="hidden" name="type" id="type" value="{type}" />
20
-	<input type="hidden" name="date" id="date" value="{date}" />
21
-	<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
22
-
23
-
24
-
25
-
26
-	<script>
27
-		$('#photo_upload').css('display','none');	
28
-		$("#autosave").validate({
29
-			rules: {				
30
-				photo: { 
31
-					required:  function() {
32
- 						return ($('#photo_upload').css('display')!= 'none') ? true : false;
33
-  					},
34
-					accept: "(jpe?g|gif|png)" 
35
-				},
36
- 				url: { 
37
-					required:  function() {
38
- 						return ($('#photo_url').css('display')!= 'none') ? true : false;
39
-  					},
40
-					url: true
41
-				}
42
-			},
43
-			errorElement: "span",
44
-			errorClass: "validate_span", 
45
-			errorPlacement: function(label, element) { 
46
-				label.prependTo(element.prev())
47
-			}			 
48
-		});
49
-
50
-		$("#photo_upload a.linkFrm").click( function() {
51
-				$('#photo_upload').css('display','none');				
52
-				$('#photo_url').css('display','block'); 
53
-				$('#photo').val(''); 
54
-				return false;
55
-			} 
56
-		);
57
-		
58
-		$("#photo_url a.linkFrm").click( function() {
59
-				$('#photo_url').css('display','none');				
60
-				$('#photo_upload').css('display','block'); 
61
-				$('#url').val(''); 
62
-				return false;
63
-			} 
64
-		);
65
-
66
-	</script>

+ 0 - 27
admin/themes/admin/template_add_post.htm 查看文件

@@ -1,27 +0,0 @@
1
-	
2
-	<div>
3
-		<label for="title" style="display:block;">Title <span class="option">(optional)</span></label>
4
-		<br /><input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
5
-	</div>	
6
-	<div>
7
-		<label for="description" style="display:block;">Body</label>
8
-		<textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
9
-	</div>
10
-
11
-	<input type="hidden" name="url" id="url" value="" />
12
-	<input type="hidden" name="type" id="type" value="{type}" />
13
-	<input type="hidden" name="date" id="date" value="{date}" />
14
-	<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
15
-
16
-	<script>
17
-		$("#autosave").validate({
18
-			rules: {
19
-				description: "required"
20
-			},
21
-			errorElement: "span",
22
-			errorClass: "validate_span", 
23
-			errorPlacement: function(label, element) { 
24
-				label.prependTo(element.prev())
25
-			} 
26
-		});
27
-	</script>

+ 0 - 29
admin/themes/admin/template_add_quote.htm 查看文件

@@ -1,29 +0,0 @@
1
-		
2
-		
3
-		<div>
4
-			<label for="description">Quote</label>
5
-			<br /><textarea rows="12" cols="84" name="description" id="description">{editBody}</textarea>											
6
-		</div>
7
-		<div>
8
-			<label for="title">Source <span class="option">(optional)</span></label>
9
-			<br /><input class="txt" type="text" name="title" id="title" value="{editTitle}" size="80" />
10
-		</div>
11
-
12
-		<input type="hidden" name="url" id="url" value="" />
13
-		<input type="hidden" name="type" id="type" value="{type}" />
14
-		<input type="hidden" name="date" id="date" value="{date}" />
15
-		<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
16
-
17
-
18
-	<script>
19
-		$("#autosave").validate({
20
-			rules: {
21
-				description: "required"
22
-			},
23
-			errorElement: "span",
24
-			errorClass: "validate_span", 
25
-			errorPlacement: function(label, element) { 
26
-				label.prependTo(element.prev())
27
-			} 
28
-		});
29
-	</script>

+ 0 - 36
admin/themes/admin/template_add_video.htm 查看文件

@@ -1,36 +0,0 @@
1
-				
2
-		<div>
3
-			<label for="url">Video URL</label>			
4
-			<br /><input class="txt" type="text" name="url" id="url" value="{editUrl}" size="80" />
5
-			<div style="color: rgb(136, 136, 136); margin-bottom: 5px; font-size: 11px; font-weight: bold;">
6
-				This is the URL from the video sites YouTube, Vimeo, Yahoo, Daily Motion <br />
7
-				or even an Slide Share Presentation.<br />
8
-				<span style="font-size: 10px; font-weight: normal;">(ie. http://youtube.com/watch?v=HcBFLN9cli0)</span>
9
-			</div>
10
-		</div>									
11
-		<div>
12
-			<label for="description">Caption <span class="option">(optional)</span></label><br />
13
-			<textarea rows="12" cols="84" name="description" id="description" tabindex="2">{editBody}</textarea>											
14
-		</div>
15
-
16
-		<input type="hidden" name="title" id="title" value="" />
17
-		<input type="hidden" name="type" id="type" value="{type}" />
18
-		<input type="hidden" name="date" id="date" value="{date}" />
19
-		<input type="hidden" name="id_user" id="id_user" value="{id_user}" />
20
-
21
-
22
-	<script>
23
-		$("#autosave").validate({
24
-			rules: {
25
-				url: {
26
-					required: true,
27
-					url: true
28
-				}
29
-			},
30
-			errorElement: "span",
31
-			errorClass: "validate_span", 
32
-			errorPlacement: function(label, element) { 
33
-				label.prependTo(element.prev())
34
-			} 
35
-		});
36
-	</script>

+ 0 - 8
admin/themes/admin/template_comment.htm 查看文件

@@ -1,8 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/comments.php?edit={Id_Comment}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/comments.php?delete={Id_Comment}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Comment_Author}</p>
4
-				</div>
5
-				<div class="post">
6
-					<p>{Comment}</p>
7
-				</div>
8
-			</div>

+ 0 - 28
admin/themes/admin/template_comment_post.htm 查看文件

@@ -1,28 +0,0 @@
1
-		<form action="{Form_Action}" method="post" name="commentForm" id="commentForm" class="newpost">
2
-			<fieldset>
3
-			<p>
4
-				<label for="username">Name</label>
5
-				<input class="txt" name="username" id="username" value="{User}" size="22" tabindex="1" type="text" />				
6
-			</p>
7
-			<p>
8
-				<label for="email">E-mail</label>
9
-				<input class="txt" name="email" id="email" value="{Email}" size="22" tabindex="2" type="text" />				
10
-			</p>
11
-			<p>
12
-				<label for="web">Website</label>
13
-				<input class="txt" name="web" id="web" value="{Web}" size="22" tabindex="3" type="text" />				
14
-			</p>			
15
-			<p>
16
-				<label for="description">Body</label><br />
17
-				<textarea name="content" id="content" cols="50" rows="10" tabindex="4">{Comment}</textarea>
18
-			</p>
19
-			<p>
20
-				<input type="submit" value="Modify comment" name="btnAdd" id="btnAdd" tabindex="5" />
21
-			</p>
22
-			<p>
23
-				<input name="id_post" id="id_post" value="{Id_Post}" type="hidden" />
24
-				<input name="comment_date" id="comment_date" value="{Date_Added}" type="hidden" />
25
-				<input name="id_comment" id="id_comment" value="{Id_Comment}" type="hidden" />
26
-			</p>
27
-			</fieldset>
28
-		</form>

+ 0 - 9
admin/themes/admin/template_conversation.htm 查看文件

@@ -1,9 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Date_Added}</p>
4
-				</div>
5
-				<div class="post">
6
-					<span class="option">{Title}</span>
7
-					<div class="conversation">{Conversation}</div>
8
-				</div>
9
-			</div>

+ 0 - 9
admin/themes/admin/template_mp3.htm 查看文件

@@ -1,9 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Date_Added}</p>
4
-				</div>
5
-				<div class="post">
6
-					<span class="option">{Caption}</span>
7
-					<p><img src="{URL_Tumble}/admin/css/images/music.png" alt="Play song" />&nbsp;<a href="{Permalink}">Play</a></p>
8
-				</div>
9
-			</div>

+ 0 - 9
admin/themes/admin/template_photo.htm 查看文件

@@ -1,9 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Date_Added}</p>
4
-				</div>
5
-				<div class="post">
6
-					<span class="option">{Caption}</span>
7
-					<p><a {Effect}><img src="{PhotoURL}" alt="{PhotoAlt}" /></a></a></p>
8
-				</div>
9
-			</div>

+ 0 - 9
admin/themes/admin/template_quote.htm 查看文件

@@ -1,9 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Date_Added}</p>
4
-				</div>
5
-				<div class="post">
6
-					<span class="option">&mdash; {Source}</span>
7
-					<p><big class="quote"><a href="{Permalink}">&#147;</a></big> {Quote}</p>
8
-				</div>
9
-			</div>

+ 0 - 9
admin/themes/admin/template_regular_post.htm 查看文件

@@ -1,9 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Date_Added}</p>
4
-				</div>
5
-				<div class="post">
6
-					<span class="option"><a href="{Permalink}">{Title}</a></span>
7
-					<p>{Body}</p>
8
-				</div>
9
-			</div>

+ 0 - 9
admin/themes/admin/template_url.htm 查看文件

@@ -1,9 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Date_Added}</p>
4
-				</div>
5
-				<div class="post">
6
-					<span class="option">&#187; <a href="{URL}">{Name}</a></span>
7
-					<p>{Description}</p>
8
-				</div>
9
-			</div>

+ 0 - 9
admin/themes/admin/template_video.htm 查看文件

@@ -1,9 +0,0 @@
1
-			<div class="entry">
2
-				<div class="info"><span class="compact"><a href="{Permalink}">Link</a>&nbsp;<a href="{URL_Tumble}/admin/index.php?edit={Id_Post}"><img src="{URL_Tumble}/admin/css/images/edit.png" alt="" title="" /></a>&nbsp;<a href="{URL_Tumble}/admin/index.php?delete={Id_Post}"><img src="{URL_Tumble}/admin/css/images/delete.png" alt="" title="" /></a></span>
3
-					<p>{Date_Added}</p>
4
-				</div>
5
-				<div class="post">
6
-					<span class="option">{Caption}</span>
7
-					<p><img src="{URL_Tumble}/admin/css/images/film.png" alt="Watch video" />&nbsp;<a href="{Permalink}">Watch</a></p>
8
-				</div>
9
-			</div>

+ 50 - 42
classes/gelato.class.php 查看文件

@@ -1,5 +1,5 @@
1 1
 <?php
2
-if(!defined('entry') || !entry) die('Not a valid page'); 
2
+if(!defined('entry') || !entry) die('Not a valid page');
3 3
 /* ===========================
4 4
 
5 5
   gelato CMS - A PHP based tumblelog CMS
@@ -17,12 +17,12 @@ require_once("functions.php");
17 17
 
18 18
 class gelato extends Conexion_Mysql {
19 19
 	var $conf;
20
-	
20
+
21 21
 	function gelato() {
22 22
 		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
23 23
 		$this->conf = new configuration();
24 24
 	}
25
-	
25
+
26 26
 	function saveSettings($fieldsArray) {
27 27
 		if ($this->modificarDeFormulario($this->conf->tablePrefix."config", $fieldsArray)) {
28 28
 			header("Location: ".$this->conf->urlGelato."/admin/settings.php?modified=true");
@@ -32,24 +32,24 @@ class gelato extends Conexion_Mysql {
32 32
 			die();
33 33
 		}
34 34
 	}
35
-	
35
+
36 36
 	function saveOption($value, $name) {
37
-		$sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1";		
37
+		$sqlStr = "UPDATE ".$this->conf->tablePrefix."options SET val='".$value."' WHERE name='".$name."' LIMIT 1";
38 38
 		if ($this->ejecutarConsulta($sqlStr)) {
39 39
 			return true;
40 40
 		} else {
41 41
 			return true;
42 42
 		}
43 43
 	}
44
-	
45
-	function addPost($fieldsArray) {		
44
+
45
+	function addPost($fieldsArray) {
46 46
 		if ($this->insertarDeFormulario($this->conf->tablePrefix."data", $fieldsArray)) {
47 47
 			return true;
48 48
 		} else {
49 49
 			return false;
50
-		}		
50
+		}
51 51
 	}
52
-	
52
+
53 53
 	function modifyPost($fieldsArray, $id_post) {
54 54
 		if ($this->modificarDeFormulario($this->conf->tablePrefix."data", $fieldsArray, "id_post=$id_post")) {
55 55
 			header("Location: ".$this->conf->urlGelato."/admin/index.php?modified=true");
@@ -59,31 +59,31 @@ class gelato extends Conexion_Mysql {
59 59
 			die();
60 60
 		}
61 61
 	}
62
-	
62
+
63 63
 	function deletePost($idPost) {
64 64
 		$this->ejecutarConsulta("DELETE FROM ".$this->conf->tablePrefix."data WHERE id_post=".$idPost);
65
-	}	
66
-	
65
+	}
66
+
67 67
 	function getPosts($limit="10", $from="0") {
68 68
 		$sqlStr = "select * from ".$this->conf->tablePrefix."data ORDER BY date DESC LIMIT $from,$limit";
69 69
 		$this->ejecutarConsulta($sqlStr);
70 70
 		return $this->mid_consulta;
71 71
 	}
72
-	
72
+
73 73
 	function getPost($id="") {
74 74
 		$this->ejecutarConsulta("select * from ".$this->conf->tablePrefix."data WHERE id_post=".$id);
75 75
 		return mysql_fetch_array($this->mid_consulta);
76 76
 	}
77
-	
77
+
78 78
 	function getPostsNumber() {
79 79
 		$this->ejecutarConsulta("select count(*) as total from ".$this->conf->tablePrefix."data");
80 80
 		$row = mysql_fetch_assoc($this->mid_consulta);
81 81
 		return $row['total'];
82 82
 	}
83
-	
83
+
84 84
 	function getType($id) {
85
-		if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {	
86
-			if ($this->contarRegistros()>0) {	
85
+		if ($this->ejecutarConsulta("select type from ".$this->conf->tablePrefix."data WHERE id_post=".$id)) {
86
+			if ($this->contarRegistros()>0) {
87 87
 				while($registro = mysql_fetch_array($this->mid_consulta)) {
88 88
 					return $registro[0];
89 89
 				}
@@ -92,55 +92,55 @@ class gelato extends Conexion_Mysql {
92 92
 			return "0";
93 93
 		}
94 94
 	}
95
-	
95
+
96 96
 	function formatConversation($text) {
97 97
 		$formatedText = "";
98 98
 		$odd=true;
99
-		
99
+
100 100
 		$lines = explode("\n", $text);
101
-		
101
+
102 102
 		$formatedText .= "<ul>\n";
103 103
 		foreach ($lines as $line) {
104 104
 			$pos = strpos($line, ":") + 1;
105
-			
105
+
106 106
 			$label = substr($line, 0, $pos);
107 107
 			$desc = substr($line, $pos, strlen($line));
108
-			
109
-			if ($odd) { 
110
-				$cssClass = "odd"; 
108
+
109
+			if ($odd) {
110
+				$cssClass = "odd";
111 111
 			} else {
112
-				$cssClass = "even"; 
112
+				$cssClass = "even";
113 113
 			}
114 114
 			$odd=!$odd;
115
-			
116
-			
115
+
116
+
117 117
 			$formatedText .= "	<li class=\"".$cssClass."\">\n";
118 118
 			$formatedText .= "		<span class=\"label\">".$label."</span>\n";
119 119
 			$formatedText .= "		".$desc."\n";
120
-			$formatedText .= "	</li>\n";			
120
+			$formatedText .= "	</li>\n";
121 121
 		}
122 122
 		$formatedText .= "</ul>\n";
123 123
 		return $formatedText;
124 124
 	}
125
-	
125
+
126 126
 	function formatApiConversation($text) {
127 127
 		$formatedText = "";
128
-		
128
+
129 129
 		$lines = explode("\n", $text);
130
-		
130
+
131 131
 		foreach ($lines as $line) {
132 132
 			$pos = strpos($line, ":") + 1;
133
-			
133
+
134 134
 			$name = substr($line, 0, $pos-1);
135 135
 			$label = substr($line, 0, $pos);
136 136
 			$desc = substr($line, $pos, strlen($line));
137
-			
137
+
138 138
 			$formatedText .= "<conversation-line name=\"".$name."\" label=\"".$label."\">".$desc."</conversation-line>\n";
139 139
 		}
140
-		
140
+
141 141
 		return $formatedText;
142 142
 	}
143
-	
143
+
144 144
 	function saveMP3($remoteFileName) {
145 145
 		if (getMP3File($remoteFileName)) {
146 146
 			return true;
@@ -148,15 +148,15 @@ class gelato extends Conexion_Mysql {
148 148
 			return false;
149 149
 		}
150 150
 	}
151
-	
152
-	function savePhoto($remoteFileName) {		
151
+
152
+	function savePhoto($remoteFileName) {
153 153
 		if (getPhotoFile($remoteFileName)) {
154 154
 			return true;
155 155
 		} else {
156 156
 			return false;
157 157
 		}
158 158
 	}
159
-	
159
+
160 160
 	function getVideoPlayer($url) {
161 161
 		if (isYoutubeVideo($url)) {
162 162
 			$id_video = getYoutubeVideoUrl($url);
@@ -178,7 +178,7 @@ class gelato extends Conexion_Mysql {
178 178
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" style=\"width:500px;height:393px\" data=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\"><param name=\"movie\" value=\"http://video.google.com/googleplayer.swf?docid=".$id_video."&amp;hl=es&amp;fs=true\" /><param name=\"allowFullScreen\" value=\"true\" /><param name=\"allowScriptAccess\" value=\"always\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
179 179
 		} else {
180 180
 			return "This URL is not a supported video (YouTube, Google Video, Vimeo, DailyMotion, Yahoo Video or SlideShare)";
181
-		}		
181
+		}
182 182
 	}
183 183
 	function getMp3Player($url) {
184 184
 		if (isMP3($url)) {
@@ -190,7 +190,15 @@ class gelato extends Conexion_Mysql {
190 190
 			return "\t\t\t<object type=\"application/x-shockwave-flash\" data=\"http://media.odeo.com/flash/odeo_player.swf?v=3\" width=\"366\" height=\"75\"><param name=\"quality\" value=\"high\" /><param name=\"FlashVars\" value=\"type=audio&amp;id=".getOdeoCode($url)."\" /><param name=\"wmode\" value=\"transparent\" /></object>\n";
191 191
 		} else {
192 192
 			return "This URL is not an MP3 file.";
193
-		}		
193
+		}
194
+	}
195
+
196
+	function getPermalink($post_id){
197
+		$strEnd = ($this->conf->urlFriendly) ? "/" : "";
198
+		$out = $this->conf->urlGelato;
199
+		$out .= ($this->conf->urlFriendly) ? "/post/" : "/index.php?post=";
200
+		$out .= $post_id.$strEnd;
201
+		return $out;
194 202
 	}
195 203
 
196 204
 	function getPermalink($post_id){
@@ -200,5 +208,5 @@ class gelato extends Conexion_Mysql {
200 208
 		$out .= $post_id.$strEnd;
201 209
 		return $out;
202 210
 	}
203
-} 
204
-?>
211
+}
212
+?>

+ 6 - 6
classes/mysql_connection.class.php 查看文件

@@ -122,12 +122,12 @@ class Conexion_Mysql {
122 122
 			$sqlValues .= "'$valor',";
123 123
 		 }
124 124
 	  }
125
-	  $cols = rtrim($cols, ',').')';
126
-	  $sqlValues = rtrim($sqlValues, ',').')';
125
+		  $cols = rtrim($cols, ',').')';
126
+		  $sqlValues = rtrim($sqlValues, ',').')';
127 127
 
128
-	  // inserta los valores en la DB
129
-	  $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
130
-	  return $this->ejecutarConsulta($sql);
128
+		  // inserta los valores en la DB
129
+		  $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
130
+		return $this->ejecutarConsulta($sql);
131 131
 	}
132 132
 
133 133
 	/**
@@ -291,4 +291,4 @@ class Conexion_Mysql {
291 291
 	    return $value;
292 292
 	}
293 293
 } //fin de la Clase conexion_mysql
294
-?>
294
+?>

+ 1 - 1
classes/themes.class.php 查看文件

@@ -110,4 +110,4 @@ class themes{
110 110
 			}
111 111
 	}
112 112
 }
113
-?>
113
+?>

+ 1 - 1
entry.php 查看文件

@@ -81,6 +81,6 @@ if($installed){
81 81
 	$feeds = new feeds();
82 82
 	$feeds->updateFeeds();
83 83
 	unset($feeds);
84
-}
84
+}
85 85
 ?>
86 86
 

+ 1 - 1
index.php 查看文件

@@ -107,7 +107,7 @@ $theme = new themes;
107 107
                         while($register = mysql_fetch_assoc($rs)) {
108 108
 								$formatedDate = gmdate("M d", strtotime($register["date"])+transform_offset($conf->offsetTime));
109 109
                                 if ( $dateTmp != null && $formatedDate == $dateTmp ) { $formatedDate = ""; } else { $dateTmp = $formatedDate; }
110
-								
110
+
111 111
 								$permalink = $tumble->getPermalink($register["id_post"]);
112 112
 
113 113
 								$conversation = $register["description"];