| | |
| | | |
| | | rcmail_process_compose_params($COMPOSE); |
| | | |
| | | // add attachments listed by message_compose hook |
| | | if (is_array($plugin['attachments'])) { |
| | | foreach ($plugin['attachments'] as $attach) { |
| | | // we have structured data |
| | | if (is_array($attach)) { |
| | | $attachment = $attach; |
| | | } |
| | | // only a file path is given |
| | | else { |
| | | $filename = basename($attach); |
| | | $attachment = array( |
| | | 'group' => $COMPOSE_ID, |
| | | 'name' => $filename, |
| | | 'mimetype' => rcube_mime::file_content_type($attach, $filename), |
| | | 'path' => $attach, |
| | | ); |
| | | } |
| | | |
| | | // save attachment if valid |
| | | if (($attachment['data'] && $attachment['name']) || ($attachment['path'] && file_exists($attachment['path']))) { |
| | | $attachment = rcmail::get_instance()->plugins->exec_hook('attachment_save', $attachment); |
| | | } |
| | | |
| | | if ($attachment['status'] && !$attachment['abort']) { |
| | | unset($attachment['data'], $attachment['status'], $attachment['abort']); |
| | | $COMPOSE['attachments'][$attachment['id']] = $attachment; |
| | | } |
| | | } |
| | | } |
| | | |
| | | // check if folder for saving sent messages exists and is subscribed (#1486802) |
| | | if ($sent_folder = $COMPOSE['param']['sent_mbox']) { |
| | | rcmail_check_sent_folder($sent_folder, true); |
| | |
| | | } |
| | | } |
| | | |
| | | if (!empty($COMPOSE['reply_msgid'])) |
| | | $OUTPUT->set_env('reply_msgid', $COMPOSE['reply_msgid']); |
| | | |
| | | $MESSAGE->compose = array(); |
| | | |
| | | // get user's identities |
| | |
| | | $a_recipients = array(); |
| | | $parts = array('to', 'cc', 'bcc', 'replyto', 'followupto'); |
| | | $separator = trim($RCMAIL->config->get('recipients_separator', ',')) . ' '; |
| | | $from_email = @mb_strtolower($MESSAGE->compose['from_email']); |
| | | |
| | | foreach ($parts as $header) { |
| | | $fvalue = ''; |
| | |
| | | continue; |
| | | } |
| | | |
| | | $mailto = format_email(rcube_utils::idn_to_utf8($addr_part['mailto'])); |
| | | // According to RFC5321 local part of email address is case-sensitive |
| | | // however, here it is better to compare addresses in case-insensitive manner |
| | | $mailto = format_email(rcube_utils::idn_to_utf8($addr_part['mailto'])); |
| | | $mailto_lc = mb_strtolower($addr_part['mailto']); |
| | | |
| | | if (!in_array($mailto, $a_recipients) |
| | | && ($header == 'to' |
| | | || $compose_mode != RCUBE_COMPOSE_REPLY |
| | | || empty($MESSAGE->compose['from_email']) |
| | | || $mailto != $MESSAGE->compose['from_email']) |
| | | if (($header == 'to' || $compose_mode != RCUBE_COMPOSE_REPLY || $mailto_lc != $from_email) |
| | | && !in_array($mailto_lc, $a_recipients) |
| | | ) { |
| | | if ($addr_part['name'] && $addr_part['mailto'] != $addr_part['name']) |
| | | $string = format_email_recipient($mailto, $addr_part['name']); |
| | | else |
| | | $string = $mailto; |
| | | if ($addr_part['name'] && $mailto != $addr_part['name']) { |
| | | $mailto = format_email_recipient($mailto, $addr_part['name']); |
| | | } |
| | | |
| | | $fvalue[] = $string; |
| | | $a_recipients[] = $addr_part['mailto']; |
| | | $fvalue[] = $mailto; |
| | | $a_recipients[] = $mailto_lc; |
| | | } |
| | | } |
| | | |
| | |
| | | // pipe compose parameters thru plugins |
| | | $plugin = $RCMAIL->plugins->exec_hook('message_compose', $COMPOSE); |
| | | $COMPOSE['param'] = array_merge($COMPOSE['param'], $plugin['param']); |
| | | |
| | | // add attachments listed by message_compose hook |
| | | if (is_array($plugin['attachments'])) { |
| | | foreach ($plugin['attachments'] as $attach) { |
| | | // we have structured data |
| | | if (is_array($attach)) { |
| | | $attachment = $attach; |
| | | } |
| | | // only a file path is given |
| | | else { |
| | | $filename = basename($attach); |
| | | $attachment = array( |
| | | 'group' => $COMPOSE_ID, |
| | | 'name' => $filename, |
| | | 'mimetype' => rcube_mime::file_content_type($attach, $filename), |
| | | 'path' => $attach, |
| | | ); |
| | | } |
| | | |
| | | // save attachment if valid |
| | | if (($attachment['data'] && $attachment['name']) || ($attachment['path'] && file_exists($attachment['path']))) { |
| | | $attachment = rcmail::get_instance()->plugins->exec_hook('attachment_save', $attachment); |
| | | } |
| | | |
| | | if ($attachment['status'] && !$attachment['abort']) { |
| | | unset($attachment['data'], $attachment['status'], $attachment['abort']); |
| | | $COMPOSE['attachments'][$attachment['id']] = $attachment; |
| | | } |
| | | } |
| | | } |
| | | } |
| | | |
| | | function rcmail_compose_headers($attrib) |
| | |
| | | $index = $storage->index(null, rcmail_sort_column(), rcmail_sort_order()); |
| | | $COMPOSE['forward_uid'] = $index->get(); |
| | | } |
| | | else if (strpos($COMPOSE['forward_uid'], ':')) { |
| | | $COMPOSE['forward_uid'] = rcube_imap_generic::uncompressMessageSet($COMPOSE['forward_uid']); |
| | | } |
| | | else { |
| | | $COMPOSE['forward_uid'] = explode(',', $COMPOSE['forward_uid']); |
| | | } |