Make WordPress Core

Ticket #2460: 2460.diff

File 2460.diff, 1.8 KB (added by Nazgul, 20 years ago)
  • wp-mail.php

     
    2424
    2525        $content = '';
    2626        $content_type = '';
     27        $content_transfer_encoding = '';
    2728        $boundary = '';
    2829        $bodysignal = 0;
    2930        $dmonths = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
     
    4041                                $content_type = explode(';', $content_type);
    4142                                $content_type = $content_type[0];
    4243                        }
     44                        if (preg_match('/Content-Transfer-Encoding: /i', $line)) {
     45                                $content_transfer_encoding = trim($line);
     46                                $content_transfer_encoding = substr($content_transfer_encoding, 27, strlen($content_transfer_encoding)-14);
     47                                $content_transfer_encoding = explode(';', $content_transfer_encoding);
     48                                $content_transfer_encoding = $content_transfer_encoding[0];
     49                        }
    4350                        if (($content_type == 'multipart/alternative') && (preg_match('/boundary="/', $line)) && ($boundary == '')) {
    4451                                $boundary = trim($line);
    4552                                $boundary = explode('"', $boundary);
     
    111118                $content = strip_tags($content[1], '<img><p><br><i><b><u><em><strong><strike><font><span><div>');
    112119        }
    113120        $content = trim($content);
     121       
     122        if (stristr($content_transfer_encoding, "quoted-printable") !== false) {
     123                $content = quoted_printable_decode($content);
     124        }
     125
    114126        // Captures any text in the body after $phone_delim as the body
    115127        $content = explode($phone_delim, $content);
    116128        $content[1] ? $content = $content[1] : $content = $content[0];
    117129
    118         echo "<p><b>Content-type:</b> $content_type, <b>boundary:</b> $boundary</p>\n";
     130        echo "<p><b>Content-type:</b> $content_type, <b>Content-Transfer-Encoding:</b> $content_transfer_encoding, <b>boundary:</b> $boundary</p>\n";
    119131        echo "<p><b>Raw content:</b><br /><pre>".$content.'</pre></p>';
    120132
    121133        $content = trim($content);