"are you serious?" - "yes, sure" - "wow, install works, you are right" - "i told you"

git-svn-id: file:///svn/phpbb/trunk@9277 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Meik Sievertsen 2009-01-16 17:57:28 +00:00
parent bac6a3c0e2
commit 5a263f76a9
10 changed files with 797 additions and 1310 deletions

View file

@ -1,4 +1,4 @@
<!-- INCLUDE install_header.html --> <!-- INCLUDE install/header.html -->
<!-- IF S_NOT_INSTALLED --> <!-- IF S_NOT_INSTALLED -->
@ -131,4 +131,4 @@
</form> </form>
<!-- ENDIF --> <!-- ENDIF -->
<!-- INCLUDE install_footer.html --> <!-- INCLUDE install/footer.html -->

View file

@ -1,8 +1,8 @@
<!-- INCLUDE install_header.html --> <!-- INCLUDE install/header.html -->
<div class="errorbox"> <div class="errorbox">
<h3>{MESSAGE_TITLE}</h3> <h3>{MESSAGE_TITLE}</h3>
<p>{MESSAGE_TEXT}</p> <p>{MESSAGE_TEXT}</p>
</div> </div>
<!-- INCLUDE install_footer.html --> <!-- INCLUDE install/footer.html -->

View file

@ -0,0 +1,187 @@
<!-- INCLUDE install/header.html -->
<!-- IF S_SUB eq 'intro' -->
<h1>{L_INSTALL_INTRO}</h1>
<p>{L_INSTALL_INTRO_BODY}</p>
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons">
<legend>{L_NEXT_STEP}</legend>
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_NEXT_STEP}" />
</fieldset>
</form>
<!-- ELSEIF S_SUB eq 'requirements' -->
<h1>{L_REQUIREMENTS_TITLE}</h1>
<p>{L_REQUIREMENTS_EXPLAIN}</p>
<!-- INCLUDE install/snippet_checks.html -->
<!-- IF S_FAILED -->
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons">
<legend>{L_INSTALL_TEST}</legend>
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_INSTALL_TEST}" />
</fieldset>
</form>
<!-- ELSE -->
<form id="install_install" method="post" action="{U_ACTION_TEST}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons" style="float: left;">
<legend>{L_INSTALL_TEST}</legend>
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_INSTALL_TEST}" />
</fieldset>
</form>
<form id="install_start" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons" style="float: right;">
<legend>{L_INSTALL_START}</legend>
{S_HIDDEN}
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_INSTALL_START}" />
</fieldset>
</form>
<!-- ENDIF -->
<!-- ELSEIF S_SUB eq 'database' -->
<!-- IF S_CONNECT_TEST -->
<fieldset>
<legend>{L_DB_CONNECTION}</legend>
<!-- IF S_SUCCESS -->
<dl>
<dt>{L_DB_TEST}:</dt>
<dd><strong style="color:green">{L_SUCCESSFUL_CONNECT}</strong></dd>
</dl>
<!-- ELSE -->
<dl>
<dt>{L_DB_TEST}:</dt>
<dd><strong style="color:red">{ERROR}</strong></dd>
</dl>
<!-- ENDIF -->
</fieldset>
<!-- ENDIF -->
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<!-- INCLUDE install/snippet_options.html -->
<fieldset class="submit-buttons">
<legend>{L_NEXT_STEP}</legend>
{S_HIDDEN}
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_NEXT_STEP}" />
</fieldset>
</form>
<!-- ELSEIF S_SUB eq 'administrator' -->
<!-- INCLUDE install/snippet_checks.html -->
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<!-- INCLUDE install/snippet_options.html -->
<fieldset class="submit-buttons">
<legend>{L_NEXT_STEP}</legend>
{S_HIDDEN}
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_NEXT_STEP}" />
</fieldset>
</form>
<!-- ELSEIF S_SUB eq 'config_file' -->
<!-- IF S_WRITTEN -->
<p>{L_CONFIG_FILE_WRITTEN}</p>
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons">
<legend>{L_NEXT_STEP}</legend>
{S_HIDDEN}
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_NEXT_STEP}" />
</fieldset>
</form>
<!-- ELSE -->
<p>{L_CONFIG_FILE_UNABLE_WRITE}</p>
<h1>{L_DL_CONFIG}</h1>
<p>{L_DL_CONFIG_EXPLAIN}</p>
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons">
<legend>{L_DL_CONFIG}</legend>
{S_HIDDEN}
<input class="button1" type="submit" id="dlconfig" name="dlconfig" value="{L_DL_DOWNLOAD}" />&nbsp;<input class="button1" type="submit" id="dldone" name="dldone" value="{L_DONE}" />
</fieldset>
</form>
<!-- ENDIF -->
<!-- ELSEIF S_SUB eq 'advanced' -->
<p>{L_STAGE_ADVANCED_EXPLAIN}</p>
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<!-- INCLUDE install/snippet_options.html -->
<fieldset class="submit-buttons">
<legend>{L_NEXT_STEP}</legend>
{S_HIDDEN}
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_NEXT_STEP}" />
</fieldset>
</form>
<!-- ELSEIF S_SUB eq 'create_table' -->
<p>{L_STAGE_CREATE_TABLE_EXPLAIN}</p>
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons">
<legend>{L_NEXT_STEP}</legend>
{S_HIDDEN}
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_NEXT_STEP}" />
</fieldset>
</form>
<!-- ELSEIF S_SUB eq 'final' -->
<!-- INCLUDE install/snippet_checks.html -->
<h1>{L_INSTALL_CONGRATS}</h1>
<p>{L_BODY}</p>
<form id="install_install" method="post" action="{U_ACTION}" onsubmit="submit.disabled = 'disabled';">
<fieldset class="submit-buttons">
<legend>{L_INSTALL_LOGIN}</legend>
<input class="button1" type="submit" id="submit" onclick="this.className = 'button1 disabled';" name="submit" value="{L_INSTALL_LOGIN}" />
</fieldset>
</form>
<!-- ENDIF -->
<!-- INCLUDE install/footer.html -->

