From: Michael M Slusarz Date: Fri, 5 Mar 2010 19:38:01 +0000 (-0700) Subject: Default disposition should be empty, not inline X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=380ebbfb7306a2d3d18de923c19d2cffd22d3c37;p=horde.git Default disposition should be empty, not inline --- diff --git a/framework/Mime/lib/Horde/Mime/Part.php b/framework/Mime/lib/Horde/Mime/Part.php index 5554a0290..ad312777a 100644 --- a/framework/Mime/lib/Horde/Mime/Part.php +++ b/framework/Mime/lib/Horde/Mime/Part.php @@ -21,9 +21,6 @@ class Horde_Mime_Part * messages. */ const RFC_EOL = "\r\n"; - /* The default MIME disposition. */ - const DEFAULT_DISPOSITION = 'inline'; - /* The default encoding. */ const DEFAULT_ENCODING = 'binary'; @@ -108,7 +105,7 @@ class Horde_Mime_Part * * @var string */ - protected $_disposition = self::DEFAULT_DISPOSITION; + protected $_disposition = ''; /** * The disposition parameters of this part. @@ -243,22 +240,26 @@ class Horde_Mime_Part /** * Set the content-disposition of this part. * - * @param string $disposition The content-disposition to set (inline or - * attachment). + * @param string $disposition The content-disposition to set ('inline', + * 'attachment', or an empty value). */ - public function setDisposition($disposition) + public function setDisposition($disposition = null) { - $disposition = Horde_String::lower($disposition); - - if (in_array($disposition, array('inline', 'attachment'))) { - $this->_disposition = $disposition; + if (empty($disposition)) { + $this->_disposition = ''; + } else { + $disposition = Horde_String::lower($disposition); + if (in_array($disposition, array('inline', 'attachment'))) { + $this->_disposition = $disposition; + } } } /** * Get the content-disposition of this part. * - * @return string The part's content-disposition. + * @return string The part's content-disposition. An empty string means + * q no desired disposition has been set for this part. */ public function getDisposition() { @@ -921,10 +922,13 @@ class Horde_Mime_Part } /* Don't show Content-Disposition for multipart messages unless - there is a name parameter. */ + * there is a name parameter. RFC 2183 [2] indicates that default is + * no requested disposition. */ + $disposition = $this->getDisposition(); $name = $this->getName(); - if (($ptype != 'multipart') || !empty($name)) { - $headers->replaceHeader('Content-Disposition', $this->getDisposition(), array('params' => (!empty($name) ? array('filename' => $name) : array()))); + if (($ptype != 'multipart') || + ($disposition || !empty($name))) { + $headers->replaceHeader('Content-Disposition', $disposition, array('params' => (!empty($name) ? array('filename' => $name) : array()))); } /* Add transfer encoding information. */ diff --git a/framework/Mime/lib/Horde/Mime/Viewer/Driver.php b/framework/Mime/lib/Horde/Mime/Viewer/Driver.php index f1c374d04..1124ead92 100644 --- a/framework/Mime/lib/Horde/Mime/Viewer/Driver.php +++ b/framework/Mime/lib/Horde/Mime/Viewer/Driver.php @@ -252,7 +252,7 @@ class Horde_Mime_Viewer_Driver return $this->getConfigParam('inline') && ($this->_metadata['forceinline'] || ($this->_capability['inline'] && - ($this->_mimepart->getDisposition() == 'inline'))); + ($this->_mimepart->getDisposition() != 'attachment'))); default: return false; diff --git a/framework/Mime/package.xml b/framework/Mime/package.xml index f063c9dd4..261a579bf 100644 --- a/framework/Mime/package.xml +++ b/framework/Mime/package.xml @@ -31,7 +31,8 @@ http://pear.php.net/dtd/package-2.0.xsd"> alpha LGPL - * Request #8556: Allow specifying a header charset for a part. + * Default disposition should be empty by default, not inline (RFC 2183 [2]). + * Request #8556: Allow specifying a header charset for a part. * Add 'raw' render view to Horde_Mime_Viewer. * Horde_Mime_Part::parseMessage() correctly parses non-MIME parts. * Remove dependence on PEAR's Mail_mimeDecode::.