Browse Source

Some changes and bug fixes.

Victor De la Rocha 16 years ago
parent
commit
11022c204d
3 changed files with 50 additions and 50 deletions
  1. 41 41
      admin/bm.php
  2. 1 1
      install.php
  3. 8 8
      update.php

+ 41 - 41
admin/bm.php View File

21
 
21
 
22
 	if(isset($_POST["btnAdd"]))	{
22
 	if(isset($_POST["btnAdd"]))	{
23
 		unset($_POST["btnAdd"]);
23
 		unset($_POST["btnAdd"]);
24
-		
25
-		if ($_POST["type"]=="2") { // is Photo type			
26
-			if (isset($_POST["url"]) && $_POST["url"]!="")  {			
24
+
25
+		if ($_POST["type"]=="2") { // is Photo type
26
+			if (isset($_POST["url"]) && $_POST["url"]!="")  {
27
 				$photoName = getFileName($_POST["url"]);
27
 				$photoName = getFileName($_POST["url"]);
28
 				if (!$tumble->savePhoto($_POST["url"])) {
28
 				if (!$tumble->savePhoto($_POST["url"])) {
29
 					header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
29
 					header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
31
 				}
31
 				}
32
 				$_POST["url"] = "../uploads/".sanitizeName($photoName);
32
 				$_POST["url"] = "../uploads/".sanitizeName($photoName);
33
 			}
33
 			}
34
-			
34
+
35
 			if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
35
 			if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
36
 				$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
36
 				$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
37
 			}
37
 			}
38
-			
38
+
39
 			unset($_POST["photo"]);
39
 			unset($_POST["photo"]);
40
 			unset($_POST["MAX_FILE_SIZE"]);
40
 			unset($_POST["MAX_FILE_SIZE"]);
41
 		}
41
 		}
42
-		
42
+
43
 		if ($_POST["type"]=="7") { // is MP3 type
43
 		if ($_POST["type"]=="7") { // is MP3 type
44
 			set_time_limit(300);
44
 			set_time_limit(300);
45
 			$mp3Name = getFileName($_POST["url"]);
45
 			$mp3Name = getFileName($_POST["url"]);
50
 			if (isMP3($remoteFileName)) {
50
 			if (isMP3($remoteFileName)) {
51
 				$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
51
 				$_POST["url"] = $conf->urlGelato."/uploads/".$mp3Name;
52
 			}
52
 			}
53
-		}		
54
-				
55
-		if (!get_magic_quotes_gpc()) {	
53
+		}
54
+
55
+		if (!get_magic_quotes_gpc()) {
56
 			$_POST["title"] = addslashes($_POST["title"]);
56
 			$_POST["title"] = addslashes($_POST["title"]);
57
 			$_POST["description"] = addslashes($_POST["description"]);
57
 			$_POST["description"] = addslashes($_POST["description"]);
58
 		}
58
 		}
59
-		
59
+
60
 		$textile = new Textile();
60
 		$textile = new Textile();
61
-		
61
+
62
 		$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"]));
62
 		$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"]));
63
 		$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
63
 		$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
64
-		
64
+
65
 		if ($tumble->addPost($_POST)) {
65
 		if ($tumble->addPost($_POST)) {
66
 			$input = array("{type}");
66
 			$input = array("{type}");
67
 			$output = array("1");
67
 			$output = array("1");
68
-			
68
+
69
 			$template->cargarPlantilla($input, $output, "template_bm");
69
 			$template->cargarPlantilla($input, $output, "template_bm");
70
 			$template->mostrarPlantilla();
70
 			$template->mostrarPlantilla();
71
 			die();
71
 			die();
74
 			die();
74
 			die();
75
 		}
75
 		}
76
 	} else {
76
 	} else {
77
-	
77
+
78
 		if (isset($_GET["url"])) {
78
 		if (isset($_GET["url"])) {
79
 			$url = $_GET["url"];
79
 			$url = $_GET["url"];
80
 		} else {
80
 		} else {
81
 			$url = null;
81
 			$url = null;
82
 		}
82
 		}
83
-		if (isset($url)) {	
84
-			
83
+		if (isset($url)) {
84
+
85
 			if (isMP3($url)) {
85
 			if (isMP3($url)) {
86
 				$postType = "mp3";
86
 				$postType = "mp3";
87
 			} elseif (isGoEar($url)) {
87
 			} elseif (isGoEar($url)) {
97
 					$postType = "url";
97
 					$postType = "url";
98
 				}
98
 				}
99
 			}
99
 			}
100
-			
101
-		} else { 
102
-			die(__("Must be a valid URL")); 
100
+
101
+		} else {
102
+			die(__("Must be a valid URL"));
103
 		}
103
 		}
104
-?>	
104
+?>
105
 	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
105
 	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
106
 	<html xmlns="http://www.w3.org/1999/xhtml">
