| | |
| | | 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 |
| | |
| | | * return table with message headers |
| | | */ |
| | | function rcmail_message_headers($attrib, $headers=null) |
| | | { |
| | | { |
| | | global $OUTPUT, $MESSAGE, $PRINT_MODE, $RCMAIL; |
| | | static $sa_attrib; |
| | | |
| | |
| | | $value = $headers[$hkey]; |
| | | else if ($headers['others'][$hkey]) |
| | | $value = $headers['others'][$hkey]; |
| | | else |
| | | else if (!$attrib['valueof']) |
| | | continue; |
| | | |
| | | if (in_array($hkey, $exclude_headers)) |
| | |
| | | $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; |
| | |
| | | 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), |
| | |
| | | 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, |
| | | ))) |
| | |
| | | $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) |
| | |
| | | // 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, |
| | |
| | | if ($name) |
| | | $address .= Q($name); |
| | | if ($mailto) |
| | | $address .= (strlen($address) ? ' ' : '') . sprintf('<%s>', Q($mailto)); |
| | | $address = trim($address . ' ' . Q($name ? sprintf('<%s>', $mailto) : $mailto)); |
| | | } |
| | | |
| | | $address = html::span('adr', $address); |
| | |
| | | /** |
| | | * Wrap text to a given number of characters per line |
| | | * but respect the mail quotation of replies messages (>). |
| | | * Finally add another quotation level by prpending the lines |
| | | * Finally add another quotation level by prepending the lines |
| | | * with > |
| | | * |
| | | * @param string Text to wrap |
| | | * @param int The line width |
| | | * @param int The line width |
| | | * @return string The wrapped text |
| | | */ |
| | | function rcmail_wrap_and_quote($text, $length = 72) |
| | |
| | | $line = '>' . rtrim($line); |
| | | else if (mb_strlen($line) > $max) { |
| | | $newline = ''; |
| | | foreach(explode("\n", rc_wordwrap($line, $length - 2)) as $l) { |
| | | foreach (explode("\n", rc_wordwrap($line, $length - 2)) as $l) { |
| | | if (strlen($l)) |
| | | $newline .= '> ' . $l . "\n"; |
| | | else |
| | |
| | | $a_to = rcube_mime::decode_address_list($MESSAGE->headers->to, null, true, $MESSAGE->headers->charset); |
| | | foreach ($a_to as $addr) { |
| | | if (!empty($addr['mailto'])) { |
| | | $a_recipients[] = format_email($addr['mailto']); |
| | | $a_recipients[] = strtolower($addr['mailto']); |
| | | $a_names[] = $addr['name']; |
| | | } |
| | | } |
| | |
| | | $a_cc = rcube_mime::decode_address_list($MESSAGE->headers->cc, null, true, $MESSAGE->headers->charset); |
| | | foreach ($a_cc as $addr) { |
| | | if (!empty($addr['mailto'])) { |
| | | $a_recipients[] = format_email($addr['mailto']); |
| | | $a_recipients[] = strtolower($addr['mailto']); |
| | | $a_names[] = $addr['name']; |
| | | } |
| | | } |
| | |
| | | break; |
| | | } |
| | | // use replied message recipients |
| | | else if (($found = array_search($ident['email_ascii'], $a_recipients)) !== false) { |
| | | else if (($found = array_search(strtolower($ident['email_ascii']), $a_recipients)) !== false) { |
| | | if ($found_idx === null) { |
| | | $found_idx = $idx; |
| | | } |
| | |
| | | // Try Return-Path |
| | | if ($from_idx === null && ($return_path = $MESSAGE->headers->others['return-path'])) { |
| | | foreach ($identities as $idx => $ident) { |
| | | if (strpos($return_path, str_replace('@', '=', $ident['email_ascii']).'@') !== false) { |
| | | $from_idx = $idx; |
| | | break; |
| | | // Return-Path header contains an email address, but on some mailing list |
| | | // it can be e.g. <pear-dev-return-55250-local=domain.tld@lists.php.net> |
| | | // where local@domain.tld is the address we're looking for (#1489241) |
| | | $ident1 = $ident['email_ascii']; |
| | | $ident2 = str_replace('@', '=', $ident1); |
| | | |
| | | foreach ((array)$return_path as $path) { |
| | | if (stripos($path, $ident1) !== false || stripos($path, $ident2)) { |
| | | $from_idx = $idx; |
| | | break 2; |
| | | } |
| | | } |
| | | } |
| | | } |
| | |
| | | // 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'; |
| | | |