Browse Source

* Repaired installation script.

Victor De la Rocha 16 years ago
parent
commit
02407f90f3
6 changed files with 235 additions and 258 deletions
  1. 51 86
      classes/install.class.php
  2. 109 109
      classes/mysql_connection.class.php
  3. 11 12
      classes/user.class.php
  4. 2 3
      config-sample.php
  5. 31 22
      entry.php
  6. 31 26
      install.php

+ 51 - 86
classes/install.class.php View File

1
 <?php
1
 <?php
2
-if(!defined('entry') || !entry) die('Not a valid page'); 
3
-require('classes/mysql_connection.class.php');
2
+if(!defined('entry') || !entry) die('Not a valid page');
3
+require(Absolute_Path.'/classes/mysql_connection.class.php');
4
 
4
 
5
 class Install {
5
 class Install {
6
 	var $data = null;
6
 	var $data = null;
7
 	var $errors = null;
7
 	var $errors = null;
8
 	var $showForm;
8
 	var $showForm;
9
 	var $errors_d = array();
9
 	var $errors_d = array();
10
-	
10
+
11
 	function Install(){
11
 	function Install(){
12
 		$this->errors_d[1]="The login field cannot be empty";
12
 		$this->errors_d[1]="The login field cannot be empty";
13
 		$this->errors_d[2]="The password field cannot be empty";
13
 		$this->errors_d[2]="The password field cannot be empty";
20
 		$this->errors_d[9]="Password does not match the confirm password";
20
 		$this->errors_d[9]="Password does not match the confirm password";
21
 		$this->errors_d[10]="The login field cannot be empty";
21
 		$this->errors_d[10]="The login field cannot be empty";
22
 	}
22
 	}
23
-	
23
+
24
     function run() {
24
     function run() {
25
-    	
25
+
26
     	if (empty($this->data)) false;
26
     	if (empty($this->data)) false;
27
-    	
28
-    	if (!$this->create_config()) return false;
29
-    	
27
+
30
     	$this->create_db();
28
     	$this->create_db();
31
-    	
29
+
32
     	if (!$this->install_db()) return false;
30
     	if (!$this->install_db()) return false;
33
-		
31
+
34
 		return true;
32
 		return true;
35
     }
33
     }
36
-    
34
+
37
     function create_db(){
35
     function create_db(){
38
-		
36
+
39
 	    $link =  mysql_connect($this->data['db_host'], $this->data['db_login'], $this->data['db_password']);
37
 	    $link =  mysql_connect($this->data['db_host'], $this->data['db_login'], $this->data['db_password']);
40
 		if (!$link) {
38
 		if (!$link) {
41
 		    die('Could not connect: ' . mysql_error());
39
 		    die('Could not connect: ' . mysql_error());
42
 		}
40
 		}
43
-		
41
+
44
 		$sql = 'CREATE DATABASE ' . $this->data['db_name'];
42
 		$sql = 'CREATE DATABASE ' . $this->data['db_name'];
45
 		if (!mysql_query($sql, $link)) {
43
 		if (!mysql_query($sql, $link)) {
46
 			$link = mysql_close($link);
44
 			$link = mysql_close($link);
47
 			return false;
45
 			return false;
48
-		} 
49
-		
50
-		return true;    	
46
+		}
47
+
48
+		return true;
51
     }
49
     }
52
-    
50
+
53
 	function install_db(){
51
 	function install_db(){
54
 		require('config.php');
52
 		require('config.php');
55
-		$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);	
53
+		$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
56
 		$sqlStr = array();
54
 		$sqlStr = array();
57
-		
55
+
58
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."data` (
56
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."data` (
59
 			  `id_post` int(11) NOT NULL auto_increment,
57
 			  `id_post` int(11) NOT NULL auto_increment,
60
 			  `title` text NULL,
58
 			  `title` text NULL,
86
 			  `url_installation` varchar(250) NOT NULL,
84
 			  `url_installation` varchar(250) NOT NULL,
87
 			  PRIMARY KEY  (`title`)
85
 			  PRIMARY KEY  (`title`)
88
 			) ENGINE = MYISAM ;";
86
 			) ENGINE = MYISAM ;";
89
-			
90
 
87
 
91
-		
88
+
89
+
92
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."options` (
90
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."options` (
93
 		  `name` varchar(100) NOT NULL,
91
 		  `name` varchar(100) NOT NULL,
94
 		  `val` varchar(255) NOT NULL,
92
 		  `val` varchar(255) NOT NULL,
95
 		  PRIMARY KEY  (`name`)
93
 		  PRIMARY KEY  (`name`)
96
 		) ENGINE = MYISAM ;";
94
 		) ENGINE = MYISAM ;";
97
 
95
 
98
-		
96
+
99
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."comments` (
97
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."comments` (
100
 		  `id_comment` int(11) NOT NULL auto_increment,
98
 		  `id_comment` int(11) NOT NULL auto_increment,
101
 		  `id_post` int(11) NOT NULL,
99
 		  `id_post` int(11) NOT NULL,
108
 		  `spam` tinyint(4) NOT NULL,
106
 		  `spam` tinyint(4) NOT NULL,
109
 		  PRIMARY KEY  (`id_comment`)
107
 		  PRIMARY KEY  (`id_comment`)
110
 		) ENGINE = MYISAM ;";
108
 		) ENGINE = MYISAM ;";
111
-		
109
+
112
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."feeds` (
110
 		$sqlStr[] = "CREATE TABLE `".Table_prefix."feeds` (
113
 			`id_feed` int(11) NOT NULL auto_increment,
111
 			`id_feed` int(11) NOT NULL auto_increment,
114
 			`url` varchar(255) NOT NULL,
112
 			`url` varchar(255) NOT NULL,
122
 			PRIMARY KEY  (`id_feed`)
120
 			PRIMARY KEY  (`id_feed`)
123
 			) ENGINE=MyISAM ;";
121
 			) ENGINE=MyISAM ;";
124
 
122
 
125
-					
126
-		$sqlStr[] = "INSERT INTO `".Table_prefix."config` VALUES (". $this->data['posts_limit'] .", '".$this->data['title']."', '".$this->data['description']."', '".$this->data['lang']."', '".$this->data['template']."', '".$this->data['url_installation']."');";		
123
+
124
+		$sqlStr[] = "INSERT INTO `".Table_prefix."config` VALUES (". $this->data['posts_limit'] .", '".$this->data['title']."', '".$this->data['description']."', '".$this->data['lang']."', '".$this->data['template']."', '".$this->data['url_installation']."');";
127
 		$sqlStr[] = "INSERT INTO `".Table_prefix."users` VALUES ('', '', '".$this->data['login']."', '".md5($this->data['password'])."', '".$this->data['email']."', '".$this->data['website']."', '".$this->data['about']."');";
