mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 06:08:52 +00:00
Remove '<select ...' from language, timezone and style option list generation, change is_dir (which doesn't always work) to is_file, etc. introduce root_path to language option list gen
git-svn-id: file:///svn/phpbb/trunk@3441 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
70cd310197
commit
ad19326d39
1 changed files with 17 additions and 17 deletions
|
@ -288,22 +288,25 @@ function make_jumpbox($action, $forum_id = false, $extra_form_fields = array())
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a language, any language ...
|
// Pick a language, any language ...
|
||||||
function language_select($default, $select_name = "language", $dirname="language")
|
function language_select($default = '')
|
||||||
{
|
{
|
||||||
global $phpEx;
|
global $phpbb_root_path, $phpEx;
|
||||||
|
|
||||||
$dir = @opendir($dirname);
|
$dir = @opendir($phpbb_root_path . 'language');
|
||||||
|
|
||||||
$user = array();
|
$user = array();
|
||||||
while ($file = readdir($dir))
|
while ($file = readdir($dir))
|
||||||
{
|
{
|
||||||
if (!is_dir($dirname . '/' . $file))
|
$path = $phpbb_root_path . 'language/' . $file;
|
||||||
|
|
||||||
|
if (is_file($path) || is_link($path) || $file == '.' || $file == '..')
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (@file_exists($dirname . '/' . $file . '/iso.txt'))
|
|
||||||
|
if (file_exists($path . '/iso.txt'))
|
||||||
{
|
{
|
||||||
list($displayname) = file($dirname . '/' . $file . '/iso.txt');
|
list($displayname) = @file($path . '/iso.txt');
|
||||||
$lang[$displayname] = $file;
|
$lang[$displayname] = $file;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -312,19 +315,17 @@ function language_select($default, $select_name = "language", $dirname="language
|
||||||
@asort($lang);
|
@asort($lang);
|
||||||
@reset($lang);
|
@reset($lang);
|
||||||
|
|
||||||
$user_select = '<select name="' . $select_name . '">';
|
|
||||||
foreach ($lang as $displayname => $filename)
|
foreach ($lang as $displayname => $filename)
|
||||||
{
|
{
|
||||||
$selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : '';
|
$selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : '';
|
||||||
$user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
|
$user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>';
|
||||||
}
|
}
|
||||||
$user_select .= '</select>';
|
|
||||||
|
|
||||||
return $user_select;
|
return $user_select;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a template/theme combo,
|
// Pick a template/theme combo,
|
||||||
function style_select($default_style, $select_name = 'style', $dirname = 'templates')
|
function style_select($default = '')
|
||||||
{
|
{
|
||||||
global $db;
|
global $db;
|
||||||
|
|
||||||
|
@ -333,30 +334,29 @@ function style_select($default_style, $select_name = 'style', $dirname = 'templa
|
||||||
ORDER BY style_name, style_id";
|
ORDER BY style_name, style_id";
|
||||||
$result = $db->sql_query($sql);
|
$result = $db->sql_query($sql);
|
||||||
|
|
||||||
$style_select = '<select name="' . $select_name . '">';
|
|
||||||
while ($row = $db->sql_fetchrow($result))
|
while ($row = $db->sql_fetchrow($result))
|
||||||
{
|
{
|
||||||
$selected = ($row['style_id'] == $default_style) ? ' selected="selected"' : '';
|
$selected = ($row['style_id'] == $default) ? ' selected="selected"' : '';
|
||||||
|
|
||||||
$style_select .= '<option value="' . $row['style_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
|
$style_select .= '<option value="' . $row['style_id'] . '"' . $selected . '>' . $row['style_name'] . '</option>';
|
||||||
}
|
}
|
||||||
$style_select .= "</select>";
|
|
||||||
|
|
||||||
return $style_select;
|
return $style_select;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Pick a timezone
|
// Pick a timezone
|
||||||
function tz_select($default, $select_name = 'timezone')
|
function tz_select($default = '')
|
||||||
{
|
{
|
||||||
global $sys_timezone, $user;
|
global $sys_timezone, $user;
|
||||||
|
|
||||||
$tz_select = '<select name="' . $select_name . '">';
|
|
||||||
foreach ($user->lang['tz'] as $offset => $zone)
|
foreach ($user->lang['tz'] as $offset => $zone)
|
||||||
{
|
{
|
||||||
$selected = ($offset == $default) ? ' selected="selected"' : '';
|
if (is_numeric($offset))
|
||||||
|
{
|
||||||
|
$selected = ($offset === $default) ? ' selected="selected"' : '';
|
||||||
$tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
|
$tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>';
|
||||||
}
|
}
|
||||||
$tz_select .= '</select>';
|
}
|
||||||
|
|
||||||
return $tz_select;
|
return $tz_select;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue