diff --git a/phpBB/install.php b/phpBB/install.php index 9f1da1f07e..85bee7ef1b 100644 --- a/phpBB/install.php +++ b/phpBB/install.php @@ -292,12 +292,11 @@ else // out some additional instruction_textions later on what to do after installation // for the odbc DBMS. // - if( ereg(':', $dbms) && $install_step < 2 ) + if( ereg(':', $dbms) ) { $dbms = explode(':', $dbms); $dbhost = $dbms[1] . ':' . $dbhost; $dbms = $dbms[0]; - $install_step = 2; } else if( isset($dbms) ) { @@ -310,9 +309,10 @@ else $remove_remarks = ( $dbms == 'mysql' ) ? 'remove_remarks' : 'remove_comments'; $delimiter = ( $dbms == 'mssql' ) ? 'GO' : ';'; - switch ( $install_step ) + if( $install_step == 1 ) { - case 1: + if($dbms != 'odbc') + { // // Ok we have the db info go ahead and read in the relevant schema // and work on building the table.. probably ought to provide some @@ -324,16 +324,16 @@ else $sql_query = split_sql_file($sql_query, $delimiter); $sql_count = count($sql_query); $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); - + for($i = 0; $i < $sql_count; $i++) { $result = $db->sql_query($sql_query[$i]); if( !$result ) { $error = $db->sql_error(); - + $template->assign_block_vars("error_install", array()); - $template->assign_vars(array( + $template->assign_vars(array( "L_ERROR_TITLE" => $lang['Installer_Error'], "L_ERROR" => $lang['Install_db_error'] . '
' . $error['message']) ); @@ -341,23 +341,23 @@ else die(); } } - + // // Ok tables have been built, let's fill in the basic information // $sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic)); $sql_query = $remove_remarks($sql_query); $sql_query = split_sql_file($sql_query, $delimiter); - $sql_count = count($sql_query); + $sql_count = count($sql_query); $sql_query = preg_replace('/phpbb_/', $table_prefix, $sql_query); - + for($i = 0; $i < $sql_count; $i++) { $result = $db->sql_query($sql_query[$i]); if( !$result ) { $error = $db->sql_error(); - + $template->assign_block_vars("error_install", array()); $template->assign_vars(array( "L_ERROR_TITLE" => $lang['Installer_Error'], @@ -374,146 +374,137 @@ else // this we are going to pass them over to the admin_forum.php script // to set up their forum defaults. // - if( $dbms == 'odbc' ) + $error = ""; + // + // Update the default admin user with their information. + // + $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) + VALUES ('board_startdate', " . time() . ")"; + $result = $db->sql_query($sql); + if( !$result ) + { + $error .= "Could not insert board_startdate :: " . $sql . "