View file

@ -1,6 +1,6 @@
<!-- INCLUDE install_header.html --> <!-- INCLUDE install/header.html -->
<h1>{TITLE}</h1> <h1>{TITLE}</h1>
<p>{BODY}</p> <p>{BODY}</p>
<!-- INCLUDE install_footer.html --> <!-- INCLUDE install/footer.html -->

View file

@ -1,4 +1,4 @@
<!-- INCLUDE install_header.html --> <!-- INCLUDE install/header.html -->
<script type="text/javascript"> <script type="text/javascript">
// <![CDATA[ // <![CDATA[
@ -399,4 +399,4 @@
<!-- ENDIF --> <!-- ENDIF -->
<!-- INCLUDE install_footer.html --> <!-- INCLUDE install/footer.html -->

View file

@ -18,6 +18,9 @@ if (!defined('IN_PHPBB'))
/** /**
* Determine if we are able to load a specified PHP module and do so if possible * Determine if we are able to load a specified PHP module and do so if possible
*
* @param string $dll Name of the DLL without extension. For example 'sqlite'.
* @return bool Returns true of successfully loaded, else false.
*/ */
function can_load_dll($dll) function can_load_dll($dll)
{ {
@ -25,112 +28,72 @@ function can_load_dll($dll)
} }
/** /**
* Returns an array of available DBMS with some data, if a DBMS is specified it will only * Returns an array of available DBMS with some data, if a DBMS is specified it will only return data for that DBMS and will load its extension if necessary.
* return data for that DBMS and will load its extension if necessary. *
*/ */
function get_available_dbms($dbms = false, $return_unavailable = false, $only_20x_options = false) function get_available_dbms($dbms = false, $return_unavailable = false, $only_30x_options = false)
{ {
global $lang;
$available_dbms = array( $available_dbms = array(
'firebird' => array( 'firebird' => array(
'LABEL' => 'FireBird', 'LABEL' => 'FireBird',
'SCHEMA' => 'firebird',
'MODULE' => 'interbase', 'MODULE' => 'interbase',
'DELIM' => ';;',
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'firebird',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '3.0.x' => true,
), ),
'mysqli' => array( 'mysqli' => array(
'LABEL' => 'MySQL with MySQLi Extension', 'LABEL' => 'MySQL with MySQLi Extension',
'SCHEMA' => 'mysql',
'MODULE' => 'mysqli', 'MODULE' => 'mysqli',
'DELIM' => ';',
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysqli', 'DRIVER' => 'mysqli',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '3.0.x' => true,
), ),
'mysql' => array( 'mysql' => array(
'LABEL' => 'MySQL', 'LABEL' => 'MySQL',
'SCHEMA' => 'mysql',
'MODULE' => 'mysql', 'MODULE' => 'mysql',
'DELIM' => ';',
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'mysql',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '3.0.x' => true,
), ),
'mssql' => array( 'mssql' => array(
'LABEL' => 'MS SQL Server 2000+', 'LABEL' => 'MS SQL Server 2000+',
'SCHEMA' => 'mssql',
'MODULE' => 'mssql', 'MODULE' => 'mssql',
'DELIM' => 'GO',
'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '3.0.x' => true,
), ),
'mssql_odbc'=> array( 'mssql_odbc'=> array(
'LABEL' => 'MS SQL Server [ ODBC ]', 'LABEL' => 'MS SQL Server [ ODBC ]',
'SCHEMA' => 'mssql',
'MODULE' => 'odbc', 'MODULE' => 'odbc',
'DELIM' => 'GO',
'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql_odbc',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '3.0.x' => true,
), ),
'mssql_2005'=> array( 'mssql_2005'=> array(
'LABEL' => 'MS SQL Server [ 2005 ]', 'LABEL' => 'MS SQL Server [ 2005 ]',
'SCHEMA' => 'mssql',
'MODULE' => 'sqlsrv', 'MODULE' => 'sqlsrv',
'DELIM' => 'GO',
'COMMENTS' => 'remove_comments',
'DRIVER' => 'mssql_2005',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '3.0.x' => true,
), ),
'db2' => array( 'db2' => array(
'LABEL' => 'IBM DB2', 'LABEL' => 'IBM DB2',
'SCHEMA' => 'db2',
'MODULE' => 'ibm_db2', 'MODULE' => 'ibm_db2',
'DELIM' => ';',
'COMMENTS' => 'remove_comments',
'DRIVER' => 'db2',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '3.0.x' => false,
), ),
'oracle' => array( 'oracle' => array(
'LABEL' => 'Oracle', 'LABEL' => 'Oracle',
'SCHEMA' => 'oracle',
'MODULE' => 'oci8', 'MODULE' => 'oci8',
'DELIM' => '/',
'COMMENTS' => 'remove_comments',
'DRIVER' => 'oracle',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '3.0.x' => true,
), ),
'postgres' => array( 'postgres' => array(
'LABEL' => 'PostgreSQL 7.x/8.x', 'LABEL' => 'PostgreSQL 7.x/8.x',
'SCHEMA' => 'postgres',
'MODULE' => 'pgsql', 'MODULE' => 'pgsql',
'DELIM' => ';',
'COMMENTS' => 'remove_comments',
'DRIVER' => 'postgres',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => true, '3.0.x' => true,
), ),
'sqlite' => array( 'sqlite' => array(
'LABEL' => 'SQLite', 'LABEL' => 'SQLite',
'SCHEMA' => 'sqlite',
'MODULE' => 'sqlite', 'MODULE' => 'sqlite',
'DELIM' => ';',
'COMMENTS' => 'remove_remarks',
'DRIVER' => 'sqlite',
'AVAILABLE' => true, 'AVAILABLE' => true,
'2.0.x' => false, '3.0.x' => true,
), ),
); );
@ -149,7 +112,7 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
// now perform some checks whether they are really available // now perform some checks whether they are really available
foreach ($available_dbms as $db_name => $db_ary) foreach ($available_dbms as $db_name => $db_ary)
{ {
if ($only_20x_options && !$db_ary['2.0.x']) if ($only_30x_options && !$db_ary['3.0.x'])
{ {
if ($return_unavailable) if ($return_unavailable)
{ {
@ -186,23 +149,24 @@ function get_available_dbms($dbms = false, $return_unavailable = false, $only_20
{ {
$available_dbms['ANY_DB_SUPPORT'] = $any_db_support; $available_dbms['ANY_DB_SUPPORT'] = $any_db_support;
} }
return $available_dbms; return $available_dbms;
} }
/** /**
* Generate the drop down of available database options * Generate the drop down of available database options
*/ */
function dbms_select($default = '', $only_20x_options = false) function dbms_select($default = '', $only_30x_options = false)
{ {
global $lang; $available_dbms = get_available_dbms(false, false, $only_30x_options);
$available_dbms = get_available_dbms(false, false, $only_20x_options);
$dbms_options = ''; $dbms_options = '';
foreach ($available_dbms as $dbms_name => $details) foreach ($available_dbms as $dbms_name => $details)
{ {
$selected = ($dbms_name == $default) ? ' selected="selected"' : ''; $selected = ($dbms_name == $default) ? ' selected="selected"' : '';
$dbms_options .= '<option value="' . $dbms_name . '"' . $selected .'>' . $lang['DLL_' . strtoupper($dbms_name)] . '</option>'; $dbms_options .= '<option value="' . $dbms_name . '"' . $selected .'>' . phpbb::$user->lang['DLL_' . strtoupper($dbms_name)] . '</option>';
} }
return $dbms_options; return $dbms_options;
} }
@ -275,34 +239,26 @@ function get_tables($db)
* @param array $dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()} * @param array $dbms should be of the format of an element of the array returned by {@link get_available_dbms get_available_dbms()}
* necessary extensions should be loaded already * necessary extensions should be loaded already
*/ */
function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $load_dbal = true, $unicode_check = true) function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix, $dbhost, $dbuser, $dbpasswd, $dbname, $dbport, $prefix_may_exist = false, $unicode_check = true)
{ {
global $lang;
$dbms = $dbms_details['DRIVER']; $dbms = $dbms_details['DRIVER'];
if ($load_dbal) phpbb::assign('checkdb', phpbb_db_dbal::new_instance($dbms));
{ $db = phpbb::get_instance('checkdb');
// Include the DB layer
include(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT);
}
// Instantiate it and set return on error true
$sql_db = 'dbal_' . $dbms;
$db = new $sql_db();
$db->sql_return_on_error(true); $db->sql_return_on_error(true);
// Check that we actually have a database name before going any further..... // Check that we actually have a database name before going any further.....
if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '') if ($dbms_details['DRIVER'] != 'sqlite' && $dbms_details['DRIVER'] != 'oracle' && $dbname === '')
{ {
$error[] = $lang['INST_ERR_DB_NO_NAME']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_NAME'];
return false; return false;
} }
// Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea // Make sure we don't have a daft user who thinks having the SQLite database in the forum directory is a good idea
if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb_realpath($dbhost), phpbb_realpath('../')) === 0) if ($dbms_details['DRIVER'] == 'sqlite' && stripos(phpbb::$url->realpath($dbhost), phpbb::$url->realpath('../')) === 0)
{ {
$error[] = $lang['INST_ERR_DB_FORUM_PATH']; $error[] = phpbb::$user->lang['INST_ERR_DB_FORUM_PATH'];
return false; return false;
} }
@ -313,7 +269,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
case 'mysqli': case 'mysqli':
if (strspn($table_prefix, '-./\\') !== 0) if (strspn($table_prefix, '-./\\') !== 0)
{ {
$error[] = $lang['INST_ERR_PREFIX_INVALID']; $error[] = phpbb::$user->lang['INST_ERR_PREFIX_INVALID'];
return false; return false;
} }
@ -345,7 +301,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (strlen($table_prefix) > $prefix_length) if (strlen($table_prefix) > $prefix_length)
{ {
$error[] = sprintf($lang['INST_ERR_PREFIX_TOO_LONG'], $prefix_length); $error[] = phpbb::$user->lang('INST_ERR_PREFIX_TOO_LONG', $prefix_length);
return false; return false;
} }
@ -353,7 +309,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true))) if (is_array($db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, true)))
{ {
$db_error = $db->sql_error(); $db_error = $db->sql_error();
$error[] = $lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : $lang['INST_ERR_DB_NO_ERROR']); $error[] = phpbb::$user->lang['INST_ERR_DB_CONNECT'] . '<br />' . (($db_error['message']) ? $db_error['message'] : phpbb::$user->lang['INST_ERR_DB_NO_ERROR']);
} }
else else
{ {
@ -369,7 +325,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (sizeof($table_intersect)) if (sizeof($table_intersect))
{ {
$error[] = $lang['INST_ERR_PREFIX']; $error[] = phpbb::$user->lang['INST_ERR_PREFIX'];
} }
} }
@ -377,23 +333,23 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
switch ($dbms_details['DRIVER']) switch ($dbms_details['DRIVER'])
{ {
case 'mysql': case 'mysql':
if (version_compare(mysql_get_server_info($db->db_connect_id), '4.1.3', '<')) if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
{ {
$error[] = $lang['INST_ERR_DB_NO_MYSQL']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQL'];
} }
break; break;
case 'mysqli': case 'mysqli':
if (version_compare(mysqli_get_server_info($db->db_connect_id), '4.1.3', '<')) if (version_compare($db->sql_server_info(true), '4.1.3', '<'))
{ {
$error[] = $lang['INST_ERR_DB_NO_MYSQLI']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_MYSQLI'];
} }
break; break;
case 'sqlite': case 'sqlite':
if (version_compare(sqlite_libversion(), '2.8.2', '<')) if (version_compare($db->sql_server_info(true), '2.8.2', '<'))
{ {
$error[] = $lang['INST_ERR_DB_NO_SQLITE']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_SQLITE'];
} }
break; break;
@ -405,7 +361,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
preg_match('#V([\d.]+)#', $val, $match); preg_match('#V([\d.]+)#', $val, $match);
if ($match[1] < 2) if ($match[1] < 2)
{ {
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
} }
$db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES); $db_info = @ibase_db_info($db->service_handle, $dbname, IBASE_STS_HDR_PAGES);
@ -413,7 +369,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
$page_size = intval($regs[1]); $page_size = intval($regs[1]);
if ($page_size < 8192) if ($page_size < 8192)
{ {
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS'];
} }
} }
else else
@ -429,7 +385,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
// if its a UDF, its too old // if its a UDF, its too old
if ($row) if ($row)
{ {
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
} }
else else
{ {
@ -438,7 +394,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
$result = $db->sql_query($sql); $result = $db->sql_query($sql);
if (!$result) // This can only fail if char_length is not defined if (!$result) // This can only fail if char_length is not defined
{ {
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD'];
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }
@ -467,7 +423,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (ibase_errmsg() !== false) if (ibase_errmsg() !== false)
{ {
$error[] = $lang['INST_ERR_DB_NO_FIREBIRD_PS']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_FIREBIRD_PS'];
} }
// Kill the old table // Kill the old table
@ -494,12 +450,12 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<')) if (version_compare($stats['NLS_RDBMS_VERSION'], '9.2', '<'))
{ {
$error[] = $lang['INST_ERR_DB_NO_ORACLE']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE'];
} }
if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8') if ($stats['NLS_CHARACTERSET'] !== 'AL32UTF8')
{ {
$error[] = $lang['INST_ERR_DB_NO_ORACLE_NLS']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_ORACLE_NLS'];
} }
} }
break; break;
@ -514,7 +470,7 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8') if ($row['server_encoding'] !== 'UNICODE' && $row['server_encoding'] !== 'UTF8')
{ {
$error[] = $lang['INST_ERR_DB_NO_POSTGRES']; $error[] = phpbb::$user->lang['INST_ERR_DB_NO_POSTGRES'];
} }
} }
break; break;
@ -529,47 +485,4 @@ function connect_check_db($error_connect, &$error, $dbms_details, $table_prefix,
return false; return false;
} }
/**
* remove_remarks will strip the sql comment lines out of an uploaded sql file
*/
function remove_remarks(&$sql)
{
$sql = preg_replace('/\n{2,}/', "\n", preg_replace('/^#.*$/m', "\n", $sql));
}
/**
* split_sql_file will split an uploaded sql file into single sql statements.
* Note: expects trim() to have already been run on $sql.
*/
function split_sql_file($sql, $delimiter)
{
$sql = str_replace("\r" , '', $sql);
$data = preg_split('/' . preg_quote($delimiter, '/') . '$/m', $sql);
$data = array_map('trim', $data);
// The empty case
$end_data = end($data);
if (empty($end_data))
{
unset($data[key($data)]);
}
return $data;
}
/**
* For replacing {L_*} strings with preg_replace_callback
*/
function adjust_language_keys_callback($matches)
{
if (!empty($matches[1]))
{
global $lang, $db;
return (!empty($lang[$matches[1]])) ? $db->sql_escape($lang[$matches[1]]) : $db->sql_escape($matches[1]);
}
}
?> ?>

