Several kinky code smoothed, fixes for admin login
[mailer.git] / inc / wrapper-functions.php
index f7ef134affe92ecda299c3aa06a43b80a3180055..0f89445a06222c3fcb2a83b573f2a24574efe6f9 100644 (file)
@@ -286,7 +286,13 @@ function isInstalled () {
                $GLOBALS['is_installed'] = (
                (
                        // First is config
-                       getConfig('MXCHANGE_INSTALLED') == 'Y'
+                       (
+                               (
+                                       isConfigEntrySet('MXCHANGE_INSTALLED')
+                               ) && (
+                                       getConfig('MXCHANGE_INSTALLED') == 'Y'
+                               )
+                       )
                ) || (
                        // New config file found and loaded
                        isIncludeReadable(getConfig('CACHE_PATH') . 'config-local.php')
@@ -312,7 +318,7 @@ function isInstalled () {
 
 // Check wether an admin is registered
 function isAdminRegistered () {
-       return (getConfig('ADMIN_REGISTERED') == 'Y');
+       return ((isConfigEntrySet('ADMIN_REGISTERED')) && (getConfig('ADMIN_REGISTERED') == 'Y'));
 }
 
 // Checks wether the reset mode is active
@@ -324,13 +330,13 @@ function isResetModeEnabled () {
 // Checks wether the debug mode is enabled
 function isDebugModeEnabled () {
        // Simply check it
-       return (getConfig('DEBUG_MODE') == 'Y');
+       return ((isConfigEntrySet('DEBUG_MODE')) && (getConfig('DEBUG_MODE') == 'Y'));
 }
 
 // Checks wether we shall debug regular expressions
 function isDebugRegExpressionEnabled () {
        // Simply check it
-       return (getConfig('DEBUG_REGEX') == 'Y');
+       return ((isConfigEntrySet('DEBUG_REGEX')) && (getConfig('DEBUG_REGEX') == 'Y'));
 }
 
 // Checks wether the cache instance is valid
@@ -640,12 +646,14 @@ function redirectToIndexMemberOnlyModule () {
 // Wrapper function for checking if extension is installed and newer or same version
 function isExtensionInstalledAndNewer ($ext_name, $version) {
        // Return it
+       //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'=&gt;'.$version.'<br />';
        return ((isExtensionInstalled($ext_name)) && (getExtensionVersion($ext_name) >= $version));
 }
 
 // Wrapper function for checking if extension is installed and older than given version
 function isExtensionInstalledAndOlder ($ext_name, $version) {
        // Return it
+       //* DEBUG: */ print __FUNCTION__.':'.$ext_name.'&lt;'.$version.'<br />';
        return ((isExtensionInstalled($ext_name)) && (isExtensionOlder($ext_name, $version)));
 }
 
@@ -690,5 +698,15 @@ function getPhpCaching () {
        return $GLOBALS['php_caching'];
 }
 
+// Checks wether the admin hash is set
+function isAdminHashSet ($admin) {
+       return isset($GLOBALS['cache_array']['admin']['password'][$admin]);
+}
+
+// Setter for admin hash
+function setAdminHash ($admin, $hash) {
+       $GLOBALS['cache_array']['admin']['password'][$admin] = $hash;
+}
+
 // [EOF]
 ?>