* messages. */
const RFC_EOL = "\r\n";
- /* The default MIME disposition. */
- const DEFAULT_DISPOSITION = 'inline';
-
/* The default encoding. */
const DEFAULT_ENCODING = 'binary';
*
* @var string
*/
- protected $_disposition = self::DEFAULT_DISPOSITION;
+ protected $_disposition = '';
/**
* The disposition parameters of this 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()
{
}
/* 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. */
<api>alpha</api>
</stability>
<license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Request #8556: Allow specifying a header charset for a part.
+ <notes>* 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::.