125
 		$sqlStr[] = "INSERT INTO `".Table_prefix."users` VALUES ('', '', '".$this->data['login']."', '".md5($this->data['password'])."', '".$this->data['email']."', '".$this->data['website']."', '".$this->data['about']."');";
128
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('url_friendly', '0');";
126
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('url_friendly', '0');";
129
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('rich_text', '0');";		
127
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('rich_text', '0');";
130
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('allow_comments', '0');";
128
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('allow_comments', '0');";
131
-		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_city', '".$this->data['offset_city']."');";		
129
+		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_city', '".$this->data['offset_city']."');";
132
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_time', '".$this->data['offset_time']."');";
130
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('offset_time', '".$this->data['offset_time']."');";
133
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
131
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('shorten_links', '0');";
134
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');";
132
 		$sqlStr[] = "INSERT INTO `".Table_prefix."options` VALUES ('rss_import_frec', '5 minutes');";
141
 
139
 
142
 		return true;
140
 		return true;
143
 	}
141
 	}
144
-	
142
+
145
 	function inerrors($n) {
143
 	function inerrors($n) {
146
 		if ( strpos($this->errors,$n)===false) {
144
 		if ( strpos($this->errors,$n)===false) {
147
 			return false;
145
 			return false;
149
 			return true;
147
 			return true;
150
 		}
148
 		}
151
 	}
149
 	}
152
-	
150
+
153
 	function mostrarerror($n) {
151
 	function mostrarerror($n) {
154
 		if ($this->inerrors($n)) {
152
 		if ($this->inerrors($n)) {
155
 			return '<span class="error">'.$this->errors_d[$n].'</span>';
153
 			return '<span class="error">'.$this->errors_d[$n].'</span>';
157
 			return "";
155
 			return "";
158
 		}
156
 		}
159
 	}
157
 	}
