Aleksander Machniak
2013-08-05 9263f55a634cafc805307a138f3f2d54df1faa21
program/steps/mail/compose.inc
@@ -322,8 +322,8 @@
      else if (!empty($MESSAGE->headers->from))
        $fvalue = $MESSAGE->headers->from;
      // Reply to message sent by yourself (#1487074)
      if (!empty($ident) && $fvalue == $ident['ident']) {
      // Reply to message sent by yourself (#1487074, #1489230)
      if (!empty($ident) && in_array($ident['ident'], array($fvalue, $MESSAGE->headers->from))) {
        $fvalue = $MESSAGE->headers->to;
      }
    }
@@ -1005,12 +1005,17 @@
    $cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml);
  }
  // clean up html tags - XSS prevention (#1489251)
  $body = rcmail_wash_html($body, array('safe' => 1), $cid_map);
  // clean up HTML tags - XSS prevention (#1489251)
  if ($bodyIsHtml) {
    $body = rcmail_wash_html($body, array('safe' => 1), $cid_map);
  // replace cid with href in inline images links
  if ($cid_map) {
    $body = str_replace(array_keys($cid_map), array_values($cid_map), $body);
    // remove comments (produced by washtml)
    $body = preg_replace('/<!--[^>]+-->/', '', $body);
    // replace cid with href in inline images links
    if (!empty($cid_map)) {
      $body = str_replace(array_keys($cid_map), array_values($cid_map), $body);
    }
  }
  return $body;