$page->WarningBox('Connection has not been made to a database server. The step <a href="?step=' . STEP_DBCONNECT . '">' . '<b>' . $steps[STEP_DBCONNECT]['title'] . '</b></a> must be processed first!'); $page->ShowPage(STEP_RUNSQL); } if (!$dbase->IsDatabaseSelected()) { $page->MainTitle($steps[STEP_RUNSQL]['title'], 'sql'); $page->WarningBox('Database has not been selected. The step <a href="?step=' . STEP_DBSELECT . '">' . '<b>' . $steps[STEP_DBSELECT]['title'] . '</b></a> must be processed first!'); $page->ShowPage(STEP_RUNSQL); } // If a request has been made to run SQL installation script on the selected database, // run the script and set installation status to sessions $databaseErrorMessage = ''; if (isset($_REQUEST['runsql']) && $dbase->GetDatabaseName() == $_REQUEST['runsql']) { // Get the installation queries and split them by the "next query" separator, // and then run each query and get an array of results. If there is no split // then the query will be an array with only one cell - still an array :) $results = $dbase->RunQuery($mask->GetSqlInstallQueries(TRUE)); // Go through all the results, and every one of them must be 'true' // othervice some query failed and installation is incomplete! $databaseSuccessCount = 0; $databaseFailedCount = 0; foreach ($results as $result) { if ($result['success']) { $databaseSuccessCount++; } else { $databaseFailedCount++; $databaseErrorMessage .= $result['error'] . "<br />\n"; } } // If some query failed if ($databaseFailedCount == 0) { $state = 'success';
$hash =new PasswordHash(8, true); $final_password = $hash->HashPassword($data['admin_password']); // Create Library Password $keywords['special']['library_password'] = md5('RS' . $data['admin_username'] . $final_password); $keywords['admin']['admin_password'] = $data['admin_password']; $keywords['admin']['admin_hashkey'] = md5( $data['admin_username'].$keywords['admin']['admin_password'].$data['admin_email'] ); $keywords['special']['admin_password_hash'] = $final_password; // Update mask class with the changed keywords $mask->SetKeywords(); // Get the installation queries and split them by the "next query" separator, // and then run each query and get an array of results. If there is no split // then the query will be an array with only one cell - still an array :) $results = $dbase->RunQuery( $mask->GetSqlRootAccessQueries(true), false ); // Go through all the results, and every one of them must be 'true' // otherwise some query failed and installation is incomplete! $databaseErrorMessage = ''; $databaseSuccessCount = 0; $databaseFailedCount = 0; foreach($results as $result) { if($result['success']) $databaseSuccessCount++; else { $databaseFailedCount++; $databaseErrorMessage .= $result['error']."<br />\n";