Performance hacks, encapsulation and more EL code usage:
[mailer.git] / inc / wrapper-functions.php
index 4bfcad28f21720a3b3bf19c86d05bb1594b7b126..4a6e0e0dc9f01ea38ffd6727128eff575e8c1318 100644 (file)
@@ -771,7 +771,7 @@ function isDemoModeActive () {
        // Is cache set?
        if (!isset($GLOBALS[__FUNCTION__])) {
                // Simply check it
-               $GLOBALS[__FUNCTION__] = ((isExtensionActive('demo')) && (getAdminLogin(getSession('admin_id')) == 'demo'));
+               $GLOBALS[__FUNCTION__] = ((isExtensionActive('demo')) && (getCurrentAdminLogin() == 'demo'));
        } // END - if
 
        // Return it
@@ -800,6 +800,69 @@ function setAdminHash ($adminId, $hash) {
        $GLOBALS['cache_array']['admin']['password'][$adminId] = $hash;
 }
 
+// Getter for current admin login
+function getCurrentAdminLogin () {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!');
+
+       // Do we have cache?
+       if (!isset($GLOBALS[__FUNCTION__])) {
+               // Determine it
+               $GLOBALS[__FUNCTION__] = getAdminLogin(getCurrentAdminId());
+       } // END - if
+
+       // Return it
+       return $GLOBALS[__FUNCTION__];
+}
+
+// Setter for admin id (and current)
+function setAdminId ($adminId) {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminId=' . $adminId);
+
+       // Set session
+       $status = setSession('admin_id', bigintval($adminId));
+
+       // Set current id
+       setCurrentAdminId($adminId);
+
+       // Return status
+       return $status;
+}
+
+// Setter for admin_last
+function setAdminLast ($adminLast) {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminLast=' . $adminLast);
+
+       // Set session
+       $status = setSession('admin_last', $adminLast);
+
+       // Return status
+       return $status;
+}
+
+// Setter for admin_md5
+function setAdminMd5 ($adminMd5) {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'adminMd5=' . $adminMd5);
+
+       // Set session
+       $status = setSession('admin_md5', $adminMd5);
+
+       // Return status
+       return $status;
+}
+
+// Getter for admin_md5
+function getAdminMd5 () {
+       // Log debug message
+       //* DEBUG: */ logDebugMessage(__FUNCTION__, __LINE__, 'called!');
+
+       // Get session
+       return getSession('admin_md5');
+}
+
 // Init user data array
 function initUserData () {
        // User id should not be zero