From: stekkel Date: Fri, 13 Jun 2003 15:30:28 +0000 (+0000) Subject: in case of BYE response display errormessage X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=dd38100210b7d4473df1e5e55bd529107e420474;p=squirrelmail.git in case of BYE response display errormessage git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5038 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_general.php b/functions/imap_general.php index 04799a60..9cfd1c74 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -81,7 +81,6 @@ function sqimap_fgets($imap_stream) { $buffer = 4096; $results = ''; $offset = 0; - $i=0; while (strpos($results, "\r\n", $offset) === false) { if (!($read = fgets($imap_stream, $buffer))) { /* this happens in case of an error */ @@ -269,9 +268,14 @@ function sqimap_read_data_list ($imap_stream, $tag_uid, $handle_errors, &$respon /* Return result or handle errors */ if ($handle_errors == false) { return( $resultlist ); - } - elseif ($response == 'NO') { - /* ignore this error from M$ exchange, it is not fatal (aka bug) */ + } + switch ($response) + { + case 'OK': + return $resultlist; + break; + case 'NO': + /* ignore this error from M$ exchange, it is not fatal (aka bug) */ if (strstr($message, 'command resulted in') === false) { set_up_language($squirrelmail_language); require_once(SM_PATH . 'functions/display_messages.php'); @@ -283,10 +287,11 @@ function sqimap_read_data_list ($imap_stream, $tag_uid, $handle_errors, &$respon _("Reason Given: ") . htmlspecialchars($message) . "
\n"; error_box($string,$color); + echo ''; exit; } - } - elseif ($response == 'BAD') { + break; + case 'BAD': set_up_language($squirrelmail_language); require_once(SM_PATH . 'functions/display_messages.php'); $string = "\n" . @@ -296,11 +301,37 @@ function sqimap_read_data_list ($imap_stream, $tag_uid, $handle_errors, &$respon htmlspecialchars($query) . '
' . _("Server responded: ") . htmlspecialchars($message) . "

\n"; - error_box($string,$color); + error_box($string,$color); + echo ''; + exit; + case 'BYE': + set_up_language($squirrelmail_language); + require_once(SM_PATH . 'functions/display_messages.php'); + $string = "\n" . + _("ERROR : Imap server closed the connection.") . + "
\n" . + _("Query:") . ' '. + htmlspecialchars($query) . '
' . + _("Server responded: ") . + htmlspecialchars($message) . "

\n"; + error_box($string,$color); + echo ''; exit; - } - else { - return $resultlist; + default: + set_up_language($squirrelmail_language); + require_once(SM_PATH . 'functions/display_messages.php'); + $string = "\n" . + _("ERROR : Unknown imap response.") . + "
\n" . + _("Query:") . ' '. + htmlspecialchars($query) . '
' . + _("Server responded: ") . + htmlspecialchars($message) . "

\n"; + error_box($string,$color); + /* the error is displayed but because we don't know the reponse we + return the result anyway */ + return $resultlist; + break; } }