| | |
| | | } |
| | | |
| | | // check if folder for saving sent messages exists and is subscribed (#1486802) |
| | | if (($sent_folder = $_SESSION['compose']['param']['sent_mbox']) && !$IMAP->mailbox_exists($sent_folder, true)) { |
| | | // folder may exist but isn't subscribed (#1485241) |
| | | if (!$IMAP->mailbox_exists($sent_folder)) |
| | | $IMAP->create_mailbox($sent_folder, true); |
| | | else |
| | | $IMAP->subscribe($sent_folder); |
| | | if ($sent_folder = $_SESSION['compose']['param']['sent_mbox']) { |
| | | rcmail_check_sent_folder($sent_folder, true); |
| | | } |
| | | |
| | | // redirect to a unique URL with all parameters stored in session |
| | |
| | | // add some labels to client |
| | | $OUTPUT->add_label('nosubject', 'nosenderwarning', 'norecipientwarning', 'nosubjectwarning', 'cancel', |
| | | 'nobodywarning', 'notsentwarning', 'notuploadedwarning', 'savingmessage', 'sendingmessage', |
| | | 'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror'); |
| | | 'messagesaved', 'converting', 'editorwarning', 'searching', 'uploading', 'fileuploaderror', |
| | | 'autocompletechars'); |
| | | |
| | | // add config parameters to client script |
| | | if (!empty($CONFIG['drafts_mbox'])) { |
| | |
| | | $OUTPUT->set_env('mailbox', $IMAP->get_mailbox_name()); |
| | | $OUTPUT->set_env('sig_above', $CONFIG['sig_above']); |
| | | $OUTPUT->set_env('top_posting', $CONFIG['top_posting']); |
| | | $OUTPUT->set_env('autocomplete_min_length', $CONFIG['autocomplete_min_length']); |
| | | |
| | | // get reference message and set compose mode |
| | | if ($msg_uid = $_SESSION['compose']['param']['reply_uid']) |
| | |
| | | $MESSAGE->reply_all = $_SESSION['compose']['param']['all']; |
| | | |
| | | $OUTPUT->set_env('compose_mode', 'reply'); |
| | | |
| | | // Save the sent message in the same folder of the message being replied to |
| | | if ($RCMAIL->config->get('reply_same_folder') && ($sent_folder = $_SESSION['compose']['mailbox']) |
| | | && rcmail_check_sent_folder($sent_folder, false) |
| | | ) { |
| | | $_SESSION['compose']['param']['sent_mbox'] = $sent_folder; |
| | | } |
| | | } |
| | | else if ($compose_mode == RCUBE_COMPOSE_DRAFT) |
| | | { |
| | |
| | | $_SESSION['compose']['forward_uid'] = $info['uid']; |
| | | |
| | | $_SESSION['compose']['mailbox'] = $info['folder']; |
| | | |
| | | // Save the sent message in the same folder of the message being replied to |
| | | if ($RCMAIL->config->get('reply_same_folder') && ($sent_folder = $info['folder']) |
| | | && rcmail_check_sent_folder($sent_folder, false) |
| | | ) { |
| | | $_SESSION['compose']['param']['sent_mbox'] = $sent_folder; |
| | | } |
| | | } |
| | | |
| | | |
| | | if ($MESSAGE->headers->in_reply_to) |
| | | $_SESSION['compose']['reply_msgid'] = '<'.$MESSAGE->headers->in_reply_to.'>'; |
| | | |
| | |
| | | $header = 'reply-to'; |
| | | |
| | | case 'mailreplyto': |
| | | case 'mailreply-to': |
| | | case 'mail-reply-to': |
| | | if (!$fname) { |
| | | $fname = '_mailreplyto'; |
| | | $param = 'mailreplyto'; |
| | | $header = 'mailreply-to'; |
| | | $header = 'mail-reply-to'; |
| | | } |
| | | |
| | | case 'mailfollowupto': |
| | | case 'mailfollowup-to': |
| | | case 'mail-followup-to': |
| | | if (!$fname) { |
| | | $fname = '_mailfollowupto'; |
| | | $param = 'mailfollowupto'; |
| | | $header = 'mailfollowup-to'; |
| | | $header = 'mail-followup-to'; |
| | | } |
| | | |
| | | $allow_attrib = array('id', 'class', 'style', 'size', 'tabindex'); |
| | |
| | | $from_id = get_input_value('_from', RCUBE_INPUT_POST); |
| | | else if (!empty($_SESSION['compose']['param']['from'])) |
| | | $from_id = $_SESSION['compose']['param']['from']; |
| | | else { |
| | | else if (count($user_identities) > 1) { |
| | | $return_path = $MESSAGE->headers->others['return-path']; |
| | | |
| | | // Set identity |
| | |
| | | $out .= $msgtype->show(); |
| | | |
| | | // If desired, set this textarea to be editable by TinyMCE |
| | | if ($isHtml) $attrib['class'] = 'mce_editor'; |
| | | $textarea = new html_textarea($attrib); |
| | | $out .= $textarea->show($MESSAGE_BODY); |
| | | if ($isHtml) { |
| | | $attrib['class'] = 'mce_editor'; |
| | | $textarea = new html_textarea($attrib); |
| | | $out .= $textarea->show($MESSAGE_BODY); |
| | | } |
| | | else { |
| | | $textarea = new html_textarea($attrib); |
| | | $out .= $textarea->show(''); |
| | | // quote plain text, inject into textarea |
| | | $table = get_html_translation_table(HTML_SPECIALCHARS); |
| | | $MESSAGE_BODY = strtr($MESSAGE_BODY, $table); |
| | | $out = substr($out, 0, -11) . $MESSAGE_BODY . '</textarea>'; |
| | | } |
| | | |
| | | $out .= $form_end ? "\n$form_end" : ''; |
| | | |
| | | $OUTPUT->set_env('composebody', $attrib['id']); |
| | |
| | | |
| | | function rcmail_write_compose_attachments(&$message, $bodyIsHtml) |
| | | { |
| | | global $OUTPUT; |
| | | global $RCMAIL; |
| | | |
| | | $cid_map = $messages = array(); |
| | | foreach ((array)$message->mime_parts as $pid => $part) |
| | |
| | | if (!$skip && ($attachment = rcmail_save_attachment($message, $pid))) { |
| | | $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; |
| | | if ($bodyIsHtml && ($part->content_id || $part->content_location)) { |
| | | $url = $OUTPUT->app->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id']; |
| | | $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id']; |
| | | if ($part->content_id) |
| | | $cid_map['cid:'.$part->content_id] = $url; |
| | | else |
| | |
| | | |
| | | function rcmail_write_inline_attachments(&$message) |
| | | { |
| | | global $OUTPUT; |
| | | global $RCMAIL; |
| | | |
| | | $cid_map = array(); |
| | | foreach ((array)$message->mime_parts as $pid => $part) { |
| | | if (($part->content_id || $part->content_location) && $part->filename) { |
| | | if ($attachment = rcmail_save_attachment($message, $pid)) { |
| | | $_SESSION['compose']['attachments'][$attachment['id']] = $attachment; |
| | | $url = $OUTPUT->app->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id']; |
| | | $url = $RCMAIL->comm_path.'&_action=display-attachment&_file=rcmfile'.$attachment['id']; |
| | | if ($part->content_id) |
| | | $cid_map['cid:'.$part->content_id] = $url; |
| | | else |
| | |
| | | } |
| | | |
| | | |
| | | function rcmail_check_sent_folder($folder, $create=false) |
| | | { |
| | | global $IMAP; |
| | | |
| | | if ($IMAP->mailbox_exists($folder, true)) { |
| | | return true; |
| | | } |
| | | |
| | | // folder may exist but isn't subscribed (#1485241) |
| | | if ($create) { |
| | | if (!$IMAP->mailbox_exists($folder)) |
| | | return $IMAP->create_mailbox($folder, true); |
| | | else |
| | | return $IMAP->subscribe($folder); |
| | | } |
| | | |
| | | return false; |
| | | } |
| | | |
| | | |
| | | function get_form_tags($attrib) |
| | | { |
| | | global $RCMAIL, $MESSAGE_FORM; |
| | |
| | | $form_start = empty($attrib['form']) ? $RCMAIL->output->form_tag(array('name' => "form", 'method' => "post")) : ''; |
| | | $form_start .= $hiddenfields->show(); |
| | | } |
| | | |
| | | |
| | | $form_end = ($MESSAGE_FORM && !strlen($attrib['form'])) ? '</form>' : ''; |
| | | $form_name = !empty($attrib['form']) ? $attrib['form'] : 'form'; |
| | | |
| | | |
| | | if (!$MESSAGE_FORM) |
| | | $RCMAIL->output->add_gui_object('messageform', $form_name); |
| | | |
| | | |
| | | $MESSAGE_FORM = $form_name; |
| | | |
| | | return array($form_start, $form_end); |