two more subpackage blocks
[squirrelmail.git] / functions / imap_general.php
index 6f0a7c6f44b78b507d1bf478b223c977179dab21..2a6e1d1366abbad83a7fda7900e5129b868d5375 100755 (executable)
@@ -8,8 +8,9 @@
  *
  * This implements all functions that do general imap functions.
  *
- * $Id$
+ * @version $Id$
  * @package squirrelmail
+ * @subpackage imap
  */
 
 /** Includes.. */
@@ -17,17 +18,15 @@ require_once(SM_PATH . 'functions/page_header.php');
 require_once(SM_PATH . 'functions/auth.php');
 
 
-global $sqimap_session_id;
-$sqimap_session_id = 1;
-
 /**
  * Generates a new session ID by incrementing the last one used;
  * this ensures that each command has a unique ID.
  * @param bool unique_id
  * @return string IMAP session id of the form 'A000'.
  */
-function sqimap_session_id($unique_id = false) {
-    global $data_dir, $username, $sqimap_session_id;
+function sqimap_session_id($unique_id = FALSE) {
+    static $sqimap_session_id = 1;
+
     if (!$unique_id) {
         return( sprintf("A%03d", $sqimap_session_id++) );
     } else {
@@ -567,10 +566,10 @@ function sqimap_read_data ($imap_stream, $tag_uid, $handle_errors,
 function sqimap_create_stream($server,$port,$tls=false) {
     global $username, $use_imap_tls;
 
-    if ($use_imap_tls == true) {
+    if ($tls == true) {
         if ((check_php_version(4,3)) and (extension_loaded('openssl'))) {
             /* Use TLS by prefixing "tls://" to the hostname */
-            $server = 'tls://' . $imap_server_address;
+            $server = 'tls://' . $server;
         } else {
             require_once(SM_PATH . 'functions/display_messages.php');
             $string = "Unable to connect to IMAP server!<br>TLS is enabled, but this " .