160
-	
158
+
161
 	function is_gelato_installed(){
159
 	function is_gelato_installed(){
162
-		if(file_exists('config.php')) {
163
-			@include("config.php");
164
-			if (!$this->check_for_config()){ 
165
-				return false; 
160
+		if(file_exists(Absolute_Path.'config.php')) {
161
+			@include(Absolute_Path."config.php");
162
+			if (!$this->check_for_config()){
163
+				return false;
166
 			} else {
164
 			} else {
167
 				if (!$this->is_db_installed()){
165
 				if (!$this->is_db_installed()){
168
 					return false;
166
 					return false;
173
 			return false;
171
 			return false;
174
 		}
172
 		}
175
 	}
173
 	}
176
-	
174
+
177
 	function is_db_installed(){
175
 	function is_db_installed(){
178
-			$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);	
176
+			$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
179
 				$sqlStr = "SELECT * FROM `".Table_prefix."config`";
177
 				$sqlStr = "SELECT * FROM `".Table_prefix."config`";
180
 				if($db->ejecutarConsulta($sqlStr)) {
178
 				if($db->ejecutarConsulta($sqlStr)) {
181
 					return ($db->contarRegistros() > 0);
179
 					return ($db->contarRegistros() > 0);
182
 			}else{
180
 			}else{
183
 			return false;
181
 			return false;
184
 			}
182
 			}
185
-	
183
+
186
 	}
184
 	}
187
-	
185
+
188
 	function check_for_config(){
186
 	function check_for_config(){
189
 		if(!defined('DB_Server')) return false;
187
 		if(!defined('DB_Server')) return false;
190
 		if(!defined('DB_name')) return false;
188
 		if(!defined('DB_name')) return false;
192
 		if(!defined('DB_Password')) return false;
190
 		if(!defined('DB_Password')) return false;
193
 		return true;
191
 		return true;
194
 	}
192
 	}
195
-	
196
-	function create_config(){
197
-		$config = fopen("config.php", 'w+');
198
-		$contents = '<?php
199
-if(!defined(\'entry\') || !entry) die(\'Not a valid page\'); 
200
-/* ===========================
201
-
202
-  gelato CMS - A PHP based tumblelog CMS
203
-  development version
204
-  http://www.gelatocms.com/
205
-
206
-  gelato CMS is a free software licensed under the GPL 2.0
207
-  Copyright (C) 2007 by Pedro Santana <pecesama at gmail dot com>
208
-
209
-  =========================== */
210
-
211
-define(\'DB_Server\', \''. $this->data['db_host'] . '\');
212
-define(\'DB_name\', \''. $this->data['db_name'] . '\');
213
-define(\'DB_User\', \''. $this->data['db_login'] . '\');
214
-define(\'DB_Password\', \''. $this->data['db_password'] . '\'); 
215
-define(\'Table_prefix\', \'gel_\');
216
-define(\'Absolute_Path\', dirname(__FILE__).DIRECTORY_SEPARATOR);
217
-
218
-?>';
219
-
220
-	    if (fwrite($config, $contents) === FALSE) {
221
-	        $this->errors = "Could not write config file to directory";
222
-	        return false;
223
-	    } 
224
-	    fclose($config);
225
-	    return true;		
226
-	}
227
-	
193
+
228
 	function check_form(){
194
 	function check_form(){
229
 
195
 
230
 		$action="";
196
 		$action="";
231
-		
197
+
232
 		if (isset($this->data['action'])){
198
 		if (isset($this->data['action'])){
233
 			$action=$this->data['action'];
199
 			$action=$this->data['action'];
234
 		}
200
 		}
235
-		
201
+
236
 		if (!$this->is_gelato_installed()){
202
 		if (!$this->is_gelato_installed()){
237
-			
203
+
238
 		$this->showForm = true;
204
 		$this->showForm = true;
239
-			
240
-		
205
+
241
 			if ($action=="config") {
206
 			if ($action=="config") {
242
-				
207
+
243
 				$sep_err="";
208
 				$sep_err="";
244
 				$this->errors = false;
209
 				$this->errors = false;
245
-				
210
+
246
 				if (!$this->data['login']) {
211
 				if (!$this->data['login']) {
247
 					$this->errors =$this->errors.$sep_err."1";
212
 					$this->errors =$this->errors.$sep_err."1";
248
 					$sep_err="|";
213
 					$sep_err="|";
274
 				if ($this->data['password']!=$_POST['password2']) {
239
 				if ($this->data['password']!=$_POST['password2']) {
275
 					$this->errors=$this->errors.$sep_err."3";
240
 					$this->errors=$this->errors.$sep_err."3";
276
 					$sep_err="|";
241
 					$sep_err="|";
277
-				}				
242
+				}
278
 				if ( $_POST['db_password']!=$_POST['db_password2']) {
243
 				if ( $_POST['db_password']!=$_POST['db_password2']) {
279
 					$this->errors=$this->errors.$sep_err."9";
244
 					$this->errors=$this->errors.$sep_err."9";
280
 					$sep_err="|";
245
 					$sep_err="|";
281
-				}				
282
-				
246
+				}
247
+
283
 				$off_r= split("," , $this->data['time_offsets']);
248
 				$off_r= split("," , $this->data['time_offsets']);
284
 				$this->data['offset_time'] = $off_r[0];
249
 				$this->data['offset_time'] = $off_r[0];
285
 				$this->data['offset_city'] = $off_r[1];
250
 				$this->data['offset_city'] = $off_r[1];
286
 				unset($this->data['time_offsets']);
251
 				unset($this->data['time_offsets']);
287
-				
252
+
288
 				if (!$this->errors) {
253
 				if (!$this->errors) {
289
-							
254
+
290
 					if ($this->run($this->data)) {
255
 					if ($this->run($this->data)) {
291
 						$this->showForm=false;
256
 						$this->showForm=false;
292
 					} else {
257
 					} else {
293
 						$this->errors=$this->errors.$sep_err."6";
258
 						$this->errors=$this->errors.$sep_err."6";
294
 						$sep_err="|";
259
 						$sep_err="|";
295
 						$this->showForm=true;
260
 						$this->showForm=true;
296
-					}		
261
+					}
297
 				} else {
262
 				} else {
298
 					$this->showForm=true;
263
 					$this->showForm=true;
299
 				}
264
 				}
300
 			}
265
 			}
301
-		}	
302
-	}	
266
+		}
267
+	}
303
 }
268
 }
304
 ?>
269
 ?>

+ 109 - 109
classes/mysql_connection.class.php View File

15
 // constantes
15
 // constantes
16
 define('MYSQL_TYPES_NUMERIC', 'int real ');
16
 define('MYSQL_TYPES_NUMERIC', 'int real ');
17
 define('MYSQL_TYPES_DATE', 'datetime timestamp year date time ');
17
 define('MYSQL_TYPES_DATE', 'datetime timestamp year date time ');
18
-define('MYSQL_TYPES_STRING', 'string blob '); 
18
+define('MYSQL_TYPES_STRING', 'string blob ');
19
 
19
 
20
 class Conexion_Mysql {
20
 class Conexion_Mysql {
21
 
21
 
22
-	var $mbase_datos;	
23
-	var $mservidor;	
24
-	var $musuario;	
25
-	var $mclave; 
26
-	var $mid_conexion = 0; 	// Identificador de conexión	
22
+	var $mbase_datos;
23
+	var $mservidor;
24
+	var $musuario;
25
+	var $mclave;
26
+	var $mid_conexion = 0; 	// Identificador de conexi�n
27
 	var $mid_consulta = 0; 	// Identificador de consulta
27
 	var $mid_consulta = 0; 	// Identificador de consulta
28
-	var $merror_numero = 0;		// Número de error			
29
-	var $merror = "";		// Descripción del error.
30
-	
31
-	/** Al crear una instancia de clase, se ejecutará esta función */	
32
-	function Conexion_Mysql($bd="", $host="localhost", $user="", $pass="") {	
33
-		$this->mbase_datos = $bd;	
34
-		$this->mservidor = $host;	
35
-		$this->musuario = $user;	
28
+	var $merror_numero = 0;		// N�mero de error
29
+	var $merror = "";		// Descripci�n del error.
30
+
31
+	/** Al crear una instancia de clase, se ejecutara esta funcion */
32
+	function Conexion_Mysql($bd="", $host="localhost", $user="", $pass="") {
33
+		$this->mbase_datos = $bd;
34
+		$this->mservidor = $host;
35
+		$this->musuario = $user;
36
 		$this->mclave = $pass;
36
 		$this->mclave = $pass;
37
-		
37
+
38
 		if (!$this->conectar()) {
38
 		if (!$this->conectar()) {
39
 			$mensaje = "
39
 			$mensaje = "
40
 				<h3 class=\"important\">Error establishing a database connection</h3>
40
 				<h3 class=\"important\">Error establishing a database connection</h3>
44
 					<li>Are you sure that you have typed the correct hostname?</li>
44
 					<li>Are you sure that you have typed the correct hostname?</li>
45
 					<li>Are you sure that the database server is running?</li>
45
 					<li>Are you sure that the database server is running?</li>
46
 				</ul>";
46
 				</ul>";
47
-			die($mensaje);			
47
+			die($mensaje);
48
 		}
48
 		}
49
 	}
49
 	}
50
-	
51
-	/** Conectar a la base de datos */	
52
-	function conectar() {		
53
-		// Conectamos al servidor		
54
-		$this->mid_conexion = @mysql_connect($this->mservidor, $this->musuario, $this->mclave);		
55
-		if (!$this->mid_conexion) {		
56
-			$this->merror = "No se logró realizar la conexión.";		
50
+
51
+	/** Conectar a la base de datos */
52
+	function conectar() {
53
+		// Conectamos al servidor
54
+		$this->mid_conexion = @mysql_connect($this->mservidor, $this->musuario, $this->mclave);
55
+		if (!$this->mid_conexion) {
56
+			$this->merror = "No se logr� realizar la conexi�n.";
57
 			return false;
57
 			return false;
58
-		}	 
59
-		//seleccionamos la base de datos		
60
-		if (!@mysql_select_db($this->mbase_datos, $this->mid_conexion)) {		
61
-			$this->merror = "No se puede abrir la base ".$this->mbase_datos ;		
62
-			return false;		
63
-		}	 
64
-		return $this->mid_conexion;	// Si todo salio bien regresa el id de la conexión
65
-	}	
66
-	
67
-	/** Para ejecutar consultas en la conexión abierta */	
58
+		}
59
+		//seleccionamos la base de datos
60
+		if (!@mysql_select_db($this->mbase_datos, $this->mid_conexion)) {
61
+			$this->merror = "No se puede abrir la base ".$this->mbase_datos ;
62
+			return false;
63
+		}
64
+		return $this->mid_conexion;	// Si todo salio bien regresa el id de la conexi�n
65
+	}
66
+
67
+	/** Para ejecutar consultas en la conexi�n abierta */
68
 	function ejecutarConsulta($msql = "") {
68
 	function ejecutarConsulta($msql = "") {
69
-		if ($msql == "") {	
70
-			$this->merror = "No introdujo la sentencia SQL";	
71
-			return false;	
72
-		}		
73
-		//ejecutamos la consulta		
74
-		$this->mid_consulta = mysql_query($msql, $this->mid_conexion);		
75
-		if (!$this->mid_consulta) {		
76
-			$this->merror_numero = mysql_errno();		
69
+		if ($msql == "") {
70
+			$this->merror = "No introdujo la sentencia SQL";
71
+			return false;
72
+		}
73
+		//ejecutamos la consulta
74
+		$this->mid_consulta = mysql_query($msql, $this->mid_conexion);
75
+		if (!$this->mid_consulta) {
76
+			$this->merror_numero = mysql_errno();
77
 			$this->merror = mysql_error()." error";
77
 			$this->merror = mysql_error()." error";
78
-			return false;		
79
-		}				
80
-		return $this->mid_consulta; // Si todo salio bien regresa el id de la consulta	
81
-	}	
82
-	
78
+			return false;
79
+		}
80
+		return $this->mid_consulta; // Si todo salio bien regresa el id de la consulta
81
+	}
82
+
83
 	/**
83
 	/**
84
 	 * Inserta un registro en la DB por cada llave->valor en un arreglo.
84
 	 * Inserta un registro en la DB por cada llave->valor en un arreglo.
85
 	 * No se debe usar sentencias SQL con esta funcion.
85
 	 * No se debe usar sentencias SQL con esta funcion.
90
 	 * @return string El ID del insert, verdadero si la tabla no tiene un campo auto_increment o false si ocurre un error.
90
 	 * @return string El ID del insert, verdadero si la tabla no tiene un campo auto_increment o false si ocurre un error.
91
 	 */
91
 	 */
92
 	function insertarDeFormulario($tabla, $datos) {
92
 	function insertarDeFormulario($tabla, $datos) {
93
-	  	  
93
+
94
 	  if (empty($datos)) {
94
 	  if (empty($datos)) {
95
 		 $this->merror = "Debes de pasar un arreglo como parametro.";
95
 		 $this->merror = "Debes de pasar un arreglo como parametro.";
96
 		 return false;
96
 		 return false;
97
 	  }
97
 	  }
98
-	  
98
+
99
 	  $cols = '(';
99
 	  $cols = '(';
100
 	  $sqlValues = '(';
100
 	  $sqlValues = '(';
101
-	  
101
+
102
 	  foreach ($datos as $llave=>$valor) {
102
 	  foreach ($datos as $llave=>$valor) {
103
-		  
104
-		 $cols .= "$llave,"; 
105
-		 
103
+
104
+		 $cols .= "$llave,";
105
+
106
 		 $tipo_col = $this->obtenerTipoCampo($tabla, $llave);  // obtiene el tipo de campo
106
 		 $tipo_col = $this->obtenerTipoCampo($tabla, $llave);  // obtiene el tipo de campo
107
 		 if (!$tipo_col) return false;  // error!
107
 		 if (!$tipo_col) return false;  // error!
108
-		 
108
+
109
 		 // determina si se necesita poner comillas al valor.
109
 		 // determina si se necesita poner comillas al valor.
110
 		 if (is_null($valor)) {
110
 		 if (is_null($valor)) {
111
-			$sqlValues .= "NULL,";   
112
-		 } 
111
+			$sqlValues .= "NULL,";
112
+		 }
113
 		 elseif (substr_count(MYSQL_TYPES_NUMERIC, "$tipo_col ")) {
113
 		 elseif (substr_count(MYSQL_TYPES_NUMERIC, "$tipo_col ")) {
114
 			$sqlValues .= "$valor,";
114
 			$sqlValues .= "$valor,";
115
 		 }
115
 		 }
119
 		 }
119
 		 }
120
 		 elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
120
 		 elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
121
 			$valor = $this->sql_escape($valor);
121
 			$valor = $this->sql_escape($valor);
122
-			$sqlValues .= "'$valor',";  
122
+			$sqlValues .= "'$valor',";
123
 		 }
123
 		 }
124
 	  }
124
 	  }
125
 	  $cols = rtrim($cols, ',').')';
125
 	  $cols = rtrim($cols, ',').')';
126
-	  $sqlValues = rtrim($sqlValues, ',').')';     
127
-	  
128
-	  // inserta los valores en la DB	  
126
+	  $sqlValues = rtrim($sqlValues, ',').')';
127
+
128
+	  // inserta los valores en la DB
129
 	  $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
129
 	  $sql = "INSERT INTO $tabla $cols VALUES $sqlValues";
130
-	  return $this->ejecutarConsulta($sql);	  
130
+	  return $this->ejecutarConsulta($sql);
131
 	}
131
 	}
132
-	
132
+
133
 	/**
133
 	/**
134
 	 * Modifica un registro en la DB por cada llave->valor en un arreglo.
134
 	 * Modifica un registro en la DB por cada llave->valor en un arreglo.
135
 	 * No se debe usar sentencias SQL con esta funcion.
135
 	 * No se debe usar sentencias SQL con esta funcion.
143
 	 * 		Falso si ocurrio algun error.
143
 	 * 		Falso si ocurrio algun error.
144
 	 */
144
 	 */
145
 	function modificarDeFormulario($tabla, $datos, $condicion="") {
145
 	function modificarDeFormulario($tabla, $datos, $condicion="") {
146
-      
146
+
147
 		if (empty($datos)) {
147
 		if (empty($datos)) {
148
 			$this->merror = "Debes de pasar un arreglo como parametro.";
148
 			$this->merror = "Debes de pasar un arreglo como parametro.";
149
 			return false;
149
 			return false;
152
 		$sql = "UPDATE $tabla SET";
152
 		$sql = "UPDATE $tabla SET";
153
 		foreach ($datos as $llave=>$valor) {
153
 		foreach ($datos as $llave=>$valor) {
154
 			$sql .= " $llave=";
154
 			$sql .= " $llave=";
155
-			
155
+
156
 			$tipo_col = $this->obtenerTipoCampo($tabla, $llave);  // obtiene el tipo de campo
156
 			$tipo_col = $this->obtenerTipoCampo($tabla, $llave);  // obtiene el tipo de campo
157
 			if (!$tipo_col) return false;  // error!
157
 			if (!$tipo_col) return false;  // error!
158
-			
158
+
159
 			// determina si se necesita poner comillas al valor.
159
 			// determina si se necesita poner comillas al valor.
160
 			if (is_null($valor)) {
160
 			if (is_null($valor)) {
161
-			$sql .= "NULL,";   
162
-			} 
161
+			$sql .= "NULL,";
162
+			}
163
 			elseif (substr_count(MYSQL_TYPES_NUMERIC, "$tipo_col ")) {
163
 			elseif (substr_count(MYSQL_TYPES_NUMERIC, "$tipo_col ")) {
164
 			$sql .= "$valor,";
164
 			$sql .= "$valor,";
165
 			}
165
 			}
169
 			}
169
 			}
170
 			elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
170
 			elseif (substr_count(MYSQL_TYPES_STRING, "$tipo_col ")) {
171
 			$valor = $this->sql_escape($valor);
171
 			$valor = $this->sql_escape($valor);
172
-			$sql .= "'$valor',";  
173
-			}	
172
+			$sql .= "'$valor',";
173
+			}
174
 		}
174
 		}
175
 		$sql = rtrim($sql, ','); // elimina la ultima coma
175
 		$sql = rtrim($sql, ','); // elimina la ultima coma
176
 		if (!empty($condicion)) $sql .= " WHERE $condicion";
176
 		if (!empty($condicion)) $sql .= " WHERE $condicion";
177
-		
177
+
178
 		// modifica los valores
178
 		// modifica los valores
179
 		return $this->ejecutarConsulta($sql);
179
 		return $this->ejecutarConsulta($sql);
180
 	}
180
 	}
181
-	
181
+
182
 	/**
182
 	/**
183
-	 * Obtiene la informacion sobre un campo usando la funcion mysql_fetch_field.	 
183
+	 * Obtiene la informacion sobre un campo usando la funcion mysql_fetch_field.
184
 	 *
184
 	 *
185
 	 * @param mixed $tabla El nombre de la tabla en la BD.
185
 	 * @param mixed $tabla El nombre de la tabla en la BD.
186
 	 * @param string $campo El campo del que se desea la informacion.
186
 	 * @param string $campo El campo del que se desea la informacion.
187
 	 * @return array Un arreglo con la informacion del campo o false si hay algun error.
187
 	 * @return array Un arreglo con la informacion del campo o false si hay algun error.
188
 	 */
188
 	 */
189
 	function obtenerTipoCampo($tabla, $campo) {
189
 	function obtenerTipoCampo($tabla, $campo) {
190
-	
190
+
191
 	  $r = mysql_query("SELECT $campo FROM $tabla");
191
 	  $r = mysql_query("SELECT $campo FROM $tabla");
192
 	  if (!$r) {
192
 	  if (!$r) {
193
 		 $this->merror = mysql_error();
193
 		 $this->merror = mysql_error();
200
 		 return false;
200
 		 return false;
201
 	  }
201
 	  }
202
 	  mysql_free_result($r);
202
 	  mysql_free_result($r);
203
-	  return $ret;	  
203
+	  return $ret;
204
 	}
204
 	}
205
-   
205
+
206
 	/**
206
 	/**
207
 	 * Convierte una fecha en formato para DB.
207
 	 * Convierte una fecha en formato para DB.
208
 	 *
208
 	 *
214
 			if(eregi("^([0-9]+)$",$valor)){
214
 			if(eregi("^([0-9]+)$",$valor)){
215
 				$valor = date("Y-m-d H:i:s",$valor);
215
 				$valor = date("Y-m-d H:i:s",$valor);
216
 			}else{
216
 			}else{
217
-				// Estariá en el formato strtotime()
217
+				// Estari� en el formato strtotime()
218
 				$valor = date("Y-m-d H:i:s",strtotime($valor));
218
 				$valor = date("Y-m-d H:i:s",strtotime($valor));
219
 			}
219
 			}
220
 		}
220
 		}
222
 	/*  if (gettype($valor) == 'string') $valor = strtotime($valor);
222
 	/*  if (gettype($valor) == 'string') $valor = strtotime($valor);
223
 	  return date('Y-m-d H:i:s', $valor);
223
 	  return date('Y-m-d H:i:s', $valor);
224
 	*/
224
 	*/
225
-	}	
225
+	}
226
 
226
 
227
 	/**
227
 	/**
228
 	 * Obtiene el registro obtenido de una consulta.
228
 	 * Obtiene el registro obtenido de una consulta.
229
 	 */
229
 	 */
230
-	function obtenerRegistro() {				
231
-		return mysql_fetch_assoc($this->mid_consulta);	  	
232
-	}	
233
-	
230
+	function obtenerRegistro() {
231
+		return mysql_fetch_assoc($this->mid_consulta);
232
+	}
233
+
234
 	/**
234
 	/**
235
-	 * Devuelve el número de campos de una consulta.
235
+	 * Devuelve el n�mero de campos de una consulta.
236
 	 */
236
 	 */
237
-	function contarCampos() {	
238
-		return mysql_num_fields($this->mid_consulta);	
239
-	}	
240
-	
237
+	function contarCampos() {
238
+		return mysql_num_fields($this->mid_consulta);
239
+	}
240
+
241
 	/**
241
 	/**
242
-	 * Devuelve el número de registros de una consulta.
242
+	 * Devuelve el n�mero de registros de una consulta.
243
 	 */
243
 	 */
244
-	function contarRegistros() {	
245
-		return @mysql_num_rows($this->mid_consulta);	
246
-	}	
247
-	
244
+	function contarRegistros() {
245
+		return @mysql_num_rows($this->mid_consulta);
246
+	}
247
+
248
 	/**
248
 	/**
249
 	 * Devuelve el nombre de un campo de una consulta.
249
 	 * Devuelve el nombre de un campo de una consulta.
250
 	 */
250
 	 */
251
-	function obtenerNombreCampo($numero_campo) {	
252
-		return mysql_field_name($this->mid_consulta, $numero_campo);	
253
-	}	
254
-	
251
+	function obtenerNombreCampo($numero_campo) {
252
+		return mysql_field_name($this->mid_consulta, $numero_campo);
253
+	}
254
+
255
 	/**
255
 	/**
256
 	 * Muestra los datos de una consulta (para debug).
256
 	 * Muestra los datos de una consulta (para debug).
257
 	 */
257
 	 */
258
 	function verConsulta() {
258
 	function verConsulta() {
259
-		echo "<table border=1>\n";	 	
260
-		// mostramos los nombres de los campos		
261
-		for ($i = 0; $i < $this->contarCampos(); $i++) {		
262
-			echo "<td><b>".$this->obtenerNombreCampo($i)."</b></td>\n";		
263
-		}		
264
-		echo "</tr>\n";		
259
+		echo "<table border=1>\n";
260
+		// mostramos los nombres de los campos
261
+		for ($i = 0; $i < $this->contarCampos(); $i++) {
262
+			echo "<td><b>".$this->obtenerNombreCampo($i)."</b></td>\n";
263
+		}
264
+		echo "</tr>\n";
265
 		// mostrarmos los registros
265
 		// mostrarmos los registros
266
-		while ($row = mysql_fetch_row($this->mid_consulta)) {		
267
-			echo "<tr> \n";		
268
-			for ($i = 0; $i < $this->contarCampos(); $i++) {		
269
-				echo "<td>".$row[$i]."</td>\n";		
270
-			}		
271
-			echo "</tr>\n";		
272
-		}	
266
+		while ($row = mysql_fetch_row($this->mid_consulta)) {
267
+			echo "<tr> \n";
268
+			for ($i = 0; $i < $this->contarCampos(); $i++) {
269
+				echo "<td>".$row[$i]."</td>\n";
270
+			}
271
+			echo "</tr>\n";
272
+		}
273
 	}
273
 	}
274
-	
274
+
275
 	/**
275
 	/**
276
 	 * Cierra la conexion a la BD.
276
 	 * Cierra la conexion a la BD.
277
 	 */
277
 	 */
289
 	          $value = addslashes($value);
289
 	          $value = addslashes($value);
290
 	    }
290
 	    }
291
 	    return $value;
291
 	    return $value;
292
-	}	
292
+	}
293
 } //fin de la Clase conexion_mysql
293
 } //fin de la Clase conexion_mysql
