forked from extern/egroupware
fix fetching/opening subsequent message/rfc822 attachments on display
This commit is contained in:
parent
7f222b165d
commit
ec013651a3
@ -3696,6 +3696,13 @@ class mail_bo
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (!empty($_partID))
|
||||||
|
{
|
||||||
|
$_structure->contentTypeMap();
|
||||||
|
$_structure = $_structure->getPart($_partID);
|
||||||
|
//_debug_array($_structure->getMimeId()); exit;
|
||||||
|
}
|
||||||
|
|
||||||
switch($_structure->getPrimaryType())
|
switch($_structure->getPrimaryType())
|
||||||
{
|
{
|
||||||
case 'application':
|
case 'application':
|
||||||
@ -3733,7 +3740,7 @@ class mail_bo
|
|||||||
return array(
|
return array(
|
||||||
array(
|
array(
|
||||||
'body' => '',
|
'body' => '',
|
||||||
'mimeType' => $_structure->subType,
|
'mimeType' => $_structure->getSubType(),
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -3761,8 +3768,8 @@ class mail_bo
|
|||||||
{
|
{
|
||||||
case 'rfc822':
|
case 'rfc822':
|
||||||
$newStructure = $_structure->getParts();
|
$newStructure = $_structure->getParts();
|
||||||
if (self::$debug) {echo __METHOD__." Message -> RFC -> NewStructure:"; _debug_array($newStructure);}
|
if (self::$debug) {echo __METHOD__." Message -> RFC -> NewStructure:"; _debug_array($newStructure[0]);}
|
||||||
return self::normalizeBodyParts($this->getMessageBody($_uid, $_htmlOptions, $newStructure->getMimeId(), $newStructure, $_preserveSeen, $_folder));
|
return self::normalizeBodyParts($this->getMessageBody($_uid, $_htmlOptions, $newStructure[0]->getMimeId(), $newStructure[0], $_preserveSeen, $_folder));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -4057,7 +4064,7 @@ class mail_bo
|
|||||||
|
|
||||||
$headers = $this->getMessageHeader($_uid, $_partID, true,true,$_folder);
|
$headers = $this->getMessageHeader($_uid, $_partID, true,true,$_folder);
|
||||||
|
|
||||||
//print_r(__METHOD__.__LINE__.':'.array2string($headers),true);
|
//error_log(__METHOD__.__LINE__.':'.array2string($headers));
|
||||||
//_debug_array($headers);
|
//_debug_array($headers);
|
||||||
$newData = array(
|
$newData = array(
|
||||||
'DATE' => $headers['DATE'],
|
'DATE' => $headers['DATE'],
|
||||||
@ -4083,7 +4090,7 @@ class mail_bo
|
|||||||
} else {
|
} else {
|
||||||
$addressData['RFC822_EMAIL'] = 'NIL';
|
$addressData['RFC822_EMAIL'] = 'NIL';
|
||||||
}
|
}
|
||||||
$newData[$recepientType][] = $addressData;
|
$newData[$recepientType][] = ($addressData['RFC822_EMAIL']!='NIL'?$addressData['RFC822_EMAIL']:$addressData['EMAIL']);//$addressData;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if($recepientType == 'SENDER' || $recepientType == 'REPLY_TO') {
|
if($recepientType == 'SENDER' || $recepientType == 'REPLY_TO') {
|
||||||
@ -4117,8 +4124,15 @@ class mail_bo
|
|||||||
$uidsToFetch->add($_uid);
|
$uidsToFetch->add($_uid);
|
||||||
|
|
||||||
$fquery = new Horde_Imap_Client_Fetch_Query();
|
$fquery = new Horde_Imap_Client_Fetch_Query();
|
||||||
$fquery->headerText(array('peek'=>$preserveUnSeen));
|
if ($_partID != '')
|
||||||
if ($_partID != '') $fquery->structure();
|
{
|
||||||
|
$fquery->headerText(array('id'=>$_partID,'peek'=>$preserveUnSeen));
|
||||||
|
$fquery->structure();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fquery->headerText(array('peek'=>$preserveUnSeen));
|
||||||
|
}
|
||||||
$headersNew = $this->icServer->fetch($_folder, $fquery, array(
|
$headersNew = $this->icServer->fetch($_folder, $fquery, array(
|
||||||
'ids' => $uidsToFetch,
|
'ids' => $uidsToFetch,
|
||||||
));
|
));
|
||||||
@ -4132,7 +4146,9 @@ class mail_bo
|
|||||||
{
|
{
|
||||||
if ($mime_id==$_partID)
|
if ($mime_id==$_partID)
|
||||||
{
|
{
|
||||||
|
//error_log(__METHOD__.__LINE__."$mime_id == $_partID".array2string($_headerObject->getHeaderText($mime_id,Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->toArray()));
|
||||||
$retValue = $_headerObject->getHeaderText($mime_id,Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->toArray();
|
$retValue = $_headerObject->getHeaderText($mime_id,Horde_Imap_Client_Data_Fetch::HEADER_PARSE)->toArray();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4175,8 +4191,15 @@ class mail_bo
|
|||||||
$uidsToFetch->add($uid);
|
$uidsToFetch->add($uid);
|
||||||
|
|
||||||
$fquery = new Horde_Imap_Client_Fetch_Query();
|
$fquery = new Horde_Imap_Client_Fetch_Query();
|
||||||
$fquery->headerText(array('peek'=>true));
|
if ($_partID != '')
|
||||||
if ($_partID != '') $fquery->structure();
|
{
|
||||||
|
$fquery->headerText(array('id'=>$_partID,'peek'=>true));
|
||||||
|
$fquery->structure();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$fquery->headerText(array('peek'=>true));
|
||||||
|
}
|
||||||
$headersNew = $this->icServer->fetch($_folder, $fquery, array(
|
$headersNew = $this->icServer->fetch($_folder, $fquery, array(
|
||||||
'ids' => $uidsToFetch,
|
'ids' => $uidsToFetch,
|
||||||
));
|
));
|
||||||
@ -4418,16 +4441,22 @@ class mail_bo
|
|||||||
if (!isset($_structure))
|
if (!isset($_structure))
|
||||||
{
|
{
|
||||||
$_structure = $this->getStructure($_uid, $_partID,$_folder,true);
|
$_structure = $this->getStructure($_uid, $_partID,$_folder,true);
|
||||||
|
//error_log(__METHOD__.__LINE__.':'.print_r($_structure->contentTypeMap(),true));
|
||||||
}
|
}
|
||||||
if (!$_structure || !$_structure->contentTypeMap()) return array();
|
if (!$_structure || !$_structure->contentTypeMap()) return array();
|
||||||
|
if (!empty($_partID)) $_structure = $_structure->getPart($_partID);
|
||||||
foreach($_structure->contentTypeMap() as $mime_id => $mime_type)
|
foreach($_structure->contentTypeMap() as $mime_id => $mime_type)
|
||||||
{
|
{
|
||||||
$part = $_structure->getPart($mime_id);
|
$part = $_structure->getPart($mime_id);
|
||||||
|
//error_log(__METHOD__.__LINE__.':'.array2string($part->getMimeId()));
|
||||||
|
|
||||||
if ($part->getDisposition() == 'attachment' ||
|
if ($part->getDisposition() == 'attachment' ||
|
||||||
$fetchEmbeddedImages && $part->getDisposition() == 'inline' &&
|
$fetchEmbeddedImages && $part->getDisposition() == 'inline' &&
|
||||||
$part->getPrimaryType() == 'image')
|
$part->getPrimaryType() == 'image')
|
||||||
{
|
{
|
||||||
|
// if type is message/rfc822 and _partID is gien, and MimeID equals partID
|
||||||
|
// we attempt to fetch "ourselves"
|
||||||
|
if ($_partID==$part->getMimeId() && $part->getPrimaryType()=='message') continue;
|
||||||
$attachment = $part->getAllDispositionParameters();
|
$attachment = $part->getAllDispositionParameters();
|
||||||
$attachment['mimeType'] = $mime_type;
|
$attachment['mimeType'] = $mime_type;
|
||||||
$attachment['uid'] = $_uid;
|
$attachment['uid'] = $_uid;
|
||||||
|
@ -1806,25 +1806,6 @@ unset($query['actions']);
|
|||||||
*/
|
*/
|
||||||
$subject = /*mail_bo::htmlspecialchars(*/$this->mail_bo->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']),false)/*,
|
$subject = /*mail_bo::htmlspecialchars(*/$this->mail_bo->decode_subject(preg_replace($nonDisplayAbleCharacters,'',$envelope['SUBJECT']),false)/*,
|
||||||
mail_bo::$displayCharset)*/;
|
mail_bo::$displayCharset)*/;
|
||||||
if($envelope['FROM'][0] != $envelope['SENDER'][0]) {
|
|
||||||
$content['mail_displayfromaddress'] = self::emailAddressToHTML($envelope['SENDER'],'',false,true,false);
|
|
||||||
$content['mail_displayonbehalfofaddress'] = self::emailAddressToHTML($envelope['FROM'], $organization,false,true,false);
|
|
||||||
} else {
|
|
||||||
$content['mail_displayfromaddress'] = self::emailAddressToHTML($envelope['FROM'], $organization,false,true,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse the to header
|
|
||||||
$content['mail_displaytoaddress'] = self::emailAddressToHTML($envelope['TO'],'',false,true,false);
|
|
||||||
|
|
||||||
// parse the cc header
|
|
||||||
if(count($envelope['CC'])) {
|
|
||||||
$content['mail_displayccaddress'] = self::emailAddressToHTML($envelope['CC'],'',false,true,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse the bcc header
|
|
||||||
if(count($envelope['BCC'])) {
|
|
||||||
$content['mail_displaybccaddress'] = self::emailAddressToHTML($envelope['BCC'],'',false,true,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set up data for taglist widget(s)
|
// Set up data for taglist widget(s)
|
||||||
if ($envelope['FROM']==$envelope['SENDER']) unset($envelope['SENDER']);
|
if ($envelope['FROM']==$envelope['SENDER']) unset($envelope['SENDER']);
|
||||||
|
Loading…
Reference in New Issue
Block a user