Changeset 5285 in subversion
- Timestamp:
- Sep 28, 2011 7:49:37 AM (20 months ago)
- Location:
- trunk/roundcubemail/program
- Files:
-
- 6 edited
-
include/main.inc (modified) (1 diff)
-
include/rcmail.php (modified) (1 diff)
-
include/rcube_config.php (modified) (3 diffs)
-
include/rcube_template.php (modified) (2 diffs)
-
js/app.js (modified) (1 diff)
-
js/common.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/program/include/main.inc
r5267 r5285 1039 1039 return ''; 1040 1040 1041 // get user's timezone 1041 // get user's timezone offset 1042 1042 $tz = $RCMAIL->config->get_timezone(); 1043 1043 -
trunk/roundcubemail/program/include/rcmail.php
r5264 r5285 898 898 if (isset($_REQUEST['_timezone']) && $_REQUEST['_timezone'] != '_default_') 899 899 $_SESSION['timezone'] = floatval($_REQUEST['_timezone']); 900 if (isset($_REQUEST['_dstactive']) && $_REQUEST['_dstactive'] != '_default_') 901 $_SESSION['dst_active'] = intval($_REQUEST['_dstactive']); 900 902 901 903 // force reloading complete list of subscribed mailboxes -
trunk/roundcubemail/program/include/rcube_config.php
r5132 r5285 91 91 // enable display_errors in 'show' level, but not for ajax requests 92 92 ini_set('display_errors', intval(empty($_REQUEST['_remote']) && ($this->prop['debug_level'] & 4))); 93 94 // set timezone auto settings values 95 if ($this->prop['timezone'] == 'auto') { 96 $this->prop['_timezone_auto'] = true; 97 $this->prop['dst_active'] = intval(date('I')); 98 $this->prop['timezone'] = date('Z') / 3600 - $this->prop['dst_active']; 99 } 93 100 94 101 // export config data … … 208 215 $this->userprefs = $prefs; 209 216 $this->prop = array_merge($this->prop, $prefs); 217 218 // override timezone settings with client values 219 if ($this->prop['_timezone_auto']) { 220 $this->prop['timezone'] = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : $this->prop['timezone']; 221 $this->prop['dst_active'] = isset($_SESSION['dst_active']) ? $_SESSION['dst_active'] : $this->prop['dst_active']; 222 } 210 223 } 211 224 … … 222 235 223 236 /** 224 * Special getter for user's timezone 237 * Special getter for user's timezone offset including DST 238 * 239 * @return float Timezone offset (in hours) 225 240 */ 226 241 public function get_timezone() 227 242 { 228 $tz = $this->get('timezone'); 229 if ($tz == 'auto') 230 $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z') / 3600; 231 else 232 $tz = intval($tz) + intval($this->get('dst_active')); 233 234 return $tz; 243 return floatval($this->get('timezone')) + intval($this->get('dst_active')); 235 244 } 236 245 -
trunk/roundcubemail/program/include/rcube_template.php
r5282 r5285 1106 1106 $input_action = new html_hiddenfield(array('name' => '_action', 'value' => 'login')); 1107 1107 $input_tzone = new html_hiddenfield(array('name' => '_timezone', 'id' => 'rcmlogintz', 'value' => '_default_')); 1108 $input_dst = new html_hiddenfield(array('name' => '_dstactive', 'id' => 'rcmlogindst', 'value' => '_default_')); 1108 1109 $input_url = new html_hiddenfield(array('name' => '_url', 'id' => 'rcmloginurl', 'value' => $url)); 1109 1110 $input_user = new html_inputfield(array('name' => '_user', 'id' => 'rcmloginuser') … … 1157 1158 $out .= $input_action->show(); 1158 1159 $out .= $input_tzone->show(); 1160 $out .= $input_dst->show(); 1159 1161 $out .= $input_url->show(); 1160 1162 $out .= $table->show(); -
trunk/roundcubemail/program/js/app.js
r5283 r5285 381 381 382 382 // detect client timezone 383 $('#rcmlogintz').val(new Date().getTimezoneOffset() / -60); 383 var tz = new Date().getTimezoneOffset() / -60; 384 var stdtz = new Date().getStdTimezoneOffset() / -60; 385 $('#rcmlogintz').val(stdtz); 386 $('#rcmlogindst').val(tz > stdtz ? 0 : 0); 384 387 385 388 // display 'loading' message on form submit, lock submit button -
trunk/roundcubemail/program/js/common.js
r5280 r5285 672 672 }; 673 673 674 // Extend Date prototype to detect Standard timezone without DST 675 // from http://www.michaelapproved.com/articles/timezone-detect-and-ignore-daylight-saving-time-dst/ 676 Date.prototype.getStdTimezoneOffset = function() 677 { 678 var m = 12, 679 d = new Date(null, m, 1), 680 tzo = d.getTimezoneOffset(); 681 682 while (--m) { 683 d.setUTCMonth(m); 684 if (tzo != d.getTimezoneOffset()) { 685 return Math.max(tzo, d.getTimezoneOffset()); 686 } 687 } 688 689 return tzo; 690 } 674 691 675 692 // Make getElementById() case-sensitive on IE
Note: See TracChangeset
for help on using the changeset viewer.
