From c8ae2497b7e4c7393210ed186acd672a0040389f Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Wed, 03 Sep 2008 12:03:19 -0400
Subject: [PATCH] Auto-detect client language and timezone if desired by config/prefs

---
 program/include/main.inc |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 83ed8c0..469d844 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -706,9 +706,13 @@
     return '';
    
   // get user's timezone
-  $tz = $CONFIG['timezone'];
-  if ($CONFIG['dst_active'])
-    $tz++;
+  if ($CONFIG['timezone'] == 'auto')
+    $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : intval(date('O'))/100;
+  else {
+    $tz = $CONFIG['timezone'];
+    if ($CONFIG['dst_active'])
+      $tz++;
+  }
 
   // convert time to user's timezone
   $timestamp = $ts - date('Z', $ts) + ($tz * 3600);

--
Gitblit v1.9.1