294
 ?>
294
 ?>

+ 11 - 12
classes/user.class.php View File

1
 <?php
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
   gelato CMS - A PHP based tumblelog CMS
5
   gelato CMS - A PHP based tumblelog CMS
20
 	var $cookieTime;
20
 	var $cookieTime;
21
 	var $persist = false;
21
 	var $persist = false;
22
 
22
 
23
-
24
 	function user() {
23
 	function user() {
25
 		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
24
 		parent::Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
26
 		$this->cookie_life = 60*24*3600;
25
 		$this->cookie_life = 60*24*3600;
29
 	}
28
 	}
30
 
29
 
31
 	function isAdmin() {
30
 	function isAdmin() {
32
-		
31
+
33
 		if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"]))  && (isset($_SESSION['authenticated'])  && $_SESSION['authenticated']==true)) {
32
 		if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"]))  && (isset($_SESSION['authenticated'])  && $_SESSION['authenticated']==true)) {
34
 			return true;
33
 			return true;
35
 		}
34
 		}
36
-		
35
+
37
 		if(isset($_COOKIE["PHPSESSID"]) && $_COOKIE["PHPSESSID"]!="") {
36
 		if(isset($_COOKIE["PHPSESSID"]) && $_COOKIE["PHPSESSID"]!="") {
38
 			if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"]))  && (isset($_SESSION['authenticated'])  && $_SESSION['authenticated']==true)) {
37
 			if ((!empty($_SESSION["user_id"]) && !empty($_SESSION["user_login"]))  && (isset($_SESSION['authenticated'])  && $_SESSION['authenticated']==true)) {
39
 				return true;
38
 				return true;
40
-			} 
39
+			}
41
 		}
