bah, various issues, assign lang to this->lang via pointer(?)

git-svn-id: file:///svn/phpbb/trunk@2962 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2002-10-21 14:10:45 +00:00
parent 413cd7bf03
commit 6ebc8de14c
6 changed files with 161 additions and 167 deletions

View file

@ -304,7 +304,7 @@ if ( isset($_POST['bansubmit']) )
add_admin_log('log_ban_' . $mode, $ban_reason, $ban_list_log); add_admin_log('log_ban_' . $mode, $ban_reason, $ban_list_log);
} }
$message = $lang['Ban_update_sucessful'] . '<br /><br />' . sprintf($lang['Click_return_banadmin'], '<a href="' . "admin_ban.$phpEx$SID&amp;mode=$mode" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>'); $message = $user->lang['Ban_update_sucessful'] . '<br /><br />' . sprintf($user->lang['Click_return_banadmin'], '<a href="' . "admin_ban.$phpEx$SID&amp;mode=$mode" . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>');
message_die(MESSAGE, $message); message_die(MESSAGE, $message);
} }
@ -325,7 +325,7 @@ else if ( isset($_POST['unbansubmit']) )
add_admin_log('log_unban_' . $mode, sizeof($_POST['unban'])); add_admin_log('log_unban_' . $mode, sizeof($_POST['unban']));
} }
message_die(MESSAGE, $lang['Ban_update_sucessful']); message_die(MESSAGE, $user->lang['Ban_update_sucessful']);
} }
// //
@ -343,7 +343,7 @@ $db->sql_query($sql);
// //
// Ban length options // Ban length options
// //
$ban_end_text = array(0 => $lang['Permanent'], 30 => $lang['30_Mins'], 60 => $lang['1_Hour'], 360 => $lang['6_Hours'], 1440 => $lang['1_Day'], 10080 => $lang['7_Days'], 20160 => $lang['2_Weeks'], 40320 => $lang['1_Month'], -1 => $lang['Other']); $ban_end_text = array(0 => $user->lang['Permanent'], 30 => $user->lang['30_Mins'], 60 => $user->lang['1_Hour'], 360 => $user->lang['6_Hours'], 1440 => $user->lang['1_Day'], 10080 => $user->lang['7_Days'], 20160 => $user->lang['2_Weeks'], 40320 => $user->lang['1_Month'], -1 => $user->lang['Other']);
$ban_end_options = ''; $ban_end_options = '';
foreach ( $ban_end_text as $length => $text ) foreach ( $ban_end_text as $length => $text )
@ -357,13 +357,13 @@ foreach ( $ban_end_text as $length => $text )
switch ( $mode ) switch ( $mode )
{ {
case 'user': case 'user':
$l_title = $lang['Ban_users']; $l_title = $user->lang['Ban_users'];
break; break;
case 'email': case 'email':
$l_title = $lang['Ban_emails']; $l_title = $user->lang['Ban_emails'];
break; break;
case 'ip': case 'ip':
$l_title = $lang['Ban_ips']; $l_title = $user->lang['Ban_ips'];
break; break;
} }
@ -374,7 +374,7 @@ page_header($l_title);
?> ?>
<p><?php echo $lang['Ban_explain']; ?></p> <p><?php echo $user->lang['Ban_explain']; ?></p>
<?php <?php
@ -406,13 +406,13 @@ switch ( $mode )
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
$l_ban_title = $lang['Ban_users']; $l_ban_title = $user->lang['Ban_users'];
$l_ban_explain = $lang['Ban_username_explain']; $l_ban_explain = $user->lang['Ban_username_explain'];
$l_unban_title = $lang['Unban_username']; $l_unban_title = $user->lang['Unban_username'];
$l_unban_explain = $lang['Unban_username_explain']; $l_unban_explain = $user->lang['Unban_username_explain'];
$l_ban_cell = $lang['Username']; $l_ban_cell = $user->lang['Username'];
$l_no_ban_cell = $lang['No_banned_users']; $l_no_ban_cell = $user->lang['No_banned_users'];
$s_submit_extra = '<input type="submit" name="usersubmit" value="' . $lang['Find_username'] . '" class="liteoption" onClick="window.open(\'../search.' . $phpEx . $SID . '&amp;mode=searchuser&amp;field=ban\', \'_phpbbsearch\', \'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650\');return false;" />'; $s_submit_extra = '<input type="submit" name="usersubmit" value="' . $user->lang['Find_username'] . '" class="liteoption" onClick="window.open(\'../search.' . $phpEx . $SID . '&amp;mode=searchuser&amp;field=ban\', \'_phpbbsearch\', \'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=650\');return false;" />';
break; break;
@ -440,12 +440,12 @@ switch ( $mode )
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
$l_ban_title = $lang['Ban_ips']; $l_ban_title = $user->lang['Ban_ips'];
$l_ban_explain = $lang['Ban_IP_explain']; $l_ban_explain = $user->lang['Ban_IP_explain'];
$l_unban_title = $lang['Unban_IP']; $l_unban_title = $user->lang['Unban_IP'];
$l_unban_explain = $lang['Unban_IP_explain']; $l_unban_explain = $user->lang['Unban_IP_explain'];
$l_ban_cell = $lang['IP_hostname']; $l_ban_cell = $user->lang['IP_hostname'];
$l_no_ban_cell = $lang['No_banned_ip']; $l_no_ban_cell = $user->lang['No_banned_ip'];
$s_submit_extra = ''; $s_submit_extra = '';
break; break;
@ -474,12 +474,12 @@ switch ( $mode )
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
$l_ban_title = $lang['Ban_emails']; $l_ban_title = $user->lang['Ban_emails'];
$l_ban_explain = $lang['Ban_email_explain']; $l_ban_explain = $user->lang['Ban_email_explain'];
$l_unban_title = $lang['Unban_email']; $l_unban_title = $user->lang['Unban_email'];
$l_unban_explain = $lang['Unban_email_explain']; $l_unban_explain = $user->lang['Unban_email_explain'];
$l_ban_cell = $lang['Email_address']; $l_ban_cell = $user->lang['Email_address'];
$l_no_ban_cell = $lang['No_banned_email']; $l_no_ban_cell = $user->lang['No_banned_email'];
$s_submit_extra = ''; $s_submit_extra = '';
break; break;
@ -507,15 +507,15 @@ switch ( $mode )
<td class="row1"><textarea cols="40" rows="3" name="ban"></textarea></td> <td class="row1"><textarea cols="40" rows="3" name="ban"></textarea></td>
</tr> </tr>
<tr> <tr>
<td class="row2" width="45%"><?php echo $lang['Ban_length']; ?>:</td> <td class="row2" width="45%"><?php echo $user->lang['Ban_length']; ?>:</td>
<td class="row2"><select name="banlength"><?php echo $ban_end_options; ?></select>&nbsp; <input type="text" name="banlengthother" maxlength="10" size="10" /></td> <td class="row2"><select name="banlength"><?php echo $ban_end_options; ?></select>&nbsp; <input type="text" name="banlengthother" maxlength="10" size="10" /></td>
</tr> </tr>
<tr> <tr>
<td class="row2" width="45%"><?php echo $lang['Ban_reason']; ?>:</td> <td class="row2" width="45%"><?php echo $user->lang['Ban_reason']; ?>:</td>
<td class="row2"><input type="text" name="banreason" maxlength="255" size="40" /></td> <td class="row2"><input type="text" name="banreason" maxlength="255" size="40" /></td>
</tr> </tr>
<tr> <tr>
<td class="cat" colspan="2" align="center"> <input type="submit" name="bansubmit" value="<?php echo $lang['Submit']; ?>" class="mainoption" />&nbsp; <input type="reset" value="<?php echo $lang['Reset']; ?>" class="liteoption" />&nbsp; <?php echo $s_submit_extra; ?></td> <td class="cat" colspan="2" align="center"> <input type="submit" name="bansubmit" value="<?php echo $user->lang['Submit']; ?>" class="mainoption" />&nbsp; <input type="reset" value="<?php echo $user->lang['Reset']; ?>" class="liteoption" />&nbsp; <?php echo $s_submit_extra; ?></td>
</tr> </tr>
</table> </table>
@ -551,7 +551,7 @@ switch ( $mode )
?> ?>
</tr> </tr>
<tr> <tr>
<td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $lang['Submit']; ?>" class="mainoption" /></td> <td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $user->lang['Submit']; ?>" class="mainoption" /></td>
</tr> </tr>
</table></form> </table></form>

