diff options
| author | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-01-31 15:39:07 +0000 |
|---|---|---|
| committer | Paul S. Owen <psotfx@users.sourceforge.net> | 2003-01-31 15:39:07 +0000 |
| commit | ad19326d397256590fd9285869b6a2ef4864c37b (patch) | |
| tree | 14f34e3260a6b8f5410e7818a2fcdb08f838952b /phpBB/includes | |
| parent | 70cd3101974c0d56d1788b87f6fb8005395f55cb (diff) | |
| download | forums-ad19326d397256590fd9285869b6a2ef4864c37b.tar forums-ad19326d397256590fd9285869b6a2ef4864c37b.tar.gz forums-ad19326d397256590fd9285869b6a2ef4864c37b.tar.bz2 forums-ad19326d397256590fd9285869b6a2ef4864c37b.tar.xz forums-ad19326d397256590fd9285869b6a2ef4864c37b.zip | |
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
Diffstat (limited to 'phpBB/includes')
| -rw-r--r-- | phpBB/includes/functions.php | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 090a36b0e3..5863ff1f53 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -288,22 +288,25 @@ function make_jumpbox($action, $forum_id = false, $extra_form_fields = array()) } // 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(); 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; } - 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; } } @@ -312,19 +315,17 @@ function language_select($default, $select_name = "language", $dirname="language @asort($lang); @reset($lang); - $user_select = '<select name="' . $select_name . '">'; foreach ($lang as $displayname => $filename) { $selected = (strtolower($default) == strtolower($filename)) ? ' selected="selected"' : ''; $user_select .= '<option value="' . $filename . '"' . $selected . '>' . ucwords($displayname) . '</option>'; } - $user_select .= '</select>'; return $user_select; } // Pick a template/theme combo, -function style_select($default_style, $select_name = 'style', $dirname = 'templates') +function style_select($default = '') { global $db; @@ -333,30 +334,29 @@ function style_select($default_style, $select_name = 'style', $dirname = 'templa ORDER BY style_name, style_id"; $result = $db->sql_query($sql); - $style_select = '<select name="' . $select_name . '">'; 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 .= "</select>"; return $style_select; } // Pick a timezone -function tz_select($default, $select_name = 'timezone') +function tz_select($default = '') { global $sys_timezone, $user; - $tz_select = '<select name="' . $select_name . '">'; foreach ($user->lang['tz'] as $offset => $zone) { - $selected = ($offset == $default) ? ' selected="selected"' : ''; - $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>'; + if (is_numeric($offset)) + { + $selected = ($offset === $default) ? ' selected="selected"' : ''; + $tz_select .= '<option value="' . $offset . '"' . $selected . '>' . $zone . '</option>'; + } } - $tz_select .= '</select>'; return $tz_select; } |