40
 		}
42
-		
41
+
43
 		return false;
42
 		return false;
44
-		
43
+
45
 	}
44
 	}
46
 
45
 
47
 	function validateUser($username="", $password="") {
46
 	function validateUser($username="", $password="") {
55
 				if (isset($_POST["save_pass"])) {
54
 				if (isset($_POST["save_pass"])) {
56
 					$this->persist = true;
55
 					$this->persist = true;
57
 					setcookie("PHPSESSID",session_id(),$this->cookieTime+$this->cookie_life);
56
 					setcookie("PHPSESSID",session_id(),$this->cookieTime+$this->cookie_life);
58
-				} 
57
+				}
59
 				return true;
58
 				return true;
60
 			} else {
59
 			} else {
61
 				return false;
60
 				return false;
65
 		}
64
 		}
66
 	}
65
 	}
67
 
66
 
68
-	function closeSession() {	
67
+	function closeSession() {
69
 		if (!$this->persist) session_destroy();
68
 		if (!$this->persist) session_destroy();
70
-		return true;	
69
+		return true;
71
 	}
70
 	}
72
 
71
 
73
 	function userExist($user="") {
72
 	function userExist($user="") {
79
 			}
78
 			}
80
 		}
79
 		}
81
 	}
80
 	}
82
-	
81
+
83
 	function isAuthenticated(){
82
 	function isAuthenticated(){
84
 		return $this->isAdmin();
83
 		return $this->isAdmin();
85
 	}
84
 	}
