summaryrefslogtreecommitdiff
path: root/program/steps
diff options
context:
space:
mode:
authorAleksander Machniak <alec@alec.pl>2014-02-17 17:40:07 +0100
committerAleksander Machniak <alec@alec.pl>2014-02-17 17:40:36 +0100
commita16cbb204e52cbbdad24ef7361fc11a859413e31 (patch)
tree91af81d788c6e30267cb4c60158b2e4196410d18 /program/steps
parent7c61ba49539aa705afbf243be7858caef6044574 (diff)
Fix regression in handling of 'attachments' result in message_compose hook (#1489627)
Diffstat (limited to 'program/steps')
-rw-r--r--program/steps/mail/compose.inc60
1 files changed, 30 insertions, 30 deletions
diff --git a/program/steps/mail/compose.inc b/program/steps/mail/compose.inc
index 8504d026c..c76da14ce 100644
--- a/program/steps/mail/compose.inc
+++ b/program/steps/mail/compose.inc
@@ -62,36 +62,6 @@ if (!is_array($COMPOSE)) {
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);
@@ -498,6 +468,36 @@ function rcmail_process_compose_params(&$COMPOSE)
// 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)