Fix structure parsing and html output for multipart messages
| | |
| | | $struct->ctype_primary = 'multipart'; |
| | | |
| | | // find first non-array entry |
| | | for ($i=1; count($part); $i++) |
| | | for ($i=1; $i<count($part); $i++) |
| | | if (!is_array($part[$i])) |
| | | { |
| | | $struct->ctype_secondary = strtolower($part[$i]); |
| | |
| | | |
| | | $struct->parts = array(); |
| | | for ($i=0, $count=0; $i<count($part); $i++) |
| | | if (is_array($part[$i]) && count($part[$i]) > 5) |
| | | if (is_array($part[$i]) && count($part[$i]) > 3) |
| | | $struct->parts[] = $this->_structure_part($part[$i], ++$count, $struct->mime_id); |
| | | |
| | | return $struct; |
| | |
| | | $result .= $line; |
| | | } while (!preg_match("/^$key/", $line)); |
| | | |
| | | $result = trim(substr($result, strpos($result, 'BODYSTRUCTURE')+13, |
| | | -(strlen($result)-strrpos($result, $key)-2))); |
| | | $result = trim(substr($result, strpos($result, 'BODYSTRUCTURE')+13, -(strlen($result)-strrpos($result, $key)+1))); |
| | | } |
| | | } |
| | | return $result; |
| | |
| | | } |
| | | // text/enriched |
| | | else if ($part->ctype_secondary=='enriched') { |
| | | $part->ctype_secondary = 'html'; |
| | | return Q(enriched_to_html($body), 'show'); |
| | | } |
| | | else |
| | |
| | | if (!$headers) |
| | | $headers = is_object($MESSAGE->headers) ? get_object_vars($MESSAGE->headers) : $MESSAGE->headers; |
| | | |
| | | // add empty subject if none exsists |
| | | if (empty($headers['subject'])) |
| | | $headers['subject'] = rcube_label('nosubject'); |
| | | |
| | | $header_count = 0; |
| | | |
| | | // allow the following attributes to be added to the <table> tag |
| | |
| | | |
| | | $body = rcmail_print_body($part, $safe_mode, !$CONFIG['prefer_html']); |
| | | |
| | | if ($part->ctype_secondary != 'plain') |
| | | if ($part->ctype_secondary == 'html') |
| | | $out .= html::div('message-htmlpart', rcmail_html4inline($body, $attrib['id'])); |
| | | else |
| | | $out .= html::div('message-part', $body); |
| | |
| | | } |
| | | } |
| | | else |
| | | $out .= html::div('message-part', html::div('pre', $MESSAGE->body)); |
| | | $out .= html::div('message-part', html::div('pre', Q($MESSAGE->body))); |
| | | |
| | | |
| | | $ctype_primary = strtolower($MESSAGE->structure->ctype_primary); |
| | |
| | | border-top: 0; |
| | | } |
| | | |
| | | div.message-part a |
| | | div.message-part a, |
| | | div.message-htmlpart a |
| | | { |
| | | color: #0000CC; |
| | | } |