View file

@ -18,109 +18,17 @@ define('IN_INSTALL', true);
if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../'); if (!defined('PHPBB_ROOT_PATH')) define('PHPBB_ROOT_PATH', './../');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1)); if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
// Report all errors, except notices // Include bootstrap
error_reporting(E_ALL ^ E_NOTICE); include PHPBB_ROOT_PATH . 'includes/core/bootstrap.' . PHP_EXT;
// @todo Review this test and see if we can find out what it is which prevents PHP 4.2.x from even displaying the page with requirements on it // Includes functions for the installer
if (version_compare(PHP_VERSION, '5.2.0') < 0) require PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT;
{
die('You are running an unsupported PHP version. Please upgrade to PHP 5.2.0 or higher before trying to install phpBB 3.0');
}
/* // Set time limit to 0
* Remove variables created by register_globals from the global scope
* Thanks to Matt Kavanagh
*/
function deregister_globals()
{
$not_unset = array(
'GLOBALS' => true,
'_GET' => true,
'_POST' => true,
'_COOKIE' => true,
'_REQUEST' => true,
'_SERVER' => true,
'_SESSION' => true,
'_ENV' => true,
'_FILES' => true,
'phpEx' => true,
'phpbb_root_path' => true
);
// Not only will array_merge and array_keys give a warning if
// a parameter is not an array, array_merge will actually fail.
// So we check if _SESSION has been initialised.
if (!isset($_SESSION) || !is_array($_SESSION))
{
$_SESSION = array();
}
// Merge all into one extremely huge array; unset this later
$input = array_merge(
array_keys($_GET),
array_keys($_POST),
array_keys($_COOKIE),
array_keys($_SERVER),
array_keys($_SESSION),
array_keys($_ENV),
array_keys($_FILES)
);
foreach ($input as $varname)
{
if (isset($not_unset[$varname]))
{
// Hacking attempt. No point in continuing unless it's a COOKIE
if ($varname !== 'GLOBALS' || isset($_GET['GLOBALS']) || isset($_POST['GLOBALS']) || isset($_SERVER['GLOBALS']) || isset($_SESSION['GLOBALS']) || isset($_ENV['GLOBALS']) || isset($_FILES['GLOBALS']))
{
exit;
}
else
{
$cookie = &$_COOKIE;
while (isset($cookie['GLOBALS']))
{
foreach ($cookie['GLOBALS'] as $registered_var => $value)
{
if (!isset($not_unset[$registered_var]))
{
unset($GLOBALS[$registered_var]);
}
}
$cookie = &$cookie['GLOBALS'];
}
}
}
unset($GLOBALS[$varname]);
}
unset($input);
}
// If we are on PHP >= 6.0.0 we do not need some code
if (version_compare(PHP_VERSION, '6.0.0-dev', '>='))
{
/**
* @ignore
*/
define('STRIP', false);
}
else
{
@set_magic_quotes_runtime(0);
// Be paranoid with passed vars
if (@ini_get('register_globals') == '1' || strtolower(@ini_get('register_globals')) == 'on')
{
deregister_globals();
}
define('STRIP', (get_magic_quotes_gpc()) ? true : false);
}
// Try to override some limits - maybe it helps some...
@set_time_limit(0); @set_time_limit(0);
/**
* @todo get memory limit and display notice if it is too low for a conversion (only within conversion)
$mem_limit = @ini_get('memory_limit'); $mem_limit = @ini_get('memory_limit');
if (!empty($mem_limit)) if (!empty($mem_limit))
{ {
@ -146,25 +54,9 @@ else
$mem_limit = '128M'; $mem_limit = '128M';
} }
@ini_set('memory_limit', $mem_limit); @ini_set('memory_limit', $mem_limit);
*/
// Include essential scripts /* Try and load an appropriate language if required
require(PHPBB_ROOT_PATH . 'includes/functions.' . PHP_EXT);
if (file_exists(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT))
{
require(PHPBB_ROOT_PATH . 'includes/functions_content.' . PHP_EXT);
}
include(PHPBB_ROOT_PATH . 'includes/auth.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/session.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/template.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/acm/acm_file.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/cache.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/functions_admin.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'includes/utf/utf_tools.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/functions_install.' . PHP_EXT);
// Try and load an appropriate language if required
$language = basename(request_var('language', '')); $language = basename(request_var('language', ''));
if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language) if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !$language)
@ -230,7 +122,26 @@ include(PHPBB_ROOT_PATH . 'language/' . $language . '/acp/board.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'language/' . $language . '/install.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'language/' . $language . '/install.' . PHP_EXT);
include(PHPBB_ROOT_PATH . 'language/' . $language . '/posting.' . PHP_EXT); include(PHPBB_ROOT_PATH . 'language/' . $language . '/posting.' . PHP_EXT);
// usually we would need every single constant here - and it would be consistent. For 3.0.x, use a dirty hack... :( */
// Initialize some common config variables
phpbb::$config += array(
'load_tplcompile' => true,
'cookie_name' => '',
);
// Register the template and the user object
phpbb::register('template');
phpbb::register('user', false, false, 'db', PHPBB_ROOT_PATH . 'language/');
// Init "loose" user session
phpbb::$user->session_begin();
// Now set users language
phpbb::$user->set_language(request_var('language', ''));
// And also add the install language file
phpbb::$user->add_lang('install');
$mode = request_var('mode', 'overview'); $mode = request_var('mode', 'overview');
$sub = request_var('sub', ''); $sub = request_var('sub', '');
@ -238,15 +149,8 @@ $sub = request_var('sub', '');
// Set PHP error handler to ours // Set PHP error handler to ours
set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler'); set_error_handler(defined('PHPBB_MSG_HANDLER') ? PHPBB_MSG_HANDLER : 'msg_handler');
$user = new user(); phpbb::$template->set_custom_template('../adm/style', 'admin');
$auth = new auth(); phpbb::$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
$template = new template();
// Set some standard variables we want to force
phpbb::$config['load_tplcompile'] = '1';
$template->set_custom_template('../adm/style', 'admin');
$template->assign_var('T_TEMPLATE_PATH', '../adm/style');
$install = new module(); $install = new module();
@ -257,7 +161,7 @@ $install->load();
$install->page_header(); $install->page_header();
$install->generate_navigation(); $install->generate_navigation();
$template->set_filenames(array( phpbb::$template->set_filenames(array(
'body' => $install->get_tpl_name()) 'body' => $install->get_tpl_name())
); );
@ -282,8 +186,6 @@ class module
*/ */
function create($module_type, $module_url, $selected_mod = false, $selected_submod = false) function create($module_type, $module_url, $selected_mod = false, $selected_submod = false)
{ {
global $db;
$module = array(); $module = array();
// Grab module information using Bart's "neat-o-module" system (tm) // Grab module information using Bart's "neat-o-module" system (tm)
@ -393,22 +295,18 @@ class module
} }
define('HEADER_INC', true); define('HEADER_INC', true);
global $template, $lang, $stage; global $stage;
$template->assign_vars(array( phpbb::$template->assign_vars(array(
'L_CHANGE' => $lang['CHANGE'],
'L_INSTALL_PANEL' => $lang['INSTALL_PANEL'],
'L_SELECT_LANG' => $lang['SELECT_LANG'],
'L_SKIP' => $lang['SKIP'],
'PAGE_TITLE' => $this->get_page_title(), 'PAGE_TITLE' => $this->get_page_title(),
'T_IMAGE_PATH' => PHPBB_ROOT_PATH . 'adm/images/', 'T_IMAGE_PATH' => PHPBB_ROOT_PATH . 'adm/images/',
'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_DIRECTION' => phpbb::$user->lang['DIRECTION'],
'S_CONTENT_FLOW_BEGIN' => ($lang['DIRECTION'] == 'ltr') ? 'left' : 'right', 'S_CONTENT_FLOW_BEGIN' => (phpbb::$user->lang['DIRECTION'] == 'ltr') ? 'left' : 'right',
'S_CONTENT_FLOW_END' => ($lang['DIRECTION'] == 'ltr') ? 'right' : 'left', 'S_CONTENT_FLOW_END' => (phpbb::$user->lang['DIRECTION'] == 'ltr') ? 'right' : 'left',
'S_CONTENT_ENCODING' => 'UTF-8', 'S_CONTENT_ENCODING' => 'UTF-8',
'S_USER_LANG' => $lang['USER_LANG'], 'S_USER_LANG' => phpbb::$user->lang['USER_LANG'],
) )
); );
@ -425,14 +323,12 @@ class module
*/ */
function page_footer() function page_footer()
{ {
global $db, $template; phpbb::$template->display('body');
$template->display('body');
// Close our DB connection. // Close our DB connection.
if (!empty($db) && is_object($db)) if (phpbb::registered('db'))
{ {
$db->sql_close(); phpbb::$db->sql_close();
} }
if (function_exists('exit_handler')) if (function_exists('exit_handler'))
@ -454,52 +350,12 @@ class module
*/ */
function get_page_title() function get_page_title()
{ {
global $lang;
if (!isset($this->module->page_title)) if (!isset($this->module->page_title))
{ {
return ''; return '';
} }
return (isset($lang[$this->module->page_title])) ? $lang[$this->module->page_title] : $this->module->page_title; return (isset(phpbb::$user->lang[$this->module->page_title])) ? phpbb::$user->lang[$this->module->page_title] : $this->module->page_title;
}
/**
* Generate an HTTP/1.1 header to redirect the user to another page
* This is used during the installation when we do not have a database available to call the normal redirect function
* @param string $page The page to redirect to relative to the installer root path
*/
function redirect($page)
{
// HTTP_HOST is having the correct browser url in most cases...
$server_name = (!empty($_SERVER['HTTP_HOST'])) ? strtolower($_SERVER['HTTP_HOST']) : ((!empty($_SERVER['SERVER_NAME'])) ? $_SERVER['SERVER_NAME'] : getenv('SERVER_NAME'));
$server_port = (!empty($_SERVER['SERVER_PORT'])) ? (int) $_SERVER['SERVER_PORT'] : (int) getenv('SERVER_PORT');
$secure = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') ? 1 : 0;
$script_name = (!empty($_SERVER['PHP_SELF'])) ? $_SERVER['PHP_SELF'] : getenv('PHP_SELF');
if (!$script_name)
{
$script_name = (!empty($_SERVER['REQUEST_URI'])) ? $_SERVER['REQUEST_URI'] : getenv('REQUEST_URI');
}
// Replace backslashes and doubled slashes (could happen on some proxy setups)
$script_name = str_replace(array('\\', '//'), '/', $script_name);
$script_path = trim(dirname($script_name));
$url = (($secure) ? 'https://' : 'http://') . $server_name;
if ($server_port && (($secure && $server_port <> 443) || (!$secure && $server_port <> 80)))
{
// HTTP HOST can carry a port number...
if (strpos($server_name, ':') === false)
{
$url .= ':' . $server_port;
}
}
$url .= $script_path . '/' . $page;
header('Location: ' . $url);
exit;
} }
/** /**
@ -507,8 +363,6 @@ class module
*/ */
function generate_navigation() function generate_navigation()
{ {
global $lang, $template, $language;
if (is_array($this->module_ary)) if (is_array($this->module_ary))
{ {
@ksort($this->module_ary); @ksort($this->module_ary);
@ -517,11 +371,11 @@ class module
$cat = $cat_ary['name']; $cat = $cat_ary['name'];
$l_cat = (!empty($lang['CAT_' . $cat])) ? $lang['CAT_' . $cat] : preg_replace('#_#', ' ', $cat); $l_cat = (!empty($lang['CAT_' . $cat])) ? $lang['CAT_' . $cat] : preg_replace('#_#', ' ', $cat);
$cat = strtolower($cat); $cat = strtolower($cat);
$url = $this->module_url . "?mode=$cat&amp;language=$language"; $url = $this->module_url . "?mode=$cat&amp;language=" . phpbb::$user->lang_name;
if ($this->mode == $cat) if ($this->mode == $cat)
{ {
$template->assign_block_vars('t_block1', array( phpbb::$template->assign_block_vars('t_block1', array(
'L_TITLE' => $l_cat, 'L_TITLE' => $l_cat,
'S_SELECTED' => true, 'S_SELECTED' => true,
'U_TITLE' => $url, 'U_TITLE' => $url,
@ -532,11 +386,11 @@ class module
$subs = $this->module_ary[$this->id]['subs']; $subs = $this->module_ary[$this->id]['subs'];
foreach ($subs as $option) foreach ($subs as $option)
{ {
$l_option = (!empty($lang['SUB_' . $option])) ? $lang['SUB_' . $option] : preg_replace('#_#', ' ', $option); $l_option = (!empty(phpbb::$user->lang['SUB_' . $option])) ? phpbb::$user->lang['SUB_' . $option] : preg_replace('#_#', ' ', $option);
$option = strtolower($option); $option = strtolower($option);
$url = $this->module_url . '?mode=' . $this->mode . "&amp;sub=$option&amp;language=$language"; $url = $this->module_url . '?mode=' . $this->mode . "&amp;sub=$option&amp;language=" . phpbb::$user->lang_name;
$template->assign_block_vars('l_block1', array( phpbb::$template->assign_block_vars('l_block1', array(
'L_TITLE' => $l_option, 'L_TITLE' => $l_option,
'S_SELECTED' => ($this->sub == $option), 'S_SELECTED' => ($this->sub == $option),
'U_TITLE' => $url, 'U_TITLE' => $url,
@ -550,11 +404,11 @@ class module
$matched = false; $matched = false;
foreach ($subs as $option) foreach ($subs as $option)
{ {
$l_option = (!empty($lang['STAGE_' . $option])) ? $lang['STAGE_' . $option] : preg_replace('#_#', ' ', $option); $l_option = (!empty(phpbb::$user->lang['STAGE_' . $option])) ? phpbb::$user->lang['STAGE_' . $option] : preg_replace('#_#', ' ', $option);
$option = strtolower($option); $option = strtolower($option);
$matched = ($this->sub == $option) ? true : $matched; $matched = ($this->sub == $option) ? true : $matched;
$template->assign_block_vars('l_block2', array( phpbb::$template->assign_block_vars('l_block2', array(
'L_TITLE' => $l_option, 'L_TITLE' => $l_option,
'S_SELECTED' => ($this->sub == $option), 'S_SELECTED' => ($this->sub == $option),
'S_COMPLETE' => !$matched, 'S_COMPLETE' => !$matched,
@ -564,7 +418,7 @@ class module
} }
else else
{ {
$template->assign_block_vars('t_block1', array( phpbb::$template->assign_block_vars('t_block1', array(
'L_TITLE' => $l_cat, 'L_TITLE' => $l_cat,
'S_SELECTED' => false, 'S_SELECTED' => false,
'U_TITLE' => $url, 'U_TITLE' => $url,
@ -578,106 +432,38 @@ class module
* Output an error message * Output an error message
* If skip is true, return and continue execution, else exit * If skip is true, return and continue execution, else exit
*/ */
function error($error, $line, $file, $skip = false) function error($error, $line, $file)
{ {
global $lang, $db, $template; phpbb::$template->assign_block_vars('checks', array(
'S_LEGEND' => true,
'LEGEND' => phpbb::$user->lang['INST_ERR'],
));
if ($skip) phpbb::$template->assign_block_vars('checks', array(
{ 'TITLE' => basename($file) . ' [ ' . $line . ' ]',
$template->assign_block_vars('checks', array( 'RESULT' => '<b style="color:red">' . $error . '</b>',
'S_LEGEND' => true, ));
'LEGEND' => $lang['INST_ERR'],
));
$template->assign_block_vars('checks', array( return;
'TITLE' => basename($file) . ' [ ' . $line . ' ]',
'RESULT' => '<b style="color:red">' . $error . '</b>',
));
return;
}
echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">';
echo '<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">';
echo '<head>';
echo '<meta http-equiv="content-type" content="text/html; charset=utf-8" />';
echo '<title>' . $lang['INST_ERR_FATAL'] . '</title>';
echo '<link href="../adm/style/admin.css" rel="stylesheet" type="text/css" media="screen" />';
echo '</head>';
echo '<body id="errorpage">';
echo '<div id="wrap">';
echo ' <div id="page-header">';
echo ' </div>';
echo ' <div id="page-body">';
echo ' <div id="acp">';
echo ' <div class="panel">';
echo ' <span class="corners-top"><span></span></span>';
echo ' <div id="content">';
echo ' <h1>' . $lang['INST_ERR_FATAL'] . '</h1>';
echo ' <p>' . $lang['INST_ERR_FATAL'] . "</p>\n";
echo ' <p>' . basename($file) . ' [ ' . $line . " ]</p>\n";
echo ' <p><b>' . $error . "</b></p>\n";
echo ' </div>';
echo ' <span class="corners-bottom"><span></span></span>';
echo ' </div>';
echo ' </div>';
echo ' </div>';
echo ' <div id="page-footer">';
echo ' Powered by phpBB &copy; 2000, 2002, 2005, 2007 <a href="http://www.phpbb.com/">phpBB Group</a>';
echo ' </div>';
echo '</div>';
echo '</body>';
echo '</html>';
if (!empty($db) && is_object($db))
{
$db->sql_close();
}
exit_handler();
} }
/** /**
* Output an error message for a database related problem * Output an error message for a database related problem
* If skip is true, return and continue execution, else exit * If skip is true, return and continue execution, else exit
*/ */
function db_error($error, $sql, $line, $file, $skip = false) function db_error($error, $sql, $line, $file)
{ {
global $lang, $db, $template; phpbb::$template->assign_block_vars('checks', array(
'S_LEGEND' => true,
if ($skip) 'LEGEND' => phpbb::$user->lang['INST_ERR_FATAL'],
{
$template->assign_block_vars('checks', array(
'S_LEGEND' => true,
'LEGEND' => $lang['INST_ERR_FATAL'],
));
$template->assign_block_vars('checks', array(
'TITLE' => basename($file) . ' [ ' . $line . ' ]',
'RESULT' => '<b style="color:red">' . $error . '</b><br />&#187; SQL:' . $sql,
));
return;
}
$template->set_filenames(array(
'body' => 'install_error.html')
);
$this->page_header();
$this->generate_navigation();
$template->assign_vars(array(
'MESSAGE_TITLE' => $lang['INST_ERR_FATAL_DB'],
'MESSAGE_TEXT' => '<p>' . basename($file) . ' [ ' . $line . ' ]</p><p>SQL : ' . $sql . '</p><p><b>' . $error . '</b></p>',
)); ));
// Rollback if in transaction phpbb::$template->assign_block_vars('checks', array(
if ($db->transaction) 'TITLE' => basename($file) . ' [ ' . $line . ' ]',
{ 'RESULT' => '<b style="color:red">' . $error . '</b><br />&#187; SQL:' . $sql,
$db->sql_transaction('rollback'); ));
}
$this->page_footer(); return;
} }
/** /**
@ -685,7 +471,6 @@ class module
*/ */
function input_field($name, $type, $value='', $options='') function input_field($name, $type, $value='', $options='')
{ {
global $lang;
$tpl_type = explode(':', $type); $tpl_type = explode(':', $type);
$tpl = ''; $tpl = '';
@ -713,8 +498,8 @@ class module
$tpl_type_cond = explode('_', $tpl_type[1]); $tpl_type_cond = explode('_', $tpl_type[1]);
$type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true; $type_no = ($tpl_type_cond[0] == 'disabled' || $tpl_type_cond[0] == 'enabled') ? false : true;
$tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? $lang['NO'] : $lang['DISABLED']) . '</label>'; $tpl_no = '<label><input type="radio" name="' . $name . '" value="0"' . $key_no . ' class="radio" /> ' . (($type_no) ? phpbb::$user->lang['NO'] : phpbb::$user->lang['DISABLED']) . '</label>';
$tpl_yes = '<label><input type="radio" name="' . $name . '" value="1"' . $key_yes . ' class="radio" /> ' . (($type_no) ? $lang['YES'] : $lang['ENABLED']) . '</label>'; $tpl_yes = '<label><input type="radio" name="' . $name . '" value="1"' . $key_yes . ' class="radio" /> ' . (($type_no) ? phpbb::$user->lang['YES'] : phpbb::$user->lang['ENABLED']) . '</label>';
$tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . '&nbsp;&nbsp;' . $tpl_no : $tpl_no . '&nbsp;&nbsp;' . $tpl_yes; $tpl = ($tpl_type_cond[0] == 'yes' || $tpl_type_cond[0] == 'enabled') ? $tpl_yes . '&nbsp;&nbsp;' . $tpl_no : $tpl_no . '&nbsp;&nbsp;' . $tpl_yes;
break; break;

File diff suppressed because it is too large Load diff

View file

@ -43,34 +43,32 @@ class install_main extends module
function main($mode, $sub) function main($mode, $sub)
{ {
global $lang, $template, $language;
switch ($sub) switch ($sub)
{ {
case 'intro' : case 'intro' :
$title = $lang['SUB_INTRO']; $title = phpbb::$user->lang['SUB_INTRO'];
$body = $lang['OVERVIEW_BODY']; $body = phpbb::$user->lang['OVERVIEW_BODY'];
break; break;
case 'license' : case 'license' :
$title = $lang['GPL']; $title = phpbb::$user->lang['GPL'];
$body = implode("<br/>\n", file('../docs/COPYING')); $body = implode("<br />\n", file('../docs/COPYING'));
break; break;
case 'support' : case 'support' :
$title = $lang['SUB_SUPPORT']; $title = phpbb::$user->lang['SUB_SUPPORT'];
$body = $lang['SUPPORT_BODY']; $body = phpbb::$user->lang['SUPPORT_BODY'];
break; break;
} }
$this->tpl_name = 'install_main'; $this->tpl_name = 'install/main';
$this->page_title = $title; $this->page_title = $title;
$template->assign_vars(array( phpbb::$template->assign_vars(array(
'TITLE' => $title, 'TITLE' => $title,
'BODY' => $body, 'BODY' => $body,
'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select($language) . '</select>', 'S_LANG_SELECT' => '<select id="language" name="language">' . $this->p_master->inst_language_select(phpbb::$user->lang_name) . '</select>',
)); ));
} }
} }

View file

@ -70,7 +70,7 @@ class install_update extends module
function main($mode, $sub) function main($mode, $sub)
{ {
global $template, $user, $db, $auth; require PHPBB_ROOT_PATH . 'common.' . PHP_EXT;
$this->tpl_name = 'install_update'; $this->tpl_name = 'install_update';
$this->page_title = 'UPDATE_INSTALLATION'; $this->page_title = 'UPDATE_INSTALLATION';
@ -79,33 +79,13 @@ class install_update extends module
$this->old_location = PHPBB_ROOT_PATH . 'install/update/old/'; $this->old_location = PHPBB_ROOT_PATH . 'install/update/old/';
$this->new_location = PHPBB_ROOT_PATH . 'install/update/new/'; $this->new_location = PHPBB_ROOT_PATH . 'install/update/new/';
// Init DB
require(PHPBB_ROOT_PATH . 'config.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/db/' . $dbms . '.' . PHP_EXT);
require(PHPBB_ROOT_PATH . 'includes/constants.' . PHP_EXT);
// Special options for conflicts/modified files
define('MERGE_NO_MERGE_NEW', 1);
define('MERGE_NO_MERGE_MOD', 2);
define('MERGE_NEW_FILE', 3);
define('MERGE_MOD_FILE', 4);
$db = new $sql_db();
// Connect to DB
$db->sql_connect($dbhost, $dbuser, $dbpasswd, $dbname, $dbport, false, false);
// We do not need this any longer, unset for safety purposes
unset($dbpasswd);
// Force template recompile // Force template recompile
phpbb::$config['load_tplcompile'] = 1; phpbb::$config['load_tplcompile'] = 1;
// First of all, init the user session // Start session management
$user->session_begin(); phpbb::$user->session_begin();
$auth->acl($user->data); phpbb::$acl->init(phpbb::$user->data);
phpbb::$user->setup('viewforum');
$user->setup('install');
// If we are within the intro page we need to make sure we get up-to-date version info // If we are within the intro page we need to make sure we get up-to-date version info
if ($sub == 'intro') if ($sub == 'intro')