[#4609] Wrong timezone used in linked attachment notifications
Summary Wrong timezone used in linked attachment notifications
Queue IMP
Queue Version 4.1.3
Type Bug
State Resolved
Priority 2. Medium
Owners Jan Schneider <jan (at) horde (dot) org>, Michael Slusarz <slusarz (at) horde (dot) org>
Requester jkau (at) jasper (dot) k12 (dot) ga (dot) us
Created 11/01/2006 (712 days ago)
Due
Updated 11/12/2007 (336 days ago)
Assigned 11/16/2006 (697 days ago)
Resolved 11/12/2007 (336 days ago)
Attachments
Milestone
Patch No

History
11/12/2007 Michael Slusarz Comment #8
State ⇒ Resolved
Assigned to Michael Slusarz
Reply to this comment
Fixed in 4.2.0 - looks like we were missing a call to NLS::setTimeZone().
10/26/2007 Jan Schneider Comment #7
Priority ⇒ 2. Medium
Reply to this comment
No progress.
10/25/2007 Chuck Hagenbuch Comment #6 Reply to this comment
I "fixed" this locally already but with some weird results that I 
still need to look into.
What's the status of this?
11/16/2006 Jan Schneider Comment #5
State ⇒ Assigned
Assigned to Jan Schneider
Reply to this comment
So is there a reason not to just use time instead of gmmktime in
Compose.php?
There is no difference because it returns the timestamp, so that 
doesn't fix the problem. I "fixed" this locally already but with some 
weird results that I still need to look into.
11/16/2006 Chuck Hagenbuch Comment #4
State ⇒ Feedback
Reply to this comment
So is there a reason not to just use time instead of gmmktime in 
Compose.php? And can you please upload your patch as an attachment, 
generated as a unified diff? Thanks.
11/05/2006 jkau (at) jasper (dot) k12 (dot) ga (dot) us Comment #3 Reply to this comment
I meant to say:

"On my system, gmmktime() returns seconds since epoch - 5 hours"
11/01/2006 Chuck Hagenbuch Comment #2
Summary ⇒ Wrong timezone used in linked attachment notifications
Reply to this comment
Please, PLEASE provide meaningful ticket summaries.
11/01/2006 jkau (at) jasper (dot) k12 (dot) ga (dot) us Comment #1
Queue ⇒ IMP
Priority ⇒ 1. Low
State ⇒ Unconfirmed
Type ⇒ Bug
Summary ⇒ Down
Reply to this comment
In link attachment downloaded notifications emails, the "Attachment 
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))));
---
             $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), Util::addParameter(Horde::selfUrl(true, false, true), 
'd', $id))));
I'm using Horde 3.1.4, IMP 4.1.3 on RHEL 4 AS U4.  This has PHP version 4.3.9.