From: Michael M Slusarz Date: Fri, 21 Nov 2008 08:01:59 +0000 (-0700) Subject: Re-add limit_inline_size. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=70f8b64dca58384380d513cd8645b4e87aafcae1;p=horde.git Re-add limit_inline_size. Add a limit for HTML messages also. --- diff --git a/imp/config/mime_drivers.php.dist b/imp/config/mime_drivers.php.dist index 04a68ea5c..2082cbd58 100644 --- a/imp/config/mime_drivers.php.dist +++ b/imp/config/mime_drivers.php.dist @@ -57,7 +57,9 @@ $mime_drivers_map['imp']['overrides'] = array(); */ $mime_drivers['imp']['plain'] = array( 'inline' => true, - 'handles' => array('text/plain', 'text/rfc822-headers', 'application/pgp'), + 'handles' => array( + 'text/plain', 'text/rfc822-headers', 'application/pgp' + ), /* If you want to limit the display of message data inline for large * messages, set the maximum size of the displayed message here (in * bytes). If exceeded, the user will only be able to download the part. @@ -82,6 +84,11 @@ $mime_drivers['imp']['html'] = array( 'icons' => array( 'default' => 'html.png' ), + /* If you want to limit the display of message data inline for large + * messages, set the maximum size of the displayed message here (in + * bytes). If exceeded, the user will only be able to download the part. + * Set to 0 to disable this check. */ + 'limit_inline_size' => 1048576, /* Run 'tidy' on all HTML output? This requires at least version 2.0 of the * PECL 'tidy' extension to be installed on your system. */ 'tidy' => false, diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index f7f541ef1..48b75b9d8 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -326,6 +326,24 @@ class IMP_Contents case self::RENDER_INLINE_AUTO: case self::RENDER_INLINE_DISP_NO: $textmode = 'inline'; + $limit = $viewer->getConfigParam('limit_inline_size'); + if ($limit && ($mime_part->getBytes() > $limit)) { + return array( + $mime_id => array( + 'data' => '', + 'name' => '', + 'status' => array( + array( + 'text' => array( + _("This message part cannot be viewed because it is too large."), + sprintf(_("Click %s to download the data."), $this->linkView($mime_part, 'download_attach', _("HERE"))) + ) + ) + ), + 'type' => 'text/html; charset=' . NLS::getCharset() + ) + ); + } break; case self::RENDER_INFO: