Aleksander Machniak
2013-08-08 bc94e296e74ab4a3313a3f807b0a5cc40f264879
program/steps/mail/compose.inc
@@ -207,7 +207,10 @@
  if (!empty($MESSAGE->headers->charset))
    $RCMAIL->storage->set_charset($MESSAGE->headers->charset);
  if ($compose_mode == RCUBE_COMPOSE_REPLY) {
  if (!$MESSAGE->headers) {
    // error
  }
  else if ($compose_mode == RCUBE_COMPOSE_REPLY) {
    $COMPOSE['reply_uid'] = $msg_uid;
    $COMPOSE['reply_msgid'] = $MESSAGE->headers->messageID;
    $COMPOSE['references']  = trim($MESSAGE->headers->references . " " . $MESSAGE->headers->messageID);
@@ -319,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;
      }
    }
@@ -1000,10 +1003,19 @@
      && count($MESSAGE->mime_parts) > 0)
  {
    $cid_map = rcmail_write_compose_attachments($MESSAGE, $bodyIsHtml);
  }
  // clean up HTML tags - XSS prevention (#1489251)
  if ($bodyIsHtml) {
    $body = rcmail_wash_html($body, array('safe' => 1), $cid_map);
    // remove comments (produced by washtml)
    $body = preg_replace('/<!--[^>]+-->/', '', $body);
    // replace cid with href in inline images links
    if ($cid_map)
    if (!empty($cid_map)) {
      $body = str_replace(array_keys($cid_map), array_values($cid_map), $body);
    }
  }
  return $body;
@@ -1450,17 +1462,17 @@
                       rcube_label('normal'),
                       rcube_label('high'),
                       rcube_label('highest')),
                 array(5, 4, 0, 2, 1));
                 array('5', '4', '0', '2', '1'));
  if (isset($_POST['_priority']))
    $sel = $_POST['_priority'];
  else if (intval($MESSAGE->headers->priority) != 3)
    $sel = intval($MESSAGE->headers->priority);
  else if (isset($MESSAGE->headers->priority) && intval($MESSAGE->headers->priority) != 3)
    $sel = $MESSAGE->headers->priority;
  else
    $sel = 0;
  $out = $form_start ? "$form_start\n" : '';
  $out .= $selector->show($sel);
  $out .= $selector->show(strval($sel));
  $out .= $form_end ? "\n$form_end" : '';
  return $out;