106
 	<html xmlns="http://www.w3.org/1999/xhtml">
107
 	<head>
107
 	<head>
110
 		<title>gelato :: <?php echo __("bookmarklet")?></title>
110
 		<title>gelato :: <?php echo __("bookmarklet")?></title>
111
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
111
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
112
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
112
 		<script language="javascript" type="text/javascript" src="<?php echo $conf->urlGelato;?>/admin/scripts/tools.js"></script>
113
-		<style type="text/css" media="screen">	
113
+		<style type="text/css" media="screen">
114
 			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
114
 			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
115
 		</style>
115
 		</style>
116
 	</head>
116
 	</head>
117
-	
117
+
118
 	<body>
118
 	<body>
119
 		<div id="cont">
119
 		<div id="cont">
120
 			<div id="main">
120
 			<div id="main">
131
 								case "photo":
131
 								case "photo":
132
 ?>
132
 ?>
133
 									<li class="selected"><a href="#"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li>
133
 									<li class="selected"><a href="#"><img src="css/images/image.png" alt="New picture" /> <?php echo __("Picture")?></a></li>
134
-<?php									
134
+<?php
135
 									break;
135
 									break;
136
 								case "url":
136
 								case "url":
137
 ?>
137
 ?>
138
 									<li class="selected"><a href="#"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li>
138
 									<li class="selected"><a href="#"><img src="css/images/world.png" alt="New link" /> <?php echo __("Link")?></a></li>
139
-<?php									
140
-									break;								
139
+<?php
140
+									break;
141
 								case "video":
141
 								case "video":
142
 ?>
142
 ?>
143
 									<li class="selected"><a href="#"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li>
143
 									<li class="selected"><a href="#"><img src="css/images/film.png" alt="New video" /> <?php echo __("Video")?></a></li>
144
-<?php									
144
+<?php
145
 									break;
145
 									break;
146
 								case "mp3":
146
 								case "mp3":
147
 ?>
147
 ?>
148
 									<li class="selected"><a href="#"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li>
148
 									<li class="selected"><a href="#"><img src="css/images/music.png" alt="New audio" /> <?php echo __("Audio")?></a></li>
149
-<?php									
149
+<?php
150
 									break;
150
 									break;
151
 							}
151
 							}
152
-?>					
152
+?>
153
 					</ul>
153
 					</ul>
154
 					<p>&nbsp;</p>
154
 					<p>&nbsp;</p>
155
 					<form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
155
 					<form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
156
 						<fieldset>
156
 						<fieldset>
157
-<?php					
157
+<?php
158
 							$date = gmmktime();
158
 							$date = gmmktime();
159
 							$title = "";
159
 							$title = "";
160
 							$body = (isset($_GET["sel"])) ? $_GET["sel"] : "";
160
 							$body = (isset($_GET["sel"])) ? $_GET["sel"] : "";
161
 							$url = (isset($url)) ? $url : "";
161
 							$url = (isset($url)) ? $url : "";
