diff options
author | thomascube <thomas@roundcube.net> | 2008-06-05 17:35:12 +0000 |
---|---|---|
committer | thomascube <thomas@roundcube.net> | 2008-06-05 17:35:12 +0000 |
commit | cfe4a6baf462c0befa06b283366945130cabfa5b (patch) | |
tree | 83d74e1c6fa50a71c4e893359630de247bc5c05a /program | |
parent | 077070381f4e97e98c5edf3ce6b456c4c57d057d (diff) |
Fix structure parsing and html output for multipart messages
Diffstat (limited to 'program')
-rw-r--r-- | program/include/rcube_imap.php | 4 | ||||
-rw-r--r-- | program/lib/imap.inc | 3 | ||||
-rw-r--r-- | program/steps/mail/func.inc | 9 |
3 files changed, 10 insertions, 6 deletions
diff --git a/program/include/rcube_imap.php b/program/include/rcube_imap.php index 43c311735..574ed6cc2 100644 --- a/program/include/rcube_imap.php +++ b/program/include/rcube_imap.php @@ -1074,7 +1074,7 @@ class rcube_imap $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]); @@ -1085,7 +1085,7 @@ class rcube_imap $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; diff --git a/program/lib/imap.inc b/program/lib/imap.inc index 877e8a219..e2cd724da 100644 --- a/program/lib/imap.inc +++ b/program/lib/imap.inc @@ -2570,8 +2570,7 @@ function iil_C_FetchStructureString(&$conn, $folder, $id) { $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; diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc index ddaf29063..79a84ccb4 100644 --- a/program/steps/mail/func.inc +++ b/program/steps/mail/func.inc @@ -549,6 +549,7 @@ function rcmail_print_body($part, $safe=false, $plain=false) } // text/enriched else if ($part->ctype_secondary=='enriched') { + $part->ctype_secondary = 'html'; return Q(enriched_to_html($body), 'show'); } else @@ -645,6 +646,10 @@ function rcmail_message_headers($attrib, $headers=NULL) // get associative array of headers object 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; @@ -720,7 +725,7 @@ function rcmail_message_body($attrib) $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); @@ -728,7 +733,7 @@ function rcmail_message_body($attrib) } } 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); |