Skip to content

Commit 0bbb5b3

Browse files
committed
Merge pull request #89 from dallaslu/patch-2
fixed #88 PGP and S/MIME encryption
1 parent 939a101 commit 0bbb5b3

File tree

1 file changed

+2
-15
lines changed

1 file changed

+2
-15
lines changed

src/include/mimeDecode.php

+2-15
Original file line numberDiff line numberDiff line change
@@ -330,25 +330,12 @@ function _decode($headers, $body, $default_ctype = 'text/plain')
330330
if (isset($content_type)) {
331331
switch (strtolower($content_type['value'])) {
332332
case 'text/plain':
333-
$encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit';
334-
$charset = isset($return->ctype_parameters['charset']) ? $return->ctype_parameters['charset'] : $this->_charset;
335-
$this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding, $charset, true) : $body) : null;
336-
break;
337-
338333
case 'text/html':
339334
$encoding = isset($content_transfer_encoding) ? $content_transfer_encoding['value'] : '7bit';
340335
$charset = isset($return->ctype_parameters['charset']) ? $return->ctype_parameters['charset'] : $this->_charset;
341336
$this->_include_bodies ? $return->body = ($this->_decode_bodies ? $this->_decodeBody($body, $encoding, $charset, true) : $body) : null;
342337
break;
343-
344-
case 'multipart/signed': // PGP
345-
$parts = $this->_boundarySplit($body, $content_type['other']['boundary'], true);
346-
$return->parts['msg_body'] = $parts[0];
347-
list($part_header, $part_body) = $this->_splitBodyHeader($parts[1]);
348-
$return->parts['sig_hdr'] = $part_header;
349-
$return->parts['sig_body'] = $part_body;
350-
break;
351-
338+
352339
case 'multipart/encrypted': // #190 encrypted parts will be treated as normal ones
353340
case 'multipart/parallel':
354341
case 'multipart/appledouble': // Appledouble mail
@@ -367,7 +354,7 @@ function _decode($headers, $body, $default_ctype = 'text/plain')
367354

368355
$default_ctype = (strtolower($content_type['value']) === 'multipart/digest') ? 'message/rfc822' : 'text/plain';
369356

370-
$parts = $this->_boundarySplit($body, $content_type['other']['boundary']);
357+
$parts = $this->_boundarySplit($body, $content_type['other']['boundary'], strtolower($content_type['value']) === 'multipart/signed');
371358
for ($i = 0; $i < count($parts); $i++) {
372359
list($part_header, $part_body) = $this->_splitBodyHeader($parts[$i]);
373360
$part = $this->_decode($part_header, $part_body, $default_ctype);

0 commit comments

Comments
 (0)