X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fmime.php;h=24e11590200449eec14dbe2840d0437525c915a3;hb=2e2b30211a93ee9e8d1bff6b323fb771bb8831b0;hp=5874a7ff20a19242754685148222a6d8924b3596;hpb=a3daaaf398ca4ec329ffb3b9eea641809848cd0b;p=squirrelmail.git diff --git a/functions/mime.php b/functions/mime.php index 5874a7ff..24e11590 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -1,30 +1,48 @@ Body retrieval error. The reason for this is most probably that
' . + 'the message is malformed. Please help us making future versions
' . + "better by submitting this message to the developers knowledgebase!
\n" . + "Submit message
" . + + "Response: $response
" . + "Message: $message
" . + "FETCH line: $topline
"; + + fputs ($imap_stream, "$sid FETCH $passed_id BODY[]\r\n"); + $data = sqimap_read_data ($imap_stream, $sid, true, $response, $message); + array_shift($data); + $wholemessage = implode('', $data); + + $ret = "---------------\n$wholemessage"; + } return( $ret ); } @@ -593,7 +628,7 @@ } else { $body = formatAttachments ($message, -1, $message->header->mailbox, $id); } - return( $body ); + return ($body); } // A recursive function that returns a list of attachments with links @@ -607,7 +642,7 @@ if ($ShownHTML == 0) { $ShownHTML = 1; - $body .= "\n" . + $body .= "
\n" . "'; + $ret .= " bgcolor=$bgcolor width=\"100%\">"; if( $leftmargin <> '' ) $ret .= ""; $ret .= '
\n" . _("Attachments") . ':' . "
\n" . @@ -706,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); } @@ -759,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} ) { @@ -767,7 +798,6 @@ $ret .= '=3D'; break; case '?': - $l = TRUE; $ret .= '=3F'; break; case '_': @@ -803,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': @@ -874,7 +914,7 @@ $style .= $body{$i}; $i++; } - stripComments( &$i, $j, &$body ); + stripComments( $i, $j, $body ); $style = strtoupper( trim( $style ) ); if( $style == 'BODY' ) { // Next we look into the definitions of the body style @@ -903,7 +943,7 @@ } $styleblk .= $body{$i}; } - stripComments( &$i, $j, &$body ); + stripComments( $i, $j, $body ); if( $body{$i} <> '>' ) $i++; } @@ -915,13 +955,16 @@ $ret .= '' . _("Title:") . " $title
\n"; $ret .= " '' ) - $ret .= " bgcolor=$bgcolor"; - $ret .= ' width=100%>
 '; + if (strtolower($bgcolor) == 'ffffff' || + strtolower($bgcolor) == '#ffffff') + $ret .= ''; break; case 'BASE': $i += 5; @@ -946,12 +989,14 @@ } break; case '/BOD': - $ret .= '
'; + $ret .= ''; $i += 6; break; default: // Following tags can contain some event handler, lets search it stripComments( $i, $j, $body ); + if (! isset($base)) + $base = ''; $ret .= stripEvent( $i, $j, $body, $id, $base ) . '>'; // $ret .= ""; } @@ -1113,4 +1158,4 @@ return( $ret ); } -?> \ No newline at end of file +?>