From fdf7cef1e0ee99e385fadba612ee6a29ac073604 Mon Sep 17 00:00:00 2001 From: tokul Date: Sun, 9 Oct 2005 20:35:31 +0000 Subject: [PATCH] fixed quoted-printable decoding. removed $show_html_default global call. Call was introduced in 1.113 and made obsolate in 1.114. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@10152 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 29 +++++++++++++++++++---------- 1 file changed, 19 insertions(+), 10 deletions(-) diff --git a/functions/mime.php b/functions/mime.php index ebd0e873..1427ab37 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -613,10 +613,18 @@ function sqimap_base64_decode(&$string) { return $sStringRem; } - -/* This function decodes the body depending on the encoding type. */ +/** + * Decodes encoded message body + * + * This function decodes the body depending on the encoding type. + * Currently quoted-printable and base64 encodings are supported. + * decode_body hook was added to this function in 1.4.2/1.5.0 + * @param string $body encoded message body + * @param string $encoding used encoding + * @return string decoded string + * @since 1.0 + */ function decodeBody($body, $encoding) { - global $show_html_default; $body = str_replace("\r\n", "\n", $body); $encoding = strtolower($encoding); @@ -629,15 +637,16 @@ function decodeBody($body, $encoding) { if (!empty($encoding_handler) && function_exists($encoding_handler)) { $body = $encoding_handler('decode', $body); - } else if ($encoding == 'quoted-printable' || + } elseif ($encoding == 'quoted-printable' || $encoding == 'quoted_printable') { + /** + * quoted_printable_decode() function is broken in older + * php versions. Text with \r\n decoding was fixed only + * in php 4.3.0. Minimal code requirement 4.0.4 + + * str_replace("\r\n", "\n", $body); call. + */ $body = quoted_printable_decode($body); - - while (ereg("=\n", $body)) { - $body = ereg_replace ("=\n", '', $body); - } - - } else if ($encoding == 'base64') { + } elseif ($encoding == 'base64') { $body = base64_decode($body); } -- 2.25.1