mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-23 16:33:17 +01:00
fixed bug reported by V.Richert, about not decoded envelope information; thus allow arrays to be passed and processed to bofelamimail::decode_header; use the new ability; provide better control if data should be decoded or not
This commit is contained in:
parent
6c895639b3
commit
5c3203268f
@ -433,19 +433,36 @@
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* decode header (or envelope information
|
||||
* if array given, note that only values will be converted
|
||||
* @param $_string mixed input to be converted, if array call decode_header recursively on each value
|
||||
* @returns mixed - based on the input type
|
||||
*/
|
||||
static function decode_header($_string)
|
||||
{
|
||||
return $GLOBALS['egw']->translation->decodeMailHeader($_string,self::$displayCharset);
|
||||
if (is_array($_string))
|
||||
{
|
||||
foreach($_string as $k=>$v)
|
||||
{
|
||||
$_string[$k] = self::decode_header($v);
|
||||
}
|
||||
return $_string;
|
||||
}
|
||||
else
|
||||
{
|
||||
return $GLOBALS['egw']->translation->decodeMailHeader($_string,self::$displayCharset);
|
||||
}
|
||||
}
|
||||
|
||||
function decode_subject($_string)
|
||||
function decode_subject($_string,$decode=true)
|
||||
{
|
||||
#$string = $_string;
|
||||
$_string = self::decode_header($_string);
|
||||
if($_string=='NIL')
|
||||
{
|
||||
$_string = 'No Subject';
|
||||
return 'No Subject';
|
||||
}
|
||||
if ($decode) $_string = self::decode_header($_string);
|
||||
return $_string;
|
||||
|
||||
}
|
||||
@ -1878,14 +1895,14 @@
|
||||
return $sortResult;
|
||||
}
|
||||
|
||||
function getMessageEnvelope($_uid, $_partID = '')
|
||||
function getMessageEnvelope($_uid, $_partID = '',$decode=false)
|
||||
{
|
||||
if($_partID == '') {
|
||||
if( PEAR::isError($envelope = $this->icServer->getEnvelope('', $_uid, true)) ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return $envelope[0];
|
||||
return ($decode ? self::decode_header($envelope[0]): $envelope[0]);
|
||||
} else {
|
||||
if( PEAR::isError($headers = $this->icServer->getParsedHeaders($_uid, true, $_partID, true)) ) {
|
||||
return false;
|
||||
@ -1901,6 +1918,7 @@
|
||||
$recepientList = array('FROM', 'TO', 'CC', 'BCC', 'SENDER', 'REPLY_TO');
|
||||
foreach($recepientList as $recepientType) {
|
||||
if(isset($headers[$recepientType])) {
|
||||
if ($decode) $headers[$recepientType] = self::decode_header($headers[$recepientType]);
|
||||
$addresses = imap_rfc822_parse_adrlist($headers[$recepientType], '');
|
||||
foreach($addresses as $singleAddress) {
|
||||
$addressData = array(
|
||||
@ -2357,11 +2375,11 @@
|
||||
}
|
||||
}
|
||||
|
||||
function getMessageHeader($_uid, $_partID = '')
|
||||
function getMessageHeader($_uid, $_partID = '',$decode=false)
|
||||
{
|
||||
$retValue = $this->icServer->getParsedHeaders($_uid, true, $_partID, true);
|
||||
|
||||
return $retValue;
|
||||
return ($decode ? self::decode_header($retValue):$retValue);
|
||||
}
|
||||
|
||||
function getMessageRawBody($_uid, $_partID = '')
|
||||
|
@ -273,7 +273,7 @@
|
||||
#_debug_array($rawheaders);exit;
|
||||
$attachments = $this->bofelamimail->getMessageAttachments($this->uid, $partID);
|
||||
#_debug_array($attachments); exit;
|
||||
$envelope = $this->bofelamimail->getMessageEnvelope($this->uid, $partID);
|
||||
$envelope = $this->bofelamimail->getMessageEnvelope($this->uid, $partIDi,true);
|
||||
#_debug_array($envelope); exit;
|
||||
// if not using iFrames, we need to retrieve the messageBody here
|
||||
// by now this is a fixed value and controls the use/loading of the template and how the vars are set.
|
||||
@ -456,7 +456,7 @@
|
||||
ENT_QUOTES,$this->displayCharset));
|
||||
|
||||
$this->t->set_var("subject_data",
|
||||
@htmlspecialchars($this->bofelamimail->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT'])),
|
||||
@htmlspecialchars($this->bofelamimail->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']),false),
|
||||
ENT_QUOTES,$this->displayCharset));
|
||||
|
||||
$this->t->parse("header","message_header",True);
|
||||
@ -1356,7 +1356,7 @@
|
||||
$this->bofelamimail->reopen($folder);
|
||||
# print "$this->mailbox, $this->uid, $partID<br>";
|
||||
$headers = $this->bofelamimail->getMessageHeader($this->uid, $partID);
|
||||
$envelope = $this->bofelamimail->getMessageEnvelope($this->uid, $partID);
|
||||
$envelope = $this->bofelamimail->getMessageEnvelope($this->uid, $partID,true);
|
||||
# _debug_array($headers);exit;
|
||||
$rawheaders = $this->bofelamimail->getMessageRawHeader($this->uid, $partID);
|
||||
$bodyParts = $this->bofelamimail->getMessageBody($this->uid,'',$partID);
|
||||
@ -1441,7 +1441,7 @@
|
||||
@htmlspecialchars(bofelamimail::_strtotime($headers['DATE'],$GLOBALS['egw_info']['user']['preferences']['common']['dateformat']).' - '.bofelamimail::_strtotime($headers['DATE'],'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);
|
||||
$subject = @htmlspecialchars($this->bofelamimail->decode_subject(preg_replace($nonDisplayAbleCharacters, '', $envelope['SUBJECT']),false), ENT_QUOTES, $this->displayCharset);
|
||||
$this->t->set_var("subject_data", $subject);
|
||||
$this->t->set_var("full_subject_data", $subject);
|
||||
$linkData = array (
|
||||
|
Loading…
Reference in New Issue
Block a user