cvs: pear /Mail_Mime mime.php

From: Date: Sun, 09 Apr 2006 14:18:48 +0000
Subject: cvs: pear /Mail_Mime mime.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39506@lists.php.net to get a copy of this message
cipri Sun Apr 9 14:18:48 2006 UTC Modified files: /pear/Mail_Mime mime.php Log: Fixed Bug #5934: Confiurable Content-Dispositions for Attachments http://cvs.php.net/viewcvs.cgi/pear/Mail_Mime/mime.php?r1=1.46&r2=1.47&diff_format=u Index: pear/Mail_Mime/mime.php diff -u pear/Mail_Mime/mime.php:1.46 pear/Mail_Mime/mime.php:1.47 --- pear/Mail_Mime/mime.php:1.46 Sun Apr 9 00:37:56 2006 +++ pear/Mail_Mime/mime.php Sun Apr 9 14:18:48 2006 @@ -35,7 +35,7 @@ // | Tomas V.V.Cox <cox@idecnet.com> (port to PEAR) | // +-----------------------------------------------------------------------+ // -// $Id: mime.php,v 1.46 2006/04/09 00:37:56 cipri Exp $ +// $Id: mime.php,v 1.47 2006/04/09 14:18:48 cipri Exp $ require_once('PEAR.php'); require_once('Mail/mimePart.php'); @@ -233,19 +233,27 @@ /** * Adds a file to the list of attachments. * - * @param string $file The file name of the file to attach - * OR the file data itself - * @param string $c_type The content type - * @param string $name The filename of the attachment - * Only use if $file is the file data - * @param bool $isFilename Whether $file is a filename or not - * Defaults to true + * @param string $file The file name of the file to attach + * OR the file contents itself + * @param string $c_type The content type + * @param string $name The filename of the attachment + * Only use if $file is the contents + * @param bool $isFilename Whether $file is a filename or not + * Defaults to true + * @param string $encoding The type of encoding to use. + * Defaults to base64. + * Possible values: 7bit, 8bit, base64, + * or quoted-printable. + * @param string $disposition The content-disposition of this file + * Defaults to attachment. + * Possible values: attachment, inline. * @return mixed true on success or PEAR_Error object * @access public */ function addAttachment($file, $c_type = 'application/octet-stream', $name = '', $isfilename = true, - $encoding = 'base64') + $encoding = 'base64', + $disposition = 'attachment') { $filedata = ($isfilename === true) ? $this->_file2str($file) : $file; @@ -267,10 +275,11 @@ } $this->_parts[] = array( - 'body' => $filedata, - 'name' => $filename, - 'c_type' => $c_type, - 'encoding' => $encoding + 'body' => $filedata, + 'name' => $filename, + 'c_type' => $c_type, + 'encoding' => $encoding, + 'disposition' => $disposition ); return true; } @@ -446,7 +455,8 @@ { $params['content_type'] = $value['c_type']; $params['encoding'] = $value['encoding']; - $params['disposition'] = 'attachment'; + $params['disposition'] = isset($value['disposition']) ? + $value['disposition'] : 'attachment'; $params['dfilename'] = $value['name']; $ret = $obj->addSubpart($value['body'], $params); return $ret;

« previous php.pear.cvs (#39506) next »