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';
//
// Variables defined ... start program proper
//
// 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;
}
}
}
// 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);
// 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']))
{
$stage = 0;
}
else if (isset($_POST['testdb']))
{
$stage = 1;
}
else 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['INSTALL_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 (!can_load_dll($available_dbms[$dbms]['MODULE']))
{
$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['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;
}
}
// 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)
{
// 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 (!can_load_dll($dll))
{
$dlls_db[$db_name] = '' . $lang['UNAVAILABLE'] . '';
continue;
}
}
$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 (!can_load_dll($dll))
{
$dlls_other[$dll] = '' . 'Unavailable' . '';
continue;
}
}
$dlls_other[$dll] = '' . 'Available' . '';
}
inst_page_header();
?>
• : |
' . $lang['NO'] . '';
}
else
{
// 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 ', ' . $lang['PHP_SAFE_MODE'];
}
echo '';
}
?> |
• : |
$available)
{
echo ($i++ > 0) ? '
' : '';
?>
|
|
$yesno)
{
?>
• : |
|
• : |
' . $lang['AVAILABLE'] . ', ' . $imagemagick . '' : '' . $lang['NO_LOCATION'] . ''; ?> |
' . $lang['TESTS_PASSED'] : 'style="color:red">' . $lang['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