1542 |
1543 |
1543 if ( !preg_match('/^[a-z0-9_]*$/', $_POST['table_prefix']) ) |
1544 if ( !preg_match('/^[a-z0-9_]*$/', $_POST['table_prefix']) ) |
1544 err('Hacking attempt was detected in table_prefix.'); |
1545 err('Hacking attempt was detected in table_prefix.'); |
1545 |
1546 |
1546 start_install_table(); |
1547 start_install_table(); |
1547 // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification. |
|
1548 // Thus, they need to be run on each retry, e.g. never skipped. |
|
1549 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 <a href="install.php?mode=license">restart the installation</a>.', false); |
|
1550 if ( isset($_POST['drop_tables']) ) |
|
1551 { |
|
1552 // Are we supposed to drop any existing tables? If so, do it now |
|
1553 run_installer_stage('drop', 'Drop existing Enano tables', 'stg_drop_tables', 'This step never returns failure'); |
|
1554 } |
|
1555 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); |
|
1556 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); |
|
1557 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); |
|
1558 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); |
|
1559 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.'); |
|
1560 |
1548 |
1561 // Mainstream installation complete - Enano should be usable now |
1549 // Are we just trying to auto-rename the config files? If so, skip everything else |
1562 // The stage of starting the API is special because it has to be called out of function context. |
1550 if ( $_GET['stage'] != 'renameconfig' ) |
1563 // To alleviate this, we have two functions, one that returns success and one that returns failure |
1551 { |
1564 // If the Enano API load is successful, the success function is called to report the action to the user |
|
1565 // If unsuccessful, the failure report is sent |
|
1566 |
1552 |
1567 $template_bak = $template; |
1553 // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification. |
1568 |
1554 // Thus, they need to be run on each retry, e.g. never skipped. |
1569 $_GET['title'] = 'Main_Page'; |
1555 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 <a href="install.php?mode=license">restart the installation</a>.', false); |
1570 require('includes/common.php'); |
1556 if ( isset($_POST['drop_tables']) ) |
1571 |
1557 { |
1572 if ( is_object($db) && is_object($session) ) |
1558 // Are we supposed to drop any existing tables? If so, do it now |
1573 { |
1559 run_installer_stage('drop', 'Drop existing Enano tables', 'stg_drop_tables', 'This step never returns failure'); |
1574 run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_success', '...', false); |
1560 } |
1575 } |
1561 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); |
|
1562 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); |
|
1563 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); |
|
1564 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); |
|
1565 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.'); |
|
1566 |
|
1567 // Mainstream installation complete - Enano should be usable now |
|
1568 // The stage of starting the API is special because it has to be called out of function context. |
|
1569 // To alleviate this, we have two functions, one that returns success and one that returns failure |
|
1570 // If the Enano API load is successful, the success function is called to report the action to the user |
|
1571 // If unsuccessful, the failure report is sent |
|
1572 |
|
1573 $template_bak = $template; |
|
1574 |
|
1575 $_GET['title'] = 'Main_Page'; |
|
1576 require('includes/common.php'); |
|
1577 |
|
1578 if ( is_object($db) && is_object($session) ) |
|
1579 { |
|
1580 run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_success', '...', false); |
|
1581 } |
|
1582 else |
|
1583 { |
|
1584 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); |
|
1585 } |
|
1586 |
|
1587 // We need to be logged in (with admin rights) before logs can be flushed |
|
1588 $admin_password = stg_decrypt_admin_pass(true); |
|
1589 $session->login_without_crypto($_POST['admin_user'], $admin_password, false); |
|
1590 |
|
1591 // Now that login cookies are set, initialize the session manager and ACLs |
|
1592 $session->start(); |
|
1593 $paths->init(); |
|
1594 |
|
1595 run_installer_stage('initlogs', 'Initialize logs', 'stg_init_logs', '<b>The session manager denied the request to flush logs for the main page.</b><br /> |
|
1596 While under most circumstances you can still <a href="install.php?mode=finish">finish the installation</a>, you should be aware that some servers cannot |
|
1597 properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose |
|
1598 to finish the installation, please be aware that you may be unable to log into your site.'); |
|
1599 |
|
1600 } // check for stage == renameconfig |
1576 else |
1601 else |
1577 { |
1602 { |
1578 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); |
1603 // If we did skip that step, set $template_bak to $template to imitate the loading of the Enano API |
1579 } |
1604 $template_bak = $template; |
1580 |
1605 } |
1581 // We need to be logged in (with admin rights) before logs can be flushed |
|
1582 $admin_password = stg_decrypt_admin_pass(true); |
|
1583 $session->login_without_crypto($_POST['admin_user'], $admin_password, false); |
|
1584 |
|
1585 // Now that login cookies are set, initialize the session manager and ACLs |
|
1586 $session->start(); |
|
1587 $paths->init(); |
|
1588 |
|
1589 run_installer_stage('initlogs', 'Initialize logs', 'stg_init_logs', '<b>The session manager denied the request to flush logs for the main page.</b><br /> |
|
1590 While under most circumstances you can still <a href="install.php?mode=finish">finish the installation</a>, you should be aware that some servers cannot |
|
1591 properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose |
|
1592 to finish the installation, please be aware that you may be unable to log into your site.'); |
|
1593 |
1606 |
1594 // Final step is to rename the config file |
1607 // Final step is to rename the config file |
1595 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 <a href="install.php?mode=finish">finish the installation</a>.<ul><li>Rename config.new.php to config.php</li><li>Rename .htaccess.new to .htaccess (only if you selected Tiny URLs)</li></ul>'); |
1608 run_installer_stage('renameconfig', 'Rename configuration files', 'stg_rename_config', 'Enano couldn\'t rename the configuration files to their correct production names. Please CHMOD the folder where your Enano files are to 777 and click the retry button below, <b><u>or</u></b> perform the following rename operations and then <a href="install.php?mode=finish">finish the installation</a>.<ul><li>Rename config.new.php to config.php</li><li>Rename .htaccess.new to .htaccess (only if you selected Tiny URLs)</li></ul>'); |
1596 |
1609 |
1597 close_install_table(); |
1610 close_install_table(); |
1598 |
1611 |
1599 unset($template); |
1612 unset($template); |
1600 $template =& $template_bak; |
1613 $template =& $template_bak; |