|
|
|
@ -1033,17 +1033,21 @@ function rcmail_write_forward_attachments()
|
|
|
|
|
{
|
|
|
|
|
global $RCMAIL, $COMPOSE, $MESSAGE;
|
|
|
|
|
|
|
|
|
|
$storage = $RCMAIL->get_storage();
|
|
|
|
|
$names = array();
|
|
|
|
|
$refs = array();
|
|
|
|
|
|
|
|
|
|
if ($MESSAGE->pgp_mime) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$storage = $RCMAIL->get_storage();
|
|
|
|
|
$names = array();
|
|
|
|
|
$refs = array();
|
|
|
|
|
$size_errors = 0;
|
|
|
|
|
$size_limit = parse_bytes($RCMAIL->config->get('max_message_size'));
|
|
|
|
|
$total_size = 10 * 1024; // size of message body, to start with
|
|
|
|
|
|
|
|
|
|
$loaded_attachments = array();
|
|
|
|
|
foreach ((array)$COMPOSE['attachments'] as $attachment) {
|
|
|
|
|
$loaded_attachments[$attachment['name'] . $attachment['mimetype']] = $attachment;
|
|
|
|
|
$total_size += $attachment['size'];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($COMPOSE['forward_uid'] == '*') {
|
|
|
|
@ -1085,6 +1089,13 @@ function rcmail_write_forward_attachments()
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($size_limit && $size_limit < $total_size + $message->headers->size) {
|
|
|
|
|
$size_errors++;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$total_size += $message->headers->size;
|
|
|
|
|
|
|
|
|
|
rcmail_save_attachment($message, null, $COMPOSE['id'], array('filename' => $name));
|
|
|
|
|
|
|
|
|
|
if ($message->headers->messageID) {
|
|
|
|
@ -1096,9 +1107,16 @@ function rcmail_write_forward_attachments()
|
|
|
|
|
if (count($refs) == 1) {
|
|
|
|
|
$COMPOSE['reply_msgid'] = $refs[0];
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (!empty($refs)) {
|
|
|
|
|
$COMPOSE['references'] = implode(' ', $refs);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($size_errors) {
|
|
|
|
|
$limit = $RCMAIL->show_bytes($size_limit);
|
|
|
|
|
$error = $RCMAIL->gettext(array('name' => 'msgsizeerrorfwd', 'vars' => array('num' => $size_errors, 'size' => $limit)));
|
|
|
|
|
$RCMAIL->output->add_script(sprintf("%s.display_message('%s', 'error');", rcmail_output::JS_OBJECT_NAME, rcube::JQ($error)), 'docready');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Saves an image as attachment
|
|
|
|
|