X-Git-Url: https://git.mxchange.org/?p=mailer.git;a=blobdiff_plain;f=inc%2Fsession-functions.php;h=8feefa3302c17793a901c93630028fd90add42fb;hp=8f2ec9e9ec6c8da9a6fa731dff6309d6f74024cf;hb=0ab2e7a1001f1ccdb1b7c09dd0114b9c80f0df98;hpb=5714d5814873a1a329f43e1738bcefcb746a0e9a diff --git a/inc/session-functions.php b/inc/session-functions.php index 8f2ec9e9ec..8feefa3302 100644 --- a/inc/session-functions.php +++ b/inc/session-functions.php @@ -39,6 +39,7 @@ if (!defined('__SECURITY')) { function setSession ($var, $value) { // Abort in CSS mode here if (isCssOutputMode()) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Is CSS mode:' . $var . '=' . $value); return TRUE; } // END - if @@ -50,7 +51,7 @@ function setSession ($var, $value) { if (('' . $value . '' == '') && (isSessionVariableSet($var))) { // Remove the session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UNSET:' . $var . '=' . getSession($var)); - unset($GLOBALS['_SESSION'][$var]); + unset($_SESSION[$var]); if (isPhpVersionEqualNewer('5.3.0')) { // session_unregister() is deprecated as of 5.3.0 return TRUE; @@ -61,7 +62,7 @@ function setSession ($var, $value) { } elseif (('' . $value . '' != '') && (!isSessionVariableSet($var))) { // Set session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'SET:' . $var . '=' . $value); - $GLOBALS['_SESSION'][$var] = $value; + $_SESSION[$var] = $value; if (isPhpVersionEqualNewer('5.3.0')) { // session_unregister() is deprecated as of 5.3.0 return TRUE; @@ -72,7 +73,7 @@ function setSession ($var, $value) { } elseif (!empty($value)) { // Update session //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'UPDATE:' . $var . '=' . $value); - $GLOBALS['_SESSION'][$var] = $value; + $_SESSION[$var] = $value; return TRUE; } @@ -84,11 +85,12 @@ function setSession ($var, $value) { // Check whether a session variable is set function isSessionVariableSet ($var) { // Warning: DO NOT call logDebugMessage() from here, this will cause an endless loop - return (isset($GLOBALS['_SESSION'][$var])); + return (isset($_SESSION[$var])); } // Returns whether the value of the session variable or NULL if not set function getSession ($var) { + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'var=' . $var . ' - CALLED!'); // Default is not found ;-) $value = NULL; @@ -97,22 +99,22 @@ function getSession ($var) { // Then get it secured! if ((isInstaller()) || (!isSqlLinkUp())) { // Secure string without escaping (and compiling) - $value = secureString($GLOBALS['_SESSION'][$var]); + $value = secureString($_SESSION[$var]); } else { // Escape string with SQL driver - $value = sqlEscapeString($GLOBALS['_SESSION'][$var]); + $value = sqlEscapeString($_SESSION[$var]); } } // END - if // Return the value - //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $var . '=' . $value); + //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, $var . '=' . $value . ' - EXIT!'); return $value; } // Get whole session array function getSessionArray () { // Simply return it - return $GLOBALS['_SESSION']; + return $_SESSION; } // Destroy user session @@ -136,8 +138,8 @@ function destroyAdminSession ($destroy = FALSE) { setAdminMd5(''); setAdminLast(0); - // Set cache to FALSE - $GLOBALS['isAdmin'] = FALSE; + // Remove "cache" + unset($GLOBALS['isAdmin']); // Destroy session if requested and return status if ($destroy === TRUE) { @@ -200,8 +202,11 @@ function initSession () { // Is a session id there? if (!isValidSession()) { // Start the session + //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'Initializing session ...'); $GLOBALS['valid_session'] = session_start(); $GLOBALS['isValidSession'] = TRUE; + + //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'session_id=' . session_id()); } // END - if //* NOISY-DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'EXIT!');