| | |
| | | { |
| | | rcmail_compose_cleanup(); |
| | | $_SESSION['compose'] = array( |
| | | 'id' => uniqid(rand()), |
| | | 'param' => array_map('strip_tags', $_GET), |
| | | 'mailbox' => $IMAP->get_mailbox_name() |
| | | 'id' => uniqid(rand()), |
| | | 'param' => array_map('strip_tags', $_GET), |
| | | 'mailbox' => $IMAP->get_mailbox_name(), |
| | | ); |
| | | |
| | | // process values like "mailto:foo@bar.com?subject=new+message&cc=another" |
| | |
| | | { |
| | | // similar as in program/steps/mail/show.inc |
| | | // re-set 'prefer_html' to have possibility to use html part for compose |
| | | $CONFIG['prefer_html'] = $CONFIG['htmleditor']; |
| | | $CONFIG['prefer_html'] = $CONFIG['htmleditor'] || $compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT; |
| | | $MESSAGE = new rcube_message($msg_uid); |
| | | |
| | | if (!empty($MESSAGE->headers->charset)) |
| | |
| | | |
| | | $attrib['name'] = '_message'; |
| | | |
| | | if ($CONFIG['htmleditor']) |
| | | if ($CONFIG['htmleditor'] || (($compose_mode == RCUBE_COMPOSE_DRAFT || $compose_mode == RCUBE_COMPOSE_EDIT) && $MESSAGE->first_html_part())) |
| | | $isHtml = true; |
| | | else |
| | | $isHtml = false; |
| | |
| | | Q($MESSAGE->subject), |
| | | Q($MESSAGE->headers->date), |
| | | htmlspecialchars(Q($MESSAGE->get_header('from'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset()), |
| | | htmlspecialchars(Q($MESSAGE->get_header('to'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); |
| | | htmlspecialchars(Q($MESSAGE->get_header('to'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); |
| | | |
| | | if ($MESSAGE->headers->replyto && $MESSAGE->headers->replyto != $MESSAGE->headers->from) |
| | | $prefix .= sprintf("<tr><th align=\"right\" nowrap=\"nowrap\" valign=\"baseline\">Reply-To: </th><td>%s</td></tr>", |
| | | htmlspecialchars(Q($MESSAGE->get_header('replyto'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); |
| | | htmlspecialchars(Q($MESSAGE->get_header('replyto'), 'replace'), ENT_COMPAT, $OUTPUT->get_charset())); |
| | | |
| | | $prefix .= "</tbody></table><br>"; |
| | | } |
| | |
| | | * add attachments |
| | | * sizeof($MESSAGE->mime_parts can be 1 - e.g. attachment, but no text! |
| | | */ |
| | | if (!isset($_SESSION['compose']['forward_attachments']) |
| | | if (empty($_SESSION['compose']['forward_attachments']) |
| | | && is_array($MESSAGE->mime_parts) |
| | | && count($MESSAGE->mime_parts) > 0) |
| | | { |
| | |
| | | $cid_map = array(); |
| | | foreach ((array)$message->mime_parts as $pid => $part) |
| | | { |
| | | if (($part->ctype_primary != 'message' || !$bodyIsHtml) && $part->filename && |
| | | ($part->disposition=='attachment' || ($part->disposition=='inline' && $bodyIsHtml) || (empty($part->disposition)))) |
| | | if (($part->ctype_primary != 'message' || !$bodyIsHtml) && $part->ctype_primary != 'multipart' && |
| | | ($part->disposition == 'attachment' || ($part->disposition == 'inline' && $bodyIsHtml) || $part->filename)) |
| | | { |
| | | if ($attachment = rcmail_save_attachment($message, $pid)) { |
| | | $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; |
| | | if ($bodyIsHtml && $part->filename && $part->content_id) { |
| | | if ($bodyIsHtml && $part->content_id) { |
| | | $cid_map['cid:'.$part->content_id] = $OUTPUT->app->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id']; |
| | | } |
| | | } |
| | |
| | | $part = $message->mime_parts[$pid]; |
| | | |
| | | $attachment = array( |
| | | 'name' => $part->filename, |
| | | 'name' => $part->filename ? $part->filename : 'Part_'.$pid.'.'.$part->ctype_secondary, |
| | | 'mimetype' => $part->ctype_primary . '/' . $part->ctype_secondary, |
| | | 'content_id' => $part->content_id, |
| | | 'data' => $message->get_part_content($pid), |