133
 				return false;
132
 				return false;
134
 			}
133
 			}
135
 		}
134
 		}
136
-	}	
135
+	}
137
 
136
 
138
 	function confirmationEmail($email="", $user="", $password="") {
137
 	function confirmationEmail($email="", $user="", $password="") {
139
 		$msg =  "<font face=verdana><em><font size=2>Account information on <strong>gelato CMS</strong></font></em><br/><br/>";
138
 		$msg =  "<font face=verdana><em><font size=2>Account information on <strong>gelato CMS</strong></font></em><br/><br/>";

+ 2 - 3
config-sample.php View File

1
 <?php
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
   gelato CMS - A PHP based tumblelog CMS
5
   gelato CMS - A PHP based tumblelog CMS
14
 define('DB_Server', '[server]');
14
 define('DB_Server', '[server]');
15
 define('DB_name', '[database]');
15
 define('DB_name', '[database]');
16
 define('DB_User', '[userdb]');
16
 define('DB_User', '[userdb]');
17
-define('DB_Password', '[dbpass]'); 
17
+define('DB_Password', '[dbpass]');
18
 define('Table_prefix', 'gel_');
18
 define('Table_prefix', 'gel_');
19
-define('Absolute_Path', dirname(__FILE__).DIRECTORY_SEPARATOR);
20
 
19
 
21
 ?>
20
 ?>

+ 31 - 22
entry.php View File

20
  * admin/admin.php
20
  * admin/admin.php
21
  * admin/comments.php
21
  * admin/comments.php
22
  * admin/user.php
22
  * admin/user.php
23
- * admin/feeds.php 
23
+ * admin/feeds.php
24
  * classes/imgsize.php
24
  * classes/imgsize.php
25
  */
25
  */
26
 
26
 
27
- 
28
 // PHP settings specific to Gelato
27
 // PHP settings specific to Gelato
29
 ini_set('pcre.backtrack_limit', '10000');
28
 ini_set('pcre.backtrack_limit', '10000');
29
+// Globals to be used throughout the application
30
+define('Absolute_Path', dirname(__FILE__).DIRECTORY_SEPARATOR);
31
+$installed = true;
32
+$configFile = Absolute_Path.'config.php';
30
 
33
 
31
-// Globals to be used throughout the application        
32
-$configFile = dirname(__FILE__).DIRECTORY_SEPARATOR."config.php";
33
-
34
-if (!file_exists($configFile)) {
35
-	header("Location: install.php");  
36
-} else {
37
-        require(dirname(__FILE__).DIRECTORY_SEPARATOR."config.php");
38
-}       
34
+if(strpos($_SERVER['REQUEST_URI'],'/admin'))$dir = "../"; else $dir = "";
35
+if (!file_exists($configFile) and basename($_SERVER['PHP_SELF'])!='install.php'){
36
+	header("Location: {$dir}install.php");exit;
37
+}else{
38
+	include(Absolute_Path.'classes/install.class.php');
39
+	$install = new Install();
40
+	if(!$install->is_gelato_installed()){
41
+		if(basename($_SERVER['PHP_SELF'])!='install.php'){
42
+				header("Location: {$dir}install.php");exit;
43
+			}
44
+		$installed = false;
45
+	}
46
+}
39
 
47
 
48
+require($configFile);
40
 require_once("classes/configuration.class.php");
49
 require_once("classes/configuration.class.php");
41
 require_once("classes/textile.class.php");
50
 require_once("classes/textile.class.php");
42
-require_once("classes/gelato.class.php");    
51
+require_once("classes/gelato.class.php");
43
 require_once("classes/templates.class.php");
52
 require_once("classes/templates.class.php");
44
 require_once("classes/pagination.class.php");
53
 require_once("classes/pagination.class.php");
45
 require_once("classes/user.class.php");
54
 require_once("classes/user.class.php");
50
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php');
59
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'gettext.class.php');
51
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'lang.functions.php');
60
 require_once(Absolute_Path.'classes'.DIRECTORY_SEPARATOR.'lang.functions.php');
