From 671446e089d97641793952fa69211464ecf69b95 Mon Sep 17 00:00:00 2001 From: Roman Kelesidis Date: Fri, 3 Nov 2023 18:28:42 +0700 Subject: [PATCH] Removed time zone auto detection (#1025) * Removed time zone auto-detection * Update usercp_register.tpl * Updated * Update usercp_register.tpl * Update usercp_register.tpl * Update usercp_register.tpl * Update usercp_register.tpl * Update usercp_register.tpl --- library/ajax/index_data.php | 16 ---------------- library/config.php | 2 +- library/includes/page_footer.php | 2 +- library/includes/ucp/register.php | 7 +++---- styles/templates/default/page_header.tpl | 19 ------------------- styles/templates/default/usercp_register.tpl | 19 ++++++++----------- 6 files changed, 13 insertions(+), 52 deletions(-) diff --git a/library/ajax/index_data.php b/library/ajax/index_data.php index 6c96f1a66..b1da53053 100644 --- a/library/ajax/index_data.php +++ b/library/ajax/index_data.php @@ -82,22 +82,6 @@ switch ($mode) { $datastore->rm('moderators'); break; - case 'change_tz': - $tz = (int)$this->request['tz']; - if ($tz < -12) { - $tz = -12; - } - if ($tz > 13) { - $tz = 13; - } - if ($tz != $bb_cfg['board_timezone']) { - // Set current user timezone - DB()->query("UPDATE " . BB_USERS . " SET user_timezone = $tz WHERE user_id = " . $userdata['user_id']); - $bb_cfg['board_timezone'] = $tz; - \TorrentPier\Sessions::cache_rm_user_sessions($userdata['user_id']); - } - break; - case 'get_traf_stats': $user_id = (int)$this->request['user_id']; $btu = get_bt_userdata($user_id); diff --git a/library/config.php b/library/config.php index 2c9a2758a..59c88c8b3 100644 --- a/library/config.php +++ b/library/config.php @@ -524,7 +524,7 @@ $bb_cfg['poll_max_days'] = 180; // сколько дней с момента с $bb_cfg['allow_change'] = [ 'language' => true, - 'dateformat' => true, + 'timezone' => true ]; $bb_cfg['trash_forum_id'] = 0; // (int) 7 diff --git a/library/includes/page_footer.php b/library/includes/page_footer.php index 03d094bd3..9a5eb9759 100644 --- a/library/includes/page_footer.php +++ b/library/includes/page_footer.php @@ -61,7 +61,7 @@ if ($show_dbg_info) { $stat .= "  |  " . $lang['LIMIT'] . " $l[0] $l[1] $l[2]"; } - $stat .= '  ]'; + $stat .= '  ] |'; $stat .= !empty($_COOKIE['sql_log']) ? ' [ wrap · max ] |' : ''; $stat .= '  |  | diff --git a/library/includes/ucp/register.php b/library/includes/ucp/register.php index 95bb7d1d8..b2ecb76cd 100644 --- a/library/includes/ucp/register.php +++ b/library/includes/ucp/register.php @@ -105,7 +105,7 @@ switch ($mode) { 'user_lang' => $bb_cfg['allow_change']['language'], 'user_gender' => $bb_cfg['gender'], 'user_birthday' => $bb_cfg['birthday_enabled'], - 'user_timezone' => true, + 'user_timezone' => $bb_cfg['allow_change']['timezone'], 'user_opt' => true, 'avatar_ext_id' => true, 'user_icq' => true, @@ -276,9 +276,9 @@ foreach ($profile_fields as $field => $can_edit) { * Часовой пояс (edit, reg) */ case 'user_timezone': - $user_timezone = isset($_POST['user_timezone']) ? (int)$_POST['user_timezone'] : $pr_data['user_timezone']; + $user_timezone = isset($_POST['user_timezone']) ? (float)$_POST['user_timezone'] : (float)$pr_data['user_timezone']; if ($submit && ($user_timezone != $pr_data['user_timezone'] || $mode == 'register')) { - if (isset($lang['TZ'][$user_timezone])) { + if (isset($lang['TZ'][str_replace(',', '.', $user_timezone)])) { $pr_data['user_timezone'] = $user_timezone; $db_data['user_timezone'] = $user_timezone; } @@ -663,7 +663,6 @@ $template->assign_vars([ 'LANGUAGE_SELECT' => \TorrentPier\Legacy\Select::language($pr_data['user_lang'], 'user_lang'), 'TIMEZONE_SELECT' => \TorrentPier\Legacy\Select::timezone($pr_data['user_timezone'], 'user_timezone'), - 'USER_TIMEZONE' => $pr_data['user_timezone'], 'AVATAR_EXPLAIN' => sprintf($lang['AVATAR_EXPLAIN'], $bb_cfg['avatars']['max_width'], $bb_cfg['avatars']['max_height'], humn_size($bb_cfg['avatars']['max_size'])), 'AVATAR_DISALLOWED' => bf($pr_data['user_opt'], 'user_opt', 'dis_avatar'), diff --git a/styles/templates/default/page_header.tpl b/styles/templates/default/page_header.tpl index a70f07b51..52edacc73 100644 --- a/styles/templates/default/page_header.tpl +++ b/styles/templates/default/page_header.tpl @@ -291,25 +291,6 @@ function go_to_page () - -
diff --git a/styles/templates/default/usercp_register.tpl b/styles/templates/default/usercp_register.tpl index 1e318cb15..aed51a36e 100644 --- a/styles/templates/default/usercp_register.tpl +++ b/styles/templates/default/usercp_register.tpl @@ -57,15 +57,6 @@ - - - - -
@@ -83,7 +74,7 @@ - + @@ -101,7 +92,7 @@ @@ -169,6 +160,12 @@ + + + + + +
{L_EMAIL}: *
{L_EMAIL_EXPLAIN}
readonly style="color: gray;" /> readonly style="color: gray;" /> 
{L_CONFIRM_PASSWORD}: *
{L_PASSWORD_CONFIRM_IF_CHANGED}
- +  
{LANGUAGE_SELECT}
{L_SYSTEM_TIMEZONE}:{TIMEZONE_SELECT}
{L_PREFERENCES}