From 84f9312e1d17725db6040554a993db38292d46bd Mon Sep 17 00:00:00 2001
From: svncommit <devs@roundcube.net>
Date: Tue, 21 Nov 2006 07:30:48 -0500
Subject: [PATCH] Updated Russian localization

---
 program/steps/mail/sendmail.inc |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)

diff --git a/program/steps/mail/sendmail.inc b/program/steps/mail/sendmail.inc
index b4a6b7c..c3e0170 100644
--- a/program/steps/mail/sendmail.inc
+++ b/program/steps/mail/sendmail.inc
@@ -89,19 +89,29 @@
 
   $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)));
+    $image_name = substr($body,
+                         $pos + strlen($searchstr),
+                         $pos2 - ($pos + strlen($searchstr)));
+
     $body_post = substr($body, $pos2);
 
-    // 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');
+      // 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');
+        }
+      array_push($included_images, $image_name);
       }
 
     $body = $body_pre . 'cid:_' . $image_name . $body_post;

--
Gitblit v1.9.1