X-Git-Url: https://vcs.fsf.org/?a=blobdiff_plain;f=functions%2Fimap_general.php;h=414e2a95ecb2947c7f0757358d92d28204ca059d;hb=6654098883ee3a5b5ca49b54020a743c3ef4a46c;hp=f39956d6f2a15fe88f13efd0618cdb4634e394a3;hpb=45e7eca2bbcb3bb643893e84bfca0d742854376b;p=squirrelmail.git
diff --git a/functions/imap_general.php b/functions/imap_general.php
index f39956d6..414e2a95 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-2012 The SquirrelMail Project Team
+ * @copyright 1999-2017 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 != '')
@@ -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 '