Long time in coming: allow sqimap_login() to return even if connection failed. Usefu...
authorpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 11 Nov 2006 08:13:12 +0000 (08:13 +0000)
committerpdontthink <pdontthink@7612ce4b-ef26-0410-bec9-ea0150e637f0>
Sat, 11 Nov 2006 08:13:12 +0000 (08:13 +0000)
git-svn-id: https://svn.code.sf.net/p/squirrelmail/code/trunk/squirrelmail@11952 7612ce4b-ef26-0410-bec9-ea0150e637f0

functions/imap_general.php

index 38ef57224b4c35814517d0673c47d3a46f6f8455..46c49ee5491b0f9b71a4eef399cbf12ab7c5e912 100755 (executable)
@@ -748,15 +748,18 @@ function sqimap_create_stream($server,$port,$tls=0) {
 
 /**
  * Logs the user into the IMAP server.  If $hide is set, no error messages
- * will be displayed.  This function returns the IMAP connection handle.
+ * will be displayed (if set to 1, just exits, if set to 2, returns FALSE).  
+ * This function returns the IMAP connection handle.
  * @param string $username user name
  * @param string $password password encrypted with onetimepad. Since 1.5.2
  *  function can use internal password functions, if parameter is set to
  *  boolean false.
  * @param string $imap_server_address address of imap server
  * @param integer $imap_port port of imap server
- * @param boolean $hide controls display connection errors
- * @return stream
+ * @param int $hide controls display connection errors:
+ *                  0 = do not hide, 1 = show logout error, 2 = return FALSE
+ * @return mixed The IMAP connection stream, or FALSE if $hide is set to 2 
+ *               and the connection fails.
  */
 function sqimap_login ($username, $password, $imap_server_address, $imap_port, $hide) {
     global $color, $squirrelmail_language, $onetimepad, $use_imap_tls,
@@ -936,6 +939,7 @@ function sqimap_login ($username, $password, $imap_server_address, $imap_port, $
                 exit;
             }
         } else {
+            if ($hide == 2) return FALSE;
             exit;
         }
     }