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
This commit is contained in:
Roman Kelesidis 2023-11-03 18:28:42 +07:00 committed by GitHub
commit 671446e089
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 13 additions and 52 deletions

View file

@ -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);

View file

@ -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

View file

@ -61,7 +61,7 @@ if ($show_dbg_info) {
$stat .= " &nbsp;|&nbsp; " . $lang['LIMIT'] . " $l[0] $l[1] $l[2]";
}
$stat .= ' &nbsp;]';
$stat .= ' &nbsp;]&nbsp;|';
$stat .= !empty($_COOKIE['sql_log']) ? '&nbsp;[ <a href="#" class="med" onclick="$p(\'sqlLog\').className=\'sqlLog sqlLogWrapped\'; return false;">wrap</a> &middot; <a href="#sqlLog" class="med" onclick="$(\'#sqlLog\').css({ height: $(window).height()-50 }); return false;">max</a> ]&nbsp;|' : '';
$stat .= '&nbsp;<label><input type="checkbox" onclick="setCookie(\'sql_log\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['sql_log']) ? HTML_CHECKED : '') . ' />' . $lang['SHOW_LOG'] . '</label>&nbsp;|
<label title="cut long queries"><input type="checkbox" onclick="setCookie(\'sql_log_full\', this.checked ? 1 : 0); window.location.reload();" ' . (!empty($_COOKIE['sql_log_full']) ? HTML_CHECKED : '') . ' />' . $lang['CUT_LOG'] . '</label>&nbsp;|

View file

@ -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'),

View file

@ -291,25 +291,6 @@ function go_to_page ()
<!--/logo-->
<!-- IF LOGGED_IN -->
<script type="text/javascript">
ajax.index_data = function(tz) {
ajax.exec({
action : 'index_data',
mode : 'change_tz',
tz : tz
});
};
ajax.callback.index_data = function(data) {};
$(document).ready(function() {
x = new Date();
tz = -x.getTimezoneOffset()/60;
if (tz != {BOARD_TIMEZONE})
{
ajax.index_data(tz);
}
});
</script>
<!--logout-->
<div class="topmenu">
<table width="100%" cellpadding="0" cellspacing="0">

View file

@ -57,15 +57,6 @@
<!-- IF ADM_EDIT -->
<input type="hidden" name="u" value="{PR_USER_ID}"/>
<!-- ENDIF -->
<!-- IF not ADM_EDIT -->
<script type="text/javascript">
x = new Date();
tz = -x.getTimezoneOffset() / 60;
document.write('<input type="hidden" name="user_timezone" value="' + tz + '" />');
</script>
<!-- ELSE -->
<input type="hidden" name="user_timezone" value="{USER_TIMEZONE}"/>
<!-- ENDIF -->
<table class="forumline prof-tbl">
<col class="row1" width="35%">
@ -83,7 +74,7 @@
</tr>
<tr>
<td class="prof-title">{L_EMAIL}: * <!-- IF EDIT_PROFILE --><!-- ELSE IF $bb_cfg['reg_email_activation'] --><br/><h6>{L_EMAIL_EXPLAIN}</h6><!-- ENDIF --></td>
<td><input id="email" onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;" type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}"<!-- IF EDIT_PROFILE and not ADM_EDIT and not IS_ADMIN --><!-- IF $bb_cfg['emailer_disabled'] or $bb_cfg['email_change_disabled'] --> readonly style="color: gray;"<!-- ENDIF --><!-- ENDIF --> /><span id="check_email"></span></td>
<td><input id="email" onBlur="ajax.exec({ action: 'user_register', mode: 'check_email', email: $('#email').val()}); return false;" type="text" name="user_email" size="35" maxlength="40" value="{USER_EMAIL}"<!-- IF EDIT_PROFILE and not ADM_EDIT and not IS_ADMIN --><!-- IF !$bb_cfg['emailer']['enabled'] or $bb_cfg['email_change_disabled'] --> readonly style="color: gray;"<!-- ENDIF --><!-- ENDIF --> />&nbsp;<span id="check_email"></span></td>
</tr>
<!-- IF EDIT_PROFILE and not ADM_EDIT -->
<tr>
@ -101,7 +92,7 @@
<td class="prof-title">{L_CONFIRM_PASSWORD}: * <!-- IF EDIT_PROFILE --><br/>
<h6>{L_PASSWORD_CONFIRM_IF_CHANGED}</h6><!-- ENDIF --></td>
<td>
<input id="pass_confirm" onBlur="ajax.exec({ action: 'user_register', mode: 'check_pass', pass: $('#pass').val(), pass_confirm: $('#pass_confirm').val() }); return false;" type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="cfm_pass" size="35" maxlength="32" value=""/><span id="check_pass"></span>
<input id="pass_confirm" onBlur="ajax.exec({ action: 'user_register', mode: 'check_pass', pass: $('#pass').val(), pass_confirm: $('#pass_confirm').val() }); return false;" type="<!-- IF SHOW_PASS -->text<!-- ELSE -->password<!-- ENDIF -->" name="cfm_pass" size="35" maxlength="32" value=""/>&nbsp;<span id="check_pass"></span>
</td>
</tr>
<!-- IF CAPTCHA_HTML -->
@ -169,6 +160,12 @@
<td>{LANGUAGE_SELECT}</td>
</tr>
<!-- ENDIF -->
<!-- IF $bb_cfg['allow_change']['timezone'] -->
<tr>
<td class="prof-title">{L_SYSTEM_TIMEZONE}:</td>
<td>{TIMEZONE_SELECT}</td>
</tr>
<!-- ENDIF -->
<!-- IF EDIT_PROFILE -->
<tr>
<th colspan="2">{L_PREFERENCES}</th>