@mysql_query($AlterSQL, $Connection); } } } } // Close the database connection @mysql_close($Connection); } // If the database was upgraded successfully, save all parameters to the conf/database.php file if ($Context->WarningCollector->Count() == 0) { // Save database settings $DBFile = $RootDirectory . 'conf/database.php'; $DBManager = new ConfigurationManager($Context); $DBManager->GetSettingsFromFile($DBFile); // Only make these changes if the settings haven't been defined already if ($DBManager->GetSetting('DATABASE_HOST') == '') { $DBManager->DefineSetting("DATABASE_HOST", $DBHost, 1); $DBManager->DefineSetting("DATABASE_NAME", $DBName, 1); $DBManager->DefineSetting("DATABASE_USER", $DBUser, 1); $DBManager->DefineSetting("DATABASE_PASSWORD", $DBPass, 1); $DBManager->SaveSettingsToFile($DBFile); // Save the general settings as well (now that we know this person is authenticated to // a degree - knowing the database access params). $SettingsFile = $RootDirectory . 'conf/settings.php'; $SettingsManager = new ConfigurationManager($Context); $SettingsManager->DefineSetting('APPLICATION_PATH', $RootDirectory, 1); $SettingsManager->DefineSetting('DATABASE_PATH', $RootDirectory . 'conf/database.php', 1); $SettingsManager->DefineSetting('LIBRARY_PATH', $RootDirectory . 'library/', 1); $SettingsManager->DefineSetting('EXTENSIONS_PATH', $RootDirectory . 'extensions/', 1); $SettingsManager->DefineSetting('LANGUAGES_PATH', $RootDirectory . 'languages/', 1); $SettingsManager->DefineSetting('THEME_PATH', $RootDirectory . 'themes/vanilla/', 1);
} } if ($Context->WarningCollector->Count() == 0) { if ($DBPass == '') { $Context->WarningCollector->Add('Your configuration contains a blank MySQL password, please note that this is a potential security risk, and not supported by Vanilla. Make a note that before you will be able to sign in, you will need to add the following line to conf/settings.php: <code>$Configuration[\'DATABASE_PASSWORD\'] = \'\';</code><p /><a href="' . $WebRoot . 'setup/installer.php?Step=3&PostBackAction=None">Continue installation</a> with these settings, or specify a different account.'); } else { // Redirect to the next step (this is done so that refreshes don't cause steps to be redone) Redirect($WebRoot . 'setup/installer.php?Step=3&PostBackAction=None'); } } } elseif ($PostBackAction == 'User') { $CurrentStep = 3; $SettingsFile = $RootDirectory . 'conf/settings.php'; $SettingsManager = new ConfigurationManager($Context); $SettingsManager->GetSettingsFromFile($SettingsFile); if ($SettingsManager->GetSetting('SETUP_COMPLETE') != '0') { $Context->WarningCollector->Add('Vanilla seems to have been installed already. You will need to remove the conf/settings.php, conf/database.php files, and all database tables in order to run the installer utility again.'); } else { // Validate user inputs if (strip_tags($Username) != $Username) { $Context->WarningCollector->Add('You really shouldn’t have any html into your username.'); } if (strlen($Username) > 20) { $Context->WarningCollector->Add('Your username is too long'); } if ($Password != $ConfirmPassword) { $Context->WarningCollector->Add('The passwords you entered didn’t match.'); } if (strip_tags($ApplicationTitle) != $ApplicationTitle) { $Context->WarningCollector->Add('You can’t have any html in your forum name.'); }