mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-25 17:33:49 +01:00
fix retrieval of attachments for display of attachment-list in display-popup plus indicator for attachments in message list (including preview)
This commit is contained in:
parent
8d48058f22
commit
62a559e498
@ -1242,14 +1242,24 @@ class mail_bo
|
|||||||
//error_log(__METHOD__.__LINE__.' MimeMap:'.array2string($mailStructureObject->contentTypeMap()));
|
//error_log(__METHOD__.__LINE__.' MimeMap:'.array2string($mailStructureObject->contentTypeMap()));
|
||||||
//foreach ($_headerObject->getStructure()->getParts() as $p => $part)
|
//foreach ($_headerObject->getStructure()->getParts() as $p => $part)
|
||||||
$headerObject['ATTACHMENTS']=null;
|
$headerObject['ATTACHMENTS']=null;
|
||||||
|
$skipParts=array();
|
||||||
foreach ($mailStructureObject->contentTypeMap() as $mime_id => $mime_type)
|
foreach ($mailStructureObject->contentTypeMap() as $mime_id => $mime_type)
|
||||||
{
|
{
|
||||||
if ($mime_id==0) $messageMimeType = $mime_type;
|
if ($mime_id==0) $messageMimeType = $mime_type;
|
||||||
$part = $mailStructureObject->getPart($mime_id);
|
$part = $mailStructureObject->getPart($mime_id);
|
||||||
$partdisposition = $part->getDisposition();
|
$partdisposition = $part->getDisposition();
|
||||||
|
$partPrimaryType = $part->getPrimaryType();
|
||||||
$cid = $part->getContentId();
|
$cid = $part->getContentId();
|
||||||
if ($partdisposition=='attachment' || ($partdisposition=='inline'&&empty($cid)) ||
|
if ($mime_type=='message/rfc822')
|
||||||
($partdisposition=='inline' && $part->getPrimaryType() != 'image'))
|
{
|
||||||
|
//error_log(__METHOD__.__LINE__.' Uid:'.$uid.'->'.$mime_id.':'.array2string($part->contentTypeMap()));
|
||||||
|
foreach($part->contentTypeMap() as $sub_id => $sub_type) if ($sub_id != $mime_id) $skipParts[$sub_id] = $sub_type;
|
||||||
|
}
|
||||||
|
//error_log(__METHOD__.__LINE__.' Uid:'.$uid.'->'.$mime_id.':'.array2string($skipParts));
|
||||||
|
if (array_key_exists($mime_id,$skipParts)) continue;
|
||||||
|
if ($partdisposition=='attachment' ||
|
||||||
|
($partdisposition=='inline'&&$partPrimaryType == 'image'&&empty($cid)) ||
|
||||||
|
($partdisposition=='inline' && $partPrimaryType != 'image' && $partPrimaryType != 'multipart' && $partPrimaryType != 'text'))
|
||||||
{
|
{
|
||||||
$headerObject['ATTACHMENTS'][$mime_id]=$part->getAllDispositionParameters();
|
$headerObject['ATTACHMENTS'][$mime_id]=$part->getAllDispositionParameters();
|
||||||
$headerObject['ATTACHMENTS'][$mime_id]['mimeType']=$mime_type;
|
$headerObject['ATTACHMENTS'][$mime_id]['mimeType']=$mime_type;
|
||||||
@ -3307,7 +3317,7 @@ class mail_bo
|
|||||||
// as attachment AND as abstracted ical information (we use our notification style here).
|
// as attachment AND as abstracted ical information (we use our notification style here).
|
||||||
$partText = $partCalendar = $partHTML = null;
|
$partText = $partCalendar = $partHTML = null;
|
||||||
if (self::$debug) _debug_array(array("METHOD"=>__METHOD__,"LINE"=>__LINE__,"STRUCTURE"=>$_structure));
|
if (self::$debug) _debug_array(array("METHOD"=>__METHOD__,"LINE"=>__LINE__,"STRUCTURE"=>$_structure));
|
||||||
|
//error_log(__METHOD__.__LINE__);
|
||||||
$ignore_first_part = true;
|
$ignore_first_part = true;
|
||||||
foreach($_structure->contentTypeMap() as $mime_id => $mime_type)
|
foreach($_structure->contentTypeMap() as $mime_id => $mime_type)
|
||||||
{
|
{
|
||||||
@ -3350,11 +3360,11 @@ class mail_bo
|
|||||||
if (count($mimePart->getParts()) > 1)
|
if (count($mimePart->getParts()) > 1)
|
||||||
{
|
{
|
||||||
// in a multipart alternative we treat the multipart/related as html part
|
// in a multipart alternative we treat the multipart/related as html part
|
||||||
if (self::$debug) error_log(__METHOD__." process MULTIPART/RELATED with array as subparts");
|
if (self::$debug) error_log(__METHOD__." process MULTIPART/".$mimePart->getSubType()." with array as subparts");
|
||||||
$partHTML = $mimePart;
|
$partHTML = $mimePart;
|
||||||
|
break 3; // GET OUT OF LOOP, will be processed according to type
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'alternative':
|
case 'alternative':
|
||||||
if (count($mimePart->getParts()) > 1)
|
if (count($mimePart->getParts()) > 1)
|
||||||
{
|
{
|
||||||
@ -4442,15 +4452,31 @@ class mail_bo
|
|||||||
}
|
}
|
||||||
if (!$_structure || !$_structure->contentTypeMap()) return array();
|
if (!$_structure || !$_structure->contentTypeMap()) return array();
|
||||||
if (!empty($_partID)) $_structure = $_structure->getPart($_partID);
|
if (!empty($_partID)) $_structure = $_structure->getPart($_partID);
|
||||||
|
$skipParts = array();
|
||||||
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()));
|
//error_log(__METHOD__.__LINE__.':'.' Uid:'.$uid.' Part:'.$_partID.'->'.array2string($part->getMimeId()));
|
||||||
//error_log(__METHOD__.__LINE__.array2string($part->getAllContentTypeParameters()));
|
//error_log(__METHOD__.__LINE__.':'.' Uid:'.$uid.' Part:'.$_partID.'->'.$part->getPrimaryType().'/'.$part->getSubType().'->'.$part->getDisposition());
|
||||||
if ($part->getDisposition() == 'attachment' ||
|
//error_log(__METHOD__.__LINE__.':'.' Uid:'.$uid.' Part:'.$_partID.'->'.array2string($part->getAllDispositionParameters()));
|
||||||
$fetchEmbeddedImages && $part->getDisposition() == 'inline' &&
|
//error_log(__METHOD__.__LINE__.':'.' Uid:'.$uid.' Part:'.$_partID.'->'.array2string($part->getAllContentTypeParameters()));
|
||||||
$part->getPrimaryType() == 'image' ||
|
$partDisposition = $part->getDisposition();
|
||||||
$fetchTextCalendar && $part->getPrimaryType() == 'text' && $part->getSubType() == 'calendar')
|
$partPrimaryType = $part->getPrimaryType();
|
||||||
|
// we only want to retrieve the attachments of the current mail, not those of possible
|
||||||
|
// attached mails
|
||||||
|
if ($mime_type=='message/rfc822' && $_partID!=$mime_id)
|
||||||
|
{
|
||||||
|
//error_log(__METHOD__.__LINE__.' Uid:'.$uid.'->'.$mime_id.':'.array2string($part->contentTypeMap()));
|
||||||
|
foreach($part->contentTypeMap() as $sub_id => $sub_type) if ($sub_id != $mime_id) $skipParts[$sub_id] = $sub_type;
|
||||||
|
}
|
||||||
|
//error_log(__METHOD__.__LINE__.' Uid:'.$uid.' Part:'.$_partID.'->'.$mime_id.':'.array2string($skipParts));
|
||||||
|
if (array_key_exists($mime_id,$skipParts)) continue;
|
||||||
|
|
||||||
|
if ($partDisposition == 'attachment' ||
|
||||||
|
(($partDisposition == 'inline' || empty($partDisposition)) && $partPrimaryType == 'image' && $part->getContentId()=='') ||
|
||||||
|
(($partDisposition == 'inline' || empty($partDisposition)) && $partPrimaryType != 'image' && $partPrimaryType != 'text' && $partPrimaryType != 'multipart') ||
|
||||||
|
($fetchEmbeddedImages && ($partDisposition == 'inline' || empty($partDisposition)) && $partPrimaryType == 'image') ||
|
||||||
|
($fetchTextCalendar && $partPrimaryType == 'text' && $part->getSubType() == 'calendar'))
|
||||||
{
|
{
|
||||||
// if type is message/rfc822 and _partID is gien, and MimeID equals partID
|
// if type is message/rfc822 and _partID is gien, and MimeID equals partID
|
||||||
// we attempt to fetch "ourselves"
|
// we attempt to fetch "ourselves"
|
||||||
|
@ -1884,6 +1884,7 @@ unset($query['actions']);
|
|||||||
if ($htmlOptions !='always_display') $fetchEmbeddedImages = true;
|
if ($htmlOptions !='always_display') $fetchEmbeddedImages = true;
|
||||||
$attachments = $this->mail_bo->getMessageAttachments($uid, $partID, null, $fetchEmbeddedImages);
|
$attachments = $this->mail_bo->getMessageAttachments($uid, $partID, null, $fetchEmbeddedImages);
|
||||||
//_debug_array($headers);
|
//_debug_array($headers);
|
||||||
|
//error_log(__METHOD__.__LINE__.array2string($attachments));
|
||||||
$attachmentHTMLBlock = self::createAttachmentBlock($attachments, $rowID, $uid, $mailbox);
|
$attachmentHTMLBlock = self::createAttachmentBlock($attachments, $rowID, $uid, $mailbox);
|
||||||
$webserverURL = $GLOBALS['egw_info']['server']['webserver_url'];
|
$webserverURL = $GLOBALS['egw_info']['server']['webserver_url'];
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user