Changes to the language handling during the install

git-svn-id: file:///svn/phpbb/trunk@6200 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Graham Eames 2006-07-23 16:04:51 +00:00
parent 5879c1c5c1
commit 4cf863dcb3
5 changed files with 63 additions and 48 deletions

View file

@ -16,6 +16,14 @@
<div id="wrap"> <div id="wrap">
<div id="page-header"> <div id="page-header">
<h1>{L_INSTALL_PANEL}</h1> <h1>{L_INSTALL_PANEL}</h1>
<!-- IF S_LANG_SELECT -->
<br />
<form method="post">
<label for="language">{L_SELECT_LANG}:</label>
{S_LANG_SELECT}
<input class="button1" type="submit" id="submit" name="submit" value="{L_CHANGE}" />
</form>
<!-- ENDIF -->
</div> </div>
<div id="page-body"> <div id="page-body">

View file

@ -310,7 +310,9 @@ class module
global $template, $lang, $stage; global $template, $lang, $stage;
$template->assign_vars(array( $template->assign_vars(array(
'L_CHANGE' => $lang['CHANGE'],
'L_INSTALL_PANEL' => $lang['INSTALL_PANEL'], 'L_INSTALL_PANEL' => $lang['INSTALL_PANEL'],
'L_SELECT_LANG' => $lang['SELECT_LANG'],
'PAGE_TITLE' => $this->get_page_title(), 'PAGE_TITLE' => $this->get_page_title(),
'S_CONTENT_DIRECTION' => $lang['DIRECTION'], 'S_CONTENT_DIRECTION' => $lang['DIRECTION'],
@ -629,6 +631,45 @@ class module
return $tpl; return $tpl;
} }
/**
* Generate the drop down of available language packs
*/
function inst_language_select($default = '')
{
global $phpbb_root_path, $phpEx;
$dir = @opendir($phpbb_root_path . 'language');
while ($file = readdir($dir))
{
$path = $phpbb_root_path . 'language/' . $file;
if (is_file($path) || is_link($path) || $file == '.' || $file == '..' || $file == 'CVS')
{
continue;
}
if (file_exists($path . '/iso.txt'))
{
list($displayname) = @file($path . '/iso.txt');
$lang[$displayname] = $file;
}
}
@closedir($dir);
@asort($lang);
@reset($lang);
$user_select = '';
foreach ($lang as $displayname => $filename)
{
$selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : '';
$user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
}
return $user_select;
}
} }
?> ?>

View file

