forked from extern/egroupware
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
7bd6f43610
commit
f5dd36ddf3
@ -438,19 +438,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)
|
static function decode_header($_string)
|
||||||
|
{
|
||||||
|
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);
|
return $GLOBALS['egw']->translation->decodeMailHeader($_string,self::$displayCharset);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function decode_subject($_string)
|
function decode_subject($_string,$decode=true)
|
||||||
{
|
{
|
||||||
#$string = $_string;
|
#$string = $_string;
|
||||||
$_string = self::decode_header($_string);
|
|
||||||
if($_string=='NIL')
|
if($_string=='NIL')
|
||||||
{
|
{
|
||||||
$_string = 'No Subject';
|
return 'No Subject';
|
||||||
}
|
}
|
||||||
|
if ($decode) $_string = self::decode_header($_string);
|
||||||
return $_string;
|
return $_string;
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1963,14 +1980,14 @@
|
|||||||
return $sortResult;
|
return $sortResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessageEnvelope($_uid, $_partID = '')
|
function getMessageEnvelope($_uid, $_partID = '',$decode=false)
|
||||||
{
|
{
|
||||||
if($_partID == '') {
|
if($_partID == '') {
|
||||||
if( PEAR::isError($envelope = $this->icServer->getEnvelope('', $_uid, true)) ) {
|
if( PEAR::isError($envelope = $this->icServer->getEnvelope('', $_uid, true)) ) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $envelope[0];
|
return ($decode ? self::decode_header($envelope[0]): $envelope[0]);
|
||||||
} else {
|
} else {
|
||||||
if( PEAR::isError($headers = $this->icServer->getParsedHeaders($_uid, true, $_partID, true)) ) {
|
if( PEAR::isError($headers = $this->icServer->getParsedHeaders($_uid, true, $_partID, true)) ) {
|
||||||
return false;
|
return false;
|
||||||
@ -1986,6 +2003,7 @@
|
|||||||
$recepientList = array('FROM', 'TO', 'CC', 'BCC', 'SENDER', 'REPLY_TO');
|
$recepientList = array('FROM', 'TO', 'CC', 'BCC', 'SENDER', 'REPLY_TO');
|
||||||
foreach($recepientList as $recepientType) {
|
foreach($recepientList as $recepientType) {
|
||||||
if(isset($headers[$recepientType])) {
|
if(isset($headers[$recepientType])) {
|
||||||
|
if ($decode) $headers[$recepientType] = self::decode_header($headers[$recepientType]);
|
||||||
$addresses = imap_rfc822_parse_adrlist($headers[$recepientType], '');
|
$addresses = imap_rfc822_parse_adrlist($headers[$recepientType], '');
|
||||||
foreach($addresses as $singleAddress) {
|
foreach($addresses as $singleAddress) {
|
||||||
$addressData = array(
|
$addressData = array(
|
||||||
@ -2453,11 +2471,11 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessageHeader($_uid, $_partID = '')
|
function getMessageHeader($_uid, $_partID = '',$decode=false)
|
||||||
{
|
{
|
||||||
$retValue = $this->icServer->getParsedHeaders($_uid, true, $_partID, true);
|
$retValue = $this->icServer->getParsedHeaders($_uid, true, $_partID, true);
|
||||||
|
|
||||||
return $retValue;
|
return ($decode ? self::decode_header($retValue):$retValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMessageRawBody($_uid, $_partID = '')
|
function getMessageRawBody($_uid, $_partID = '')
|
||||||
|
@ -273,7 +273,7 @@
|
|||||||
#_debug_array($rawheaders);exit;
|
#_debug_array($rawheaders);exit;
|
||||||
$attachments = $this->bofelamimail->getMessageAttachments($this->uid, $partID);
|
$attachments = $this->bofelamimail->getMessageAttachments($this->uid, $partID);
|
||||||
#_debug_array($attachments); exit;
|
#_debug_array($attachments); exit;
|
||||||
$envelope = $this->bofelamimail->getMessageEnvelope($this->uid, $partID);
|
$envelope = $this->bofelamimail->getMessageEnvelope($this->uid, $partIDi,true);
|
||||||
#_debug_array($envelope); exit;
|
#_debug_array($envelope); exit;
|
||||||
// if not using iFrames, we need to retrieve the messageBody here
|
// 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.
|
// 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));
|
ENT_QUOTES,$this->displayCharset));
|
||||||
|
|
||||||
$this->t->set_var("subject_data",
|
$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));
|
ENT_QUOTES,$this->displayCharset));
|
||||||
|
|
||||||
$this->t->parse("header","message_header",True);
|
$this->t->parse("header","message_header",True);
|
||||||
@ -1356,7 +1356,7 @@
|
|||||||
$this->bofelamimail->reopen($folder);
|
$this->bofelamimail->reopen($folder);
|
||||||
# print "$this->mailbox, $this->uid, $partID<br>";
|
# print "$this->mailbox, $this->uid, $partID<br>";
|
||||||
$headers = $this->bofelamimail->getMessageHeader($this->uid, $partID);
|
$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;
|
# _debug_array($headers);exit;
|
||||||
$rawheaders = $this->bofelamimail->getMessageRawHeader($this->uid, $partID);
|
$rawheaders = $this->bofelamimail->getMessageRawHeader($this->uid, $partID);
|
||||||
$bodyParts = $this->bofelamimail->getMessageBody($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));
|
@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
|
// 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("subject_data", $subject);
|
||||||
$this->t->set_var("full_subject_data", $subject);
|
$this->t->set_var("full_subject_data", $subject);
|
||||||
$linkData = array (
|
$linkData = array (
|
||||||
|
Loading…
Reference in New Issue
Block a user