diff -r 58477ab3937f -r 06db76725891 install.php
--- a/install.php Sat Nov 17 23:09:12 2007 -0500
+++ b/install.php Sat Nov 17 23:30:23 2007 -0500
@@ -148,6 +148,7 @@
$mysql_error = mysql_error();
foreach ( $_POST as $key => $value )
{
+ // FIXME: These should really also be sanitized for double quotes
$value = htmlspecialchars($value);
$key = htmlspecialchars($key);
$post_data .= " \n";
@@ -1544,55 +1545,67 @@
err('Hacking attempt was detected in table_prefix.');
start_install_table();
- // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification.
- // Thus, they need to be run on each retry, e.g. never skipped.
- run_installer_stage('connect', 'Connect to MySQL', 'stg_mysql_connect', 'MySQL denied our attempt to connect to the database. This is most likely because your login information was incorrect. You will most likely need to restart the installation.', false);
- if ( isset($_POST['drop_tables']) )
+
+ // Are we just trying to auto-rename the config files? If so, skip everything else
+ if ( $_GET['stage'] != 'renameconfig' )
{
- // Are we supposed to drop any existing tables? If so, do it now
- run_installer_stage('drop', 'Drop existing Enano tables', 'stg_drop_tables', 'This step never returns failure');
- }
- run_installer_stage('decrypt', 'Decrypt administration password', 'stg_decrypt_admin_pass', 'The administration password you entered couldn\'t be decrypted. It is possible that your server did not properly store the encryption key in the configuration file. Please check the file permissions on config.new.php. You may have to return to the login stage of the installation, clear your browser cache, and then rerun this installation.', false);
- run_installer_stage('genkey', 'Generate ' . AES_BITS . '-bit AES private key', 'stg_generate_aes_key', 'Enano encountered an internal error while generating the site encryption key. Please contact the Enano team for support.', false);
- run_installer_stage('parse', 'Prepare to execute schema file', 'stg_parse_schema', 'Enano encountered an internal error while parsing the SQL file that contains the database structure and initial data. Please contact the Enano team for support.', false);
- run_installer_stage('sql', 'Execute installer schema', 'stg_install', 'The installation failed because an SQL query wasn\'t quite correct. It is possible that you entered malformed data into a form field, or there may be a bug in Enano with your version of MySQL. Please contact the Enano team for support.', false);
- run_installer_stage('writeconfig', 'Write configuration files', 'stg_write_config', 'Enano was unable to write the configuration file with your site\'s database credentials. This is almost always because your configuration file does not have the correct permissions. On Windows servers, you may see this message even if the check on the System Requirements page passed. Temporarily running IIS as the Administrator user may help.');
- // Mainstream installation complete - Enano should be usable now
- // The stage of starting the API is special because it has to be called out of function context.
- // To alleviate this, we have two functions, one that returns success and one that returns failure
- // If the Enano API load is successful, the success function is called to report the action to the user
- // If unsuccessful, the failure report is sent
-
- $template_bak = $template;
-
- $_GET['title'] = 'Main_Page';
- require('includes/common.php');
-
- if ( is_object($db) && is_object($session) )
- {
- run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_success', '...', false);
- }
+ // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification.
+ // Thus, they need to be run on each retry, e.g. never skipped.
+ run_installer_stage('connect', 'Connect to MySQL', 'stg_mysql_connect', 'MySQL denied our attempt to connect to the database. This is most likely because your login information was incorrect. You will most likely need to restart the installation.', false);
+ if ( isset($_POST['drop_tables']) )
+ {
+ // Are we supposed to drop any existing tables? If so, do it now
+ run_installer_stage('drop', 'Drop existing Enano tables', 'stg_drop_tables', 'This step never returns failure');
+ }
+ run_installer_stage('decrypt', 'Decrypt administration password', 'stg_decrypt_admin_pass', 'The administration password you entered couldn\'t be decrypted. It is possible that your server did not properly store the encryption key in the configuration file. Please check the file permissions on config.new.php. You may have to return to the login stage of the installation, clear your browser cache, and then rerun this installation.', false);
+ run_installer_stage('genkey', 'Generate ' . AES_BITS . '-bit AES private key', 'stg_generate_aes_key', 'Enano encountered an internal error while generating the site encryption key. Please contact the Enano team for support.', false);
+ run_installer_stage('parse', 'Prepare to execute schema file', 'stg_parse_schema', 'Enano encountered an internal error while parsing the SQL file that contains the database structure and initial data. Please contact the Enano team for support.', false);
+ run_installer_stage('sql', 'Execute installer schema', 'stg_install', 'The installation failed because an SQL query wasn\'t quite correct. It is possible that you entered malformed data into a form field, or there may be a bug in Enano with your version of MySQL. Please contact the Enano team for support.', false);
+ run_installer_stage('writeconfig', 'Write configuration files', 'stg_write_config', 'Enano was unable to write the configuration file with your site\'s database credentials. This is almost always because your configuration file does not have the correct permissions. On Windows servers, you may see this message even if the check on the System Requirements page passed. Temporarily running IIS as the Administrator user may help.');
+
+ // Mainstream installation complete - Enano should be usable now
+ // The stage of starting the API is special because it has to be called out of function context.
+ // To alleviate this, we have two functions, one that returns success and one that returns failure
+ // If the Enano API load is successful, the success function is called to report the action to the user
+ // If unsuccessful, the failure report is sent
+
+ $template_bak = $template;
+
+ $_GET['title'] = 'Main_Page';
+ require('includes/common.php');
+
+ if ( is_object($db) && is_object($session) )
+ {
+ run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_success', '...', false);
+ }
+ else
+ {
+ run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_failure', 'The Enano API could not be started. This is an error that should never occur; please contact the Enano team for support.', false);
+ }
+
+ // We need to be logged in (with admin rights) before logs can be flushed
+ $admin_password = stg_decrypt_admin_pass(true);
+ $session->login_without_crypto($_POST['admin_user'], $admin_password, false);
+
+ // Now that login cookies are set, initialize the session manager and ACLs
+ $session->start();
+ $paths->init();
+
+ run_installer_stage('initlogs', 'Initialize logs', 'stg_init_logs', 'The session manager denied the request to flush logs for the main page.
+ While under most circumstances you can still finish the installation, you should be aware that some servers cannot
+ properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose
+ to finish the installation, please be aware that you may be unable to log into your site.');
+
+ } // check for stage == renameconfig
else
{
- run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_failure', 'The Enano API could not be started. This is an error that should never occur; please contact the Enano team for support.', false);
+ // If we did skip that step, set $template_bak to $template to imitate the loading of the Enano API
+ $template_bak = $template;
}
-
- // We need to be logged in (with admin rights) before logs can be flushed
- $admin_password = stg_decrypt_admin_pass(true);
- $session->login_without_crypto($_POST['admin_user'], $admin_password, false);
-
- // Now that login cookies are set, initialize the session manager and ACLs
- $session->start();
- $paths->init();
-
- run_installer_stage('initlogs', 'Initialize logs', 'stg_init_logs', 'The session manager denied the request to flush logs for the main page.
- While under most circumstances you can still finish the installation, you should be aware that some servers cannot
- properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose
- to finish the installation, please be aware that you may be unable to log into your site.');
// Final step is to rename the config file
- run_installer_stage('renameconfig', 'Rename configuration files', 'stg_rename_config', 'Enano couldn\'t rename the configuration files to their correct production names. Please perform the following rename operations and then finish the installation.