Index: trunk/install/index.php
===================================================================
--- trunk/install/index.php	(revision 248)
+++ trunk/install/index.php	(revision 253)
@@ -96,8 +96,9 @@
 <tr>
 	<td>
-	&nbsp; - supporto MySQL
-	</td>
-	<td align="left">
-	<?php echo function_exists( 'mysql_connect' ) ? '<b><font color="green">Disponibile</font></b>' : '<b><font color="red">Non Disponibile</font></b>';?>
+	&nbsp; - supporto PDO MySQL
+	</td>
+	<td align="left">
+
+	<?php echo (extension_loaded('Pdo_mysql')) ? '<b><font color="green">Disponibile</font></b>' : '<b><font color="red">Non Disponibile</font></b>';?>
 	</td>
 </tr>
@@ -163,5 +164,5 @@
 <?php
 $php_recommended_settings = array(
-array ('Magic Quotes GPC','magic_quotes_gpc','ON'),
+array ('Magic Quotes GPC','magic_quotes_gpc','OFF'),
 array ('Register Globals','register_globals','OFF'),
 array ('Session auto start','session.auto_start','OFF'),
Index: trunk/install/install2.php
===================================================================
--- trunk/install/install2.php	(revision 248)
+++ trunk/install/install2.php	(revision 253)
@@ -26,5 +26,5 @@
 $Capoluogo = mosGetParam( $_POST, 'Capoluogo', '' );
 $Lingua = mosGetParam( $_POST, 'Lingua', '' );
-$Multicomune = mosGetParam( $_POST, 'Multicomune', '' );
+$Multicomune = mosGetParam( $_POST, 'Multicomune', '0' );
 $Replica = mosGetParam( $_POST, 'Replica', '' );
 //tema
@@ -54,48 +54,22 @@
 		db_err ('stepBack','Non avete indicato il prefisso tabelle database.');
 	}
-	
-	$database = new database( $DBhostname, $DBuserName, $DBpassword, '', '', false );
-	$test = $database->getErrorMsg();
-
-	if (!$database->_resource) {
-		db_err ('stepBack2','password ed username inseriti non sono corretti.');
-	}
-
-	// Does this code actually do anything???
-	$configArray['DBhostname'] = $DBhostname;
-	$configArray['DBuserName'] = $DBuserName;
-	$configArray['DBpassword'] = $DBpassword;
-	$configArray['DBname']	 = $DBname;
-	$configArray['DBPrefix']= $DBPrefix;
-
-	$sql = "CREATE DATABASE `$DBname`";
-	$database->setQuery( $sql );
-	$database->query();
-	$test = $database->getErrorNum();
-
-	if ($test != 0 && $test != 1007) {
-		db_err( 'stepBack', 'Avvenuto un errore database: ' . $database->getErrorMsg() );
-	}
-
-	// db is now new or existing, create the db object connector to do the serious work
-	$database = new database( $DBhostname, $DBuserName, $DBpassword, $DBname, $DBPrefix );
-
-	// delete existing mos table if exists
-	$query = "SHOW TABLES FROM `$DBname`";
-	$database->setQuery( $query );
-	$errors = array();
-	if ($tables = $database->loadResultArray()) {
-		foreach ($tables as $table) {
-				$query = "DROP TABLE IF EXISTS `$table`";
-				$database->setQuery( $query );
-				$database->query();
-				if ($database->getErrorNum()) {
-					$errors[$database->getQuery()] = $database->getErrorMsg();
-				}
-		}
-	}
-
-	populate_db( $database, 'eleonline.sql' );
+	try{
+	$database = new PDO("mysql:host=$DBhostname;charset=latin1", $DBuserName, $DBpassword, array(PDO::ATTR_EMULATE_PREPARES => false, 
+                                                                                                PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));	
+	$sql = "CREATE DATABASE IF NOT EXISTS $DBname;
+	CREATE USER `$DBuserName`@'$DBhostname' IDENTIFIED BY '$DBpassword';
+        GRANT ALL ON `$DBname`.* TO `$DBuserName`@'$DBhostname';
+        FLUSH PRIVILEGES;";
+    	$database->exec($sql);
+    	$sql = "use $DBname";
+    	$database->exec($sql);
+	$sql = file_get_contents('sql/eleonline.sql');
+	$qr = $database->exec($sql);
 	$DBcreated = 1;
+	}
+	catch(PDOException $e)
+	{
+	    echo $sql . "<br>" . $e->getMessage();die();
+	}
 }
 
