From 30833a2ad5a1a67ad1f3b874e9ff1cdab99b849a Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 8 Aug 2012 14:09:19 +0200 Subject: Fix image cid substitution in compose/sendmail --- program/steps/mail/compose.inc | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'program/steps') diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc index 57869d1f7..71a1c0f21 100644 --- a/program/steps/mail/compose.inc +++ b/program/steps/mail/compose.inc @@ -666,9 +666,9 @@ function rcmail_prepare_message_body() if ($isHtml && preg_match('#comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id'].'&_id='.$COMPOSE['id'], - $body); + $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s', + $RCMAIL->comm_path, $COMPOSE['id'], $attachment['id']); + $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))) { $COMPOSE['attachments'][$attachment['id']] = $attachment; 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) $cid_map['cid:'.$part->content_id] = $url; else @@ -1075,7 +1076,8 @@ function rcmail_write_inline_attachments(&$message) if (($part->content_id || $part->content_location) && $part->filename) { if ($attachment = rcmail_save_attachment($message, $pid)) { $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) $cid_map['cid:'.$part->content_id] = $url; else -- cgit v1.2.3