[Svn] r3746 - in trunk/roundcubemail: . program/steps/mail

trac at roundcube.net trac at roundcube.net
Sun Jun 13 12:15:25 CEST 2010


Author: alec
Date: 2010-06-13 05:15:25 -0500 (Sun, 13 Jun 2010)
New Revision: 3746

Modified:
   trunk/roundcubemail/CHANGELOG
   trunk/roundcubemail/program/steps/mail/func.inc
   trunk/roundcubemail/program/steps/mail/sendmail.inc
Log:
- Use user's timezone in Date header, not server's timezone (#1486119)


Modified: trunk/roundcubemail/CHANGELOG
===================================================================
--- trunk/roundcubemail/CHANGELOG	2010-06-13 09:06:04 UTC (rev 3745)
+++ trunk/roundcubemail/CHANGELOG	2010-06-13 10:15:25 UTC (rev 3746)
@@ -1,6 +1,7 @@
 CHANGELOG RoundCube Webmail
 ===========================
 
+- Use user's timezone in Date header, not server's timezone (#1486119)
 - Add option to set separate footer for HTML messages (#1486660)
 - Add real SMTP error description to displayed error messages (#1485927)
 - Fix some IMAP errors handling when opening the message (#1485443)

Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2010-06-13 09:06:04 UTC (rev 3745)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2010-06-13 10:15:25 UTC (rev 3746)
@@ -1478,7 +1478,7 @@
 
     // compose headers array
     $headers = array(
-      'Date' => date('r'),
+      'Date' => rcmail_user_date(),
       'From' => $sender,
       'To'   => $message->headers->mdn_to,
       'Subject' => rcube_label('receiptread') . ': ' . $message->subject,
@@ -1523,6 +1523,30 @@
   return false;
 }
 
+// Returns RFC2822 formatted current date in user's timezone
+function rcmail_user_date()
+{
+  global $CONFIG;
+
+  // get user's timezone
+  if ($CONFIG['timezone'] === 'auto') {
+  console($_SESSION['timezone']);
+    $tz = isset($_SESSION['timezone']) ? $_SESSION['timezone'] : date('Z')/3600;
+  }
+  else {
+    $tz = $CONFIG['timezone'];
+    if ($CONFIG['dst_active'])
+      $tz++;
+  }
+
+  $date = time() + $tz * 60 * 60;
+  $date = gmdate('r', $date);
+  $date = preg_replace('/[+-][0-9]{4}$/', sprintf('%+05d', $tz * 100), $date);
+
+  return $date;
+}
+
+
 function rcmail_search_filter($attrib)
 {
   global $OUTPUT, $CONFIG;

Modified: trunk/roundcubemail/program/steps/mail/sendmail.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/sendmail.inc	2010-06-13 09:06:04 UTC (rev 3745)
+++ trunk/roundcubemail/program/steps/mail/sendmail.inc	2010-06-13 10:15:25 UTC (rev 3746)
@@ -287,7 +287,7 @@
   $headers['Received'] = $http_header;
 }
 
-$headers['Date'] = date('r');
+$headers['Date'] = rcmail_user_date();
 $headers['From'] = rcube_charset_convert($identity_arr['string'], RCMAIL_CHARSET, $message_charset);
 $headers['To'] = $mailto;
 

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list