Index: trunk/install/install3.php
===================================================================
--- trunk/install/install3.php	(revision 248)
+++ trunk/install/install3.php	(revision 253)
@@ -19,7 +19,7 @@
 $nomecomune = mosGetParam( $_POST, 'nomecomune', '' ) ;
 $istat =  mosGetParam( $_POST, 'istat', '' ) ;
-$Capoluogo = mosGetParam( $_POST, 'Capoluogo', '' );
+$Capoluogo = mosGetParam( $_POST, 'Capoluogo', '0' );
 $Lingua = mosGetParam( $_POST, 'Lingua', '' );
-$Multicomune = mosGetParam( $_POST, 'Multicomune', '' );
+$Multicomune = mosGetParam( $_POST, 'Multicomune', '0' );
 $Replica = mosGetParam( $_POST, 'Replica', '' );
 
Index: trunk/install/install4.php
===================================================================
--- trunk/install/install4.php	(revision 248)
+++ trunk/install/install4.php	(revision 253)
@@ -25,7 +25,7 @@
 $nomecomune = mosGetParam( $_POST, 'nomecomune', '' ) ;
 $istat =  mosGetParam( $_POST, 'istat', '' ) ;
-$Capoluogo = mosGetParam( $_POST, 'Capoluogo', '' );
+$Capoluogo = mosGetParam( $_POST, 'Capoluogo', '0' );
 $Lingua = mosGetParam( $_POST, 'Lingua', '' );
-$Multicomune = mosGetParam( $_POST, 'Multicomune', '' );
+$Multicomune = mosGetParam( $_POST, 'Multicomune', '0' );
 $Replica = mosGetParam( $_POST, 'Replica', '' );
 
@@ -295,7 +295,8 @@
 
 
-
-	$database = new database( $DBhostname, $DBuserName, $DBpassword, $DBname );
-	$nullDate = $database->getNullDate();
+	$database = new PDO("mysql:host=$DBhostname;charset=latin1", $DBuserName, $DBpassword, array(PDO::ATTR_EMULATE_PREPARES => false, 
+                                                                                                PDO::ATTR_ERRMODE=>PDO::ERRMODE_EXCEPTION));	
+    	$sql = "use $DBname";
+    	$database->exec($sql);
 
 	// create the admin user
@@ -303,26 +304,20 @@
 	//$query = "INSERT INTO {$configArray['DBPrefix']}_authors VALUES ('$adminName', '$adminName', '0', '$adminEmail', '$cryptpass','1','0','0','1','it')";
 	$query = "UPDATE {$configArray['DBPrefix']}_authors SET aid='$adminName', name='$adminName', email='$adminEmail', pwd= '$cryptpass' WHERE aid='suser'";
-	$database->setQuery( $query );
-	$database->query();
+	$database->exec( $query );
 	
 	// create Comune
+	try{
+	$query = "INSERT INTO {$configArray['DBPrefix']}_ele_comuni VALUES ('$istat', '$nomecomune', '','','','','$Limite','$Capoluogo','','','0','')";
+	$database->exec( $query );
+	} catch(PDOException $e) {}
+	$query = "UPDATE {$configArray['DBPrefix']}_config SET sitename='$sitename', siteurl='$siteUrl', adminmail='$adminEmail', tema='$tema', foot='',language='$Lingua',blocco='$blocco',fileout='$Replica',Versione='3', siteistat='$istat',multicomune='$Multicomune',flash='$flash', tema_on='$sceltatema'   WHERE sitename=''";
 	
