diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-12-29 12:32:16 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2008-12-29 12:32:16 +0000 |
| commit | 3c60767a3936eaeeade73e1f392f6973b8c5604f (patch) | |
| tree | d734e2249b100d59a7b55b847363273e438b96d2 /roundcubemail/program/steps | |
| parent | 49a6eaf1541a3eb9094f6024ccb62f7d86b60c63 (diff) | |
#1485653: fix enless loop in rcmail_attach_emoticons() + fix attaching the same image a few times
git-svn-id: https://svn.roundcube.net/trunk@2192 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program/steps')
| -rw-r--r-- | roundcubemail/program/steps/mail/sendmail.inc | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/roundcubemail/program/steps/mail/sendmail.inc b/roundcubemail/program/steps/mail/sendmail.inc index f92f0f7b4..21e1a7ff1 100644 --- a/roundcubemail/program/steps/mail/sendmail.inc +++ b/roundcubemail/program/steps/mail/sendmail.inc @@ -98,8 +98,8 @@ function rcmail_attach_emoticons(&$mime_message) $body = preg_replace('/\x00/', '', $htmlContents); $last_img_pos = 0; - $searchstr = 'program/js/tiny_mce/plugins/emotions/img/'; + $path_len = strlen(INSTALL_PATH . '/'); // keep track of added images, so they're only added once $included_images = array(); @@ -109,29 +109,29 @@ function rcmail_attach_emoticons(&$mime_message) { $pos2 = strpos($body, '"', $pos); $body_pre = substr($body, 0, $pos); + $body_post = substr($body, $pos2); + $image_name = substr($body, $pos + strlen($searchstr), $pos2 - ($pos + strlen($searchstr))); + // sanitize image name so resulting attachment doesn't leave images dir $image_name = preg_replace('/[^a-zA-Z0-9_\.\-]/i','',$image_name); - - $body_post = substr($body, $pos2); + $img_file = INSTALL_PATH . '/' . $searchstr . $image_name; if (! in_array($image_name, $included_images)) { // add the image to the MIME message - $img_file = INSTALL_PATH . '/' . $searchstr . $image_name; if(! $mime_message->addHTMLImage($img_file, 'image/gif', '', true, $image_name)) $OUTPUT->show_message("emoticonerror", 'error'); - array_push($included_images, $image_name); } - + $body = $body_pre . $img_file . $body_post; - $last_img_pos = $pos2; + $last_img_pos = $pos2 + $path_len; } - + $mime_message->setHTMLBody($body); } |
