svncommit
2006-11-21 e901f948f25db35a2639130a4d95df34dba58db2
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;