mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-02-25 14:51:35 +01:00
* eMail: improving of the fetching of cids; match cid to filename if the attempt to match the cid failed
This commit is contained in:
parent
e72cd51f8e
commit
72a015bf06
@ -1268,19 +1268,39 @@
|
|||||||
// fetch a specific attachment from a message
|
// fetch a specific attachment from a message
|
||||||
function getAttachmentByCID($_uid, $_cid, $_part)
|
function getAttachmentByCID($_uid, $_cid, $_part)
|
||||||
{
|
{
|
||||||
|
// some static variables to avoid fetching the same mail multiple times
|
||||||
|
static $uid,$part,$attachments,$structure;
|
||||||
|
|
||||||
|
if ($_uid != $uid || $_part != $part)
|
||||||
|
{
|
||||||
|
$attachments = $this->getMessageAttachments($uid=$_uid, $part=$_part);
|
||||||
|
$structure = null;
|
||||||
|
}
|
||||||
$partID = false;
|
$partID = false;
|
||||||
#error_log("getAttachmentByCID:$_uid, $_cid, $_part");
|
//list($cidname,$cidrest) = explode('@',$_cid,2);
|
||||||
$attachments = $this->getMessageAttachments($_uid, $_part);
|
//error_log("getAttachmentByCID:$_uid ($cidname -> $cidrest), $_cid, $_part");
|
||||||
foreach($attachments as $attachment) {
|
foreach($attachments as $attachment)
|
||||||
//error_log(__METHOD__.'Attachment#'.print_r($attachment,true).'#');
|
{
|
||||||
//error_log(__METHOD__.'CID#'.print_r($_cid,true).'#');
|
//error_log(print_r($attachment,true));
|
||||||
if(isset($attachment['cid']) && (strpos($attachment['cid'], $_cid) !== false || strpos($_cid, $attachment['cid']) !== false)) {
|
if(isset($attachment['cid']) && (strpos($attachment['cid'], $_cid) !== false || strpos($_cid, $attachment['cid']) !== false))
|
||||||
|
{
|
||||||
$partID = $attachment['partID'];
|
$partID = $attachment['partID'];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($partID == false)
|
||||||
#error_log( "PARTID:$_cid $partID<bR>"); #exit;
|
{
|
||||||
|
foreach($attachments as $attachment)
|
||||||
|
{
|
||||||
|
// if the former did not match try matching the cid to the name of the attachment
|
||||||
|
if(isset($attachment['cid']) && isset($attachment['name']) && (strpos($attachment['name'], $_cid) !== false || strpos($_cid, $attachment['name']) !== false))
|
||||||
|
{
|
||||||
|
$partID = $attachment['partID'];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//error_log( "Cid:$_cid PARTID:$partID<bR>"); #exit;
|
||||||
|
|
||||||
if($partID == false) {
|
if($partID == false) {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user