From 5e6416fb59f9db5203b6d4f6d6a13f1d6f9b0498 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 11 Nov 2008 18:52:30 -0700 Subject: [PATCH] Don't allow stripping of message/rfc822 parts. --- imp/lib/Contents.php | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index ca06d8cba..245c559c1 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -448,6 +448,7 @@ class IMP_Contents 'render' => array() ); $parts = array(); + $rfc822 = null; // Cache some settings before we enter the loop. $download_zip = (($mask & self::SUMMARY_DOWNLOAD_ZIP) && Util::extensionExists('zlib')); @@ -569,11 +570,13 @@ class IMP_Contents /* Strip the Attachment? */ if ($mask && self::SUMMARY_STRIP_LINK) { - // TODO: No stripping of RFC 822 parts. - $url = Util::removeParameter(Horde::selfUrl(true), array('actionID', 'imapid', 'index')); - $url = Util::addParameter($url, array('actionID' => 'strip_attachment', 'imapid' => $mime_id, 'index' => $this->_index, 'message_token' => $message_token)); - $part['strip'] = Horde::link($url, _("Strip Attachment"), 'stripAtc', null, "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete this attachment?")) . "');") . ''; - $info['has']['strip'] = true; + if (is_null($rfc822) || (strpos($mime_id, $rfc822) !== 0)) { + $rfc822 = ($mime_type == 'message/rfc822') ? $mime_id . '.' : null; + $url = Util::removeParameter(Horde::selfUrl(true), array('actionID', 'imapid', 'index')); + $url = Util::addParameter($url, array('actionID' => 'strip_attachment', 'imapid' => $mime_id, 'index' => $this->_index, 'message_token' => $message_token)); + $part['strip'] = Horde::link($url, _("Strip Attachment"), 'stripAtc', null, "return window.confirm('" . addslashes(_("Are you sure you wish to PERMANENTLY delete this attachment?")) . "');") . ''; + $info['has']['strip'] = true; + } } if ($is_atc && ($mask && self::SUMMARY_DOWNLOAD_ALL)) { -- 2.11.0