162
-							
162
+
163
 							switch ($postType) {
163
 							switch ($postType) {
164
 								case "post":
164
 								case "post":
165
 									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
165
 									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
166
 									$output = array("1", $date, $_SESSION['user_id'], $title, $body);
166
 									$output = array("1", $date, $_SESSION['user_id'], $title, $body);
167
-									
167
+
168
 									$template->cargarPlantilla($input, $output, "template_add_post");
168
 									$template->cargarPlantilla($input, $output, "template_add_post");
169
 									$template->mostrarPlantilla();
169
 									$template->mostrarPlantilla();
170
 									break;
170
 									break;
171
 								case "photo":
171
 								case "photo":
172
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
172
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
173
 									$output = array("2", $date, $_SESSION['user_id'], $url, $body);
173
 									$output = array("2", $date, $_SESSION['user_id'], $url, $body);
174
-									
174
+
175
 									$template->cargarPlantilla($input, $output, "template_add_photo_bm");
175
 									$template->cargarPlantilla($input, $output, "template_add_photo_bm");
176
-									$template->mostrarPlantilla();							   
176
+									$template->mostrarPlantilla();
177
 									break;
177
 									break;
178
 								case "url":
178
 								case "url":
179
-									
179
+
180
 									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
180
 									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
181
 									$output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
181
 									$output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
182
-									
182
+
183
 									$template->cargarPlantilla($input, $output, "template_add_link");
183
 									$template->cargarPlantilla($input, $output, "template_add_link");
184
 									$template->mostrarPlantilla();
184
 									$template->mostrarPlantilla();
185
-									break;								
185
+									break;
186
 								case "video":
186
 								case "video":
187
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
187
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
188
 									$output = array("6", $date, $_SESSION['user_id'], $url, $body);
188
 									$output = array("6", $date, $_SESSION['user_id'], $url, $body);
189
-									
189
+
190
 									$template->cargarPlantilla($input, $output, "template_add_video");
190
 									$template->cargarPlantilla($input, $output, "template_add_video");
191
 									$template->mostrarPlantilla();
191
 									$template->mostrarPlantilla();
192
 									break;
192
 									break;
193
 								case "mp3":
193
 								case "mp3":
194
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
194
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
195
 									$output = array("7", $date, $_SESSION['user_id'], $url, $body);
195
 									$output = array("7", $date, $_SESSION['user_id'], $url, $body);
196
-									
196
+
197
 									$template->cargarPlantilla($input, $output, "template_add_mp3");
197
 									$template->cargarPlantilla($input, $output, "template_add_mp3");
198
 									$template->mostrarPlantilla();
198
 									$template->mostrarPlantilla();
199
 									break;
199
 									break;
203
 									<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"><a href="http://hobix.com/textile/">Textile</a> <?php echo __("syntax is supported.")?></span>
203
 									<span style="color: rgb(136, 136, 136); margin-bottom: 10px; font-size: 10px;"><a href="http://hobix.com/textile/">Textile</a> <?php echo __("syntax is supported.")?></span>
204
 								</p>
204
 								</p>
205
 								<p>
205
 								<p>
206
-									<input class="btn" type="submit" name="btnAdd" value="<?php echo ($isEdition) ? "Modify" : "Create"; ?> post" />
206
+									<input class="btn" type="submit" name="btnAdd" value="Create post" />
207
 								</p>
207
 								</p>
208
 						</fieldset>
208
 						</fieldset>
209
-					</form>					
209
+					</form>
210
 					<div class="footer-box">&nbsp;</div>
210
 					<div class="footer-box">&nbsp;</div>
211
 				</div>
211
 				</div>
212
 
212
 
220
 		</div>
220
 		</div>
221
 	</body>
221
 	</body>
222
 	</html>
222
 	</html>
223
-<?php	
223
+<?php
224
 } else {
224
 } else {
225
 	header("Location: ".$conf->urlGelato."/login.php");
225
 	header("Location: ".$conf->urlGelato."/login.php");
226
 }
226
 }

+ 1 - 1
install.php View File

16
 
16
 
17
 $configFile = Absolute_Path."config.php";
17
 $configFile = Absolute_Path."config.php";
18
 if(file_exists($configFile)){
18
 if(file_exists($configFile)){
19
-	require($configFile);
19
+	require_once($configFile);
20
 }else{
20
 }else{
21
 	exit("You need to rename config-sample.php to config.php and fill out the required details.");
21
 	exit("You need to rename config-sample.php to config.php and fill out the required details.");
22
 }
22
 }

+ 8 - 8
update.php View File

1
 <?php
1
 <?php
2
-if(!defined('entry')) define('entry',true);  
2
+if(!defined('entry')) define('entry',true);
3
 /* ===========================
3
 /* ===========================
4
 
4
 
5
   gelato CMS - A PHP based tumblelog CMS
5
   gelato CMS - A PHP based tumblelog CMS
15
 
15
 
16
 require('entry.php');
16
 require('entry.php');
17
 global $configFile, $db;
17
 global $configFile, $db;
18
-	
18
+
19
 if (!file_exists($configFile)) {
19
 if (!file_exists($configFile)) {
20
 	$mensaje = "
20
 	$mensaje = "
21
-			<h3 class=\"important\">Error reading configuration file</h3>			
21
+			<h3 class=\"important\">Error reading configuration file</h3>
22
 			<p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
22
 			<p>There doesn't seem to be a <code>config.php</code> file. I need this before we can get started.</p>
23
 			<p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
23
 			<p>This either means that you did not rename the <code>config-sample.php</code> file to <code>config.php</code>.</p>";
24
 	die($mensaje);
24
 	die($mensaje);
25
 } else {
25
 } else {
26
-	require($configFile);
26
+	require_once($configFile);
27
 }
27
 }
28
 
28
 
29
 $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
29
 $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
30
-		
30
+
31
 $db->ejecutarConsulta($sqlStr);
31
 $db->ejecutarConsulta($sqlStr);
32
- 
32
+
33
 $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');";
33
 $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');";
34
-		
34
+
35
 $db->ejecutarConsulta($sqlStr);
35
 $db->ejecutarConsulta($sqlStr);
36
 
36
 
37
 $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('check_version', '1');";
37
 $sqlStr = "INSERT INTO `".Table_prefix."options` VALUES ('check_version', '1');";
38
-		
38
+
39
 $db->ejecutarConsulta($sqlStr);
39
 $db->ejecutarConsulta($sqlStr);
40
 
40
 
41
 $sqlStr = "CREATE TABLE `".Table_prefix."feeds` (
41
 $sqlStr = "CREATE TABLE `".Table_prefix."feeds` (