Summary | Wrong timezone used in linked attachment notifications |
Queue | IMP |
Queue Version | 4.1.3 |
Type | Bug |
State | Resolved |
Priority | 2. Medium |
Owners | jan (at) horde (dot) org, slusarz (at) horde (dot) org |
Requester | jkau (at) jasper (dot) k12 (dot) ga (dot) us |
Created | 11/01/2006 (6823 days ago) |
Due | |
Updated | 11/13/2007 (6446 days ago) |
Assigned | 11/16/2006 (6808 days ago) |
Resolved | 11/13/2007 (6446 days ago) |
Github Issue Link | |
Github Pull Request | |
Milestone | |
Patch | No |
Assigned to Michael Slusarz
State ⇒ Resolved
Priority ⇒ 2. Medium
still need to look into.
State ⇒ Assigned
Assigned to Jan Schneider
Compose.php?
doesn't fix the problem. I "fixed" this locally already but with some
weird results that I still need to look into.
State ⇒ Feedback
Compose.php? And can you please upload your patch as an attachment,
generated as a unified diff? Thanks.
"On my system, gmmktime() returns seconds since epoch - 5 hours"
Summary ⇒ Wrong timezone used in linked attachment notifications
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Queue ⇒ IMP
Summary ⇒ Down
Type ⇒ Bug
Date:" is set to GMT-10 instead of GMT-5 on our system in the EST
timezone. Using a real example, when the receipient of the link
attachment downloaded the attachment, the sender received the link
attachment download notification email with:
Attachment date: Wed, 1 Nov 2006 03:37:12 -0500
when the correct time the attachment was uploaded was actually:
Wed, 1 Nov 2006 08:37:12 -0500.
The problem appears to be caused by the use of gmmktime in
horde/imp/lib/Compose.php. It uses:
$ts = gmmktime();
$fullpath = sprintf('%s/%s/%d', IMP_VFS_LINK_ATTACH_PATH, $auth, $ts);
So this generates a URL in email sent to the receipient like so:
https://server/attachment.php?u=<email>&t=<gmmktime()>&f=<attachment>
horde/imp/attachment.php then uses the value of t=<gmmktime()> as the date:
time_stamp = Util::getFormData('t');
[snip]
$msg->setContents(String::wrap(sprintf(_("Your linked attachment has
been downloaded by at least one user.\n\nAttachment name: %s\nAtt
achment date: %s\n\nClick on the following link to permanently delete
the attachment:\n%s"), $file_name, date('r', $time_stamp),
Util::addParamete
r(Horde::selfUrl(true, false, true), 'd', $id))));
On my system, gmmktime() returns seconds since epoch + 5 hours and
time() returns second since epoch. So I used this patch:
[root@puma imp]# diff attachment.php attachment.php.orig
47,49d46
< // generate timestamp that shows correct timezone for notification email
< $time_stamp_display = $time_stamp - intval(date('Z', $time_stamp));
<
113c110
< $msg->setContents(String::wrap(sprintf(_("Your linked
attachment has been downloaded by at least one user.\n\nAttachment
name: %s\nAttachment date: %s\n\nClick on the following link to
permanently delete the attachment:\n%s"), $file_name, date('r',
$time_stamp_display), Util::addParameter(Horde::selfUrl(true, false,
true), 'd', $id))));
---
attachment has been downloaded by at least one user.\n\nAttachment
name: %s\nAttachment date: %s\n\nClick on the following link to
permanently delete the attachment:\n%s"), $file_name, date('r',
$time_stamp), Util::addParameter(Horde::selfUrl(true, false, true),
'd', $id))));