array( 'LABEL' => 'FireBird', 'SCHEMA' => 'firebird', 'MODULE' => 'interbase', 'DELIM' => ';', 'DELIM_BASIC' => ';', 'COMMENTS' => 'remove_remarks' ), 'mysql' => array( 'LABEL' => 'MySQL 3.x', 'SCHEMA' => 'mysql', 'MODULE' => 'mysql', 'DELIM' => ';', 'DELIM_BASIC' => ';', 'COMMENTS' => 'remove_remarks' ), 'mysql4' => array( 'LABEL' => 'MySQL 4.x', 'SCHEMA' => 'mysql', 'MODULE' => 'mysql', 'DELIM' => ';', 'DELIM_BASIC' => ';', 'COMMENTS' => 'remove_remarks' ), 'mssql' => array( 'LABEL' => 'MS SQL Server 7/2000', 'SCHEMA' => 'mssql', 'MODULE' => 'mssql', 'DELIM' => 'GO', 'DELIM_BASIC' => ';', 'COMMENTS' => 'remove_comments' ), 'msaccess' => array( 'LABEL' => 'MS Access [ ODBC ]', 'SCHEMA' => '', 'MODULE' => 'odbc', 'DELIM' => '', 'DELIM_BASIC' => ';', 'COMMENTS' => '' ), 'mssql-odbc'=> array( 'LABEL' => 'MS SQL Server [ ODBC ]', 'SCHEMA' => 'mssql', 'MODULE' => 'odbc', 'DELIM' => 'GO', 'DELIM_BASIC' => ';', 'COMMENTS' => 'remove_comments' ), 'oracle' => array( 'LABEL' => 'Oracle', 'SCHEMA' => 'oracle', 'MODULE' => 'oracle', 'DELIM' => '', 'DELIM_BASIC' => ';', 'COMMENTS' => 'remove_comments' ), 'postgres' => array( 'LABEL' => 'PostgreSQL 7.x', 'SCHEMA' => 'postgres', 'MODULE' => 'pgsql', 'DELIM' => ';', 'DELIM_BASIC' => ';', 'COMMENTS' => 'remove_comments' ), ); $suffix = ((defined('PHP_OS')) && (preg_match('#win#i', PHP_OS))) ? 'dll' : 'so'; // Try and load an appropriate language if required if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) { $accept_lang_ary = explode(',', $_SERVER['HTTP_ACCEPT_LANGUAGE']); foreach ($accept_lang_ary as $accept_lang) { // Set correct format ... guess full xx_YY form $accept_lang = substr($accept_lang, 0, 2) . '_' . strtoupper(substr($accept_lang, 3, 2)); if (file_exists($phpbb_root_path . 'language/' . $accept_lang)) { $language = $accept_lang; break; } else { // No match on xx_YY so try xx $accept_lang = substr($accept_lang, 0, 2); if (file_exists($phpbb_root_path . 'language/' . $accept_lang)) { $language = $accept_lang; 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) { require('upgrade.' . $phpEx); } // Do the installation if (isset($_POST['install'])) { // Check for missing data $var_ary = array( 'admin' => array('admin_name', 'admin_pass1', 'admin_pass2', 'board_email1', 'board_email2'), 'server' => array('server_name', 'server_port', 'script_path') ); foreach ($var_ary as $var_type => $var_block) { foreach ($var_block as $var) { if (!$$var) { $error[$var_type][] = 'You must fill out all fields in this block'; break; } } } // Check the entered email address and password if ($admin_pass1 != $admin_pass2 && $admin_pass1 != '') { $error['admin'][] = $lang['PASSWORD_MISMATCH']; } if ($board_email1 != $board_email2 && $board_email1 != '') { $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)) { $error['db'][] = 'Cannot load the PHP module for the selected database type'; } } // Include the DB layer include($phpbb_root_path . 'includes/db/' . $dbms . '.' . $phpEx); // Instantiate it and set return on error true $db = new sql_db(); $db->sql_return_on_error(true); // Try and connect ... if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false))) { $db_error = $db->sql_error(); $error['db'][] = 'Could not connect to the database, error message returned:' . '
' . (($db_error['message']) ? $db_error['message'] : 'No error message given'); } // No errors so lets do the twist if (sizeof($error)) { $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 // their downloaded config file ... it's not worth IMO trying to // open it and compare all the data. If a user wants to screw up this // simple task ... well ... uhm if (filesize($phpbb_root_path . 'config.'.$phpEx) < 10) { $stage = 3; } } // First 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; foreach ($available_dbms as $db_name => $db_ary) { $dll = $db_ary['MODULE']; 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")) { $dlls_db[$db_name] = '' . 'Unavailable' . ''; continue; } } $dlls_db[$db_name] = '' . '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")) { $dlls_other[$dll] = '' . 'Unavailable' . ''; continue; } } $dlls_other[$dll] = '' . 'Available' . ''; } inst_page_header($instruction_text, "install.$phpEx"); ?>

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.

