X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fmime.php;h=9b65e9c9ab5431fd351cd8b499ec0541c0a0d1d9;hb=d79e01f57042179bb540361915780eaeb0064e87;hp=750a48ae4eb81e8236cc74ad5a035d5ff3b89fea;hpb=2d367c687f9813a45a3d2f1911036cfc0425fdd0;p=squirrelmail.git diff --git a/functions/mime.php b/functions/mime.php index 750a48ae..9b65e9c9 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -1,28 +1,48 @@ header->mailbox, $id); } - return( $body ); + return ($body); } // A recursive function that returns a list of attachments with links @@ -721,13 +741,9 @@ $body = quoted_printable_decode($body); - /* - Following code has been comented as I see no reason for it. - If there is any please tell me a mingo@rotedic.com - while (ereg("=\n", $body)) $body = ereg_replace ("=\n", "", $body); - */ + } else if ($encoding == 'base64') { $body = base64_decode($body); } @@ -774,7 +790,7 @@ // Encode only if the string contains 8-bit characters or =? $j = strlen( $string ); - $l = FALSE; // Must be encoded ? + $l = strstr($string, '=?'); // Must be encoded ? $ret = ''; for( $i=0; $i < $j; ++$i) { switch( $string{$i} ) { @@ -782,7 +798,6 @@ $ret .= '=3D'; break; case '?': - $l = TRUE; $ret .= '=3F'; break; case '_': @@ -818,13 +833,23 @@ $j = strlen( $body ); // Legnth of the HTML $ret = ''; // Returned string $bgcolor = '#ffffff'; // Background style color (defaults to white) + $textcolor = '#000000'; // Foreground style color (defaults to black) $leftmargin = ''; // Left margin style $title = ''; // HTML title if any $i = 0; while( $i < $j ) { if( $body{$i} == '<' ) { - $tag = $body{$i+1}.$body{$i+2}.$body{$i+3}.$body{$i+4}; + $pos = $i + 1; + $tag = ''; + while ($body{$pos} == ' ' || $body{$pos} == "\t" || + $body{$pos} == "\n") + $pos ++; + while (strlen($tag) < 4 && $body{$pos} != ' ' && + $body{$pos} != "\t" && $body{$pos} != "\n") { + $tag .= $body{$pos}; + $pos ++; + } switch( strtoupper( $tag ) ) { // Strips the entire tag and contents case 'APPL': @@ -930,15 +955,16 @@ $ret .= '' . _("Title:") . " $title
\n"; $ret .= " '' ) - $ret .= " bgcolor=$bgcolor"; - $ret .= ' width=100%>'; + $ret .= " bgcolor=$bgcolor width=\"100%\">"; if( $leftmargin <> '' ) $ret .= " "; $ret .= ''; + if (strtolower($bgcolor) == 'ffffff' || + strtolower($bgcolor) == '#ffffff') + $ret .= ''; break; case 'BASE': $i += 5; @@ -963,7 +989,7 @@ } break; case '/BOD': - $ret .= ''; + $ret .= ''; $i += 6; break; default: