|
|
@ -176,6 +176,13 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
exit; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Handler for the template object 'messageattachments'. |
|
|
|
* |
|
|
|
* @param array $attrib Named parameters |
|
|
|
* |
|
|
|
* @return string HTML content showing the message attachments list |
|
|
|
*/ |
|
|
|
public static function message_attachments($attrib) |
|
|
|
{ |
|
|
|
if (empty(self::$MESSAGE->attachments)) { |
|
|
@ -198,6 +205,11 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
$mimetype = $type; |
|
|
|
} |
|
|
|
|
|
|
|
// Skip inline images
|
|
|
|
if (strpos($mimetype, 'image/') === 0 && !self::is_attachment(self::$MESSAGE, $attach_prop)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
if (!empty($attrib['maxlength']) && mb_strlen($filename) > $attrib['maxlength']) { |
|
|
|
$title = $filename; |
|
|
|
$filename = abbreviate_string($filename, $attrib['maxlength']); |
|
|
@ -329,6 +341,14 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
return html::div($attrib, $msg); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Handler for the template object 'messageobjects' that contains |
|
|
|
* warning/info boxes, buttons, etc. related to the displayed message. |
|
|
|
* |
|
|
|
* @param array $attrib Named parameters |
|
|
|
* |
|
|
|
* @return string HTML content showing the message objects |
|
|
|
*/ |
|
|
|
public static function message_objects($attrib) |
|
|
|
{ |
|
|
|
if (empty($attrib['id'])) { |
|
|
@ -350,6 +370,13 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
return html::div($attrib, $content); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Handler for the template object 'contactphoto'. |
|
|
|
* |
|
|
|
* @param array $attrib Named parameters |
|
|
|
* |
|
|
|
* @return string HTML content for the IMG tag |
|
|
|
*/ |
|
|
|
public static function message_contactphoto($attrib) |
|
|
|
{ |
|
|
|
$rcmail = rcmail::get_instance(); |
|
|
@ -755,13 +782,13 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
$download_label = rcube::Q($rcmail->gettext('download')); |
|
|
|
|
|
|
|
foreach (self::$MESSAGE->attachments as $attach_prop) { |
|
|
|
// skip inline images
|
|
|
|
if (!empty($attach_prop->content_id) && $attach_prop->disposition == 'inline') { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// Content-Type: image/*...
|
|
|
|
if ($mimetype = self::part_image_type($attach_prop)) { |
|
|
|
// Skip inline images
|
|
|
|
if (!self::is_attachment(self::$MESSAGE, $attach_prop)) { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
// display thumbnails
|
|
|
|
if ($thumbnail_size) { |
|
|
|
$supported = in_array($mimetype, self::$CLIENT_MIMETYPES); |
|
|
@ -824,8 +851,13 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
|
|
|
|
/** |
|
|
|
* Returns a HTML notice element for too big message parts |
|
|
|
* |
|
|
|
* @param rcube_message $message Email message object |
|
|
|
* @param string $part_id Message part identifier |
|
|
|
* |
|
|
|
* @return string HTML content |
|
|
|
*/ |
|
|
|
public static function part_too_big_message($MESSAGE, $part_id) |
|
|
|
public static function part_too_big_message($message, $part_id) |
|
|
|
{ |
|
|
|
$rcmail = rcmail::get_instance(); |
|
|
|
$token = $rcmail->get_request_token(); |
|
|
@ -833,17 +865,20 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
'task' => 'mail', |
|
|
|
'action' => 'get', |
|
|
|
'download' => 1, |
|
|
|
'uid' => $MESSAGE->uid, |
|
|
|
'uid' => $message->uid, |
|
|
|
'part' => $part_id, |
|
|
|
'mbox' => $MESSAGE->folder, |
|
|
|
'mbox' => $message->folder, |
|
|
|
'token' => $token, |
|
|
|
]); |
|
|
|
|
|
|
|
return html::span('part-notice', $rcmail->gettext('messagetoobig') . ' ' . html::a($url, $rcmail->gettext('download'))); |
|
|
|
return html::span('part-notice', $rcmail->gettext('messagetoobig') |
|
|
|
. ' ' . html::a($url, $rcmail->gettext('download'))); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Handle disposition notification requests |
|
|
|
* |
|
|
|
* @param rcube_message $message Email message object |
|
|
|
*/ |
|
|
|
public static function mdn_request_handler($message) |
|
|
|
{ |
|
|
@ -899,4 +934,30 @@ class rcmail_action_mail_show extends rcmail_action_mail_index |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* Check whether the message part is a normal attachment |
|
|
|
* |
|
|
|
* @param rcube_message $message Message object |
|
|
|
* @param rcube_message_part $part Message part |
|
|
|
* |
|
|
|
* @return bool |
|
|
|
*/ |
|
|
|
protected static function is_attachment($message, $part) |
|
|
|
{ |
|
|
|
// Inline attachment with Content-Id specified
|
|
|
|
if (!empty($part->content_id) && $part->disposition == 'inline') { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
// Any image attached to multipart/related message (#7184)
|
|
|
|
$parent_id = preg_replace('/\.[0-9]+$/', '', $part->mime_id); |
|
|
|
$parent = $message->mime_parts[$parent_id] ?? null; |
|
|
|
|
|
|
|
if ($parent && $parent->mimetype == 'multipart/related') { |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|
return true; |
|
|
|
} |
|
|
|
} |