summaryrefslogtreecommitdiff
path: root/program/include/rcube_config.php
diff options
context:
space:
mode:
authorThomas Bruederli <thomas@roundcube.net>2012-10-31 11:50:33 +0100
committerThomas Bruederli <thomas@roundcube.net>2012-10-31 11:50:33 +0100
commit086b153ae274e528e709d179795d0bafd5f382bd (patch)
tree932252c46cafcea76da0fc50bcf423626ec2a78c /program/include/rcube_config.php
parentdc6794f9c40be9a4aed6927faad85b95d7642369 (diff)
Improve client-side timezone detection using jsTimezoneDetect by Jon Nylander (#1488725); removed obsolete dstactive detection
Diffstat (limited to 'program/include/rcube_config.php')
-rw-r--r--program/include/rcube_config.php15
1 files changed, 14 insertions, 1 deletions
diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index b9fd95578..1f165ba4a 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -412,7 +412,20 @@ class rcube_config
*/
private function client_timezone()
{
- return isset($_SESSION['timezone']) && ($ctz = timezone_name_from_abbr("", $_SESSION['timezone'] * 3600, 0)) ? $ctz : date_default_timezone_get();
+ if (isset($_SESSION['timezone']) && is_numeric($_SESSION['timezone'])
+ && ($ctz = timezone_name_from_abbr("", $_SESSION['timezone'] * 3600, 0))) {
+ return $ctz;
+ }
+ else if (!empty($_SESSION['timezone'])) {
+ try {
+ $tz = timezone_open($_SESSION['timezone']);
+ return $tz->getName();
+ }
+ catch (Exception $e) { /* gracefully ignore */ }
+ }
+
+ // fallback to server's timezone
+ return date_default_timezone_get();
}
}