X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fmime.php;h=13a453a9ef89983746d790814344a98011d778c9;hb=66488126ca870faca2630ee5693f15f3423fa662;hp=ff5bf65baae0d6ec67251461ee4c9ec61027c258;hpb=9eea179c055de6dcddf7b326818a9b522bdf96e6;p=squirrelmail.git diff --git a/functions/mime.php b/functions/mime.php index ff5bf65b..13a453a9 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -363,10 +363,13 @@ fputs ($imap_stream, "a001 FETCH $id BODY[$ent_id]\r\n"); $topline = fgets ($imap_stream, 1024); - $size = substr ($topline, strpos($topline, "{")+1); - $size = substr ($size, 0, strpos($size, "}")); - $read = fread ($imap_stream, $size); - return $read; + if (ereg('\{([^\}]*)\}', $topline, $regs)) { + return fread ($imap_stream, $regs[1]); + } + else if (ereg('"([^"]*)"', $topline, $regs)) { + return $regs[1]; + } + return "Body retrival error, please report this bug!\n\nTop line is \"$topline\"\n"; } /* -[ END MIME DECODING ]----------------------------------------------------------- */ @@ -452,7 +455,7 @@ // If there are other types that shouldn't be formatted, add // them here - if ($message->header->type1 != "html") { + if ($body_message->header->type1 != "html") { translateText($body, $wrap_at, $body_message->header->charset); } @@ -521,16 +524,15 @@ $HookResults = do_hook("attachment $type0/$type1", $Links, $startMessage, $id, $urlMailbox, $ent, $DefaultLink, - $where, $what); + $display_filename, $where, $what); $Links = $HookResults[1]; $DefaultLink = $HookResults[6]; $body .= '  '; $body .= "$display_filename "; - $size = $message->header->size / 1024; - settype($size, "integer"); - $body .= "" . $size . "k  "; + $body .= '' . show_readable_size($message->header->size) . + '  '; $body .= "[ $type0/$type1 ] "; $body .= ''; if ($message->header->description) @@ -621,7 +623,7 @@ global $default_charset; // Encode only if the string contains 8-bit characters or =? - if (ereg("([\200-\377])|=\\?", $string)) { + if (ereg("([\200-\377]|=\\?)", $string)) { $newstring = "=?$default_charset?Q?"; // First the special characters