"; + } + + $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) + VALUES ('default_lang', '$language')"; + $result = $db->sql_query($sql); + if( !$result ) + { + $error .= "Could not insert default_lang :: " . $sql . "

"; + } + + $sql = "UPDATE " . $table_prefix . "users + SET username = '$admin_name', user_password='" . md5($admin_pass1) . "', user_lang = '" . $language . "' + WHERE username = 'Admin'"; + $result = $db->sql_query($sql); + if( !$result ) + { + $error .= "Could not update admin info :: " . $sql . "

"; + } + + $sql = "UPDATE " . $table_prefix . "users + SET user_regdate = " . time(); + $result = $db->sql_query($sql); + if( !$result ) + { + $error .= "Could not update user_regdate :: " . $sql . "

"; + } + + if( $error != "" ) + { + $error = $db->sql_error(); + + $template->assign_block_vars("error_install", array()); + $template->assign_vars(array( + "L_ERROR_TITLE" => $lang['Installer_Error'], + "L_ERROR" => $lang['Install_db_error'] . '

' . $error) + ); + + $template->pparse('body'); + exit; + } + } + $template->assign_block_vars("common_install", array()); + // + // Write out the config file. + // + $config_data = ''; // Done this to prevent highlighting editors getting confused! + + @umask(0111); + $no_open = FALSE; + $fp = @fopen('config.php', 'w'); + if( !$fp ) + { + // + // Unable to open the file writeable do something here as an attempt + // to get around that... + // + $s_hidden_fields = ''; + $s_hidden_fields .= ''; + if ( $dbms == 'odbc' ) { // // Output the instruction_textions for the odbc... // $template->assign_block_vars("common_install", array()); - - $s_hidden_fields = ''; - - $template->assign_vars(array( - "L_INSTRUCTION_TEXT" => $lang['ODBC_instruction_texts'], - "L_SUBMIT" => $lang['OK'], - - "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_FORM_ACTION" => 'install.'.$phpEx) - ); - exit(); + + $s_hidden_fields .= ''; + $lang['Unwritable_config'] = $lang['ODBC_Instructs'] . '
' . $lang['Unwritable_config']; } - else - { - $error = ""; - // - // Update the default admin user with their information. - // - $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) - VALUES ('board_startdate', " . time() . ")"; - $result = $db->sql_query($sql); - if( !$result ) - { - $error .= "Could not insert board_startdate :: " . $sql . "

"; - } - $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) - VALUES ('default_lang', '$language')"; - $result = $db->sql_query($sql); - if( !$result ) - { - $error .= "Could not insert default_lang :: " . $sql . "

"; - } + $template->assign_vars(array( + "L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'], + "L_SUBMIT" => $lang['Download_config'], - $sql = "UPDATE " . $table_prefix . "users - SET username = '$admin_name', user_password='" . md5($admin_pass1) . "', user_lang = '" . $language . "' - WHERE username = 'Admin'"; - $result = $db->sql_query($sql); - if( !$result ) - { - $error .= "Could not update admin info :: " . $sql . "

"; - } + "S_HIDDEN_FIELDS" => $s_hidden_fields, + "S_FORM_ACTION" => "install.$phpEx") + ); - $sql = "UPDATE " . $table_prefix . "users - SET user_regdate = " . time(); - $result = $db->sql_query($sql); - if( !$result ) - { - $error .= "Could not update user_regdate :: " . $sql . "

"; - } + $template->pparse('body'); + exit(); + } - if( $error != "" ) - { - $error = $db->sql_error(); + $result = @fputs($fp, $config_data, strlen($config_data)); + fclose($fp); - $template->assign_block_vars("error_install", array()); - $template->assign_vars(array( - "L_ERROR_TITLE" => $lang['Installer_Error'], - "L_ERROR" => $lang['Install_db_error'] . '

' . $error) - ); + // + // Ok we are basically done with the install process let's go on + // and let the user configure their board now. + // We are going to do this by calling the admin_board.php from the + // normal board admin section. + // + $s_hidden_fields = ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + $s_hidden_fields .= ''; + if ( $dbms == 'odbc' ) + { + // + // Output the instruction_textions for the odbc... + // + $lang['Inst_Step_2'] = $lang['ODBC_Instructs'] . '
' . $lang['Inst_Step_2']; + } - $template->pparse('body'); - exit; - } + $template->assign_vars(array( + "L_INSTRUCTION_TEXT" => $lang['Inst_Step_2'], + "L_SUBMIT" => $lang['Finish_Install'], - $template->assign_block_vars("common_install", array()); - - // - // Write out the config file. - // - $config_data = ''; // Done this to prevent highlighting editors getting confused! - - @umask(0111); - $no_open = FALSE; - - $fp = @fopen('config.php', 'w'); - - if( !$fp ) - { - // - // Unable to open the file writeable do something here as an attempt - // to get around that... - // - $s_hidden_fields = ''; - $s_hidden_fields .= ''; - - $template->assign_vars(array( - "L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'], - "L_SUBMIT" => $lang['Download_config'], - - "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_FORM_ACTION" => "install.$phpEx") - ); - - $template->pparse('body'); - exit(); - } - - $result = @fputs($fp, $config_data, strlen($config_data)); - fclose($fp); - - // - // Ok we are basically done with the install process let's go on - // and let the user configure their board now. - // We are going to do this by calling the admin_board.php from the - // normal board admin section. - // - $s_hidden_fields = ''; - $s_hidden_fields .= ''; - $s_hidden_fields .= ''; - $s_hidden_fields .= ''; - - $template->assign_vars(array( - "L_INSTRUCTION_TEXT" => $lang['Inst_Step_2'], - "L_SUBMIT" => $lang['Finish_Install'], - - "S_HIDDEN_FIELDS" => $s_hidden_fields, - "S_FORM_ACTION" => "login.$phpEx") - ); - - $template->pparse('body'); - exit(); - } - break; + "S_HIDDEN_FIELDS" => $s_hidden_fields, + "S_FORM_ACTION" => "login.$phpEx") + ); + + $template->pparse('body'); + exit(); } } - -?> \ No newline at end of file +?>