X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_general.php;h=17671284c7173093e7adb175b4a1ad648cd398b8;hb=6c540963c77709619a0670cc733249c8a4162c30;hp=92bb13f4d914c99de2645c927512694573b63819;hpb=c03cba152050682b174e406854a56bd7b7db2a04;p=squirrelmail.git
diff --git a/functions/imap_general.php b/functions/imap_general.php
index 92bb13f4..17671284 100755
--- a/functions/imap_general.php
+++ b/functions/imap_general.php
@@ -187,7 +187,8 @@ function sqimap_fread($imap_stream,$iSize,$filter=false,
if (!$filter || !$outputstream) {
$iBufferSize = $iSize;
} else {
- $iBufferSize = 62400; // multiple of 78 in case of base64 decoding.
+ // see php bug 24033. They changed fread behaviour %$^&$%
+ $iBufferSize = 780; // multiple of 78 in case of base64 decoding.
}
$iRet = $iSize - $iBufferSize;
$iRetrieved = 0;
@@ -294,6 +295,26 @@ function sqimap_read_data_list($imap_stream, $tag, $handle_errors,
exit;
}
+function sqimap_error_box($title, $query = '', $message_title = '', $message = '')
+{
+ global $color, $squirrelmail_language;
+
+ set_up_language($squirrelmail_language);
+ require_once(SM_PATH . 'functions/display_messages.php');
+ $string = "\n" . $title . "
\n";
+ $cmd = explode(' ',$query);
+ $cmd= strtolower($cmd[0]);
+
+ if ($query != '' && $cmd != 'login')
+ $string .= _("Query:") . ' ' . htmlspecialchars($query) . '
';
+ if ($message_title != '')
+ $string .= $message_title;
+ if ($message != '')
+ $string .= htmlspecialchars($message);
+ $string .= "
\n";
+ error_box($string,$color);
+}
+
/*
* Reads the output from the IMAP stream. If handle_errors is set to true,
* this will also handle all errors that are received. If it is not set,
@@ -461,14 +482,7 @@ function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors,
/* error processing in case $read is false */
if ($read === false) {
unset($data);
- set_up_language($squirrelmail_language);
- require_once(SM_PATH . 'functions/display_messages.php');
- $string = "\n" .
- _("ERROR : Connection dropped by imap-server.") .
- "
\n" .
- _("Query:") . ' '.
- htmlspecialchars($query) . '
' . "
\n";
- error_box($string,$color);
+ sqimap_error_box(_("ERROR : Connection dropped by imap-server."), $query);
exit;
}
@@ -483,67 +497,30 @@ function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors,
/* Return result or handle errors */
if ($handle_errors == false) {
return $aResponse;
- return( $resultlist );
+ return( $resultlist ); //?? Why this?
}
- switch ($response[$tag])
- {
+ switch ($response[$tag]) {
case 'OK':
return $aResponse;
break;
case 'NO':
/* ignore this error from M$ exchange, it is not fatal (aka bug) */
if (strstr($message[$tag], 'command resulted in') === false) {
- set_up_language($squirrelmail_language);
- require_once(SM_PATH . 'functions/display_messages.php');
- $string = "\n" .
- _("ERROR : Could not complete request.") .
- "
\n" .
- _("Query:") . ' ' .
- htmlspecialchars($query) . '
' .
- _("Reason Given: ") .
- htmlspecialchars($message[$tag]) . "
\n";
- error_box($string,$color);
+ sqimap_error_box(_("ERROR : Could not complete request."), $query, _("Reason Given: "), $message[$tag]);
echo '