git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@5038
7612ce4b-ef26-0410-bec9-
ea0150e637f0
$buffer = 4096;
$results = '';
$offset = 0;
$buffer = 4096;
$results = '';
$offset = 0;
while (strpos($results, "\r\n", $offset) === false) {
if (!($read = fgets($imap_stream, $buffer))) {
/* this happens in case of an error */
while (strpos($results, "\r\n", $offset) === false) {
if (!($read = fgets($imap_stream, $buffer))) {
/* this happens in case of an error */
/* Return result or handle errors */
if ($handle_errors == false) {
return( $resultlist );
/* 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');
if (strstr($message, 'command resulted in') === false) {
set_up_language($squirrelmail_language);
require_once(SM_PATH . 'functions/display_messages.php');
_("Reason Given: ") .
htmlspecialchars($message) . "</font><br>\n";
error_box($string,$color);
_("Reason Given: ") .
htmlspecialchars($message) . "</font><br>\n";
error_box($string,$color);
- }
- elseif ($response == 'BAD') {
set_up_language($squirrelmail_language);
require_once(SM_PATH . 'functions/display_messages.php');
$string = "<b><font color=$color[2]>\n" .
set_up_language($squirrelmail_language);
require_once(SM_PATH . 'functions/display_messages.php');
$string = "<b><font color=$color[2]>\n" .
htmlspecialchars($query) . '<br>' .
_("Server responded: ") .
htmlspecialchars($message) . "</font><br>\n";
htmlspecialchars($query) . '<br>' .
_("Server responded: ") .
htmlspecialchars($message) . "</font><br>\n";
- error_box($string,$color);
+ error_box($string,$color);
+ echo '</body></html>';
+ exit;
+ case 'BYE':
+ set_up_language($squirrelmail_language);
+ require_once(SM_PATH . 'functions/display_messages.php');
+ $string = "<b><font color=$color[2]>\n" .
+ _("ERROR : Imap server closed the connection.") .
+ "</b><br>\n" .
+ _("Query:") . ' '.
+ htmlspecialchars($query) . '<br>' .
+ _("Server responded: ") .
+ htmlspecialchars($message) . "</font><br>\n";
+ error_box($string,$color);
+ echo '</body></html>';
- }
- else {
- return $resultlist;
+ default:
+ set_up_language($squirrelmail_language);
+ require_once(SM_PATH . 'functions/display_messages.php');
+ $string = "<b><font color=$color[2]>\n" .
+ _("ERROR : Unknown imap response.") .
+ "</b><br>\n" .
+ _("Query:") . ' '.
+ htmlspecialchars($query) . '<br>' .
+ _("Server responded: ") .
+ htmlspecialchars($message) . "</font><br>\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;