* eMail: timezone and timeformat issues as reported in egroupware.org Tracker#2755

This commit is contained in:
Klaus Leithoff 2010-11-17 09:52:05 +00:00
parent bbe4b1f3f6
commit 6557cea45b
3 changed files with 10 additions and 10 deletions

View File

@ -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);

View File

@ -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<br>';
$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);

View File

@ -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
<TD nowrap valign=\"top\" style=\"overflow:hidden;\">
".($_folderType > 0?lang('to'):lang('from')).':<b>'.$full_address.' '.($fromAddress?$fromAddress:'') .'</b><br> '.
lang('date').':<b>'.bofelamimail::_strtotime($headerData['date'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).
' - '.bofelamimail::_strtotime($headerData['date'],'H:i:s')."</b><br>
' - '.bofelamimail::_strtotime($headerData['date'],($GLOBALS['egw_info']['user']['preferences']['common']['timeformat']==12?'h:i:s a':'H:i:s'))."</b><br>
".lang('subject').":<b>".$subject."</b>
</TD>
<td style=\"width:20px;\" align=\"right\">