1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00

[feature/new-tz-handling] Don't use global user but make it a parameter

PHPBB3-9558
This commit is contained in:
Joas Schilling 2012-07-19 17:41:27 +02:00
parent 5b7884907c
commit 7df1c84447
5 changed files with 11 additions and 8 deletions

View File

@ -901,7 +901,9 @@ class acp_board
*/ */
function timezone_select($value, $key) function timezone_select($value, $key)
{ {
$timezone_select = phpbb_timezone_select($value, true); global $user;
$timezone_select = phpbb_timezone_select($user, $value, true);
$timezone_select['tz_select']; $timezone_select['tz_select'];
return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select['tz_select'] . '</select>'; return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select['tz_select'] . '</select>';

View File

@ -1639,7 +1639,7 @@ class acp_users
${'s_sort_' . $sort_option . '_dir'} .= '</select>'; ${'s_sort_' . $sort_option . '_dir'} .= '</select>';
} }
$timezone_selects = phpbb_timezone_select($data['tz'], true, false); $timezone_selects = phpbb_timezone_select($user, $data['tz'], true);
$template->assign_vars(array( $template->assign_vars(array(
'S_PREFS' => true, 'S_PREFS' => true,
'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true, 'S_JABBER_DISABLED' => ($config['jab_enable'] && $user_row['user_jabber'] && @extension_loaded('xml')) ? false : true,

View File

@ -1184,22 +1184,23 @@ function phpbb_get_timezone_identifiers($selected_timezone)
*/ */
function tz_select($default = '', $truncate = false) function tz_select($default = '', $truncate = false)
{ {
$timezone_select = phpbb_timezone_select($default, $truncate); global $user;
$timezone_select = phpbb_timezone_select($user, $default, $truncate);
return $timezone_select['tz_select']; return $timezone_select['tz_select'];
} }
/** /**
* Options to pick a timezone and date/time * Options to pick a timezone and date/time
* *
* @param phpbb_user $user Object of the current user
* @param string $default A timezone to select * @param string $default A timezone to select
* @param boolean $truncate Shall we truncate the options text * @param boolean $truncate Shall we truncate the options text
* *
* @return array Returns an array, also containing the options for the time selector. * @return array Returns an array, also containing the options for the time selector.
*/ */
function phpbb_timezone_select($default = '', $truncate = false) function phpbb_timezone_select($user, $default = '', $truncate = false)
{ {
global $user;
static $timezones; static $timezones;
$default_offset = ''; $default_offset = '';

View File

@ -131,7 +131,7 @@ class ucp_prefs
} }
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
$timezone_selects = phpbb_timezone_select($data['tz'], true, false); $timezone_selects = phpbb_timezone_select($user, $data['tz'], true);
$template->assign_vars(array( $template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',

View File

@ -442,7 +442,7 @@ class ucp_register
break; break;
} }
$timezone_selects = phpbb_timezone_select($data['tz'], true, false); $timezone_selects = phpbb_timezone_select($user, $data['tz'], true);
$template->assign_vars(array( $template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
'USERNAME' => $data['username'], 'USERNAME' => $data['username'],