From da71783bc95f786968955a865943f6052eca83a4 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Thu, 25 Aug 2011 16:09:36 -0400
Subject: [PATCH] Move timezone computation to rcube_config; don't override SESSION['timezone'] when saving prefs

---
 program/include/main.inc |   21 ++++-----------------
 1 files changed, 4 insertions(+), 17 deletions(-)

diff --git a/program/include/main.inc b/program/include/main.inc
index 0401fe2..edd74f8 100644
--- a/program/include/main.inc
+++ b/program/include/main.inc
@@ -1021,7 +1021,7 @@
  */
 function format_date($date, $format=NULL)
 {
-  global $CONFIG;
+  global $RCMAIL, $CONFIG;
   
   $ts = NULL;
 
@@ -1032,13 +1032,7 @@
     return '';
 
   // get user's timezone
-  if ($CONFIG['timezone'] === 'auto')
-    $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600;
-  else {
-    $tz = $CONFIG['timezone'];
-    if ($CONFIG['dst_active'])
-      $tz++;
-  }
+  $tz = $RCMAIL->config->get_timezone();
 
   // convert time to user's timezone
   $timestamp = $ts - date('Z', $ts) + ($tz * 3600);
@@ -1823,17 +1817,10 @@
 // Returns RFC2822 formatted current date in user's timezone
 function rcmail_user_date()
 {
-  global $CONFIG;
+  global $RCMAIL, $CONFIG;
 
   // get user's timezone
-  if ($CONFIG['timezone'] === 'auto') {
-    $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600;
-  }
-  else {
-    $tz = $CONFIG['timezone'];
-    if ($CONFIG['dst_active'])
-      $tz++;
-  }
+  $tz = $RCMAIL->config->get_timezone();
 
   $date = time() + $tz * 60 * 60;
   $date = gmdate('r', $date);

--
Gitblit v1.9.1