X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_general.php;h=131278e12da048249983740fff400a3d33130518;hb=6872a6750379b6c17cf6a6dfec6150ade78f52a0;hp=d81192a7a9a67b7000e12a15f2b39b8aefe8475c;hpb=4bc49df676b788846c6e777f929dbc742159f8d1;p=squirrelmail.git
diff --git a/functions/imap_general.php b/functions/imap_general.php
index d81192a7..131278e1 100755
--- a/functions/imap_general.php
+++ b/functions/imap_general.php
@@ -5,7 +5,7 @@
*
* This implements all functions that do general IMAP functions.
*
- * @copyright © 1999-2009 The SquirrelMail Project Team
+ * @copyright 1999-2018 The SquirrelMail Project Team
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @version $Id$
* @package squirrelmail
@@ -109,6 +109,21 @@ function sqimap_run_command ($imap_stream, $query, $handle_errors, &$response,
$message = $message[$tag];
if (!empty($read[$tag])) {
+ /* sqimap_read_data should be called for one response
+ but since it just calls sqimap_retrieve_imap_response
+ which handles multiple responses we need to check for
+ that and merge the $read[$tag] array IF they are
+ separated and IF it was a FETCH response. */
+
+ if (isset($read[$tag][1]) && is_array($read[$tag][1]) && isset($read[$tag][1][0])
+ && preg_match('/^\* \d+ FETCH/', $read[$tag][1][0])) {
+ $result = array();
+ foreach($read[$tag] as $index => $value) {
+ $result = array_merge($result, $read[$tag]["$index"]);
+ }
+ return $result;
+ }
+
return $read[$tag][0];
} else {
return $read[$tag];
@@ -334,7 +349,7 @@ function sqimap_read_data_list($imap_stream, $tag, $handle_errors,
'sqimap_run_command or sqimap_run_command_list instead
'.
'The following query was issued:
'.
//FIXME: NO HTML IN CORE!
- htmlspecialchars($query) . '
' . "
\n";
+ sm_encode_html_special_chars($query) . '
' . "
\n";
error_box($string);
$oTemplate->display('footer.tpl');
exit;
@@ -361,11 +376,11 @@ function sqimap_error_box($title, $query = '', $message_title = '', $message = '
$cmd= strtolower($cmd[0]);
if ($query != '' && $cmd != 'login')
- $string .= _("Query:") . ' ' . htmlspecialchars($query) . '
';
+ $string .= _("Query:") . ' ' . sm_encode_html_special_chars($query) . '
';
if ($message_title != '')
$string .= $message_title;
if ($message != '')
- $string .= htmlspecialchars($message);
+ $string .= sm_encode_html_special_chars($message);
//FIXME: NO HTML IN CORE!
$string .= "
\n";
if ($link != '')
@@ -395,7 +410,7 @@ function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors,
$read = '';
if (!is_array($message)) $message = array();
if (!is_array($response)) $response = array();
- $aResponse = '';
+ $aResponse = array();
$resultlist = array();
$data = array();
$sCommand = '';
@@ -601,22 +616,34 @@ function sqimap_retrieve_imap_response($imap_stream, $tag, $handle_errors,
case 'NO':
/* ignore this error from M$ exchange, it is not fatal (aka bug) */
if (strstr($message[$tag], 'command resulted in') === false) {
+ sqsession_register('NO', 'IMAP_FATAL_ERROR_TYPE');
+ sqsession_register($query, 'IMAP_FATAL_ERROR_QUERY');
+ sqsession_register($message[$tag], 'IMAP_FATAL_ERROR_MESSAGE');
sqimap_error_box(_("ERROR: Could not complete request."), $query, _("Reason Given:") . ' ', $message[$tag]);
echo '