mirror of
https://github.com/EGroupware/egroupware.git
synced 2025-01-03 04:29:28 +01:00
Fix inline images of compose do not get stored as links into integrated applications like infolog, tracker or calendar
This commit is contained in:
parent
1e1447e135
commit
83de4986c8
@ -6573,7 +6573,7 @@ class Mail
|
|||||||
* @param Mailer $_mailObject instance of the Mailer Object to be used
|
* @param Mailer $_mailObject instance of the Mailer Object to be used
|
||||||
* @param string $_html2parse the html to parse and to be altered, if conditions meet
|
* @param string $_html2parse the html to parse and to be altered, if conditions meet
|
||||||
* @param $mail_bo mail bo object
|
* @param $mail_bo mail bo object
|
||||||
* @return void
|
* @return array|null return inline images stored as tmp file in vfs as array of attachments otherwise null
|
||||||
*/
|
*/
|
||||||
static function processURL2InlineImages(Mailer $_mailObject, &$_html2parse, $mail_bo)
|
static function processURL2InlineImages(Mailer $_mailObject, &$_html2parse, $mail_bo)
|
||||||
{
|
{
|
||||||
@ -6678,7 +6678,14 @@ class Mail
|
|||||||
$_html2parse = str_replace($images[0][$i], $images[1][$i].'="'.$cid.'"', $_html2parse);
|
$_html2parse = str_replace($images[0][$i], $images[1][$i].'="'.$cid.'"', $_html2parse);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
$attachments [] = array(
|
||||||
|
'name' => $filename,
|
||||||
|
'type' => $mimeType,
|
||||||
|
'file' => $attachment_file,
|
||||||
|
'tmp_name' => $attachment_file
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
return is_array($attachments) ? $attachments : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2226,6 +2226,8 @@ class mail_compose
|
|||||||
* @param array $_formData
|
* @param array $_formData
|
||||||
* @param array $_identity
|
* @param array $_identity
|
||||||
* @param boolean $_autosaving =false true: autosaving, false: save-as-draft or send
|
* @param boolean $_autosaving =false true: autosaving, false: save-as-draft or send
|
||||||
|
*
|
||||||
|
* @return array returns found inline images as attachment structure
|
||||||
*/
|
*/
|
||||||
function createMessage(Api\Mailer $_mailObject, array $_formData, array $_identity, $_autosaving=false)
|
function createMessage(Api\Mailer $_mailObject, array $_formData, array $_identity, $_autosaving=false)
|
||||||
{
|
{
|
||||||
@ -2359,7 +2361,7 @@ class mail_compose
|
|||||||
$_mailObject->setBody($this->convertHTMLToText($body, true, true));
|
$_mailObject->setBody($this->convertHTMLToText($body, true, true));
|
||||||
}
|
}
|
||||||
// convert URL Images to inline images - if possible
|
// convert URL Images to inline images - if possible
|
||||||
if (!$_autosaving) Mail::processURL2InlineImages($_mailObject, $body, $mail_bo);
|
if (!$_autosaving) $inline_images = Mail::processURL2InlineImages($_mailObject, $body, $mail_bo);
|
||||||
if (strpos($body,"<!-- HTMLSIGBEGIN -->")!==false)
|
if (strpos($body,"<!-- HTMLSIGBEGIN -->")!==false)
|
||||||
{
|
{
|
||||||
$body = str_replace(array('<!-- HTMLSIGBEGIN -->','<!-- HTMLSIGEND -->'),'',$body);
|
$body = str_replace(array('<!-- HTMLSIGBEGIN -->','<!-- HTMLSIGEND -->'),'',$body);
|
||||||
@ -2464,6 +2466,7 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
if ($connection_opened) $mail_bo->closeConnection();
|
if ($connection_opened) $mail_bo->closeConnection();
|
||||||
}
|
}
|
||||||
|
return is_array($inline_images)?$inline_images:array();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -2826,8 +2829,8 @@ class mail_compose
|
|||||||
}
|
}
|
||||||
//error_log($this->sessionData['mailaccount']);
|
//error_log($this->sessionData['mailaccount']);
|
||||||
//error_log(__METHOD__.__LINE__.':'.array2string($this->sessionData['mailidentity']).'->'.array2string($identity));
|
//error_log(__METHOD__.__LINE__.':'.array2string($this->sessionData['mailidentity']).'->'.array2string($identity));
|
||||||
// create the messages
|
// create the messages and store inline images
|
||||||
$this->createMessage($mail, $_formData, $identity);
|
$inline_images = $this->createMessage($mail, $_formData, $identity);
|
||||||
// remember the identity
|
// remember the identity
|
||||||
if ($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on') $fromAddress = $mail->From;//$mail->FromName.($mail->FromName?' <':'').$mail->From.($mail->FromName?'>':'');
|
if ($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on') $fromAddress = $mail->From;//$mail->FromName.($mail->FromName?' <':'').$mail->From.($mail->FromName?'>':'');
|
||||||
#print "<pre>". $mail->getMessageHeader() ."</pre><hr><br>";
|
#print "<pre>". $mail->getMessageHeader() ."</pre><hr><br>";
|
||||||
@ -3157,6 +3160,8 @@ class mail_compose
|
|||||||
|
|
||||||
if ($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on' || $_formData['to_calendar'] == 'on' )
|
if ($_formData['to_infolog'] == 'on' || $_formData['to_tracker'] == 'on' || $_formData['to_calendar'] == 'on' )
|
||||||
{
|
{
|
||||||
|
$this->sessionData['attachments'] = array_merge((array)$this->sessionData['attachments'], (array)$inline_images);
|
||||||
|
|
||||||
foreach(array('to_infolog','to_tracker','to_calendar') as $app_key)
|
foreach(array('to_infolog','to_tracker','to_calendar') as $app_key)
|
||||||
{
|
{
|
||||||
$entryid = $_formData['to_integrate_ids'][0][$app_key];
|
$entryid = $_formData['to_integrate_ids'][0][$app_key];
|
||||||
|
Loading…
Reference in New Issue
Block a user