52
 
61
 
53
-// Globals to be used throughout the application
54
-$user = new user();
55
-$tumble = new gelato();
56
-$conf = new configuration();
57
-$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
58
-
59
-
60
-session_start();
62
+if($installed){
63
+	// Globals to be used throughout the application
64
+	$user = new user();
65
+	$tumble = new gelato();
66
+	$conf = new configuration();
67
+	$db = new Conexion_Mysql(DB_name, DB_Server, DB_User, DB_Password);
61
 
68
 
62
-$feeds = new feeds();
63
-$feeds->updateFeeds();
64
-unset($feeds);
69
+	session_start();
65
 
70
 
71
+	$feeds = new feeds();
72
+	$feeds->updateFeeds();
73
+	unset($feeds);
74
+}
66
 ?>
75
 ?>

+ 31 - 26
install.php View File

1
 <?php
1
 <?php
2
-if(!defined('entry'))define('entry', true);
2
+if(!defined('entry') || !entry) define('entry',true);
3
 /* ===========================
3
 /* ===========================
4
 
4
 
5
   gelato CMS - A PHP based tumblelog CMS
5
   gelato CMS - A PHP based tumblelog CMS
11
 
11
 
12
   =========================== */
12
   =========================== */
13
 
13
 
14
-require('entry.php');
15
-global $user, $conf, $tumble;
14
+// Received a valid request, better start setting globals we'll need throughout the app in entry.php
15
+require_once('entry.php');
16
 
16
 
17
-include('classes/install.class.php'); 
18
-$install = new Install(); 
17
+$configFile = Absolute_Path."config.php";
18
+if(file_exists($configFile)){
19
+	require($configFile);
20
+}else{
21
+	exit("You need to rename config-sample.php to config.php and fill out the required details.");
22
+}
19
 
23
 
24
+global $user, $conf, $tumble;
25
+$install = new Install();
20
 $install->data = $_POST;
26
 $install->data = $_POST;
21
 $install->check_form();
27
 $install->check_form();
22
-
23
 ?>
28
 ?>
24
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
29
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
25
 <html xmlns="http://www.w3.org/1999/xhtml">
30
 <html xmlns="http://www.w3.org/1999/xhtml">
26
 <head>
31
 <head>
27
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
32
 	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
28
 	<meta name="generator" content="gelato cms <?php echo version();?>" />
33
 	<meta name="generator" content="gelato cms <?php echo version();?>" />
29
-	<title>gelato :: installation</title>	
34
+	<title>gelato :: installation</title>
30
 	<link rel="shortcut icon" href="images/favicon.ico" />
35
 	<link rel="shortcut icon" href="images/favicon.ico" />
31
-	<style type="text/css" media="screen">	
32
-		@import "admin/css/style.css";		
33
-	</style>		
36
+	<style type="text/css" media="screen">
37
+		@import "admin/css/style.css";
38
+	</style>
34
 </head>
39
 </head>
35
 <body>
40
 <body>
36
 <div id="cont">
41
 <div id="cont">
37
 	<div id="head">
42
 	<div id="head">
38
 		<h1><a href="index.php" title="gelato :: home">gelato cms</a></h1>
43
 		<h1><a href="index.php" title="gelato :: home">gelato cms</a></h1>
39
 	</div>
44
 	</div>
40
-	
45
+
41
 	<div id="main">
46
 	<div id="main">
42
-	
47
+
43
 <?php
48
 <?php
44
 
49
 
