From: stekkel Date: Thu, 24 Oct 2002 09:25:20 +0000 (+0000) Subject: error check on imap_stream. X-Git-Url: https://vcs.fsf.org/?a=commitdiff_plain;h=c5809184548399d1a5e4d70bc32f78dc206e8dff;p=squirrelmail.git error check on imap_stream. git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@3995 7612ce4b-ef26-0410-bec9-ea0150e637f0 --- diff --git a/functions/imap_general.php b/functions/imap_general.php index f658073f..d085800d 100755 --- a/functions/imap_general.php +++ b/functions/imap_general.php @@ -31,17 +31,41 @@ function sqimap_session_id($unique_id = false) { * This is to allow proper session number handling. */ function sqimap_run_command_list ($imap_stream, $query, $handle_errors, &$response, &$message, $unique_id = false) { - $sid = sqimap_session_id($unique_id); - fputs ($imap_stream, $sid . ' ' . $query . "\r\n"); - $read = sqimap_read_data_list ($imap_stream, $sid, $handle_errors, $response, $message, $query ); - return $read; + if ($imap_stream) { + $sid = sqimap_session_id($unique_id); + fputs ($imap_stream, $sid . ' ' . $query . "\r\n"); + $read = sqimap_read_data_list ($imap_stream, $sid, $handle_errors, $response, $message, $query ); + return $read; + } else { + global $squirrelmail_language, $color; + set_up_language($squirrelmail_language); + require_once(SM_PATH . 'functions/display_messages.php'); + $string = "\n" . + _("ERROR : No available imapstream.") . + "\n"; + error_box($string,$color); + return false; + } + } function sqimap_run_command ($imap_stream, $query, $handle_errors, &$response, &$message, $unique_id = false) { - $sid = sqimap_session_id($unique_id); - fputs ($imap_stream, $sid . ' ' . $query . "\r\n"); - $read = sqimap_read_data ($imap_stream, $sid, $handle_errors, $response, $message, $query); - return $read; + if ($imap_stream) { + $sid = sqimap_session_id($unique_id); + fputs ($imap_stream, $sid . ' ' . $query . "\r\n"); + $read = sqimap_read_data ($imap_stream, $sid, $handle_errors, $response, $message, $query); + return $read; + } else { + global $squirrelmail_language, $color; + set_up_language($squirrelmail_language); + require_once(SM_PATH . 'functions/display_messages.php'); + $string = "\n" . + _("ERROR : No available imapstream.") . + "\n"; + error_box($string,$color); + return false; + } + }