@ -54,6 +54,7 @@ class install_install extends module
'TITLE' => $lang['INSTALL_INTRO'], 'TITLE' => $lang['INSTALL_INTRO'],
'BODY' => $lang['INSTALL_INTRO_BODY'], 'BODY' => $lang['INSTALL_INTRO_BODY'],
'L_SUBMIT' => $lang['NEXT'], 'L_SUBMIT' => $lang['NEXT'],
'S_LANG_SELECT' => '<select name="language">' . $this->p_master->inst_language_select() . '</select>',
'U_ACTION' => $this->p_master->module_url . "?mode=$mode&amp;sub=requirements", 'U_ACTION' => $this->p_master->module_url . "?mode=$mode&amp;sub=requirements",
)); ));
@ -1044,7 +1045,7 @@ class install_install extends module
VALUES ('board_startdate', $current_time)", VALUES ('board_startdate', $current_time)",
'INSERT INTO ' . $table_prefix . "config (config_name, config_value) 'INSERT INTO ' . $table_prefix . "config (config_name, config_value)
VALUES ('default_lang', '" . $db->sql_escape($language) . "')", VALUES ('default_lang', '" . $db->sql_escape($default_lang) . "')",
'UPDATE ' . $table_prefix . "config 'UPDATE ' . $table_prefix . "config
SET config_value = '" . $db->sql_escape($img_imagick) . "' SET config_value = '" . $db->sql_escape($img_imagick) . "'
@ -1123,7 +1124,7 @@ class install_install extends module
WHERE config_name = 'newest_username'", WHERE config_name = 'newest_username'",
'UPDATE ' . $table_prefix . "users '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_email1) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = '" . (int) (crc32(strtolower($board_email1)) . strlen($board_email1)) . "' SET username = '" . $db->sql_escape($admin_name) . "', user_password='" . $db->sql_escape(md5($admin_pass1)) . "', user_lang = '" . $db->sql_escape($default_lang) . "', user_email='" . $db->sql_escape($board_email1) . "', user_dateformat='" . $db->sql_escape($lang['default_dateformat']) . "', user_email_hash = '" . (int) (crc32(strtolower($board_email1)) . strlen($board_email1)) . "'
WHERE username = 'Admin'", WHERE username = 'Admin'",
'UPDATE ' . $table_prefix . "moderator_cache 'UPDATE ' . $table_prefix . "moderator_cache
@ -1491,7 +1492,7 @@ class install_install extends module
'user_password' => '', 'user_password' => '',
'user_colour' => '9E8DA7', 'user_colour' => '9E8DA7',
'user_email' => '', 'user_email' => '',
'user_lang' => $language, 'user_lang' => $default_lang,
'user_style' => 1, 'user_style' => 1,
'user_timezone' => 0, 'user_timezone' => 0,
'user_dateformat' => $lang['default_dateformat'], 'user_dateformat' => $lang['default_dateformat'],
@ -1743,45 +1744,6 @@ class install_install extends module
return $dbms_options; return $dbms_options;
} }
/**
* Generate the drop down of available language packs
*/
function inst_language_select($default = '')
{
global $phpbb_root_path, $phpEx;
$dir = @opendir($phpbb_root_path . 'language');
while ($file = readdir($dir))
{
$path = $phpbb_root_path . 'language/' . $file;
if (is_file($path) || is_link($path) || $file == '.' || $file == '..' || $file == 'CVS')
{
continue;
}
if (file_exists($path . '/iso.txt'))
{
list($displayname) = @file($path . '/iso.txt');
$lang[$displayname] = $file;
}
}
@closedir($dir);
@asort($lang);
@reset($lang);
$user_select = '';
foreach ($lang as $displayname => $filename)
{
$selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : '';
$user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
}
return $user_select;
}
/** /**
* Generate a list of available mail server authentication methods * Generate a list of available mail server authentication methods
*/ */
@ -1805,7 +1767,7 @@ class install_install extends module
* The variables that we will be passing between pages * The variables that we will be passing between pages
* Used to retrieve data quickly on each page * Used to retrieve data quickly on each page
*/ */
var $request_vars = array('language', 'dbms', 'dbhost', 'dbport', 'dbuser', 'dbpasswd', 'dbname', 'table_prefix', 'admin_name', 'admin_pass1', 'admin_pass2', 'board_email1', 'board_email2', 'img_imagick', 'ftp_path', 'ftp_user', 'ftp_pass', 'email_enable', 'smtp_delivery', 'smtp_host', 'smtp_auth', 'smtp_user', 'smtp_pass', 'cookie_secure', 'force_server_vars', 'server_protocol', 'server_name', 'server_port'); var $request_vars = array('language', 'dbms', 'dbhost', 'dbport', 'dbuser', 'dbpasswd', 'dbname', 'table_prefix', 'default_lang', 'admin_name', 'admin_pass1', 'admin_pass2', 'board_email1', 'board_email2', 'img_imagick', 'ftp_path', 'ftp_user', 'ftp_pass', 'email_enable', 'smtp_delivery', 'smtp_host', 'smtp_auth', 'smtp_user', 'smtp_pass', 'cookie_secure', 'force_server_vars', 'server_protocol', 'server_name', 'server_port');
/** /**
* The information below will be used to build the input fields presented to the user * The information below will be used to build the input fields presented to the user
@ -1822,7 +1784,7 @@ class install_install extends module
); );
var $admin_config_options = array( var $admin_config_options = array(
'legend1' => 'ADMIN_CONFIG', 'legend1' => 'ADMIN_CONFIG',
'language' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false), 'default_lang' => array('lang' => 'DEFAULT_LANG', 'type' => 'select', 'options' => '$this->module->inst_language_select(\'{VALUE}\')', 'explain' => false),
'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true), 'admin_name' => array('lang' => 'ADMIN_USERNAME', 'type' => 'text:25:100', 'explain' => true),
'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true), 'admin_pass1' => array('lang' => 'ADMIN_PASSWORD', 'type' => 'password:25:100', 'explain' => true),
'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false), 'admin_pass2' => array('lang' => 'ADMIN_PASSWORD_CONFIRM', 'type' => 'password:25:100', 'explain' => false),

View file

@ -69,6 +69,8 @@ class install_main extends module
$template->assign_vars(array( $template->assign_vars(array(
'TITLE' => $title, 'TITLE' => $title,
'BODY' => $body, 'BODY' => $body,
'S_LANG_SELECT' => '<select name="language">' . $this->p_master->inst_language_select() . '</select>',
)); ));
} }
} }

View file

@ -49,6 +49,7 @@ $lang = array_merge($lang, array(
'CAT_CONVERT' => 'Convert', 'CAT_CONVERT' => 'Convert',
'CAT_INSTALL' => 'Install', 'CAT_INSTALL' => 'Install',
'CAT_OVERVIEW' => 'Overview', 'CAT_OVERVIEW' => 'Overview',
'CHANGE' => 'Change',
'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.', 'CHECK_TABLE_PREFIX' => 'Please check your table prefix and try again.',
'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure', 'CLEAN_VERIFY' => 'Cleaning up and verifying the final structure',
'CONFIG_CONVERT' => 'Converting the configuration', 'CONFIG_CONVERT' => 'Converting the configuration',
@ -210,6 +211,7 @@ $lang = array_merge($lang, array(
'SCRIPT_PATH' => 'Script path', 'SCRIPT_PATH' => 'Script path',
'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB2 is located relative to the domain name', 'SCRIPT_PATH_EXPLAIN' => 'The path where phpBB2 is located relative to the domain name',
'SELECT_LANG' => 'Select language',
'SERVER_CONFIG' => 'Server Configuration', 'SERVER_CONFIG' => 'Server Configuration',
'SOFTWARE' => 'Forum Software', 'SOFTWARE' => 'Forum Software',
'SPECIFY_OPTIONS' => 'Specify Conversion Options', 'SPECIFY_OPTIONS' => 'Specify Conversion Options',