45
 	if ($install->showForm) {
50
 	if ($install->showForm) {
46
 ?>
51
 ?>
47
-	
52
+
48
 	<div class="box">
53
 	<div class="box">
49
 		<ul class="menu manage">
54
 		<ul class="menu manage">
50
 		<h3>gelato :: installation</h3>
55
 		<h3>gelato :: installation</h3>
51
 
56
 
52
 		<li class="selected"><a>Install</a></li>
57
 		<li class="selected"><a>Install</a></li>
53
 		</ul>
58
 		</ul>
54
-	
59
+
55
 		<div class="tabla">
60
 		<div class="tabla">
56
 			<form action="install.php" method="post" id="config_form" autocomplete="off" class="newpost">
61
 			<form action="install.php" method="post" id="config_form" autocomplete="off" class="newpost">
57
 				<fieldset class="install">
62
 				<fieldset class="install">
62
 						<li><label for="password">Password:</label>
67
 						<li><label for="password">Password:</label>
63
 							<input type="password" name="db_password" id="db_password" value="" class="txt"/></li>
68
 							<input type="password" name="db_password" id="db_password" value="" class="txt"/></li>
64
 						<li><label for="password2">Re-type password:</label>
69
 						<li><label for="password2">Re-type password:</label>
65
-							<input type="password" name="db_password2" id="db_password2" value="" class="txt"/><?php echo $install->mostrarerror("9")?></li>						
70
+							<input type="password" name="db_password2" id="db_password2" value="" class="txt"/><?php echo $install->mostrarerror("9")?></li>
66
 						<li><label for="email">Database Host:</label>
71
 						<li><label for="email">Database Host:</label>
67
-							<input type="text" name="db_host" id="db_host" value="<?php echo (!empty($install->data['db_host']))?  $install->data['db_host'] : 'localhost'?>" class="txt"/><?php echo $install->mostrarerror("7")?></li>	
72
+							<input type="text" name="db_host" id="db_host" value="<?php echo (!empty($install->data['db_host']))?  $install->data['db_host'] : 'localhost'?>" class="txt"/><?php echo $install->mostrarerror("7")?></li>
68
 						<li><label for="email">Database Name:</label>
73
 						<li><label for="email">Database Name:</label>
69
-							<input type="text" name="db_name" id="db_name" value="<?php echo (!empty($install->data['db_name']))?  $install->data['db_name'] : 'gelatocms'?>" class="txt"/><?php echo $install->mostrarerror("8")?></li>											
74
+							<input type="text" name="db_name" id="db_name" value="<?php echo (!empty($install->data['db_name']))?  $install->data['db_name'] : 'gelatocms'?>" class="txt"/><?php echo $install->mostrarerror("8")?></li>
70
 					</ul>
75
 					</ul>
71
 				</fieldset><br  />
76
 				</fieldset><br  />
72
 				<fieldset class="install">
77
 				<fieldset class="install">
77
 						<li><label for="password">Password:</label>
82
 						<li><label for="password">Password:</label>
78
 							<input type="password" name="password" id="password" value="" class="txt"/><?php echo $install->mostrarerror("2")?></li>
83
 							<input type="password" name="password" id="password" value="" class="txt"/><?php echo $install->mostrarerror("2")?></li>
79
 						<li><label for="password2">Re-type password:</label>
84
 						<li><label for="password2">Re-type password:</label>
80
-							<input type="password" name="password2" id="password2" value="" class="txt"/><?php echo $install->mostrarerror("3")?></li>						
85
+							<input type="password" name="password2" id="password2" value="" class="txt"/><?php echo $install->mostrarerror("3")?></li>
81
 						<li><label for="email">E-mail:</label>
86
 						<li><label for="email">E-mail:</label>
82
-							<input type="text" name="email" id="email" value="<?php echo $install->data['email']?>" class="txt"/><?php echo $install->mostrarerror("4")?></li>						
87
+							<input type="text" name="email" id="email" value="<?php echo $install->data['email']?>" class="txt"/><?php echo $install->mostrarerror("4")?></li>
83
 					</ul>
88
 					</ul>
84
 				</fieldset><br  />
89
 				</fieldset><br  />
85
 				<fieldset class="install">
90
 				<fieldset class="install">
86
 					<legend class="install">Tumblelog configuration</legend>
91
 					<legend class="install">Tumblelog configuration</legend>
87
-					<ul>							
92
+					<ul>
88
 						<li><label for="title">Title:</label>
93
 						<li><label for="title">Title:</label>
89
 							<input type="text" name="title" id="title" value="<?php echo $install->data['title']?>" class="txt"/></li>
94
 							<input type="text" name="title" id="title" value="<?php echo $install->data['title']?>" class="txt"/></li>
90
 						<li><label for="description">Description:</label>
95
 						<li><label for="description">Description:</label>
102
 							<select id="template" name="template">
107
 							<select id="template" name="template">
103
 <?php
108
 <?php
104
 							$themes = getThemes();
109
 							$themes = getThemes();
105
-							foreach ($themes as $theme) {									
110
+							foreach ($themes as $theme) {
106
 								echo "<option value=\"".$theme."\" selected=\"true\">".$theme."</option>\n";
111
 								echo "<option value=\"".$theme."\" selected=\"true\">".$theme."</option>\n";
107
-								
112
+
108
 							}
113
 							}
109
 ?>							</select>
114
 ?>							</select>
110
 						<li>
115
 						<li>
175
 						</li>
180
 						</li>
176
 					</ul>
181
 					</ul>
177
 				</fieldset>
182
 				</fieldset>
178
-				<p>	
183
+				<p>
179
 					<input type="hidden" name="website" id="website" value="" />
184
 					<input type="hidden" name="website" id="website" value="" />
180
 					<input type="hidden" name="about" id="about" value="" />
185
 					<input type="hidden" name="about" id="about" value="" />
181
 					<input type="hidden" name="action" id="action" value="config" />
186
 					<input type="hidden" name="action" id="action" value="config" />
182
 					<input type="submit" name="btnsubmit" id="btnsubmit" value="<< Install >>" class="submit"/>
187
 					<input type="submit" name="btnsubmit" id="btnsubmit" value="<< Install >>" class="submit"/>
183
 				</p>
188
 				</p>
184
-			</form>		
189
+			</form>
185
 		</div>
190
 		</div>
186
 		<div class="footer-box">&nbsp;</div>
191
 		<div class="footer-box">&nbsp;</div>
187
 	</div>
192
 	</div>
188
-	
193
+
189
 <?php
194
 <?php
190
 	} else {
195
 	} else {
191
 		echo "<p><em>Finished!</em></p>";
196
 		echo "<p><em>Finished!</em></p>";
197
 	<div id="foot">
202
 	<div id="foot">
198
 		<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
203
 		<a href="http://www.gelatocms.com/" title="gelato CMS">gelato CMS</a> :: PHP/MySQL Tumblelog Content Management System.
199
 	</div>
204
 	</div>
200
-	
205
+
201
 </div>
206
 </div>
202
 </body>
207
 </body>
203
 </html>
208
 </html>