AddConfigurationSetting($Context, 'NOTIFY_SETUP'); } } if (!array_key_exists('NOTIFY_VERSION', $Configuration)) { AddConfigurationSetting($Context, 'NOTIFY_ALLOW_ALL', '1'); AddConfigurationSetting($Context, 'NOTIFY_ALLOW_DISCUSSION', '1'); AddConfigurationSetting($Context, 'NOTIFY_ALLOW_CATEGORY', '1'); AddConfigurationSetting($Context, 'NOTIFY_VERSION', '1.0.0'); if (!mysql_query("ALTER TABLE `" . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Category` ADD `Subscribeable` INT( 1 ) NOT NULL ;", $Context->Database->Connection)) { $Errors = 1; } } if ($Context->Configuration['NOTIFY_VERSION'] < '1.2.0') { AddConfigurationSetting($Context, 'NOTIFY_AUTO_ALL', '0'); $cm = new ConfigurationManager($Context); $cm->GetSettingsFromFile($Configuration['APPLICATION_PATH'] . 'conf/settings.php'); $cm->DefineSetting('NOTIFY_VERSION', '1.2.0'); $cm->SaveSettingsToFile($Configuration['APPLICATION_PATH'] . 'conf/settings.php'); } function CheckNotifySyntax($Context, $Method, $SelectID) { switch ($Method) { case 'ALL': if ($SelectID == 0) { return true; } else { return false; } case 'CATEGORY': if ($SelectID > 0) { $result = mysql_query("SELECT CategoryID FROM " . $Context->Configuration['DATABASE_TABLE_PREFIX'] . "Category WHERE CategoryID = '{$SelectID}'", $Context->Database->Connection);
if (in_array('UseQuickKeys', $UserColumns)) { $AlterSQL = "alter table " . $DatabaseTables['User'] . " drop column UseQuickKeys"; @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);
} } } 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.');