Changeset 505f6e5 in github


Ignore:
Timestamp:
Jun 9, 2012 9:48:53 AM (12 months ago)
Author:
Aleksander Machniak <alec@…>
Branches:
release-0.8
Children:
9e43252
Parents:
16114e6
git-author:
Aleksander Machniak <alec@…> (06/09/12 09:44:56)
git-committer:
Aleksander Machniak <alec@…> (06/09/12 09:48:53)
Message:

Update to Mail_Mime-1.8.5 (#1488521)

Conflicts:

CHANGELOG
program/lib/Mail/mime.php
program/lib/Mail/mimePart.php

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • CHANGELOG

    ra7d5e3e8 r505f6e5  
    22=========================== 
    33 
     4- Update to Mail_Mime-1.8.5 (#1488521) 
    45- Fix XSS vulnerability in message subject handling using Larry skin (#1488519) 
    56- Fix handling of links with various URI schemes e.g. "skype:" (#1488106) 
  • program/lib/Mail/mime.php

    rfe3a1d6 r505f6e5  
    4949 * @copyright 2003-2006 PEAR <pear-group@php.net> 
    5050 * @license   http://www.opensource.org/licenses/bsd-license.php BSD License 
    51  * @version   CVS: $Id$ 
     51 * @version   1.8.5 
    5252 * @link      http://pear.php.net/package/Mail_mime 
    5353 * 
     
    9090 * @copyright 2003-2006 PEAR <pear-group@php.net> 
    9191 * @license   http://www.opensource.org/licenses/bsd-license.php BSD License 
    92  * @version   Release: @package_version@ 
     92 * @version   Release: 1.8.5 
    9393 * @link      http://pear.php.net/package/Mail_mime 
    9494 */ 
     
    388388     * @param string $h_charset   The character set of the headers e.g. filename 
    389389     *                            If not specified, $charset will be used 
     390     * @param array  $add_headers Additional part headers. Array keys can be in form 
     391     *                            of <header_name>:<parameter_name> 
    390392     * 
    391393     * @return mixed              True on success or PEAR_Error object 
     
    404406        $f_encoding  = null, 
    405407        $description = '', 
    406         $h_charset   = null 
     408        $h_charset   = null, 
     409        $add_headers = array() 
    407410    ) { 
    408411        $bodyfile = null; 
     
    443446            'disposition' => $disposition, 
    444447            'description' => $description, 
     448            'add_headers' => $add_headers, 
    445449            'name_encoding'     => $n_encoding, 
    446450            'filename_encoding' => $f_encoding, 
     
    680684        if (!empty($value['description'])) { 
    681685            $params['description'] = $value['description']; 
     686        } 
     687        if (is_array($value['add_headers'])) { 
     688            $params['headers'] = $value['add_headers']; 
    682689        } 
    683690 
     
    13201327    function encodeHeader($name, $value, $charset, $encoding) 
    13211328    { 
    1322         return Mail_mimePart::encodeHeader( 
     1329        $mime_part = new Mail_mimePart; 
     1330        return $mime_part->encodeHeader( 
    13231331            $name, $value, $charset, $encoding, $this->_build_params['eol'] 
    13241332        ); 
  • program/lib/Mail/mimePart.php

    re5b5162 r505f6e5  
    4949 * @copyright 2003-2006 PEAR <pear-group@php.net> 
    5050 * @license   http://www.opensource.org/licenses/bsd-license.php BSD License 
    51  * @version   CVS: $Id$ 
     51 * @version   1.8.5 
    5252 * @link      http://pear.php.net/package/Mail_mime 
    5353 */ 
     
    7171 * @copyright 2003-2006 PEAR <pear-group@php.net> 
    7272 * @license   http://www.opensource.org/licenses/bsd-license.php BSD License 
    73  * @version   Release: @package_version@ 
     73 * @version   Release: 1.8.5 
    7474 * @link      http://pear.php.net/package/Mail_mime 
    7575 */ 
     
    157157    *                         If not set, 'charset' will be used 
    158158    *     eol               - End of line sequence. Default: "\r\n" 
     159    *     headers           - Hash array with additional part headers. Array keys can be 
     160    *                         in form of <header_name>:<parameter_name> 
    159161    *     body_file         - Location of file with part's body (instead of $body) 
    160162    * 
     
    167169        } else if (defined('MAIL_MIMEPART_CRLF')) { // backward-copat. 
    168170            $this->_eol = MAIL_MIMEPART_CRLF; 
     171        } 
     172 
     173        // Additional part headers 
     174        if (!empty($params['headers']) && is_array($params['headers'])) { 
     175            $headers = $params['headers']; 
    169176        } 
    170177 
     
    217224            } 
    218225        } 
     226 
     227        // header values encoding parameters 
     228        $h_charset  = !empty($params['headers_charset']) ? $params['headers_charset'] : 'US-ASCII'; 
     229        $h_language = !empty($params['language']) ? $params['language'] : null; 
     230        $h_encoding = !empty($params['name_encoding']) ? $params['name_encoding'] : null; 
     231 
     232 
    219233        if (!empty($params['filename'])) { 
    220234            $headers['Content-Type'] .= ';' . $this->_eol; 
    221235            $headers['Content-Type'] .= $this->_buildHeaderParam( 
    222                 'name', $params['filename'], 
    223                 !empty($params['headers_charset']) ? $params['headers_charset'] : 'US-ASCII', 
    224                 !empty($params['language']) ? $params['language'] : null, 
    225                 !empty($params['name_encoding']) ? $params['name_encoding'] : null 
     236                'name', $params['filename'], $h_charset, $h_language, $h_encoding 
    226237            ); 
    227238        } 
     
    233244                $headers['Content-Disposition'] .= ';' . $this->_eol; 
    234245                $headers['Content-Disposition'] .= $this->_buildHeaderParam( 
    235                     'filename', $params['filename'], 
    236                     !empty($params['headers_charset']) ? $params['headers_charset'] : 'US-ASCII', 
    237                     !empty($params['language']) ? $params['language'] : null, 
     246                    'filename', $params['filename'], $h_charset, $h_language, 
    238247                    !empty($params['filename_encoding']) ? $params['filename_encoding'] : null 
    239248                ); 
    240249            } 
     250 
     251            // add attachment size 
     252            $size = $this->_body_file ? filesize($this->_body_file) : strlen($body); 
     253            if ($size) { 
     254                $headers['Content-Disposition'] .= ';' . $this->_eol . ' size=' . $size; 
     255            } 
    241256        } 
    242257 
    243258        if (!empty($params['description'])) { 
    244259            $headers['Content-Description'] = $this->encodeHeader( 
    245                 'Content-Description', $params['description'], 
    246                 !empty($params['headers_charset']) ? $params['headers_charset'] : 'US-ASCII', 
    247                 !empty($params['name_encoding']) ? $params['name_encoding'] : 'quoted-printable', 
     260                'Content-Description', $params['description'], $h_charset, $h_encoding, 
    248261                $this->_eol 
    249262            ); 
     263        } 
     264 
     265        // Search and add existing headers' parameters 
     266        foreach ($headers as $key => $value) { 
     267            $items = explode(':', $key); 
     268            if (count($items) == 2) { 
     269                $header = $items[0]; 
     270                $param  = $items[1]; 
     271                if (isset($headers[$header])) { 
     272                    $headers[$header] .= ';' . $this->_eol; 
     273                } 
     274                $headers[$header] .= $this->_buildHeaderParam( 
     275                    $param, $value, $h_charset, $h_language, $h_encoding 
     276                ); 
     277                unset($headers[$key]); 
     278            } 
    250279        } 
    251280 
Note: See TracChangeset for help on using the changeset viewer.