From 086b153ae274e528e709d179795d0bafd5f382bd Mon Sep 17 00:00:00 2001
From: Thomas Bruederli <thomas@roundcube.net>
Date: Wed, 31 Oct 2012 06:50:33 -0400
Subject: [PATCH] Improve client-side timezone detection using jsTimezoneDetect by Jon Nylander (#1488725); removed obsolete dstactive detection
---
program/include/rcube_config.php | 15 ++++++++++++++-
1 files changed, 14 insertions(+), 1 deletions(-)
diff --git a/program/include/rcube_config.php b/program/include/rcube_config.php
index b9fd955..1f165ba 100644
--- a/program/include/rcube_config.php
+++ b/program/include/rcube_config.php
@@ -412,7 +412,20 @@
*/
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();
}
}
--
Gitblit v1.9.1