/**
* imap_general.php
*
- * Copyright (c) 1999-2003 The SquirrelMail Project Team
+ * Copyright (c) 1999-2004 The SquirrelMail Project Team
* Licensed under the GNU GPL. For full terms see the file COPYING.
*
* This implements all functions that do general imap functions.
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 {
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 " .