1819 } |
1819 } |
1820 function err($t) { global $template; echo $t; $template->footer(); exit; } |
1820 function err($t) { global $template; echo $t; $template->footer(); exit; } |
1821 |
1821 |
1822 // $stages = array('connect', 'decrypt', 'genkey', 'parse', 'sql', 'writeconfig', 'renameconfig', 'startapi', 'initlogs'); |
1822 // $stages = array('connect', 'decrypt', 'genkey', 'parse', 'sql', 'writeconfig', 'renameconfig', 'startapi', 'initlogs'); |
1823 |
1823 |
1824 if ( !preg_match('/^[a-z0-9_]*$/', $_POST['table_prefix']) ) |
1824 if ( !preg_match('/^[a-z0-9_-]*$/', $_POST['table_prefix']) ) |
1825 err('Hacking attempt was detected in table_prefix.'); |
1825 err('Hacking attempt was detected in table_prefix.'); |
1826 |
1826 |
1827 start_install_table(); |
1827 start_install_table(); |
1828 // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification. |
1828 // The stages connect, decrypt, genkey, and parse are preprocessing and don't do any actual data modification. |
1829 // Thus, they need to be run on each retry, e.g. never skipped. |
1829 // Thus, they need to be run on each retry, e.g. never skipped. |
1830 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); |
1830 run_installer_stage('connect', $lang->get('install_stg_connect_title'), 'stg_mysql_connect', $lang->get('install_stg_connect_body'), false); |
1831 if ( isset($_POST['drop_tables']) ) |
1831 if ( isset($_POST['drop_tables']) ) |
1832 { |
1832 { |
1833 // Are we supposed to drop any existing tables? If so, do it now |
1833 // Are we supposed to drop any existing tables? If so, do it now |
1834 run_installer_stage('drop', 'Drop existing Enano tables', 'stg_drop_tables', 'This step never returns failure'); |
1834 run_installer_stage('drop', $lang->get('install_stg_drop_title'), 'stg_drop_tables', 'This step never returns failure'); |
1835 } |
1835 } |
1836 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); |
1836 run_installer_stage('decrypt', $lang->get('install_stg_decrypt_title'), 'stg_decrypt_admin_pass', $lang->get('install_stg_decrypt_body'), false); |
1837 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); |
1837 run_installer_stage('genkey', $lang->get('install_stg_genkey_title', array( 'aes_bits' => AES_BITS )), 'stg_generate_aes_key', $lang->get('install_stg_genkey_body'), false); |
1838 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); |
1838 run_installer_stage('parse', $lang->get('install_stg_parse_title'), 'stg_parse_schema', $lang->get('install_stg_parse_body'), false); |
1839 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); |
1839 run_installer_stage('sql', $lang->get('install_stg_sql_title'), 'stg_install', $lang->get('install_stg_sql_body'), false); |
1840 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.'); |
1840 run_installer_stage('writeconfig', $lang->get('install_stg_writeconfig_title'), 'stg_write_config', $lang->get('install_stg_writeconfig_body')); |
1841 run_installer_stage('renameconfig', 'Rename configuration files', 'stg_rename_config', 'Enano couldn\'t rename the configuration files to their correct production names. On some UNIX systems, you need to CHMOD the directory with your Enano files to 777 in order for this stage to succeed.'); |
1841 run_installer_stage('renameconfig', $lang->get('install_stg_rename_title'), 'stg_rename_config', $lang->get('install_stg_rename_body')); |
1842 |
1842 |
1843 // Mainstream installation complete - Enano should be usable now |
1843 // Mainstream installation complete - Enano should be usable now |
1844 // The stage of starting the API is special because it has to be called out of function context. |
1844 // The stage of starting the API is special because it has to be called out of function context. |
1845 // To alleviate this, we have two functions, one that returns success and one that returns failure |
1845 // To alleviate this, we have two functions, one that returns success and one that returns failure |
1846 // If the Enano API load is successful, the success function is called to report the action to the user |
1846 // If the Enano API init is successful, the success function is called to report the action to the user |
1847 // If unsuccessful, the failure report is sent |
1847 // If unsuccessful, the failure report is sent |
1848 |
1848 |
1849 $template_bak = $template; |
1849 $template_bak = $template; |
1850 |
1850 |
1851 $_GET['title'] = 'Main_Page'; |
1851 $_GET['title'] = 'Main_Page'; |
1852 require('includes/common.php'); |
1852 require('includes/common.php'); |
1853 |
1853 |
1854 if ( is_object($db) && is_object($session) ) |
1854 if ( is_object($db) && is_object($session) ) |
1855 { |
1855 { |
1856 run_installer_stage('startapi', 'Start the Enano API', 'stg_start_api_success', '...', false); |
1856 run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_start_api_success', '...', false); |
1857 } |
1857 } |
1858 else |
1858 else |
1859 { |
1859 { |
1860 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); |
1860 run_installer_stage('startapi', $lang->get('install_stg_startapi_title'), 'stg_start_api_failure', $lang->get('install_stg_startapi_body'), false); |
1861 } |
1861 } |
1862 |
1862 |
1863 // We need to be logged in (with admin rights) before logs can be flushed |
1863 // We need to be logged in (with admin rights) before logs can be flushed |
1864 $admin_password = stg_decrypt_admin_pass(true); |
1864 $admin_password = stg_decrypt_admin_pass(true); |
1865 $session->login_without_crypto($_POST['admin_user'], $admin_password, false); |
1865 $session->login_without_crypto($_POST['admin_user'], $admin_password, false); |
1866 |
1866 |
1867 // Now that login cookies are set, initialize the session manager and ACLs |
1867 // Now that login cookies are set, initialize the session manager and ACLs |
1868 $session->start(); |
1868 $session->start(); |
1869 $paths->init(); |
1869 $paths->init(); |
1870 |
1870 |
1871 run_installer_stage('importlang', 'Import default language', 'stg_import_language', 'Enano couldn\'t import the English language file.'); |
1871 run_installer_stage('importlang', $lang->get('install_stg_importlang_title'), 'stg_import_language', $lang->get('install_stg_importlang_body')); |
1872 |
1872 |
1873 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 /> |
1873 run_installer_stage('initlogs', $lang->get('install_stg_initlogs_title'), 'stg_init_logs', $lang->get('install_stg_initlogs_body')); |
1874 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 |
|
1875 properly set cookies due to limitations with PHP. These limitations are exposed primarily when this issue is encountered during installation. If you choose |
|
1876 to finish the installation, please be aware that you may be unable to log into your site.'); |
|
1877 close_install_table(); |
1874 close_install_table(); |
1878 |
1875 |
1879 unset($template); |
1876 unset($template); |
1880 $template =& $template_bak; |
1877 $template =& $template_bak; |
1881 |
1878 |
1882 echo '<h3>Installation of Enano is complete.</h3><p>Review any warnings above, and then <a href="install.php?mode=finish">click here to finish the installation</a>.'; |
1879 echo '<h3>' . $lang->get('install_msg_complete_title') . '</h3>'; |
|
1880 echo '<p>' . $lang->get('install_msg_complete_body', array('finish_link' => 'install.php?mode=finish')) . '</p>'; |
1883 |
1881 |
1884 // echo '<script type="text/javascript">window.location="'.scriptPath.'/install.php?mode=finish";</script>'; |
1882 // echo '<script type="text/javascript">window.location="'.scriptPath.'/install.php?mode=finish";</script>'; |
1885 |
1883 |
1886 break; |
1884 break; |
1887 case "finish": |
1885 case "finish": |
1888 echo '<h3>Congratulations!</h3> |
1886 echo '<h3>' . $lang->get('finish_msg_congratulations') . '</h3> |
1889 <p>You have finished installing Enano on this server.</p> |
1887 ' . $lang->get('finish_body') . ' |
1890 <h3>Now what?</h3> |
1888 <p>' . $lang->get('finish_link_mainpage', array('mainpage_link' => 'index.php')) . '</p>'; |
1891 <p>Click the link below to see the main page for your website. Where to go from here:</p> |
|
1892 <ul> |
|
1893 <li>The first thing you should do is log into your site using the Log in link on the sidebar.</li> |
|
1894 <li>Go into the Administration panel, expand General, and click General Configuration. There you will be able to configure some basic information about your site.</li> |
|
1895 <li>Visit the <a href="http://enanocms.org/Category:Plugins" onclick="window.open(this.href); return false;">Enano Plugin Gallery</a> to download and use plugins on your site.</li> |
|
1896 <li>Periodically create a backup of your database and filesystem, in case something goes wrong. This should be done at least once a week – more for wiki-based sites.</li> |
|
1897 <li>Hire some moderators, to help you keep rowdy users tame.</li> |
|
1898 <li>Tell the <a href="http://enanocms.org/Contact_us">Enano team</a> what you think.</li> |
|
1899 <li><b>Spread the word about Enano by adding a link to the Enano homepage on your sidebar!</b> You can enable this option in the General Configuration section of the administration panel.</li> |
|
1900 </ul> |
|
1901 <p><a href="index.php">Go to your website...</a></p>'; |
|
1902 break; |
1889 break; |
1903 } |
1890 } |
1904 $template->footer(); |
1891 $template->footer(); |
1905 |
1892 |
1906 ?> |
1893 ?> |