summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authoralecpl <alec@alec.pl>2010-06-13 10:15:25 +0000
committeralecpl <alec@alec.pl>2010-06-13 10:15:25 +0000
commit2bf3cc6fc3a1255a878778f05e1b0d745c5059c6 (patch)
tree7009a5c838d1f9812b2a6e89300cc79b176ca126 /program/steps
parent0133e6b7aa4360f4edc1aef0e4e7bd4749273f3e (diff)
- Use user's timezone in Date header, not server's timezone (#1486119)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/func.inc26
-rw-r--r--program/steps/mail/sendmail.inc2
2 files changed, 26 insertions, 2 deletions
diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index defb6f9cc..c7489148e 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -1478,7 +1478,7 @@ function rcmail_send_mdn($uid, &$smtp_error)
// 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 @@ function rcmail_send_mdn($uid, &$smtp_error)
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;
diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index f94950e87..e229234c1 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -287,7 +287,7 @@ if ($CONFIG['http_received_header'])
$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;