Index: trunk/admin/install.php =================================================================== diff -u -r77 -r78 --- trunk/admin/install.php (.../install.php) (revision 77) +++ trunk/admin/install.php (.../install.php) (revision 78) @@ -69,6 +69,15 @@ $pathtoroot = ".".$pathchar; } } + +if( file_exists($pathtoroot.'debug.php') ) include_once($pathtoroot.'debug.php'); +if( defined('DEBUG_MODE') ) +{ + error_reporting(E_ALL & E_NOTICE); +} +else + error_reporting(0); + $path_char = GetPathChar(); //phpinfo(INFO_VARIABLES); @@ -141,7 +150,8 @@ //echo "RU: $rootURL
"; // simulate rootURL variable: end -if(strlen($g_DBType)>0 && strlen($state)>0 && $state !="dbinfo" && $state !="db_config_save") +$db_savings = Array('dbinfo', 'db_config_save', 'db_reconfig_save', 'reinstall_process'); +if(strlen($g_DBType)>0 && strlen($state)>0 && !in_array($state, $db_savings) ) { require_once($pathtoroot."kernel/startup.php"); $localURL=$rootURL."kernel/"; @@ -570,34 +580,7 @@ } } unset($ado); - $ado = inst_GetADODBConnection(); - if($ado->ErrorNo()!=0) - { - $db_error = "Connection Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg(); - $state = "db_reconfig"; - - } - else - { - if(!TableExists($ado,"ConfigurationAdmin,Category,Permissions")) - { - $state="db_reconfig"; - $db_error = "An In-Portal Database was not found at this location"; - } - else { - set_ini_value("Database", "DBType",$_POST["ServerType"]); - set_ini_value("Database", "DBHost",$_POST["ServerHost"]); - set_ini_value("Database", "DBName",$_POST["ServerDB"]); - set_ini_value("Database", "DBUser",$_POST["ServerUser"]); - set_ini_value("Database", "DBUserPassword",$_POST["ServerPass"]); - set_ini_value("Database","TablePrefix",$_POST["TablePrefix"]); - - save_values(); - - $state = "finish"; - $include_file = "install/install_finish.php"; - } - } + $ado = VerifyDB('db_reconfig', 'finish', 'SaveDBConfig', true); } @@ -708,52 +691,7 @@ } } unset($ado); - $ado = inst_GetADODBConnection(); - if($ado->ErrorNo()!=0) - { - $db_error = "Connection Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg(); - $state = "dbinfo"; - - } - elseif( $ado->ErrorNo() == 0 ) - { - // check if all sql statements work - $sql_tests[] = 'DROP TABLE IF EXISTS test_table'; - $sql_tests[] = 'CREATE TABLE test_table(test_col mediumint(6))'; - $sql_tests[] = 'INSERT INTO test_table(test_col) VALUES (5)'; - $sql_tests[] = 'UPDATE test_table SET test_col = 12'; - $sql_tests[] = 'ALTER TABLE test_table ADD COLUMN new_col varchar(10)'; - $sql_tests[] = 'SELECT * FROM test_table'; - $sql_tests[] = 'DELETE FROM test_table'; - $sql_tests[] = 'DROP TABLE test_table'; - $test_result = 1; - foreach($sql_tests as $sql_test) - { - $ado->Execute($sql_test); - if( $ado->ErrorNo()!=0 ) - { - $test_result = 0; - break; - } - } - - - if($test_result == 1) - { - if(TableExists($ado,"ConfigurationAdmin,Category,Permissions")) - { - $state="dbinfo"; - $db_error = "An In-Portal Database already exists at this location"; - } - else - $state = "license"; - } - else // mysql user has insufficient permissions - { - $db_error = "Permission Error: (".$ado->ErrorNo().") ".$ado->ErrorMsg(); - $state = "dbinfo"; - } - } + $ado = VerifyDB('dbinfo', 'license'); } if($state=="dbinfo")