Pārlūkot izejas kodu

Some changes and bug fixes.

Victor De la Rocha 16 gadus atpakaļ
vecāks
revīzija
11022c204d
3 mainītis faili ar 50 papildinājumiem un 50 dzēšanām
  1. 41 41
      admin/bm.php
  2. 1 1
      install.php
  3. 8 8
      update.php

+ 41 - 41
admin/bm.php Parādīt failu

@@ -21,9 +21,9 @@ if ($user->isAdmin()) {
21 21
 
22 22
 	if(isset($_POST["btnAdd"]))	{
23 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 27
 				$photoName = getFileName($_POST["url"]);
28 28
 				if (!$tumble->savePhoto($_POST["url"])) {
29 29
 					header("Location: ".$conf->urlGelato."/admin/index.php?photo=false");
@@ -31,15 +31,15 @@ if ($user->isAdmin()) {
31 31
 				}
32 32
 				$_POST["url"] = "../uploads/".sanitizeName($photoName);
33 33
 			}
34
-			
34
+
35 35
 			if ( move_uploaded_file( $_FILES['photo']['tmp_name'], "../uploads/".sanitizeName($_FILES['photo']['name']) ) ) {
36 36
 				$_POST["url"] = "../uploads/".sanitizeName($_FILES['photo']['name']);
37 37
 			}
38
-			
38
+
39 39
 			unset($_POST["photo"]);
40 40
 			unset($_POST["MAX_FILE_SIZE"]);
41 41
 		}
42
-		
42
+
43 43
 		if ($_POST["type"]=="7") { // is MP3 type
44 44
 			set_time_limit(300);
45 45
 			$mp3Name = getFileName($_POST["url"]);
@@ -50,22 +50,22 @@ if ($user->isAdmin()) {
50 50
 			if (isMP3($remoteFileName)) {
51 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 56
 			$_POST["title"] = addslashes($_POST["title"]);
57 57
 			$_POST["description"] = addslashes($_POST["description"]);
58 58
 		}
59
-		
59
+
60 60
 		$textile = new Textile();
61
-		
61
+
62 62
 		$_POST["title"] = $textile->TextileThis(removeBadTags($_POST["title"]));
63 63
 		$_POST["description"] = $textile->TextileThis(removeBadTags($_POST["description"]));
64
-		
64
+
65 65
 		if ($tumble->addPost($_POST)) {
66 66
 			$input = array("{type}");
67 67
 			$output = array("1");
68
-			
68
+
69 69
 			$template->cargarPlantilla($input, $output, "template_bm");
70 70
 			$template->mostrarPlantilla();
71 71
 			die();
@@ -74,14 +74,14 @@ if ($user->isAdmin()) {
74 74
 			die();
75 75
 		}
76 76
 	} else {
77
-	
77
+
78 78
 		if (isset($_GET["url"])) {
79 79
 			$url = $_GET["url"];
80 80
 		} else {
81 81
 			$url = null;
82 82
 		}
83
-		if (isset($url)) {	
84
-			
83
+		if (isset($url)) {
84
+
85 85
 			if (isMP3($url)) {
86 86
 				$postType = "mp3";
87 87
 			} elseif (isGoEar($url)) {
@@ -97,11 +97,11 @@ if ($user->isAdmin()) {
97 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 105
 	<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
106 106
 	<html xmlns="http://www.w3.org/1999/xhtml">
107 107
 	<head>
@@ -110,11 +110,11 @@ if ($user->isAdmin()) {
110 110
 		<title>gelato :: <?php echo __("bookmarklet")?></title>
111 111
 		<link rel="shortcut icon" href="<?php echo $conf->urlGelato;?>/images/favicon.ico" />
112 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 114
 			@import "<?php echo $conf->urlGelato;?>/admin/css/style.css";
115 115
 		</style>
116 116
 	</head>
117
-	
117
+
118 118
 	<body>
119 119
 		<div id="cont">
120 120
 			<div id="main">
@@ -131,69 +131,69 @@ if ($user->isAdmin()) {
131 131
 								case "photo":
132 132
 ?>
133 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 135
 									break;
136 136
 								case "url":
137 137
 ?>
138 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 141
 								case "video":
142 142
 ?>
143 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 145
 									break;
146 146
 								case "mp3":
147 147
 ?>
148 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 150
 									break;
151 151
 							}
152
-?>					
152
+?>
153 153
 					</ul>
154 154
 					<p>&nbsp;</p>
155 155
 					<form action="bm.php" method="post" <?php echo (isset($_GET["new"]) && $_GET["new"]=="photo") ? "enctype=\"multipart/form-data\"" : ""?> name="frmAdd" class="newpost">
156 156
 						<fieldset>
157
-<?php					
157
+<?php
158 158
 							$date = gmmktime();
159 159
 							$title = "";
160 160
 							$body = (isset($_GET["sel"])) ? $_GET["sel"] : "";
161 161
 							$url = (isset($url)) ? $url : "";
162
-							
162
+
163 163
 							switch ($postType) {
164 164
 								case "post":
165 165
 									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editBody}");
166 166
 									$output = array("1", $date, $_SESSION['user_id'], $title, $body);
167
-									
167
+
168 168
 									$template->cargarPlantilla($input, $output, "template_add_post");
169 169
 									$template->mostrarPlantilla();
170 170
 									break;
171 171
 								case "photo":
172 172
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
173 173
 									$output = array("2", $date, $_SESSION['user_id'], $url, $body);
174
-									
174
+
175 175
 									$template->cargarPlantilla($input, $output, "template_add_photo_bm");
176
-									$template->mostrarPlantilla();							   
176
+									$template->mostrarPlantilla();
177 177
 									break;
178 178
 								case "url":
179
-									
179
+
180 180
 									$input = array("{type}", "{date}", "{id_user}", "{editTitle}", "{editUrl}", "{editBody}");
181 181
 									$output = array("4", $date, $_SESSION['user_id'], $title, $url, $body);
182
-									
182
+
183 183
 									$template->cargarPlantilla($input, $output, "template_add_link");
184 184
 									$template->mostrarPlantilla();
185
-									break;								
185
+									break;
186 186
 								case "video":
187 187
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
188 188
 									$output = array("6", $date, $_SESSION['user_id'], $url, $body);
189
-									
189
+
190 190
 									$template->cargarPlantilla($input, $output, "template_add_video");
191 191
 									$template->mostrarPlantilla();
192 192
 									break;
193 193
 								case "mp3":
194 194
 									$input = array("{type}", "{date}", "{id_user}", "{editUrl}", "{editBody}");
195 195
 									$output = array("7", $date, $_SESSION['user_id'], $url, $body);
196
-									
196
+
197 197
 									$template->cargarPlantilla($input, $output, "template_add_mp3");
198 198
 									$template->mostrarPlantilla();
199 199
 									break;
@@ -203,10 +203,10 @@ if ($user->isAdmin()) {
203 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 204
 								</p>
205 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 207
 								</p>
208 208
 						</fieldset>
209
-					</form>					
209
+					</form>
210 210
 					<div class="footer-box">&nbsp;</div>
211 211
 				</div>
212 212
 
@@ -220,7 +220,7 @@ if ($user->isAdmin()) {
220 220
 		</div>
221 221
 	</body>
222 222
 	</html>
223
-<?php	
223
+<?php
224 224
 } else {
225 225
 	header("Location: ".$conf->urlGelato."/login.php");
226 226
 }

+ 1 - 1
install.php Parādīt failu

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

+ 8 - 8
update.php Parādīt failu

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