Changeset 2e6825b in github
- Timestamp:
- Sep 5, 2008 5:55:07 AM (5 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- be5f03b
- Parents:
- a6d7a9f
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_imap.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
rc505e59 r2e6825b 6 6 - Enable export of address book contacts as vCard 7 7 - Respect Content-Location headers in multipart/related messages according to RFC2110 (#1484946) 8 - Applied mime_decode patch by David Lublink 8 9 9 10 2008/09/04 (alec) -
program/include/rcube_imap.php
rc505e59 r2e6825b 2417 2417 function decode_mime_string($input, $fallback=null) 2418 2418 { 2419 // Initialize variable 2419 2420 $out = ''; 2420 2421 2421 $pos = strpos($input, '=?'); 2422 if ($pos !== false) 2423 { 2424 // rfc: all line breaks or other characters not found 2425 // in the Base64 Alphabet must be ignored by decoding software 2426 // delete all blanks between MIME-lines, differently we can 2427 // receive unnecessary blanks and broken utf-8 symbols 2428 $input = preg_replace("/\?=\s+=\?/", '?==?', $input); 2429 2430 $out = substr($input, 0, $pos); 2431 2432 $end_cs_pos = strpos($input, "?", $pos+2); 2433 $end_en_pos = strpos($input, "?", $end_cs_pos+1); 2434 $end_pos = strpos($input, "?=", $end_en_pos+1); 2435 2436 $encstr = substr($input, $pos+2, ($end_pos-$pos-2)); 2437 $rest = substr($input, $end_pos+2); 2438 2439 $out .= rcube_imap::_decode_mime_string_part($encstr); 2440 $out .= rcube_imap::decode_mime_string($rest, $fallback); 2441 2422 // Iterate instead of recursing, this way if there are too many values we don't have stack overflows 2423 // rfc: all line breaks or other characters not found 2424 // in the Base64 Alphabet must be ignored by decoding software 2425 // delete all blanks between MIME-lines, differently we can 2426 // receive unnecessary blanks and broken utf-8 symbols 2427 $input = preg_replace("/\?=\s+=\?/", '?==?', $input); 2428 2429 // Check if there is stuff to decode 2430 if (strpos($input, '=?') !== false) { 2431 // Loop through the string to decode all occurences of =? ?= into the variable $out 2432 while(($pos = strpos($input, '=?')) !== false) { 2433 // Append everything that is before the text to be decoded 2434 $out .= substr($input, 0, $pos); 2435 2436 // Get the location of the text to decode 2437 $end_cs_pos = strpos($input, "?", $pos+2); 2438 $end_en_pos = strpos($input, "?", $end_cs_pos+1); 2439 $end_pos = strpos($input, "?=", $end_en_pos+1); 2440 2441 // Extract the encoded string 2442 $encstr = substr($input, $pos+2, ($end_pos-$pos-2)); 2443 // Extract the remaining string 2444 $input = substr($input, $end_pos+2); 2445 2446 // Decode the string fragement 2447 $out .= rcube_imap::_decode_mime_string_part($encstr); 2448 } 2449 2450 // Deocde the rest (if any) 2451 if (strlen($input) != 0) 2452 $out .= rcube_imap::decode_mime_string($input, $fallback); 2453 2454 // return the results 2442 2455 return $out; 2443 }2456 } 2444 2457 2445 2458 // no encoding information, use fallback
Note: See TracChangeset
for help on using the changeset viewer.
