|
|
|
|
@ -182,24 +182,23 @@ if (empty($_GET['_thumb']) && $attachment->is_valid()) {
|
|
|
|
|
header("Content-Length: " . strlen($content));
|
|
|
|
|
echo $content;
|
|
|
|
|
}
|
|
|
|
|
else { // html warning with a button to load the file anyway
|
|
|
|
|
// html warning with a button to load the file anyway
|
|
|
|
|
else {
|
|
|
|
|
$OUTPUT = new rcmail_html_page();
|
|
|
|
|
$OUTPUT->write(html::tag('html', null, html::tag('body', 'embed',
|
|
|
|
|
html::div(array('class' => 'rcmail-inline-message rcmail-inline-warning'),
|
|
|
|
|
$OUTPUT->register_inline_warning(
|
|
|
|
|
$RCMAIL->gettext(array(
|
|
|
|
|
'name' => 'attachmentvalidationerror',
|
|
|
|
|
'vars' => array(
|
|
|
|
|
'expected' => $mimetype . ($file_extension ? " (.$file_extension)" : ''),
|
|
|
|
|
'detected' => $real_mimetype . ($extensions[0] ? " (.$extensions[0])" : ''),
|
|
|
|
|
'name' => 'attachmentvalidationerror',
|
|
|
|
|
'vars' => array(
|
|
|
|
|
'expected' => $mimetype . ($file_extension ? " (.$file_extension)" : ''),
|
|
|
|
|
'detected' => $real_mimetype . ($extensions[0] ? " (.$extensions[0])" : ''),
|
|
|
|
|
)
|
|
|
|
|
)
|
|
|
|
|
))
|
|
|
|
|
. html::p(array('class' => 'rcmail-inline-buttons'),
|
|
|
|
|
html::tag('button', array(
|
|
|
|
|
'onclick' => "location.href='" . $RCMAIL->url(array_merge($_GET, array('_nocheck' => 1))) . "'"
|
|
|
|
|
),
|
|
|
|
|
$RCMAIL->gettext('showanyway'))
|
|
|
|
|
)
|
|
|
|
|
))));
|
|
|
|
|
),
|
|
|
|
|
$RCMAIL->gettext('showanyway'),
|
|
|
|
|
$RCMAIL->url(array_merge($_GET, array('_nocheck' => 1)))
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$OUTPUT->write();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
exit;
|
|
|
|
|
@ -232,13 +231,16 @@ if (empty($_GET['_thumb']) && $attachment->is_valid()) {
|
|
|
|
|
|
|
|
|
|
// deliver part content
|
|
|
|
|
if ($mimetype == 'text/html' && empty($_GET['_download'])) {
|
|
|
|
|
$OUTPUT = new rcmail_html_page();
|
|
|
|
|
|
|
|
|
|
// Check if we have enough memory to handle the message in it
|
|
|
|
|
// #1487424: we need up to 10x more memory than the body
|
|
|
|
|
if (!rcube_utils::mem_check($attachment->size * 10)) {
|
|
|
|
|
$out = '<html><body>'
|
|
|
|
|
. $RCMAIL->gettext('messagetoobig'). ' '
|
|
|
|
|
. html::a($RCMAIL->url(array_merge($_GET, array('download' => 1))), $RCMAIL->gettext('download'))
|
|
|
|
|
. '</body></html>';
|
|
|
|
|
$OUTPUT->register_inline_warning(
|
|
|
|
|
$RCMAIL->gettext('messagetoobig'),
|
|
|
|
|
$RCMAIL->gettext('download'),
|
|
|
|
|
$RCMAIL->url(array_merge($_GET, array('_download' => 1)))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
// render HTML body
|
|
|
|
|
@ -246,23 +248,14 @@ if (empty($_GET['_thumb']) && $attachment->is_valid()) {
|
|
|
|
|
|
|
|
|
|
// insert remote objects warning into HTML body
|
|
|
|
|
if ($REMOTE_OBJECTS) {
|
|
|
|
|
$body_start = 0;
|
|
|
|
|
if ($body_pos = strpos($out, '<body')) {
|
|
|
|
|
$body_start = strpos($out, '>', $body_pos) + 1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$out = substr($out, 0, $body_start)
|
|
|
|
|
. html::div(array('class' => 'rcmail-inline-message rcmail-inline-warning'),
|
|
|
|
|
rcube::Q($RCMAIL->gettext('blockedimages')) . ' ' .
|
|
|
|
|
html::tag('button',
|
|
|
|
|
array('onclick' => "location.href='" . $RCMAIL->url(array_merge($_GET, array('_safe' => 1))) . "'"),
|
|
|
|
|
rcube::Q($RCMAIL->gettext('showimages')))
|
|
|
|
|
)
|
|
|
|
|
. substr($out, $body_start);
|
|
|
|
|
$OUTPUT->register_inline_warning(
|
|
|
|
|
$RCMAIL->gettext('blockedimages'),
|
|
|
|
|
$RCMAIL->gettext('showimages'),
|
|
|
|
|
$RCMAIL->url(array_merge($_GET, array('_safe' => 1)))
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$OUTPUT = new rcmail_html_page();
|
|
|
|
|
$OUTPUT->write($out);
|
|
|
|
|
exit;
|
|
|
|
|
}
|
|
|
|
|
|