Fix image cid substitution in compose/sendmail

pull/19/head
Aleksander Machniak 12 years ago
parent cd482ebce6
commit 30833a2ad5

@ -666,9 +666,9 @@ function rcmail_prepare_message_body()
if ($isHtml && preg_match('#<img src="\./program/resources/blocked\.gif"#', $body)) { if ($isHtml && preg_match('#<img src="\./program/resources/blocked\.gif"#', $body)) {
if ($attachment = rcmail_save_image('program/resources/blocked.gif', 'image/gif')) { if ($attachment = rcmail_save_image('program/resources/blocked.gif', 'image/gif')) {
$COMPOSE['attachments'][$attachment['id']] = $attachment; $COMPOSE['attachments'][$attachment['id']] = $attachment;
$body = preg_replace('#\./program/resources/blocked\.gif#', $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s',
$RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id'], $RCMAIL->comm_path, $COMPOSE['id'], $attachment['id']);
$body); $body = preg_replace('#\./program/resources/blocked\.gif#', $url, $body);
} }
} }
@ -1050,7 +1050,8 @@ function rcmail_write_compose_attachments(&$message, $bodyIsHtml)
if (!$skip && ($attachment = rcmail_save_attachment($message, $pid))) { if (!$skip && ($attachment = rcmail_save_attachment($message, $pid))) {
$COMPOSE['attachments'][$attachment['id']] = $attachment; $COMPOSE['attachments'][$attachment['id']] = $attachment;
if ($bodyIsHtml && ($part->content_id || $part->content_location)) { if ($bodyIsHtml && ($part->content_id || $part->content_location)) {
$url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id']; $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s',
$RCMAIL->comm_path, $COMPOSE['id'], $attachment['id']);
if ($part->content_id) if ($part->content_id)
$cid_map['cid:'.$part->content_id] = $url; $cid_map['cid:'.$part->content_id] = $url;
else else
@ -1075,7 +1076,8 @@ function rcmail_write_inline_attachments(&$message)
if (($part->content_id || $part->content_location) && $part->filename) { if (($part->content_id || $part->content_location) && $part->filename) {
if ($attachment = rcmail_save_attachment($message, $pid)) { if ($attachment = rcmail_save_attachment($message, $pid)) {
$COMPOSE['attachments'][$attachment['id']] = $attachment; $COMPOSE['attachments'][$attachment['id']] = $attachment;
$url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id']; $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s',
$RCMAIL->comm_path, $COMPOSE['id'], $attachment['id']);
if ($part->content_id) if ($part->content_id)
$cid_map['cid:'.$part->content_id] = $url; $cid_map['cid:'.$part->content_id] = $url;
else else

Loading…
Cancel
Save