-	$query = "INSERT INTO {$configArray['DBPrefix']}_ele_comuni VALUES ('$istat', '$nomecomune', '','','','','$Limite','$Capoluogo','','','')";
-	
-	$database->setQuery( $query );
-	$database->query();
-	
-	$query = "UPDATE {$configArray['DBPrefix']}_config SET sitename='$sitename', siteurl='$siteUrl', adminmail='$adminEmail', tema='$tema', foot='',language='$Lingua',blocco='$blocco',fileout='$Replica',Versione='2.0 beta', siteistat='$istat',multicomune='$Multicomune',flash='$flash', tema_on='$sceltatema'   WHERE sitename=''";
-	
-
-	$database->setQuery( $query );
-	$database->query();
+	$database->exec( $query );
 
 
 	// touch config table
 	$date = date("F Y");
-	$query = "UPDATE {$configArray['DBPrefix']}_config SET sitename='$sitename', nukeurl='$siteUrl', startdate='$date', adminmail='$adminEmail', backend_title='$sitename', notify_email='$adminEmail'";
-	$database->setQuery( $query );
-	$database->query();
+	$query = "UPDATE {$configArray['DBPrefix']}_config SET sitename='$sitename', siteurl='$siteUrl', startdate='$date', adminmail='$adminEmail'";
+	$database->exec( $query );
 
 } else {
@@ -407,5 +402,5 @@
 da quella di amministrazione (admin)<br/>
 od anche l'utenza del database pubblico in sola lettura<br/> 
-e altri accorgimenti che riterrai necessarie<br/>
+e altri accorgimenti che riterrai necessari<br/>
 
 
Index: trunk/install/sql/eleonline.sql
===================================================================
--- trunk/install/sql/eleonline.sql	(revision 248)
+++ trunk/install/sql/eleonline.sql	(revision 253)
@@ -100,5 +100,5 @@
 /*!40000 ALTER TABLE `soraldo_config` DISABLE KEYS */;
 LOCK TABLES `soraldo_config` WRITE;
-INSERT INTO `soraldo_config` VALUES ('','http://www.fonte-nuova.it','','Sito istituzionale','Maggio 2009','admin@localhost','facebook','<b>Comune di Menfi</b><br>\r\nvia  - 84023 Menfi (Ag)\r\nTel:  Fax: \r\n<hr>','it','1','','','','Gpl v3',2,0,84023,'1','1','','','0','1','1','Admin');
+INSERT INTO `soraldo_config` VALUES ('','http://www.fonte-nuova.it','','Sito istituzionale','Maggio 2009','admin@localhost','facebook','<b>Comune di Menfi</b><br>\r\nvia  - 84023 Menfi (Ag)\r\nTel:  Fax: \r\n<hr>','it','1','','','','Gpl v3',2,0,84023,'1','1','0','','0','1','1','Admin');
 UNLOCK TABLES;
 /*!40000 ALTER TABLE `soraldo_config` ENABLE KEYS */;
@@ -747,5 +747,5 @@
   `id_cons_gen` int(11) NOT NULL default '0',
   `orario` time NOT NULL default '00:00:00',
-  `data` date NOT NULL default '0000-00-00',
+  `data` date NOT NULL,
   KEY `id_cons_gen` (`id_cons_gen`)
 ) ENGINE=MyISAM DEFAULT CHARSET=latin1;
@@ -989,5 +989,5 @@
   `id_parz` int(11) NOT NULL auto_increment,
   `orario` time NOT NULL default '00:00:00',
-  `data` date NOT NULL default '0000-00-00',
+  `data` date NOT NULL,
   `voti_uomini` int(7) NOT NULL default '0',
   `voti_donne` int(7) NOT NULL default '0',
