svncommit
2006-09-23 ed65922364bafd97248af2bc7df4fdb61b906574
prevent multiple copies of an emoticon image from being attached to an outgoing message



1 files modified
14 ■■■■■ changed files
program/steps/mail/sendmail.inc 14 ●●●●● patch | view | raw | blame | history
program/steps/mail/sendmail.inc
@@ -89,12 +89,22 @@
  $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)));
write_log('emoticon', "looking for $image_name in array:" . print_r($included_images, true));
    if (! in_array($image_name, $included_images))
      {
    $body_post = substr($body, $pos2);
    // add the image to the MIME message
@@ -105,6 +115,8 @@
      }
    $body = $body_pre . 'cid:_' . $image_name . $body_post;
      array_push($included_images, $image_name);
      }
    $last_img_pos = $pos2;
    }