Changeset - r7:fad285782be8
[Not reviewed]
v0.3 default
0 1 0
Wolfgang Scherer (ws) - 13 years ago 2012-03-30 18:20:52
wolfgang.scherer@gmx.de
lib/util.php: poor man's quoted_printable_encode for PHP < 5.30.
1 file changed with 31 insertions and 0 deletions:
0 comments (0 inline, 0 general)
lib/util.php
Show inline comments
 
@@ -248,6 +248,37 @@ function error_msg($message)
 
// |||:sec:||| vaccation(1) message
 
// --------------------------------------------------
 

	
 
if (!function_exists("quoted_printable_encode")) {
 
    // only available with PHP >= 5.3.0
 
    if (function_exists("imap_8bit")) {
 
        function quoted_printable_encode($string) {
 
            return imap_8bit($string);
 
        }
 
    } else {
 
        /**
 
         * Process a string to fit the requirements of RFC2045 section 6.7. Note that
 
         * this works, but replaces more characters than the minimum set. For readability
 
         * the spaces and CRLF pairs aren't encoded though.
 
         */
 
        function quoted_printable_encode($string) {
 
            $string = str_replace(array('%20', '%0D%0A', '%'), array(' ', "\r\n", '='), rawurlencode($string));
 
            $string = preg_replace('/[^\r\n]{73}[^=\r\n]{2}/', "$0=\r\n", $string);
 
            return $string;
 
        }
 
    }
 
}
 

	
 
// there should be no need ... quoted_printable_decode is around since PHP4
 
if (!function_exists("quoted_printable_decode")) {
 
    if (function_exists("imap_qprint")) {
 
        echo "imap_qprint";
 
        function quoted_printable_decode($string) {
 
            return imap_qprint($string);
 
        }
 
    } else {
 
    }
 
}
 

	
 
function vacation_split($message, $decode)
 
{
 
    $lines = explode("\n", $message);
0 comments (0 inline, 0 general)