| | |
| | | |
| | | function rcmail_compose_editor_mode() |
| | | { |
| | | global $RCMAIL, $MESSAGE, $compose_mode; |
| | | global $RCMAIL, $compose_mode; |
| | | static $useHtml; |
| | | |
| | | if ($useHtml !== null) |
| | |
| | | $useHtml = !empty($_POST['_is_html']); |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) { |
| | | $useHtml = $MESSAGE->has_html_part(false, true); |
| | | $useHtml = rcmail_message_is_html(); |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_REPLY) { |
| | | $useHtml = ($html_editor == 1 || ($html_editor >= 2 && $MESSAGE->has_html_part(false, true))); |
| | | $useHtml = ($html_editor == 1 || ($html_editor >= 2 && rcmail_message_is_html())); |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_FORWARD) { |
| | | $useHtml = ($html_editor == 1 || ($html_editor == 3 && $MESSAGE->has_html_part(false, true))); |
| | | $useHtml = ($html_editor == 1 || ($html_editor == 3 && rcmail_message_is_html())); |
| | | } |
| | | else { |
| | | $useHtml = ($html_editor == 1); |
| | |
| | | return $useHtml; |
| | | } |
| | | |
| | | function rcmail_message_is_html() |
| | | { |
| | | global $MESSAGE; |
| | | return ($MESSAGE instanceof rcube_message) && $MESSAGE->has_html_part(true); |
| | | } |
| | | |
| | | function rcmail_prepare_message_body() |
| | | { |
| | |
| | | { |
| | | global $RCMAIL, $COMPOSE, $compose_mode; |
| | | |
| | | $loaded_attachments = array(); |
| | | foreach ((array)$COMPOSE['attachments'] as $id => $attachment) { |
| | | $loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment; |
| | | } |
| | | |
| | | $cid_map = $messages = array(); |
| | | foreach ((array)$message->mime_parts as $pid => $part) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | if (!$skip && ($attachment = rcmail_save_attachment($message, $pid))) { |
| | | if (!$skip && (($attachment = $loaded_attachments[rcmail_attachment_name($part) . $part->mimetype]) |
| | | || ($attachment = rcmail_save_attachment($message, $pid)))) { |
| | | $COMPOSE['attachments'][$attachment['id']] = $attachment; |
| | | if ($bodyIsHtml && ($part->content_id || $part->content_location)) { |
| | | $url = sprintf('%s&_id=%s&_action=display-attachment&_file=rcmfile%s', |