Aleksander Machniak
2013-05-14 05b5f969d5c10850291ae413b89461ca1f6bcc5d
program/steps/mail/func.inc
@@ -772,10 +772,12 @@
      if ($q > $quote_level) {
        $body[$n] = $replacer->get_replacement($replacer->add(
          str_repeat('<blockquote>', $q - $quote_level))) . $body[$n];
        $last = $n;
      }
      else if ($q < $quote_level) {
        $body[$n] = $replacer->get_replacement($replacer->add(
          str_repeat('</blockquote>', $quote_level - $q))) . $body[$n];
        $last = $n;
      }
      else if ($flowed) {
        // previous line is flowed
@@ -888,7 +890,7 @@
 * return table with message headers
 */
function rcmail_message_headers($attrib, $headers=null)
  {
{
  global $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL;
  static $sa_attrib;
@@ -1079,9 +1081,9 @@
        $out .= html::div('message-partheaders', rcmail_message_headers(sizeof($header_attrib) ? $header_attrib : null, $part->headers));
      }
      else if ($part->type == 'content') {
        // unsapported
        // unsupported (e.g. encrypted)
        if ($part->realtype) {
          if ($part->realtype == 'multipart/encrypted') {
          if ($part->realtype == 'multipart/encrypted' || $part->realtype == 'application/pkcs7-mime') {
            $out .= html::span('part-notice', rcube_label('encryptedmessage'));
          }
          continue;
@@ -1187,7 +1189,7 @@
             html::a($show_link + array('class' => 'image-link', 'style' => sprintf('width:%dpx', $thumbnail_size)),
               html::img(array(
                'class' => 'image-thumbnail',
                'src'   => $MESSAGE->get_part_url($attach_prop->mime_id, true) . '&_thumb=1',
                'src'   => $MESSAGE->get_part_url($attach_prop->mime_id, 'image') . '&_thumb=1',
                'title' => $attach_prop->filename,
                'alt'   => $attach_prop->filename,
                'style' => sprintf('max-width:%dpx; max-height:%dpx', $thumbnail_size, $thumbnail_size),
@@ -1207,7 +1209,7 @@
            html::tag('legend', 'image-filename', Q($attach_prop->filename)) .
            html::p(array('align' => "center"),
              html::img(array(
                'src'   => $MESSAGE->get_part_url($attach_prop->mime_id, true),
                'src'   => $MESSAGE->get_part_url($attach_prop->mime_id, 'image'),
                'title' => $attach_prop->filename,
                'alt'   => $attach_prop->filename,
              )))
@@ -1439,6 +1441,12 @@
    $name   = $part['name'];
    $mailto = $part['mailto'];
    $string = $part['string'];
    $valid  = check_email($mailto, false);
    // phishing email prevention (#1488981), e.g. "valid@email.addr <phishing@email.addr>"
    if ($name && $valid && $name != $mailto && strpos($name, '@')) {
      $name = '';
    }
    // IDNA ASCII to Unicode
    if ($name == $mailto)
@@ -1452,7 +1460,7 @@
      // for printing we display all addresses
      continue;
    }
    else if (check_email($part['mailto'], false)) {
    else if ($valid) {
      if ($linked) {
        $address = html::a(array(
            'href' => 'mailto:'.$mailto,
@@ -1485,7 +1493,7 @@
      if ($name)
        $address .= Q($name);
      if ($mailto)
        $address .= (strlen($address) ? ' ' : '') . sprintf('&lt;%s&gt;', Q($mailto));
        $address = trim($address . ' ' . Q($name ? sprintf('<%s>', $mailto) : $mailto));
    }
    $address = html::span('adr', $address);
@@ -1687,6 +1695,9 @@
    if ($agent = $RCMAIL->config->get('useragent'))
      $headers['User-Agent'] = $agent;
    if ($RCMAIL->config->get('mdn_use_from'))
      $options['mdn_use_from'] = true;
    $body = rcube_label("yourmessage") . "\r\n\r\n" .
      "\t" . rcube_label("to") . ': ' . rcube_mime::decode_mime_string($message->headers->to, $message->headers->charset) . "\r\n" .
      "\t" . rcube_label("subject") . ': ' . $message->subject . "\r\n" .
@@ -1708,7 +1719,7 @@
    $compose->setTXTBody(rc_wordwrap($body, 75, "\r\n"));
    $compose->addAttachment($report, 'message/disposition-notification', 'MDNPart2.txt', false, '7bit', 'inline');
    $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file);
    $sent = rcmail_deliver_message($compose, $identity['email'], $mailto, $smtp_error, $body_file, $options);
    if ($sent)
    {
@@ -1829,8 +1840,7 @@
  // application/pdf.A520491B_3BF7_494D_8855_7FAC2C6C0608
  if (preg_match('/^application\/pdf.+/', $name))
    $name = 'application/pdf';
  // treat image/pjpeg as image/jpeg
  // treat image/pjpeg (image/pjpg, image/jpg) as image/jpeg (#1489097)
  else if (preg_match('/^image\/p?jpe?g$/', $name))
    $name = 'image/jpeg';
@@ -1847,7 +1857,7 @@
            $filename = rcube_label('htmlmessage');
        }
        else {
            $ext      = rcube_mime::get_mime_extensions($attachment->mimetype);
            $ext      = (array) rcube_mime::get_mime_extensions($attachment->mimetype);
            $ext      = array_shift($ext);
            $filename = rcube_label('messagepart') . ' ' . $attachment->mime_id;
            if ($ext) {