View file

@ -24,7 +24,7 @@ class session
var $session_id = ''; var $session_id = '';
var $data = array(); var $data = array();
var $browser = ''; var $browser = '';
var $user_ip = ''; var $ip = '';
var $page = ''; var $page = '';
var $load; var $load;
@ -388,6 +388,7 @@ class user extends session
{ {
include($this->lang_path . 'lang_admin.' . $phpEx); include($this->lang_path . 'lang_admin.' . $phpEx);
} }
$this->lang = &$lang;
/* /*
if ( is_array($lang_set) ) if ( is_array($lang_set) )
@ -759,7 +760,7 @@ class auth
// Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him. // Authentication plug-ins is largely down to Sergey Kanareykin, our thanks to him.
function login($username, $password, $autologin = false) function login($username, $password, $autologin = false)
{ {
global $board_config, $session, $phpEx; global $board_config, $user, $phpEx;
$method = trim($board_config['auth_method']); $method = trim($board_config['auth_method']);
@ -770,14 +771,13 @@ class auth
$method = 'login_' . $method; $method = 'login_' . $method;
if ( function_exists($method) ) if ( function_exists($method) )
{ {
if ( !($user = $method($username, $password)) ) if ( !($login = $method($username, $password)) )
{ {
return false; return false;
} }
$autologin = ( isset($autologin) ) ? md5($password) : ''; $autologin = ( isset($autologin) ) ? md5($password) : '';
return ( $login['user_active'] ) ? $user->create($login['user_id'], $autologin) : false;
return ( $user['user_active'] ) ? $session->create($user['user_id'], $autologin) : false;
} }
} }

View file

@ -32,9 +32,8 @@ $lang = array();
if ( !get_magic_quotes_gpc() ) if ( !get_magic_quotes_gpc() )
{ {
$HTTP_GET_VARS = slash_input_data($HTTP_GET_VARS); $_GET = slash_input_data($_GET);
$HTTP_POST_VARS = slash_input_data($HTTP_POST_VARS); $_POST = slash_input_data($_POST);
$HTTP_COOKIE_VARS = slash_input_data($HTTP_COOKIE_VARS);
} }
/*************************************************************************** /***************************************************************************
@ -45,49 +44,74 @@ if ( !get_magic_quotes_gpc() )
* and the default template. * and the default template.
* *
**************************************************************************/ **************************************************************************/
$default_language = 'en';
if ( isset($_SERVER['HTTP_ACCEPT_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) )
{
$default_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) )
{
$default_language = $accept_lang;
break;
}
}
}
}
$default_language = 'english';
$default_template = 'subSilver'; $default_template = 'subSilver';
$available_dbms = array( $available_dbms = array(
'mysql' => array( 'mysql' => array(
'LABEL' => 'MySQL 3.x', 'LABEL' => 'MySQL 3.x',
'SCHEMA' => 'mysql', 'SCHEMA' => 'mysql',
'DELIM' => ';', 'DELIM' => ';',
'DELIM_BASIC' => ';', 'DELIM_BASIC' => ';',
'COMMENTS' => 'remove_remarks' 'COMMENTS' => 'remove_remarks'
), ),
'mysql4' => array( 'mysql4' => array(
'LABEL' => 'MySQL 4.x', 'LABEL' => 'MySQL 4.x',
'SCHEMA' => 'mysql', 'SCHEMA' => 'mysql',
'DELIM' => ';', 'DELIM' => ';',
'DELIM_BASIC' => ';', 'DELIM_BASIC' => ';',
'COMMENTS' => 'remove_remarks' 'COMMENTS' => 'remove_remarks'
), ),
'postgres' => array( 'postgres' => array(
'LABEL' => 'PostgreSQL 7.x', 'LABEL' => 'PostgreSQL 7.x',
'SCHEMA' => 'postgres', 'SCHEMA' => 'postgres',
'DELIM' => ';', 'DELIM' => ';',
'DELIM_BASIC' => ';', 'DELIM_BASIC' => ';',
'COMMENTS' => 'remove_comments' 'COMMENTS' => 'remove_comments'
), ),
'mssql' => array( 'mssql' => array(
'LABEL' => 'MS SQL Server 7/2000', 'LABEL' => 'MS SQL Server 7/2000',
'SCHEMA' => 'mssql', 'SCHEMA' => 'mssql',
'DELIM' => 'GO', 'DELIM' => 'GO',
'DELIM_BASIC' => ';', 'DELIM_BASIC' => ';',
'COMMENTS' => 'remove_comments' 'COMMENTS' => 'remove_comments'
), ),
'msaccess' => array( 'msaccess' => array(
'LABEL' => 'MS Access [ ODBC ]', 'LABEL' => 'MS Access [ ODBC ]',
'SCHEMA' => '', 'SCHEMA' => '',
'DELIM' => '', 'DELIM' => '',
'DELIM_BASIC' => ';', 'DELIM_BASIC' => ';',
'COMMENTS' => '' 'COMMENTS' => ''
), ),
'mssql-odbc' => array( 'mssql-odbc' => array(
'LABEL' => 'MS SQL Server [ ODBC ]', 'LABEL' => 'MS SQL Server [ ODBC ]',
'SCHEMA' => 'mssql', 'SCHEMA' => 'mssql',
'DELIM' => 'GO', 'DELIM' => 'GO',
'DELIM_BASIC' => ';', 'DELIM_BASIC' => ';',
'COMMENTS' => 'remove_comments' 'COMMENTS' => 'remove_comments'
@ -100,7 +124,7 @@ $available_dbms = array(
// define('NO_FTP', true); // define('NO_FTP', true);
/*************************************************************************** /***************************************************************************
* *
* End Install Customization Section * End Install Customization Section
* *
***************************************************************************/ ***************************************************************************/
@ -116,57 +140,55 @@ if ( @file_exists('../config.'.$phpEx) )
// //
// Obtain various vars // Obtain various vars
// //
$confirm = ( isset($HTTP_POST_VARS['confirm']) ) ? true : false; $confirm = ( isset($_POST['confirm']) ) ? true : false;
$cancel = ( isset($HTTP_POST_VARS['cancel']) ) ? true : false; $cancel = ( isset($_POST['cancel']) ) ? true : false;
if ( isset($HTTP_POST_VARS['install_step']) || isset($HTTP_GET_VARS['install_step']) ) if ( isset($_POST['install_step']) || isset($_GET['install_step']) )
{ {
$install_step = ( isset($HTTP_POST_VARS['install_step']) ) ? $HTTP_POST_VARS['install_step'] : $HTTP_GET_VARS['install_step']; $install_step = ( isset($_POST['install_step']) ) ? $_POST['install_step'] : $_GET['install_step'];
} }
else else
{ {
$install_step = ''; $install_step = '';
} }
$upgrade = ( !empty($HTTP_POST_VARS['upgrade']) ) ? $HTTP_POST_VARS['upgrade']: ''; $upgrade = ( !empty($_POST['upgrade']) ) ? $_POST['upgrade']: '';
$upgrade_now = ( !empty($HTTP_POST_VARS['upgrade_now']) ) ? $HTTP_POST_VARS['upgrade_now']:''; $upgrade_now = ( !empty($_POST['upgrade_now']) ) ? $_POST['upgrade_now']:'';
$dbms = isset($HTTP_POST_VARS['dbms']) ? $HTTP_POST_VARS['dbms'] : ''; $dbms = isset($_POST['dbms']) ? $_POST['dbms'] : '';
$language = ( !empty($HTTP_POST_VARS['language']) ) ? $HTTP_POST_VARS['language'] : $default_language; $language = ( !empty($_POST['language']) ) ? $_POST['language'] : $default_language;
$dbhost = ( !empty($HTTP_POST_VARS['dbhost']) ) ? $HTTP_POST_VARS['dbhost'] : ''; $dbhost = ( !empty($_POST['dbhost']) ) ? $_POST['dbhost'] : '';
$dbuser = ( !empty($HTTP_POST_VARS['dbuser']) ) ? $HTTP_POST_VARS['dbuser'] : ''; $dbuser = ( !empty($_POST['dbuser']) ) ? $_POST['dbuser'] : '';
$dbpasswd = ( !empty($HTTP_POST_VARS['dbpasswd']) ) ? $HTTP_POST_VARS['dbpasswd'] : ''; $dbpasswd = ( !empty($_POST['dbpasswd']) ) ? $_POST['dbpasswd'] : '';
$dbname = ( !empty($HTTP_POST_VARS['dbname']) ) ? $HTTP_POST_VARS['dbname'] : ''; $dbname = ( !empty($_POST['dbname']) ) ? $_POST['dbname'] : '';
$table_prefix = ( !empty($HTTP_POST_VARS['prefix']) ) ? $HTTP_POST_VARS['prefix'] : ''; $table_prefix = ( !empty($_POST['prefix']) ) ? $_POST['prefix'] : '';
$admin_name = ( !empty($HTTP_POST_VARS['admin_name']) ) ? $HTTP_POST_VARS['admin_name'] : ''; $admin_name = ( !empty($_POST['admin_name']) ) ? $_POST['admin_name'] : '';
$admin_pass1 = ( !empty($HTTP_POST_VARS['admin_pass1']) ) ? $HTTP_POST_VARS['admin_pass1'] : ''; $admin_pass1 = ( !empty($_POST['admin_pass1']) ) ? $_POST['admin_pass1'] : '';
$admin_pass2 = ( !empty($HTTP_POST_VARS['admin_pass2']) ) ? $HTTP_POST_VARS['admin_pass2'] : ''; $admin_pass2 = ( !empty($_POST['admin_pass2']) ) ? $_POST['admin_pass2'] : '';
$ftp_path = ( !empty($HTTP_POST_VARS['ftp_path']) ) ? $HTTP_POST_VARS['ftp_path'] : ''; $ftp_path = ( !empty($_POST['ftp_path']) ) ? $_POST['ftp_path'] : '';
$ftp_user = ( !empty($HTTP_POST_VARS['ftp_user']) ) ? $HTTP_POST_VARS['ftp_user'] : ''; $ftp_user = ( !empty($_POST['ftp_user']) ) ? $_POST['ftp_user'] : '';
$ftp_pass = ( !empty($HTTP_POST_VARS['ftp_pass']) ) ? $HTTP_POST_VARS['ftp_pass'] : ''; $ftp_pass = ( !empty($_POST['ftp_pass']) ) ? $_POST['ftp_pass'] : '';
$server_name = ( !empty($HTTP_POST_VARS['server_name']) ) ? $HTTP_POST_VARS['server_name'] : ''; $server_name = ( !empty($_POST['server_name']) ) ? $_POST['server_name'] : '';
$server_port = ( !empty($HTTP_POST_VARS['server_port']) ) ? $HTTP_POST_VARS['server_port'] : ''; $server_port = ( !empty($_POST['server_port']) ) ? $_POST['server_port'] : '';
$board_email = ( !empty($HTTP_POST_VARS['board_email']) ) ? $HTTP_POST_VARS['board_email'] : ''; $board_email = ( !empty($_POST['board_email']) ) ? $_POST['board_email'] : '';
$script_path = ( !empty($HTTP_POST_VARS['script_path']) ) ? $HTTP_POST_VARS['script_path'] : ''; $script_path = ( !empty($_POST['script_path']) ) ? $_POST['script_path'] : '';
// //
// Do we install/upgrade/update or quit back to index? // Do we install/upgrade/update or quit back to index?
// //
if ( !defined('PHPBB_INSTALLED') ) if ( !defined('PHPBB_INSTALLED') )
{ {
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
include($phpbb_root_path . 'includes/session.'.$phpEx); include($phpbb_root_path . 'includes/session.'.$phpEx);
include($phpbb_root_path . 'includes/functions_admin.'.$phpEx);
//
// Import language file, setup template ... // Import language file, setup template ...
// include($phpbb_root_path . 'language/' . $language . '/lang_main.'.$phpEx);
include($phpbb_root_path . 'language/lang_' . $language . '/lang_main.'.$phpEx); include($phpbb_root_path . 'language/' . $language . '/lang_admin.'.$phpEx);
include($phpbb_root_path . 'language/lang_' . $language . '/lang_admin.'.$phpEx);
if ( $upgrade == 1 ) if ( $upgrade == 1 )
{ {
@ -183,30 +205,30 @@ else
// //
// What shall we do? // What shall we do?
// //
if ( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 1 && !defined("PHPBB_INSTALLED") && empty($HTTP_POST_VARS['upgrade_now']) ) if ( !empty($_POST['send_file']) && $_POST['send_file'] == 1 && !defined("PHPBB_INSTALLED") && empty($_POST['upgrade_now']) )
{ {
// //
// We need to stripslashes no matter what the setting of magic_quotes_gpc is // We need to stripslashes no matter what the setting of magic_quotes_gpc is
// because we add slahes at the top if its off, and they are added automaticlly // because we add slahes at the top if its off, and they are added automaticlly
// if it is on. // if it is on.
// //
$HTTP_POST_VARS['config_data'] = stripslashes($HTTP_POST_VARS['config_data']); $_POST['config_data'] = stripslashes($_POST['config_data']);
header("Content-Type: text/x-delimtext; name=\"config.$phpEx\""); header("Content-Type: text/x-delimtext; name=\"config.$phpEx\"");
header("Content-disposition: attachment; filename=config.$phpEx"); header("Content-disposition: attachment; filename=config.$phpEx");
echo $HTTP_POST_VARS['config_data']; echo $_POST['config_data'];
exit; exit;
} }
else if ( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] == 2 && !defined("PHPBB_INSTALLED") ) else if ( !empty($_POST['send_file']) && $_POST['send_file'] == 2 && !defined("PHPBB_INSTALLED") )
{ {
// //
// Ok we couldn't write the config file so let's try ftping it. // Ok we couldn't write the config file so let's try ftping it.
// //
$HTTP_POST_VARS['config_data'] = stripslashes($HTTP_POST_VARS['config_data']); $_POST['config_data'] = stripslashes($_POST['config_data']);
$s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($HTTP_POST_VARS['config_data']) . '" />'; $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($_POST['config_data']) . '" />';
$s_hidden_fields .= '<input type="hidden" name="ftp_file" value="1" />'; $s_hidden_fields .= '<input type="hidden" name="ftp_file" value="1" />';
if ( $upgrade == 1 ) if ( $upgrade == 1 )
@ -225,7 +247,7 @@ else if ( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] =
"L_FTP_USER" => $lang['ftp_username'], "L_FTP_USER" => $lang['ftp_username'],
"L_SUBMIT" => $lang['Transfer_config'], "L_SUBMIT" => $lang['Transfer_config'],
"S_HIDDEN_FIELDS" => $s_hidden_fields, "S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_FORM_ACTION" => "install.$phpEx") "S_FORM_ACTION" => "install.$phpEx")
); );
@ -234,13 +256,13 @@ else if ( !empty($HTTP_POST_VARS['send_file']) && $HTTP_POST_VARS['send_file'] =
exit; exit;
} }
else if( !empty($HTTP_POST_VARS['ftp_file']) && !defined("PHPBB_INSTALLED") ) else if( !empty($_POST['ftp_file']) && !defined("PHPBB_INSTALLED") )
{ {
// //
// Here we'll actually send the file... // Here we'll actually send the file...
// //
$HTTP_POST_VARS['config_data'] = stripslashes($HTTP_POST_VARS['config_data']); $_POST['config_data'] = stripslashes($_POST['config_data']);
$conn_id = @ftp_connect('localhost'); $conn_id = @ftp_connect('localhost');
$login_result = @ftp_login($conn_id, "$ftp_user", "$ftp_pass"); $login_result = @ftp_login($conn_id, "$ftp_user", "$ftp_pass");
@ -249,7 +271,7 @@ else if( !empty($HTTP_POST_VARS['ftp_file']) && !defined("PHPBB_INSTALLED") )
// //
// Error couldn't get connected... Go back to option to send file... // Error couldn't get connected... Go back to option to send file...
// //
$s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($HTTP_POST_VARS['config_data']) . '" />'; $s_hidden_fields = '<input type="hidden" name="config_data" value="' . htmlspecialchars($_POST['config_data']) . '" />';
$s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />'; $s_hidden_fields .= '<input type="hidden" name="send_file" value="1" />';
page_header($lang['NoFTP_config'], "install.$phpEx"); page_header($lang['NoFTP_config'], "install.$phpEx");
@ -293,7 +315,7 @@ else if( !empty($HTTP_POST_VARS['ftp_file']) && !defined("PHPBB_INSTALLED") )
$fp = @fopen($tmpfname, 'w'); $fp = @fopen($tmpfname, 'w');
@fwrite($fp, $HTTP_POST_VARS['config_data']); @fwrite($fp, $_POST['config_data']);
@fclose($fp); @fclose($fp);
@ -308,7 +330,7 @@ else if( !empty($HTTP_POST_VARS['ftp_file']) && !defined("PHPBB_INSTALLED") )
unlink($tmpfname); unlink($tmpfname);
if( $upgrade == 1 ) if( $upgrade == 1 )
{ {
require('upgrade.'.$phpEx); require('upgrade.'.$phpEx);
exit; exit;
@ -335,7 +357,7 @@ else if ( ( empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin
{ {
// //
// Ok we haven't installed before so lets work our way through the various // 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 // steps of the install process. This could turn out to be quite a lengty
// process. // process.
// //
// Step 0 gather the pertinant info for database setup... // Step 0 gather the pertinant info for database setup...
@ -345,36 +367,36 @@ else if ( ( empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin
// //
// Guess at some basic info used for install.. // Guess at some basic info used for install..
// //
if ( !empty($HTTP_SERVER_VARS['SERVER_NAME']) || !empty($HTTP_ENV_VARS['SERVER_NAME']) ) if ( !empty($_SERVER['SERVER_NAME']) || !empty($_ENV['SERVER_NAME']) )
{ {
$server_name = ( !empty($HTTP_SERVER_VARS['SERVER_NAME']) ) ? $HTTP_SERVER_VARS['SERVER_NAME'] : $HTTP_ENV_VARS['SERVER_NAME']; $server_name = ( !empty($_SERVER['SERVER_NAME']) ) ? $_SERVER['SERVER_NAME'] : $_ENV['SERVER_NAME'];
} }
else if ( !empty($HTTP_SERVER_VARS['HTTP_HOST']) || !empty($HTTP_ENV_VARS['HTTP_HOST']) ) else if ( !empty($_SERVER['HTTP_HOST']) || !empty($_ENV['HTTP_HOST']) )
{ {
$server_name = ( !empty($HTTP_SERVER_VARS['HTTP_HOST']) ) ? $HTTP_SERVER_VARS['HTTP_HOST'] : $HTTP_ENV_VARS['HTTP_HOST']; $server_name = ( !empty($_SERVER['HTTP_HOST']) ) ? $_SERVER['HTTP_HOST'] : $_ENV['HTTP_HOST'];
} }
else else
{ {
$server_name = ''; $server_name = '';
} }
if ( !empty($HTTP_SERVER_VARS['SERVER_PORT']) || !empty($HTTP_ENV_VARS['SERVER_PORT']) ) if ( !empty($_SERVER['SERVER_PORT']) || !empty($_ENV['SERVER_PORT']) )
{ {
$server_port = ( !empty($HTTP_SERVER_VARS['SERVER_PORT']) ) ? $HTTP_SERVER_VARS['SERVER_PORT'] : $HTTP_ENV_VARS['SERVER_PORT']; $server_port = ( !empty($_SERVER['SERVER_PORT']) ) ? $_SERVER['SERVER_PORT'] : $_ENV['SERVER_PORT'];
} }
else else
{ {
$server_port = '80'; $server_port = '80';
} }
$script_path = preg_replace('/install\/install\.'.$phpEx.'/i', '', $HTTP_SERVER_VARS['PHP_SELF']); $script_path = preg_replace('/install\/install\.'.$phpEx.'/i', '', $_SERVER['PHP_SELF']);
// //
// //
// //
$instruction_text = $lang['Inst_Step_0']; $instruction_text = $lang['Inst_Step_0'];
/* /*
if ( (($HTTP_POST_VARS['admin_pass1'] != $HTTP_POST_VARS['admin_pass2']) && $install_step != '0') || ( empty($HTTP_POST_VARS['admin_pass1']) && !empty($dbhost)) ) if ( (($_POST['admin_pass1'] != $_POST['admin_pass2']) && $install_step != '0') || ( empty($_POST['admin_pass1']) && !empty($dbhost)) )
{ {
$instruction_text = $lang['Password_mismatch'] . '<br />' . $instruction_text; $instruction_text = $lang['Password_mismatch'] . '<br />' . $instruction_text;
} }
@ -390,7 +412,7 @@ else if ( ( empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin
$upgrade_option = '<option value="0">' . $lang['Install'] . '</option>'; $upgrade_option = '<option value="0">' . $lang['Install'] . '</option>';
$upgrade_option .= '<option value="1">' . $lang['Upgrade'] . '</option>'; $upgrade_option .= '<option value="1">' . $lang['Upgrade'] . '</option>';
$upgrade_option .= '<option value="2">' . $lang['Update'] . '</option>'; $upgrade_option .= '<option value="2">' . $lang['Update'] . '</option>';
$s_hidden_fields = '<input type="hidden" name="install_step" value="1" />'; $s_hidden_fields = '<input type="hidden" name="install_step" value="1" />';
page_header($instruction_text, "install.$phpEx"); page_header($instruction_text, "install.$phpEx");
@ -440,7 +462,7 @@ else if ( ( empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin
<tr> <tr>
<td class="row1" align="right"><span class="gen"><?php echo $lang['Server_name']; ?>: </span></td> <td class="row1" align="right"><span class="gen"><?php echo $lang['Server_name']; ?>: </span></td>
<td class="row2"><input type="text" name="server_name" value="<?php echo $server_name; ?>" /></td> <td class="row2"><input type="text" name="server_name" value="<?php echo $server_name; ?>" /></td>
</tr> </tr>
<tr> <tr>
<td class="row1" align="right"><span class="gen"><?php echo $lang['Server_port']; ?>: </span></td> <td class="row1" align="right"><span class="gen"><?php echo $lang['Server_port']; ?>: </span></td>
<td class="row2"><input type="text" name="server_port" value="<?php echo $server_port; ?>" /></td> <td class="row2"><input type="text" name="server_port" value="<?php echo $server_port; ?>" /></td>
@ -456,7 +478,7 @@ else if ( ( empty($install_step) || $admin_pass1 != $admin_pass2 || empty($admin
<tr> <tr>
<td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_email']; ?>: </span></td> <td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_email']; ?>: </span></td>
<td class="row2"><input type="text" name="board_email" value="<?php echo ( $board_email != '' ) ? $board_email : ''; ?>" /></td> <td class="row2"><input type="text" name="board_email" value="<?php echo ( $board_email != '' ) ? $board_email : ''; ?>" /></td>
</tr> </tr>
<tr> <tr>
<td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_Password']; ?>: </span></td> <td class="row1" align="right"><span class="gen"><?php echo $lang['Admin_Password']; ?>: </span></td>
<td class="row2"><input type="password" name="admin_pass1" value="<?php echo ( $admin_pass1 != '' ) ? $admin_pass1 : ''; ?>" /></td> <td class="row2"><input type="password" name="admin_pass1" value="<?php echo ( $admin_pass1 != '' ) ? $admin_pass1 : ''; ?>" /></td>
@ -505,7 +527,7 @@ else
} }
if ( !extension_loaded( $check_exts ) && !extension_loaded( $check_other ) ) if ( !extension_loaded( $check_exts ) && !extension_loaded( $check_other ) )
{ {
/* $template->assign_block_vars("switch_error_install", array()); /* $template->assign_block_vars("switch_error_install", array());
$template->assign_vars(array( $template->assign_vars(array(
@ -526,8 +548,8 @@ else
$dbms_basic = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_basic.sql'; $dbms_basic = 'schemas/' . $available_dbms[$dbms]['SCHEMA'] . '_basic.sql';
$remove_remarks = $available_dbms[$dbms]['COMMENTS'];; $remove_remarks = $available_dbms[$dbms]['COMMENTS'];;
$delimiter = $available_dbms[$dbms]['DELIM']; $delimiter = $available_dbms[$dbms]['DELIM'];
$delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC']; $delimiter_basic = $available_dbms[$dbms]['DELIM_BASIC'];
if ( $install_step == 1 || $reinstall ) if ( $install_step == 1 || $reinstall )
{ {
@ -553,7 +575,7 @@ else
{ {
$db->sql_query($sql_query[$i]); $db->sql_query($sql_query[$i]);
} }
// //
// Ok tables have been built, let's fill in the basic information // Ok tables have been built, let's fill in the basic information
// //
@ -572,7 +594,7 @@ else
} }
// //
// Ok at this point they have entered their admin password, let's go // Ok at this point they have entered their admin password, let's go
// ahead and create the admin account with some basic default information // ahead and create the admin account with some basic default information
// that they can customize later, and write out the config file. After // that they can customize later, and write out the config file. After
// this we are going to pass them over to the admin_forum.php script // this we are going to pass them over to the admin_forum.php script
@ -584,73 +606,53 @@ else
// //
// Update the default admin user with their information. // Update the default admin user with their information.
// //
$sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value)
VALUES ('board_startdate', " . time() . ")"; VALUES ('board_startdate', " . time() . ")";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value) $sql = "INSERT INTO " . $table_prefix . "config (config_name, config_value)
VALUES ('default_lang', '" . str_replace("\'", "''", $language) . "')"; VALUES ('default_lang', '" . str_replace("\'", "''", $language) . "')";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "config $sql = "UPDATE " . $table_prefix . "config
SET config_value = '" . $server_name . "' SET config_value = '" . $server_name . "'
WHERE config_name = 'server_name'"; WHERE config_name = 'server_name'";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "config $sql = "UPDATE " . $table_prefix . "config
SET config_value = '" . $server_port . "' SET config_value = '" . $server_port . "'
WHERE config_name = 'server_port'"; WHERE config_name = 'server_port'";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "config $sql = "UPDATE " . $table_prefix . "config
SET config_value = '" . $script_path . "' SET config_value = '" . $script_path . "'
WHERE config_name = 'script_path'"; WHERE config_name = 'script_path'";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "config $sql = "UPDATE " . $table_prefix . "config
SET config_value = '" . $board_email . "' SET config_value = '" . $board_email . "'
WHERE config_name = 'board_email'"; WHERE config_name = 'board_email'";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "config $sql = "UPDATE " . $table_prefix . "config
SET config_value = '" . $server_name . "' SET config_value = '" . $server_name . "'
WHERE config_name = 'cookie_domain'"; WHERE config_name = 'cookie_domain'";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "config $sql = "UPDATE " . $table_prefix . "config
SET config_value = '" . $admin_name . "' SET config_value = '" . $admin_name . "'
WHERE config_name = 'newest_username'"; WHERE config_name = 'newest_username'";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "users $sql = "UPDATE " . $table_prefix . "users
SET username = '" . str_replace("\'", "''", $admin_name) . "', user_password='" . str_replace("\'", "''", $admin_pass_md5) . "', user_lang = '" . str_replace("\'", "''", $language) . "', user_email='" . str_replace("\'", "''", $board_email) . "' SET username = '" . str_replace("\'", "''", $admin_name) . "', user_password='" . str_replace("\'", "''", $admin_pass_md5) . "', user_lang = '" . str_replace("\'", "''", $language) . "', user_email='" . str_replace("\'", "''", $board_email) . "'
WHERE username = 'Admin'"; WHERE username = 'Admin'";
$db->sql_query($sql); $db->sql_query($sql);
$sql = "UPDATE " . $table_prefix . "users $sql = "UPDATE " . $table_prefix . "users
SET user_regdate = " . time(); SET user_regdate = " . time();
$db->sql_query($sql); $db->sql_query($sql);
//
// Change session table to HEAP if MySQL version matches
//
if ( preg_match("/^mysql/", $dbms) )
{
$sql = "SELECT VERSION() AS mysql_version";
if($result = $db->sql_query($sql))
{
$row = $db->sql_fetchrow($result);
$version = $row['mysql_version'];
if( preg_match("/^(3\.23)|(4\.)/", $version) )
{
$sql = "ALTER TABLE " . $table_prefix . "sessions
TYPE=HEAP";
$db->sql_query($sql);
}
}
}
/* if ( $error != '' ) /* if ( $error != '' )
{ {
$template->assign_block_vars("switch_error_install", array()); $template->assign_block_vars("switch_error_install", array());
@ -681,7 +683,7 @@ else
$config_data .= '$dbuser = "' . $dbuser . '";' . "\n"; $config_data .= '$dbuser = "' . $dbuser . '";' . "\n";
$config_data .= '$dbpasswd = "' . $dbpasswd . '";' . "\n\n"; $config_data .= '$dbpasswd = "' . $dbpasswd . '";' . "\n\n";
$config_data .= '$table_prefix = "' . $table_prefix . '";' . "\n\n"; $config_data .= '$table_prefix = "' . $table_prefix . '";' . "\n\n";
$config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n"; $config_data .= 'define(\'PHPBB_INSTALLED\', true);'."\n\n";
$config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused! $config_data .= '?' . '>'; // Done this to prevent highlighting editors getting confused!
@umask(0111); @umask(0111);
@ -740,7 +742,7 @@ else
"L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'], "L_INSTRUCTION_TEXT" => $lang['Unwriteable_config'],
"L_SUBMIT" => $lang['Download_config'], "L_SUBMIT" => $lang['Download_config'],
"S_HIDDEN_FIELDS" => $s_hidden_fields, "S_HIDDEN_FIELDS" => $s_hidden_fields,
"S_FORM_ACTION" => "install.$phpEx") "S_FORM_ACTION" => "install.$phpEx")
); );
@ -759,7 +761,7 @@ else
// $template->assign_block_vars("switch_common_install", array()); // $template->assign_block_vars("switch_common_install", array());
} }
// //
// First off let's check and see if we are supposed to be doing an upgrade. // First off let's check and see if we are supposed to be doing an upgrade.
// //
if ( $upgrade == 1 && $upgrade_now == $lang['upgrade_submit'] ) if ( $upgrade == 1 && $upgrade_now == $lang['upgrade_submit'] )
@ -769,7 +771,7 @@ else
exit; exit;
} }
// //
// Ok we are basically done with the install process let's go on // Ok we are basically done with the install process let's go on
// and let the user configure their board now. // and let the user configure their board now.
// //
// We are going to do this by calling the admin_board.php from the // We are going to do this by calling the admin_board.php from the
@ -794,27 +796,21 @@ else
} }
} }
//
// addslashes to vars if magic_quotes_gpc is off this is a security precaution // 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. // to prevent someone trying to break out of a SQL statement.
//
function slash_input_data(&$data) function slash_input_data(&$data)
{ {
if ( is_array($data) ) if ( is_array($data) )
{ {
while( list($k, $v) = each($data) ) foreach ( $data as $k => $v )
{ {
$data[$k] = ( is_array($v) ) ? slash_input_data($v) : addslashes($v); $data[$k] = ( is_array($v) ) ? slash_input_data($v) : addslashes($v);
} }
@reset($data);
} }
return $data; return $data;
} }
// // Output page -> header
//
//
function page_header($l_instructions, $s_action) function page_header($l_instructions, $s_action)
{ {
global $phpEx, $lang; global $phpEx, $lang;
@ -854,15 +850,13 @@ td.cat { background-image: url('../admin/images/cellpic1.gif') }
} }
// // Output page -> footer
//
//
function page_footer($l_submit, $s_hidden_fields) function page_footer($l_submit, $s_hidden_fields)
{ {
global $lang; global $lang;
?> ?>
<tr> <tr>
<td class="cat" align="center" colspan="2"><?php echo $s_hidden_fields; ?><input class="mainoption" type="submit" value="<?php echo $l_submit; ?>" /></td> <td class="cat" align="center" colspan="2"><?php echo $s_hidden_fields; ?><input class="mainoption" type="submit" value="<?php echo $l_submit; ?>" /></td>
</tr> </tr>
</table></form> </table></form>

View file

@ -19,7 +19,7 @@
* *
***************************************************************************/ ***************************************************************************/
$this->lang = array_merge($this->lang, array( $lang = array_merge($lang, array(
'Admin_title' => 'Administration Panel', 'Admin_title' => 'Administration Panel',
'No_admin' => 'You are not authorised to administer this board', 'No_admin' => 'You are not authorised to administer this board',
'No_frames' => 'Sorry, your browser does not support frames', 'No_frames' => 'Sorry, your browser does not support frames',

View file

@ -19,7 +19,7 @@
* *
***************************************************************************/ ***************************************************************************/
$this->lang = array_merge($this->lang, array( $lang = array_merge($lang, array(
'ENCODING' => 'iso-8859-15', 'ENCODING' => 'iso-8859-15',
'DIRECTION' => 'ltr', 'DIRECTION' => 'ltr',
'LEFT' => 'left', 'LEFT' => 'left',

View file

@ -58,13 +58,13 @@ if ( isset($login) || isset($logout) )
'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx$SID&amp;redirect=$redirect" . '">') 'META' => '<meta http-equiv="refresh" content="3;url=' . "login.$phpEx$SID&amp;redirect=$redirect" . '">')
); );
$message = $lang['Error_login'] . '<br /><br />' . sprintf($lang['Click_return_login'], '<a href="' . "login.$phpEx$SID&amp;redirect=$redirect" . '">', '</a>') . '<br /><br />' . sprintf($lang['Click_return_index'], '<a href="' . "index.$phpEx$SID" . '">', '</a>'); $message = $user->lang['Error_login'] . '<br /><br />' . sprintf($user->lang['Click_return_login'], '<a href="' . "login.$phpEx$SID&amp;redirect=$redirect" . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_index'], '<a href="' . "index.$phpEx$SID" . '">', '</a>');
message_die(MESSAGE, $message); message_die(MESSAGE, $message);
} }
} }
else if ( $user->data['user_id'] ) else if ( $user->data['user_id'] )
{ {
$session->destroy($user->data); $user->destroy();
} }
// //
@ -77,15 +77,15 @@ if ( isset($login) || isset($logout) )
if ( !$user->data['user_id'] ) if ( !$user->data['user_id'] )
{ {
$template->assign_vars(array( $template->assign_vars(array(
'L_ENTER_PASSWORD' => $lang['Enter_password'], 'L_ENTER_PASSWORD' => $user->lang['Enter_password'],
'L_SEND_PASSWORD' => $lang['Forgotten_password'], 'L_SEND_PASSWORD' => $user->lang['Forgotten_password'],
'U_SEND_PASSWORD' => "profile.$phpEx$SID&amp;mode=sendpassword", 'U_SEND_PASSWORD' => "profile.$phpEx$SID&amp;mode=sendpassword",
'S_HIDDEN_FIELDS' => '<input type="hidden" name="redirect" value="' . $redirect . '" />') 'S_HIDDEN_FIELDS' => '<input type="hidden" name="redirect" value="' . $redirect . '" />')
); );
$page_title = $lang['Login']; $page_title = $user->lang['Login'];
include($phpbb_root_path . 'includes/page_header.'.$phpEx); include($phpbb_root_path . 'includes/page_header.'.$phpEx);
$template->set_filenames(array( $template->set_filenames(array(