From 6649b1f0a5db6160d197a13ca79cfd67fbb02d77 Mon Sep 17 00:00:00 2001 From: svncommit <devs@roundcube.net> Date: Sat, 23 Sep 2006 19:37:29 -0400 Subject: [PATCH] added TinyMCE spellchecker plugin, configured to use GoogleSpell --- program/steps/mail/sendmail.inc | 26 ++++++++++++++++++-------- 1 files changed, 18 insertions(+), 8 deletions(-) diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc index b4a6b7c..3cf5bd1 100644 --- a/program/steps/mail/sendmail.inc +++ b/program/steps/mail/sendmail.inc @@ -89,22 +89,32 @@ $searchstr = 'program/js/tiny_mce/plugins/emotions/images/'; + // keep track of added images, so they're only added once + $included_images = array(); + // find emoticon image tags while ($pos = strpos($body, $searchstr, $last_img_pos)) { $pos2 = strpos($body, '"', $pos); $body_pre = substr($body, 0, $pos); - $image_name = substr($body, $pos + strlen($searchstr), $pos2 - ($pos + strlen($searchstr))); - $body_post = substr($body, $pos2); + $image_name = substr($body, + $pos + strlen($searchstr), + $pos2 - ($pos + strlen($searchstr))); - // 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)) + if (! in_array($image_name, $included_images)) { - show_message("emoticonerror", 'error'); - } + $body_post = substr($body, $pos2); - $body = $body_pre . 'cid:_' . $image_name . $body_post; + // 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)) + { + show_message("emoticonerror", 'error'); + } + + $body = $body_pre . 'cid:_' . $image_name . $body_post; + array_push($included_images, $image_name); + } $last_img_pos = $pos2; } -- Gitblit v1.9.1