mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-08 15:08:59 +01:00
Using egw_time for date/time handling; handle unrecognized timezones like 'Westeuropäische Sommerzeit' by splitting them off, when strtotime failes
This commit is contained in:
parent
57e1782236
commit
50ac49a195
@ -1998,7 +1998,7 @@
|
|||||||
|
|
||||||
$retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_subject($headerObject['SUBJECT']);
|
$retValue['header'][$sortOrder[$uid]]['subject'] = $this->decode_subject($headerObject['SUBJECT']);
|
||||||
$retValue['header'][$sortOrder[$uid]]['size'] = $headerObject['SIZE'];
|
$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]]['mimetype'] = $headerObject['MIMETYPE'];
|
||||||
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
|
$retValue['header'][$sortOrder[$uid]]['id'] = $headerObject['MSG_NUM'];
|
||||||
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
|
$retValue['header'][$sortOrder[$uid]]['uid'] = $headerObject['UID'];
|
||||||
@ -2806,7 +2806,7 @@
|
|||||||
if ( preg_match('/\b'.$identity->emailAddress.'\b/',$headers['TO']) ) {
|
if ( preg_match('/\b'.$identity->emailAddress.'\b/',$headers['TO']) ) {
|
||||||
$send->From = $identity->emailAddress;
|
$send->From = $identity->emailAddress;
|
||||||
$send->FromName = $identity->realName;
|
$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;
|
break;
|
||||||
}
|
}
|
||||||
if($identity->default) {
|
if($identity->default) {
|
||||||
@ -2929,4 +2929,22 @@
|
|||||||
$needle = '/(=[0-9][A-F])|(=[A-F][0-9])|(=[A-F][A-F])|(=[0-9][0-9])/';
|
$needle = '/(=[0-9][A-F])|(=[A-F][0-9])|(=[A-F][A-F])|(=[0-9][0-9])/';
|
||||||
return preg_match("$needle",$string);
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -445,9 +445,9 @@
|
|||||||
} else {
|
} else {
|
||||||
$this->t->set_var("bcc_data_part",'');
|
$this->t->set_var("bcc_data_part",'');
|
||||||
}
|
}
|
||||||
|
$headerdate = new egw_time(bofelamimail::_strtotime($headers['DATE']));
|
||||||
$this->t->set_var("date_received",
|
$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));
|
ENT_QUOTES,$this->displayCharset));
|
||||||
|
|
||||||
$this->t->set_var("subject_data",
|
$this->t->set_var("subject_data",
|
||||||
@ -1426,9 +1426,9 @@
|
|||||||
} else {
|
} else {
|
||||||
$this->t->set_var("cc_data_part",'');
|
$this->t->set_var("cc_data_part",'');
|
||||||
}
|
}
|
||||||
|
$headerdate = new egw_time(bofelamimail::_strtotime($headers['DATE']));
|
||||||
$this->t->set_var("date_data",
|
$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
|
// 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);
|
$subject = @htmlspecialchars($this->bofelamimail->decode_subject(preg_replace($nonDisplayAbleCharacters, '', $envelope['SUBJECT'])), ENT_QUOTES, $this->displayCharset);
|
||||||
|
@ -399,13 +399,15 @@
|
|||||||
|
|
||||||
$this->t->set_var('message_counter', $i);
|
$this->t->set_var('message_counter', $i);
|
||||||
$this->t->set_var('message_uid', $header['uid']);
|
$this->t->set_var('message_uid', $header['uid']);
|
||||||
|
$headerdate = new egw_time($header['date']);
|
||||||
if ($dateToday == date('Y-m-d', $header['date'])) {
|
|
||||||
$this->t->set_var('date', $GLOBALS['egw']->common->show_date($header['date'],'H:i:s'));
|
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 {
|
} 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']));
|
$this->t->set_var('size', $this->show_readable_size($header['size']));
|
||||||
if ($firstuid === null)
|
if ($firstuid === null)
|
||||||
@ -634,13 +636,14 @@
|
|||||||
'uid' => $headerData['uid'],
|
'uid' => $headerData['uid'],
|
||||||
'mailbox' => base64_encode($_folderName)
|
'mailbox' => base64_encode($_folderName)
|
||||||
);
|
);
|
||||||
|
$headerdate = new egw_time($headerData['date']);
|
||||||
//_debug_array($GLOBALS['egw']->link('/index.php',$linkData));
|
//_debug_array($GLOBALS['egw']->link('/index.php',$linkData));
|
||||||
$IFRAMEBody = "<TABLE BORDER=\"1\" rules=\"rows\" style=\"table-layout:fixed;width:100%;\">
|
$IFRAMEBody = "<TABLE BORDER=\"1\" rules=\"rows\" style=\"table-layout:fixed;width:100%;\">
|
||||||
<TR class=\"th\" style=\"width:100%;\">
|
<TR class=\"th\" style=\"width:100%;\">
|
||||||
<TD nowrap valign=\"top\" style=\"overflow:hidden;\">
|
<TD nowrap valign=\"top\" style=\"overflow:hidden;\">
|
||||||
".($_folderType > 0?lang('to'):lang('from')).':<b>'.$full_address.' '.($fromAddress?$fromAddress:'') .'</b><br> '.
|
".($_folderType > 0?lang('to'):lang('from')).':<b>'.$full_address.' '.($fromAddress?$fromAddress:'') .'</b><br> '.
|
||||||
lang('date').':<b>'.$GLOBALS['egw']->common->show_date($headerData['date']/*,$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']*/)."</b><br>
|
lang('date').':<b>'.$headerdate->format($GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).
|
||||||
|
' - '.$headerdate->format('H:i:s')."</b><br>
|
||||||
".lang('subject').":<b>".$subject."</b>
|
".lang('subject').":<b>".$subject."</b>
|
||||||
</TD>
|
</TD>
|
||||||
<td style=\"width:20px;\" align=\"right\">
|
<td style=\"width:20px;\" align=\"right\">
|
||||||
|
Loading…
Reference in New Issue
Block a user