[feature/new-tz-handling] Properly name new timezone selection function

Marked the old one as deprecated and made it using the new function.

PHPBB3-9558
This commit is contained in:
Joas Schilling 2012-07-17 16:09:05 +02:00
parent 48d3c68290
commit 3637cd395e
5 changed files with 38 additions and 20 deletions

View file

@ -57,7 +57,7 @@ class acp_board
'board_disable_msg' => false, 'board_disable_msg' => false,
'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false), 'default_lang' => array('lang' => 'DEFAULT_LANGUAGE', 'validate' => 'lang', 'type' => 'select', 'function' => 'language_select', 'params' => array('{CONFIG_VALUE}'), 'explain' => false),
'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true), 'default_dateformat' => array('lang' => 'DEFAULT_DATE_FORMAT', 'validate' => 'string', 'type' => 'custom', 'method' => 'dateformat_select', 'explain' => true),
'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'select', 'function' => 'tz_select', 'params' => array('{CONFIG_VALUE}', 1), 'explain' => true), 'board_timezone' => array('lang' => 'SYSTEM_TIMEZONE', 'validate' => 'timezone', 'type' => 'custom', 'method' => 'timezone_select', 'explain' => true),
'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false), 'default_style' => array('lang' => 'DEFAULT_STYLE', 'validate' => 'int', 'type' => 'select', 'function' => 'style_select', 'params' => array('{CONFIG_VALUE}', false), 'explain' => false),
'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true), 'override_user_style' => array('lang' => 'OVERRIDE_STYLE', 'validate' => 'bool', 'type' => 'radio:yes_no', 'explain' => true),
@ -896,6 +896,16 @@ class acp_board
'<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />'; '<br /><br /><input class="button2" type="submit" id="' . $key . '_enable" name="' . $key . '_enable" value="' . $user->lang['ALLOW_QUICK_REPLY_BUTTON'] . '" />';
} }
/**
* Select guest timezone
*/
function timezone_select($value, $key)
{
$timezone_select = phpbb_timezone_select($value, true);
$timezone_select['tz_select'];
return '<select name="config[' . $key . ']" id="' . $key . '">' . $timezone_select['tz_select'] . '</select>';
}
/** /**
* Select default dateformat * Select default dateformat

View file

@ -1639,7 +1639,7 @@ class acp_users
${'s_sort_' . $sort_option . '_dir'} .= '</select>'; ${'s_sort_' . $sort_option . '_dir'} .= '</select>';
} }
$tz_select = tz_select($data['tz'], true, false); $timezone_selects = phpbb_timezone_select($data['tz'], true, false);
$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,
@ -1679,8 +1679,8 @@ class acp_users
'S_LANG_OPTIONS' => language_select($data['lang']), 'S_LANG_OPTIONS' => language_select($data['lang']),
'S_STYLE_OPTIONS' => style_select($data['style']), 'S_STYLE_OPTIONS' => style_select($data['style']),
'S_TZ_OPTIONS' => $tz_select['tz_select'], 'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
'S_TZ_DATE_OPTIONS' => $tz_select['tz_dates'], 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'],
) )
); );

View file

@ -1143,13 +1143,26 @@ function phpbb_tz_select_compare($a, $b)
* *
* @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
* @param boolean $return_tzs_only Shall we just return the options for the timezone selector,
* or also return the options for the time selector.
* *
* @return string/array Returns either the options for timezone selector * @return string Returns the options for timezone selector only
* or an array, also containing the options for the time selector. *
* @deprecated
*/ */
function tz_select($default = '', $truncate = false, $return_tzs_only = true) function tz_select($default = '', $truncate = false)
{
$timezone_select = phpbb_timezone_select($default, $truncate);
return $timezone_select['tz_select'];
}
/**
* Options to pick a timezone and date/time
*
* @param string $default A timezone to select
* @param boolean $truncate Shall we truncate the options text
*
* @return array Returns an array, also containing the options for the time selector.
*/
function phpbb_timezone_select($default = '', $truncate = false)
{ {
global $user; global $user;
@ -1220,11 +1233,6 @@ function tz_select($default = '', $truncate = false, $return_tzs_only = true)
} }
$tz_select .= '</optgroup>'; $tz_select .= '</optgroup>';
if ($return_tzs_only)
{
return $tz_select;
}
return array( return array(
'tz_select' => $tz_select, 'tz_select' => $tz_select,
'tz_dates' => $tz_dates, 'tz_dates' => $tz_dates,

View file

@ -131,7 +131,7 @@ class ucp_prefs
} }
$dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>'; $dateformat_options .= '>' . $user->lang['CUSTOM_DATEFORMAT'] . '</option>';
$tz_select = tz_select($data['tz'], true, false); $timezone_selects = phpbb_timezone_select($data['tz'], true, false);
$template->assign_vars(array( $template->assign_vars(array(
'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '', 'ERROR' => (sizeof($error)) ? implode('<br />', $error) : '',
@ -154,8 +154,8 @@ class ucp_prefs
'S_LANG_OPTIONS' => language_select($data['lang']), 'S_LANG_OPTIONS' => language_select($data['lang']),
'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']), 'S_STYLE_OPTIONS' => ($config['override_user_style']) ? '' : style_select($data['style']),
'S_TZ_OPTIONS' => $tz_select['tz_select'], 'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
'S_TZ_DATE_OPTIONS' => $tz_select['tz_dates'], 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'],
'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false, 'S_CAN_HIDE_ONLINE' => ($auth->acl_get('u_hideonline')) ? true : false,
'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false) 'S_SELECT_NOTIFY' => ($config['jab_enable'] && $user->data['user_jabber'] && @extension_loaded('xml')) ? true : false)
); );

View file

@ -442,7 +442,7 @@ class ucp_register
break; break;
} }
$tz_select = tz_select($data['tz'], true, false); $timezone_selects = phpbb_timezone_select($data['tz'], true, false);
$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'],
@ -455,8 +455,8 @@ class ucp_register
'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])), 'L_PASSWORD_EXPLAIN' => $user->lang($config['pass_complex'] . '_EXPLAIN', $user->lang('CHARACTERS', (int) $config['min_pass_chars']), $user->lang('CHARACTERS', (int) $config['max_pass_chars'])),
'S_LANG_OPTIONS' => language_select($data['lang']), 'S_LANG_OPTIONS' => language_select($data['lang']),
'S_TZ_OPTIONS' => $tz_select['tz_select'], 'S_TZ_OPTIONS' => $timezone_selects['tz_select'],
'S_TZ_DATE_OPTIONS' => $tz_select['tz_dates'], 'S_TZ_DATE_OPTIONS' => $timezone_selects['tz_dates'],
'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false, 'S_CONFIRM_REFRESH' => ($config['enable_confirm'] && $config['confirm_refresh']) ? true : false,
'S_REGISTRATION' => true, 'S_REGISTRATION' => true,
'S_COPPA' => $coppa, 'S_COPPA' => $coppa,