diff --git a/phpBB/install/install.php b/phpBB/install/install.php index 42fac0eae3..ca9c685df8 100644 --- a/phpBB/install/install.php +++ b/phpBB/install/install.php @@ -22,8 +22,9 @@ define('IN_PHPBB', true); // Error reporting level and runtime escaping -//error_reporting (E_ERROR | E_WARNING | E_PARSE); // This will NOT report uninitialized variables -set_magic_quotes_runtime(0); // Disable magic_quotes_runtime +//error_reporting (E_ERROR | E_WARNING | E_PARSE); +set_magic_quotes_runtime(0); + // Include essential scripts $phpbb_root_path = './../'; @@ -33,6 +34,7 @@ include($phpbb_root_path . 'includes/session.'.$phpEx); include($phpbb_root_path . 'includes/acm/acm_file.'.$phpEx); include($phpbb_root_path . 'includes/functions_admin.'.$phpEx); + // Slash data if necessary if (!get_magic_quotes_gpc()) { @@ -41,6 +43,7 @@ if (!get_magic_quotes_gpc()) $_COOKIE = slash_input_data($_POST); } + // Instantiate classes for future use $user = new user(); $auth = new auth(); @@ -50,7 +53,7 @@ $cache = new acm(); // Try opening config file if (@file_exists($phpbb_root_path . 'config.'.$phpEx)) { -// include($phpbb_root_path . 'config.'.$phpEx); + include($phpbb_root_path . 'config.'.$phpEx); if (defined('PHPBB_INSTALLED')) { @@ -62,6 +65,7 @@ if (@file_exists($phpbb_root_path . 'config.'.$phpEx)) // Obtain various vars $stage = (isset($_POST['stage'])) ? intval($_POST['stage']) : 0; +// These are all strings so we'll just traverse an array $var_ary = array('language', 'dbms', 'dbhost', 'dbport', 'dbuser', 'dbpasswd', 'dbname', 'table_prefix', 'admin_name', 'admin_pass1', 'admin_pass2', 'board_email1', 'board_email2', 'server_name', 'server_port', 'script_path', 'ftp_path', 'ftp_user', 'ftp_pass'); foreach ($var_ary as $var) @@ -71,17 +75,15 @@ foreach ($var_ary as $var) // Set some vars +define('ANONYMOUS', 1); + $error = array(); -define('ANONYMOUS', 1); -define('ACL_NO', 0); -define('ACL_YES', 1); - -$default_language = 'en'; -$default_template = 'subSilver'; - -$php_dlls_other = array('zlib', 'mbstring', 'ftp'); +// Other PHP modules we may find useful +//$php_dlls_other = array('zlib', 'mbstring', 'ftp'); +$php_dlls_other = array('zlib', 'ftp'); +// Supported DB layers including relevant details $available_dbms = array( 'firebird' => array( 'LABEL' => 'FireBird', @@ -152,10 +154,9 @@ $available_dbms = array( $suffix = ((defined('PHP_OS')) && (preg_match('#win#i', PHP_OS))) ? 'dll' : 'so'; - - - - +// +// Variables defined ... start program proper +// // Try and load an appropriate language if required @@ -182,59 +183,43 @@ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) } } } + + // No appropriate language found ... so let's use the first one in the language + // dir, this may or may not be English + if (!$language) + { + $dir = @opendir($phpbb_root_path . 'language'); + while ($file = readdir($dir)) + { + $path = $phpbb_root_path . 'language/' . $file; + + if (!is_file($path) && !is_link($path) && file_exists($path . '/iso.txt')) + { + $language = $file; + break; + } + } + } } include($phpbb_root_path . 'language/' . $language . '/lang_main.'.$phpEx); include($phpbb_root_path . 'language/' . $language . '/lang_admin.'.$phpEx); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -// If we're upgrading include that script -if ($upgrade) +// Here we do a number of tests and where appropriate reset the installation level +// depending on the outcome of those tests. It's perhaps a little clunky but +// it means we have a fairly clear and logical path through the installation and +// this source ... well, till I go and fill it with fudge ... damn, dribbled +// on my keyboard +if (isset($_POST['retest'])) { - require('upgrade.' . $phpEx); + $stage = 0; } - - - - - -// Do the installation -if (isset($_POST['install'])) +else if (isset($_POST['testdb'])) +{ + $stage = 1; +} +else if (isset($_POST['install'])) { // Check for missing data $var_ary = array( @@ -254,11 +239,10 @@ if (isset($_POST['install'])) } } - // Check the entered email address and password if ($admin_pass1 != $admin_pass2 && $admin_pass1 != '') { - $error['admin'][] = $lang['PASSWORD_MISMATCH']; + $error['admin'][] = $lang['INSTALL_PASSWORD_MISMATCH']; } if ($board_email1 != $board_email2 && $board_email1 != '') @@ -266,11 +250,10 @@ if (isset($_POST['install'])) $error['admin'][] = $lang['INSTALL_EMAIL_MISMATCH']; } - // Test the database connectivity if (!@extension_loaded($available_dbms[$dbms]['MODULE'])) { - if (!@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'off' || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on' || !@dl($available_dbms[$dbms]['MODULE'] . '.' . $suffix)) + if (!can_load_dll($available_dbms[$dbms]['MODULE'])) { $error['db'][] = 'Cannot load the PHP module for the selected database type'; } @@ -296,14 +279,6 @@ if (isset($_POST['install'])) $stage = 1; } } -else if (isset($_POST['testdb'])) -{ - $stage = 1; -} -else if (isset($_POST['retest'])) -{ - $stage = 0; -} else if (isset($_POST['dldone'])) { // A minor fudge ... we're basically trying to see if the user uploaded @@ -317,37 +292,13 @@ else if (isset($_POST['dldone'])) } - - - - - - - - - - - -// First stage of installation +// Zero stage of installation // // Here we basically imform the user of any potential issues such as no database // support, missing directories, etc. We also give some insight into "missing" // modules which we'd quite like installed (but which are not essential) if ($stage == 0) { - - $user->lang = array_merge($lang, array( - 'DLL_firebird' => 'Firebird 1.5+', - 'DLL_mysql' => 'MySQL 3.23.x', - 'DLL_mysql4' => 'MySQL 4.x', - 'DLL_mssql' => 'MSSQL Server 2000', - 'DLL_mssql-odbc' => 'MSSQL Server 2000 via ODBC', - 'DLL_msaccess' => 'MS Access via ODBC', - 'DLL_oracle' => 'Oracle', - 'DLL_postgres' => 'PostgreSQL 7.x') - ); - - // Test for DB modules $dlls_db = array(); $passed['db'] = false; @@ -357,25 +308,23 @@ if ($stage == 0) if (!extension_loaded($dll)) { - if (!@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'off' || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on' || !@dl($dll . ".$suffix")) + if (!can_load_dll($dll)) { - $dlls_db[$db_name] = '' . 'Unavailable' . ''; + $dlls_db[$db_name] = '' . $lang['UNAVAILABLE'] . ''; continue; } } - $dlls_db[$db_name] = '' . 'Available' . ''; + $dlls_db[$db_name] = '' . $lang['AVAILABLE'] . ''; $passed['db'] = true; } - - // Test for other modules $dlls_other = array(); foreach ($php_dlls_other as $dll) { if (!extension_loaded($dll)) { - if (!@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'off' || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on' || !@dl($dll . ".$suffix")) + if (!can_load_dll($dll)) { $dlls_other[$dll] = '' . 'Unavailable' . ''; continue; @@ -384,21 +333,21 @@ if ($stage == 0) $dlls_other[$dll] = '' . 'Available' . ''; } - inst_page_header($instruction_text, "install.$phpEx"); + inst_page_header(); ?> -
Before proceeding with full installation phpBB will carry out some tests on your server and basic install. Please ensure you read through the results thoroughly and do not proceed until all tests are passed.
+ -You must be running at least PHP 4.1.0 with support for at least one compatible database. If no support modules are shown as available you should contact your hosting provider or review the relevant PHP installation documentation for advice.
+• PHP version >= 4.1.0: | +• : | No'; + echo '' . $lang['NO'] . ''; } else { - echo 'Yes'; + // We also give feedback on whether we're running in safe mode + echo '' . $lang['YES']; if (@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') { - echo ', safe mode'; + echo ', ' . $lang['PHP_SAFE_MODE']; } echo ''; } @@ -421,7 +371,7 @@ if ($stage == 0) ?> |
• Supported Databases: | +• : | 0) ? '|
lang['DLL_' . $dll]; ?> | +
These modules or applications are optional, you do not need these to use phpBB 2.2. However if you do have them they will will enable greater functionality.
+• lang['DLL_' . $dll]; ?>: | +• : | ||
• Imagemagick support: | -Available, ' . $imagemagick . '' : 'Cannot determine location'; ?> | +• : | +' . $lang['AVAILABLE'] . ', ' . $imagemagick . '' : '' . $lang['NO_LOCATION'] . ''; ?> |
: DSN stands for Data Source Name and is relevant only for ODBC installs. |
+ : |
|
+ | - - - |