| | |
| | | $html = $part->body; |
| | | if(preg_match('/(\s+content=[\'"]\w+\/\w+;\s+charset)=([a-z0-9-]+)/i', $html)) |
| | | $html = preg_replace('/(\s+content=[\'"]\w+\/\w+;\s+charset)=([a-z0-9-]+)/i', '\\1='.RCMAIL_CHARSET, $html); |
| | | else |
| | | else { |
| | | // add <head> for malformed messages, washtml cannot work without that |
| | | if (!preg_match('/<head>(.*)<\/head>/m', $html)) |
| | | $html = '<head></head>' . $html; |
| | | $html = substr_replace($html, '<meta http-equiv="Content-Type" content="text/html; charset='.RCMAIL_CHARSET.'" />', intval(stripos($html, '</head>')), 0); |
| | | |
| | | } |
| | | |
| | | // clean HTML with washhtml by Frederic Motte |
| | | $body = washtml::wash($html, array( |
| | | 'show_washed' => false, |
| | |
| | | function rcmail_message_body($attrib) |
| | | { |
| | | global $CONFIG, $OUTPUT, $MESSAGE, $IMAP, $REMOTE_OBJECTS; |
| | | |
| | | |
| | | if (!is_array($MESSAGE->parts) && empty($MESSAGE->body)) |
| | | return ''; |
| | | |
| | |
| | | $part->body = $MESSAGE->get_part_content($part->mime_id); |
| | | |
| | | $body = rcmail_print_body($part, $safe_mode, !$CONFIG['prefer_html']); |
| | | |
| | | |
| | | if ($part->ctype_secondary == 'html') |
| | | $out .= html::div('message-htmlpart', rcmail_html4inline($body, $attrib['id'])); |
| | | else |
| | |
| | | |
| | | $ctype_primary = strtolower($MESSAGE->structure->ctype_primary); |
| | | $ctype_secondary = strtolower($MESSAGE->structure->ctype_secondary); |
| | | |
| | | |
| | | // list images after mail body |
| | | if (get_boolean($attrib['showimages']) && $ctype_primary == 'multipart' && |
| | | !empty($MESSAGE->attachments) && !strstr($message_body, '<html')) { |
| | | if (get_boolean($attrib['showimages']) |
| | | && $CONFIG['inline_images'] |
| | | && $ctype_primary == 'multipart' |
| | | && !empty($MESSAGE->attachments) |
| | | && !strstr($message_body, '<html')) |
| | | { |
| | | foreach ($MESSAGE->attachments as $attach_prop) { |
| | | if (strpos($attach_prop->mimetype, 'image/') === 0) { |
| | | $out .= html::tag('hr') . html::p(array('align' => "center"), |