From 6557cea45b493176a8bb6e07815753e18f7573f6 Mon Sep 17 00:00:00 2001 From: Klaus Leithoff Date: Wed, 17 Nov 2010 09:52:05 +0000 Subject: [PATCH] * eMail: timezone and timeformat issues as reported in egroupware.org Tracker#2755 --- felamimail/inc/class.bofelamimail.inc.php | 10 +++++----- felamimail/inc/class.uidisplay.inc.php | 4 ++-- felamimail/inc/class.uiwidgets.inc.php | 6 +++--- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/felamimail/inc/class.bofelamimail.inc.php b/felamimail/inc/class.bofelamimail.inc.php index bfcaa6ce26..9519be1729 100644 --- a/felamimail/inc/class.bofelamimail.inc.php +++ b/felamimail/inc/class.bofelamimail.inc.php @@ -2174,7 +2174,7 @@ $retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_subject($headerObject['SUBJECT']); $retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE']; - $retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime($headerObject['DATE'],'ts'); + $retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime($headerObject['DATE'],'ts',true); $retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE']; $retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM']; $retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID']; @@ -3232,10 +3232,10 @@ * @param string format string, if none is passed, use the users common dateformat supplemented by the time hour:minute:second * @return string returns the date as it is parseable by strtotime, or current timestamp if everything failes */ - static function _strtotime($date='',$format=NULL) + static function _strtotime($date='',$format=NULL,$convert2usertime=false) { - if ($format==NULL) $format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' '.'H:i:s'; - $date2return = egw_time::to($date,$format); + if ($format==NULL) $format = $GLOBALS['egw_info']['user']['preferences']['common']['dateformat'].' '.($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'); + $date2return = ($convert2usertime ? egw_time::server2user($date,$format) : egw_time::to($date,$format)); if ($date2return==null) { $dtarr = explode(' ',$date); @@ -3243,7 +3243,7 @@ while ($test===null && count($dtarr)>=1) { array_pop($dtarr); - $test= egw_time::to(implode(' ',$dtarr),$format); + $test= ($convert2usertime ? egw_time::server2user(implode(' ',$dtarr),$format): egw_time::to(implode(' ',$dtarr),$format)); if ($test) $date2return = $test; } if ($test===null) $date2return = egw_time::to('now',$format); diff --git a/felamimail/inc/class.uidisplay.inc.php b/felamimail/inc/class.uidisplay.inc.php index 26a26a4f6d..93742624f7 100644 --- a/felamimail/inc/class.uidisplay.inc.php +++ b/felamimail/inc/class.uidisplay.inc.php @@ -452,7 +452,7 @@ $this->t->set_var("bcc_data_part",''); } $this->t->set_var("date_received", - @htmlspecialchars(bofelamimail::_strtotime($headers['DATE'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).' - '.bofelamimail::_strtotime($headers['DATE'],'H:i:s'), + @htmlspecialchars(bofelamimail::_strtotime($headers['DATE'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],true).' - '.bofelamimail::_strtotime($headers['DATE'],($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'),true), ENT_QUOTES,$this->displayCharset)); //echo 'Envelope:'.preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']).'#0
'; $subject = bofelamimail::htmlspecialchars($this->bofelamimail->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']),false), @@ -1457,7 +1457,7 @@ $this->t->set_var("cc_data_part",''); } $this->t->set_var("date_data", - @htmlspecialchars(bofelamimail::_strtotime($headers['DATE'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).' - '.bofelamimail::_strtotime($headers['DATE'],'H:i:s'), ENT_QUOTES,$this->displayCharset)); + @htmlspecialchars(bofelamimail::_strtotime($headers['DATE'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat'],true).' - '.bofelamimail::_strtotime($headers['DATE'],($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'),true), ENT_QUOTES,$this->displayCharset)); // link to go back to the message view. the link differs if the print was called from a normal viewing window, or from compose $subject = bofelamimail::htmlspecialchars($this->bofelamimail->decode_subject(preg_replace($nonDisplayAbleCharacters, '', $envelope['SUBJECT']),false), $this->displayCharset); $this->t->set_var("subject_data", $subject); diff --git a/felamimail/inc/class.uiwidgets.inc.php b/felamimail/inc/class.uiwidgets.inc.php index 65c9da7734..313c186e9e 100644 --- a/felamimail/inc/class.uiwidgets.inc.php +++ b/felamimail/inc/class.uiwidgets.inc.php @@ -417,12 +417,12 @@ class uiwidgets $this->t->set_var('message_uid', $header['uid']); if ($dateToday == bofelamimail::_strtotime($header['date'],'Y-m-d')) { - $this->t->set_var('date', bofelamimail::_strtotime($header['date'],'H:i:s')); //$GLOBALS['egw']->common->show_date($header['date'],'H:i:s')); + $this->t->set_var('date', bofelamimail::_strtotime($header['date'],($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'))); //$GLOBALS['egw']->common->show_date($header['date'],'H:i:s')); } else { $this->t->set_var('date', bofelamimail::_strtotime($header['date'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat'])); } $this->t->set_var('datetime', bofelamimail::_strtotime($header['date'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']). - ' - '.bofelamimail::_strtotime($header['date'],'H:i:s')); + ' - '.bofelamimail::_strtotime($header['date'],($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'))); $this->t->set_var('size', $this->show_readable_size($header['size'])); if ($firstuid === null) @@ -677,7 +677,7 @@ class uiwidgets ".($_folderType > 0?lang('to'):lang('from')).':'.$full_address.' '.($fromAddress?$fromAddress:'') .'
'. lang('date').':'.bofelamimail::_strtotime($headerData['date'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']). - ' - '.bofelamimail::_strtotime($headerData['date'],'H:i:s')."
+ ' - '.bofelamimail::_strtotime($headerData['date'],($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'))."
".lang('subject').":".$subject."