mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-22 06:13:58 -07:00
r309
Автоопределение часового пояса git-svn-id: https://torrentpier2.googlecode.com/svn/trunk@309 a8ac35ab-4ca4-ca47-4c2d-a49a94f06293
This commit is contained in:
parent
e04c1fcf9f
commit
3b68f019ab
3 changed files with 47 additions and 6 deletions
|
@ -82,7 +82,9 @@ class ajax_common
|
|||
'posts' => array('guest'),
|
||||
'birthday_list' => array('guest'),
|
||||
'get_forum_mods' => array('guest'),
|
||||
);
|
||||
|
||||
'change_tz' => array('user'),
|
||||
);
|
||||
|
||||
var $action = null;
|
||||
|
||||
|
@ -498,5 +500,19 @@ class ajax_common
|
|||
{
|
||||
require(AJAX_DIR .'topic_tpl.php');
|
||||
}
|
||||
}
|
||||
|
||||
function change_tz()
|
||||
{
|
||||
global $bb_cfg, $userdata;
|
||||
$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'] ." LIMIT 1");
|
||||
$bb_cfg['board_timezone'] = $tz;
|
||||
cache_rm_user_sessions ($userdata['user_id']);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -328,6 +328,26 @@ function OpenInEditor ($file, $line)
|
|||
<!--/logo-->
|
||||
|
||||
<!-- IF LOGGED_IN -->
|
||||
|
||||
<script type="text/javascript">
|
||||
ajax.change_tz = function(tz) {
|
||||
ajax.exec({
|
||||
action : 'change_tz',
|
||||
tz : tz,
|
||||
});
|
||||
};
|
||||
ajax.callback.change_tz = function(data) {
|
||||
};
|
||||
$(document).ready(function() {
|
||||
x = new Date();
|
||||
tz = -x.getTimezoneOffset()/60;
|
||||
if (tz != <?php echo $bb_cfg['board_timezone']?>)
|
||||
{
|
||||
ajax.change_tz(tz);
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<!--logout-->
|
||||
<div class="topmenu">
|
||||
<table width="100%" cellpadding="0" cellspacing="0">
|
||||
|
|
|
@ -15,6 +15,15 @@ ajax.callback.user_register = function(data){
|
|||
<!-- 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 usercp_register">
|
||||
<col class="row1" width="35%">
|
||||
|
@ -130,10 +139,6 @@ ajax.callback.gen_passkey = function(data){
|
|||
<td>{LANGUAGE_SELECT}</td>
|
||||
</tr>
|
||||
<!-- ENDIF -->
|
||||
<tr>
|
||||
<td>{L_TIMEZONE}:</td>
|
||||
<td>{TIMEZONE_SELECT}</td>
|
||||
</tr>
|
||||
<!-- IF EDIT_PROFILE -->
|
||||
<tr>
|
||||
<th colspan="2">{L_PREFERENCES}</th>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue