From 346817d46e0342d2611be7732e96bc07e1b72453 Mon Sep 17 00:00:00 2001 From: philippe_mingo Date: Fri, 8 Feb 2002 21:22:38 +0000 Subject: [PATCH] Retrieval error reformated. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@2386 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- functions/mime.php | 43 ++++++++++++++++++++++++++----------------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/functions/mime.php b/functions/mime.php index d68b9507..e7016d79 100644 --- a/functions/mime.php +++ b/functions/mime.php @@ -370,7 +370,7 @@ function mime_match_parenthesis ($pos, $structure) { return( $pos ); } -function mime_fetch_body ($imap_stream, $id, $ent_id ) { +function mime_fetch_body($imap_stream, $id, $ent_id ) { /* * do a bit of error correction. If we couldn't find the entity id, just guess @@ -379,7 +379,9 @@ function mime_fetch_body ($imap_stream, $id, $ent_id ) { if (!$ent_id) { $ent_id = 1; } - $data = sqimap_run_command ($imap_stream, "FETCH $id BODY[$ent_id]", true, $response, $message); + + $cmd = "FETCH $id BODY[$ent_id]"; + $data = sqimap_run_command ($imap_stream, $cmd, true, $response, $message); $topline = array_shift($data); while (! ereg('\\* [0-9]+ FETCH ', $topline) && $data) { $topline = array_shift($data); @@ -414,35 +416,42 @@ function mime_fetch_body ($imap_stream, $id, $ent_id ) { } $k++; } - if ( $base <> '' ) - + if ( $base <> '' ) { $ret = "" . $ret; + } } } else if (ereg('"([^"]*)"', $topline, $regs)) { $ret = $regs[1]; } else { global $where, $what, $mailbox, $passed_id, $startMessage; - $par = "mailbox=".urlencode($mailbox)."&passed_id=$passed_id"; + $par = 'mailbox=' . urlencode($mailbox) . "&passed_id=$passed_id"; if (isset($where) && isset($what)) { - $par .= "&where=".urlencode($where)."&what=".urlencode($what); + $par .= '&where='. urlencode($where) . "&what=" . urlencode($what); } else { $par .= "&startMessage=$startMessage&show_more=0"; } - $par .= '&response='.urlencode($response).'&message='.urlencode($message). - '&topline='.urlencode($topline); + $par .= '&response=' . urlencode($response) . + '&message=' . urlencode($message). + '&topline=' . urlencode($topline); - echo '' . + echo '
' . + '' . + '' . + '" . + '" . + '" . + '" . + "
' . _("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!") . - "Submit message
" . - '' . _("Response:") . "$response
" . - _("Message:") . " $message
" . - _("FETCH line:") . " $topline ....
"; - + "
" . + _("Submit message") . '

 ' . + '
' . _("Command:") . "$cmd
' . _("Response:") . "$response
' . _("Message:") . "$message
' . _("FETCH line:") . "$topline


"; + $data = sqimap_run_command ($imap_stream, "FETCH $passed_id BODY[]", true, $response, $message); array_shift($data); $wholemessage = implode('', $data); - $ret = "---------------\n$wholemessage"; + $ret = $wholemessage; } return( $ret ); } @@ -461,7 +470,7 @@ function mime_print_body_lines ($imap_stream, $id, $ent_id, $encoding) { if (!ini_get("safe_mode")) { set_time_limit(0); } - + fputs ($imap_stream, "$sid FETCH $id BODY[$ent_id]\r\n"); $cnt = 0; $continue = true; @@ -849,7 +858,7 @@ function encodeHeader ($string) { if ( $l ) { $string = "=?$default_charset?Q?$ret?="; } - + return( $string ); } -- 2.25.1