PHP and Applications

Required

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.

$available) { echo ($i++ > 0) ? '' : ''; ?>
• PHP version >= 4.1.0: No'; } else { echo 'Yes'; if (@ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on') { echo ', safe mode'; } echo ''; } ?>
• Supported Databases:
lang['DLL_' . $dll]; ?>

Optional

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.

$yesno) { // TEMPORARY LANGUAGE STRINGS $user->lang = array_merge($user->lang, array( 'DLL_mbstring' => 'Multi-byte character support', 'DLL_zlib' => 'zlib Compression support', 'DLL_ftp' => 'Remote FTP support') ); ?>
• lang['DLL_' . $dll]; ?>:
• Imagemagick support: Available, ' . $imagemagick . '' : 'Cannot determine location'; ?>

Tests passed' : 'style="color:red">Tests failed'; ?>


Directory and file setup

Required

In order to function correctly phpBB needs to be able to access or write to certain files or directories. If you see "Does not exist" you need to create the relevant file or directory. If you see "Not writeable" you need to change the permissions on the file or directory to allow phpBB to write to it.

Exists' : 'Does not exist'; $write = ($write) ? ', Writeable' : (($exists) ? ', Not writeable' : ''); ?>
• 

Optional

These files, directories or permissions are optional. The installation routines will attempt to use various techniques to complete if they do not exist or cannot be written to. However, the presence of these files, directories or permissions will speed installation.

Exists' : 'Does not exist'; $write = ($write) ? ', Writeable' : (($exists) ? ', Not writeable' : ''); ?>
• 

Tests passed' : 'style="color:red">Tests failed'; ?>


Next stage

  

sql_return_on_error(true); // Try and connect ... if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false))) { $db_error = $db->sql_error(); $error['db'][] = 'Could not connect to the database, error message returned:' . '
' . (($db_error['message']) ? $db_error['message'] : 'No error message given'); } if (!sizeof($error['db'])) { $error['db'][] = 'CONNECTION SUCCESSFULL'; } } $available_dbms_temp = array(); foreach ($available_dbms as $type => $dbms_ary) { if (!extension_loaded($dbms_ary['MODULE'])) { if (!@ini_get('enable_dl') || strtolower(@ini_get('enable_dl')) == 'off' || @ini_get('safe_mode') || strtolower(@ini_get('safe_mode')) == 'on' || !@dl($dbms_ary['MODULE'] . ".$suffix")) { continue; } } $available_dbms_temp[$type] = $dbms_ary; } $available_dbms = &$available_dbms_temp; // Ok we haven't installed before so lets work our way through the various // steps of the install process. This could turn out to be quite a lengty // process. // Step 0 gather the pertinant info for database setup... // Namely dbms, dbhost, dbname, dbuser, and dbpasswd. if (!sizeof($error)) { // Guess at some basic info used for install.. if (!empty($_SERVER['SERVER_NAME']) || !empty($_ENV['SERVER_NAME'])) { $server_name = (!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : $_ENV['SERVER_NAME']; } else if (!empty($_SERVER['HTTP_HOST']) || !empty($_ENV['HTTP_HOST'])) { $server_name = (!empty($_SERVER['HTTP_HOST'])) ? $_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST']; } else { $server_name = ''; } if (!empty($_SERVER['SERVER_PORT']) || !empty($_ENV['SERVER_PORT'])) { $server_port = (!empty($_SERVER['SERVER_PORT'])) ? $_SERVER['SERVER_PORT'] : $_ENV['SERVER_PORT']; } else { $server_port = '80'; } $script_path = preg_replace('#install\/install\.'.$phpEx.'#i', '', $_SERVER['PHP_SELF']); } // Generate list of available DB's $dbms_options = ''; foreach($available_dbms as $dbms_name => $details) { $selected = ($dbms_name == $dbms) ? ' selected="selected"' : ''; $dbms_options .= ''; } $s_hidden_fields = ''; inst_page_header($instruction_text, "install.$phpEx"); ?>
', $error['admin']); ?>
:
:
:
:
:
:
 

', $error['db']); ?>
:
:
DSN stands for Data Source Name and is relevant only for ODBC installs.
:
Leave this blank unless you know the server operates on a non-standard port.
:
:
:
:

Server Configuration
', $error['server']); ?>
:
:
:
'; // Done this to prevent highlighting editors getting confused! // $stage = 3; // Attempt to write out the config directly ... if (is_writeable($phpbb_root_path . 'config.'.$phpEx)) { // Lets jump to the DB setup stage ... if nothing goes wrong below $stage = 3; if (!($fp = @fopen($phpbb_root_path . 'config.'.$phpEx, 'w'))) { // Something went wrong ... so let's try another method $stage = 2; } if (!(@fwrite($fp, $config_data))) { // Something went wrong ... so let's try another method $stage = 2; } @fclose($fp); } if ($stage == 2) { $ignore_ftp = false; // User is trying to upload via FTP ... so let's process it if (isset($_POST['sendftp'])) { if (($conn_id = @ftp_connect('localhost'))) { if (@ftp_login($conn_id, $ftp_user, $ftp_pass)) { // Write out a temp file... $tmp_path = (!@ini_get('safe_mode')) ? false : './' . $config['avatar_path'] . '/tmp'; $filename = tempnam($tmp_path, uniqid(rand()) . 'cfg'); $fp = @fopen($filename, 'w'); @fwrite($fp, $config_data); @fclose($fp); if (@ftp_chdir($conn_id, $ftp_dir)) { // Now ftp it across ... if it works, jump to next stage ... else // we'll offer more options if (@ftp_put($conn_id, 'config.' . $phpEx, $filename, FTP_ASCII)) { $stage = 3; } else { $ignore_ftp = true; } } else { $error['ftp'][] = 'Could not change to the given directory, please check the path.'; } } else { $error['ftp'][] = 'Could not login to ftp server, check your username and password'; } @ftp_quit($conn_id); } } else if (isset($_POST['dlftp'])) { header("Content-Type: text/x-delimtext; name=\"config.$phpEx\""); header("Content-disposition: attachment; filename=config.$phpEx"); echo $config_data; exit; } if ($stage == 2) { inst_page_header($instruction_text, "install.$phpEx"); ?>

Unfortunately phpBB could not write the configuration information directly to your config.php. This may be because the file does not exist or is not writeable. A number of options will be listed below enabling you to complete installation of config.php.

'; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; $s_hidden_fields .= ''; // Can we ftp? If we can then let's offer that option on top of download // We first see if the relevant extension is loaded and then whether a server is // listening on the ftp port if (extension_loaded('ftp') && ($fsock = @fsockopen('localhost', 21, $errno, $errstr, 1)) && !$ignore_ftp) { @fclose($fsock); ?>

Transfer config.php by FTP

phpBB has detected the presence of the ftp module on this server. You may attempt to install your config.php via this if you wish. You will need to supply the information listed below. Remember your username and password are those to your server! (ask your hosting provider for details if you are unsure what these are)

 
', $error['ftp']); ?>
:
This is the path from your root directory to that of phpBB2, e.g. htdocs/phpBB2/
:
:

Download config.php

You may download the complete config.php to your own PC. You will then need to upload the file manually, replacing any existing config.php in your phpBB 2.2 root directory. Please remember to upload the file in ASCII format (see your FTP application documentation if you are unsure how to achieve this). When you have uploaded the config.php please click "Done" to move to the next stage.

  

Retry automatic writing of config.php

If you wish you can change the permissions on config.php to allow phpBB to write to it. Should you wish to do that you can click Retry below to try again. Remember to return the permissions on config.php after phpBB2 has finished installation.

sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false); // Load the appropriate schema and basic data $dbms_schema = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_schema.sql'; $dbms_basic = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_basic.sql'; // How should we treat this schema? $remove_remarks = $available_dbms[$dbms]['COMMENTS'];; $delimiter = $available_dbms[$dbms]['DELIM']; $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; if ($dbms != 'msaccess') { // NOTE: trigger_error does not work here. $db->return_on_error = true; $ignore_tables = array(); // Ok we have the db info go ahead and read in the relevant schema // and work on building the table.. probably ought to provide some // kind of feedback to the user as we are working here in order // to let them know we are actually doing something. $sql_query = @fread(@fopen($dbms_schema, 'r'), @filesize($dbms_schema)); $sql_query = preg_replace('#phpbb_#is', $table_prefix, $sql_query); $sql_query = $remove_remarks($sql_query); $sql_query = split_sql_file($sql_query, $delimiter); $sql_count = count($sql_query); foreach ($sql_query as $sql) { $sql = trim($sql); if (!$db->sql_query($sql)) { $ignore_tables[] = preg_replace('#^CREATE TABLE ([a-z_]+?) .*$#is', '\1', $sql); $error = $db->sql_error(); die($error['message']); } } $ignore_tables = str_replace('\\|', '|', preg_quote(implode('|', $ignore_tables), '#')); // Ok tables have been built, let's fill in the basic information $sql_query = @fread(@fopen($dbms_basic, 'r'), @filesize($dbms_basic)); $sql_query = preg_replace('#phpbb_#', $table_prefix, $sql_query); $sql_query = $remove_remarks($sql_query); $sql_query = split_sql_file($sql_query, $delimiter_basic); $sql_count = count($sql_query); foreach ($sql_query as $sql) { $sql = trim(str_replace('|', ';', $sql)); if ($ignore_tables != '' && preg_match('#' . $ignore_tables . '#i', $sql)) { continue; } if (!$db->sql_query($sql)) { $error = $db->sql_error(); die($error['message']); } } } $current_time = time(); // Set default config and post data $sql_ary = array( 'INSERT INTO ' . $table_prefix . "config (config_name, config_value) VALUES ('board_startdate', $current_time)", 'INSERT INTO ' . $table_prefix . "config (config_name, config_value) VALUES ('default_lang', '" . $db->sql_escape($language) . "')", 'UPDATE ' . $table_prefix . "config SET config_value = '" . $db->sql_escape($server_name) . "' WHERE config_name = 'server_name'", 'UPDATE ' . $table_prefix . "config SET config_value = '" . $db->sql_escape($server_port) . "' WHERE config_name = 'server_port'", 'UPDATE ' . $table_prefix . "config SET config_value = '" . $db->sql_escape($script_path) . "' WHERE config_name = 'script_path'", 'UPDATE ' . $table_prefix . "config SET config_value = '" . $db->sql_escape($board_email) . "' WHERE config_name = 'board_email'", 'UPDATE ' . $table_prefix . "config SET config_value = '" . $db->sql_escape($server_name) . "' WHERE config_name = 'cookie_domain'", 'UPDATE ' . $table_prefix . "config SET config_value = '" . $db->sql_escape($admin_name) . "' WHERE config_name = 'newest_username'", 'UPDATE ' . $table_prefix . "users SET username = '" . $db->sql_escape($admin_name) . "', user_password='" . $db->sql_escape(md5($admin_pass1)) . "', user_lang = '" . $db->sql_escape($language) . "', user_email='" . $db->sql_escape($board_email) . "' WHERE username = 'Admin'", 'UPDATE ' . $table_prefix . "moderator_cache SET username = '" . $db->sql_escape($admin_name) . "' WHERE username = 'Admin'", 'UPDATE ' . $table_prefix . "forums SET forum_last_poster_name = '" . $db->sql_escape($admin_name) . "' WHERE forum_last_poster_name = 'Admin'", 'UPDATE ' . $table_prefix . "topics SET topic_first_poster_name = '" . $db->sql_escape($admin_name) . "', topic_last_poster_name = '" . $db->sql_escape($admin_name) . "' WHERE topic_first_poster_name = 'Admin' OR topic_last_poster_name = 'Admin'", 'UPDATE ' . $table_prefix . "users SET user_regdate = $current_time", 'UPDATE ' . $table_prefix . "posts SET post_time = $current_time", 'UPDATE ' . $table_prefix . "topics SET topic_time = $current_time, topic_last_post_time = $current_time", 'UPDATE ' . $table_prefix . "forums SET forum_last_post_time = $current_time", ); foreach ($sql_ary as $sql) { $sql = trim(str_replace('|', ';', $sql)); if ($ignore_tables != '' && preg_match('#' . $ignore_tables . '#i', $sql)) { continue; } if (!$db->sql_query($sql)) { $error = $db->sql_error(); } } $stage = 4; } // Install completed ... log the user in ... we're done if ($stage == 4) { // Load the basic configuration data define('SESSIONS_TABLE', $table_prefix . 'sessions'); define('USERS_TABLE', $table_prefix . 'users'); $sql = "SELECT * FROM {$table_prefix}config"; $result = $db->sql_query($sql); $config = array(); while ($row = $db->sql_fetchrow($result)) { $config[$row['config_name']] = $row['config_value']; } $db->sql_freeresult($result); $user->start(); $auth->login($admin_name, $admin_pass1); echo $admin_name . " :: ". $admin_pass1 . " :: "; } echo 'HERE'; exit; // addslashes to vars if magic_quotes_gpc is off this is a security precaution // to prevent someone trying to break out of a SQL statement. function slash_input_data(&$data) { if (is_array($data)) { foreach ($data as $k => $v) { $data[$k] = (is_array($v)) ? slash_input_data($v) : addslashes($v); } } return $data; } // Output page -> header function inst_page_header($l_instructions, $s_action) { global $phpEx, $lang; ?> <?php echo $lang['WELCOME_INSTALL']; ?>
phpBB Logo      


footer function inst_page_footer() { global $lang; ?>
$filename) { $selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : ''; $user_select .= ''; } return $user_select; } ?>