diff --git a/felamimail/inc/class.bofelamimail.inc.php b/felamimail/inc/class.bofelamimail.inc.php index da05a35d9c..f1473ebc64 100644 --- a/felamimail/inc/class.bofelamimail.inc.php +++ b/felamimail/inc/class.bofelamimail.inc.php @@ -1998,7 +1998,7 @@ $retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_subject($headerObject['SUBJECT']); $retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE']; - $retValue['header'][$sortOrder[$uid]]['date'] = strtotime($headerObject['DATE']); + $retValue['header'][$sortOrder[$uid]]['date'] = self::_strtotime($headerObject['DATE']); $retValue['header'][$sortOrder[$uid]]['mimetype'] = $headerObject['MIMETYPE']; $retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM']; $retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID']; @@ -2806,7 +2806,7 @@ if ( preg_match('/\b'.$identity->emailAddress.'\b/',$headers['TO']) ) { $send->From = $identity->emailAddress; $send->FromName = $identity->realName; - error_log('Not Default '.$send->From); + error_log('using identity for send from:'.$send->From.' to match header information:'.$headers['TO']); break; } if($identity->default) { @@ -2929,4 +2929,22 @@ $needle = '/(=[0-9][A-F])|(=[A-F][0-9])|(=[A-F][A-F])|(=[0-9][0-9])/'; return preg_match("$needle",$string); } + /** + * Helper function to handle wrong or unrecognized timezones + */ + static function _strtotime($date='') + { + if (strtotime($date)===false) + { + $dtarr = explode(' ',$date); + $test = false; + while ($test===false) + { + array_pop($dtarr); + $test=strtotime(implode(' ',$dtarr)); + if ($test) $date = implode(' ',$dtarr); + } + } + return $date; + } } diff --git a/felamimail/inc/class.uidisplay.inc.php b/felamimail/inc/class.uidisplay.inc.php index c6394a2a47..a072389bbd 100644 --- a/felamimail/inc/class.uidisplay.inc.php +++ b/felamimail/inc/class.uidisplay.inc.php @@ -445,9 +445,9 @@ } else { $this->t->set_var("bcc_data_part",''); } - + $headerdate = new egw_time(bofelamimail::_strtotime($headers['DATE'])); $this->t->set_var("date_received", - @htmlspecialchars($GLOBALS['egw']->common->show_date(strtotime($headers['DATE'])), + @htmlspecialchars($headerdate->format($GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).' - '.$headerdate->format('H:i:s'), ENT_QUOTES,$this->displayCharset)); $this->t->set_var("subject_data", @@ -1426,9 +1426,9 @@ } else { $this->t->set_var("cc_data_part",''); } - + $headerdate = new egw_time(bofelamimail::_strtotime($headers['DATE'])); $this->t->set_var("date_data", - @htmlspecialchars($GLOBALS['egw']->common->show_date(strtotime($headers['DATE'])), ENT_QUOTES,$this->displayCharset)); + @htmlspecialchars($headerdate->format($GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).' - '.$headerdate->format('H:i:s'), 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 = @htmlspecialchars($this->bofelamimail->decode_subject(preg_replace($nonDisplayAbleCharacters, '', $envelope['SUBJECT'])), ENT_QUOTES, $this->displayCharset); diff --git a/felamimail/inc/class.uiwidgets.inc.php b/felamimail/inc/class.uiwidgets.inc.php index ee7795dfd2..c93c064704 100644 --- a/felamimail/inc/class.uiwidgets.inc.php +++ b/felamimail/inc/class.uiwidgets.inc.php @@ -399,13 +399,15 @@ $this->t->set_var('message_counter', $i); $this->t->set_var('message_uid', $header['uid']); - - if ($dateToday == date('Y-m-d', $header['date'])) { - $this->t->set_var('date', $GLOBALS['egw']->common->show_date($header['date'],'H:i:s')); + $headerdate = new egw_time($header['date']); + + if ($dateToday == $headerdate->format('Y-m-d')) { + $this->t->set_var('date', $headerdate->format('H:i:s')); //$GLOBALS['egw']->common->show_date($header['date'],'H:i:s')); } else { - $this->t->set_var('date', $GLOBALS['egw']->common->show_date($header['date'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat'])); + $this->t->set_var('date', $headerdate->format($GLOBALS['egw_info']['user']['preferences']['common']['dateformat'])); } - $this->t->set_var('datetime', $GLOBALS['egw']->common->show_date($header['date']/*,$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']*/)); + $this->t->set_var('datetime', $headerdate->format($GLOBALS['egw_info']['user']['preferences']['common']['dateformat']). + ' - '.$headerdate->format('H:i:s')); $this->t->set_var('size', $this->show_readable_size($header['size'])); if ($firstuid === null) @@ -634,13 +636,14 @@ 'uid' => $headerData['uid'], 'mailbox' => base64_encode($_folderName) ); - + $headerdate = new egw_time($headerData['date']); //_debug_array($GLOBALS['egw']->link('/index.php',$linkData)); $IFRAMEBody = "