]> git.mxchange.org Git - mailer.git/blobdiff - inc/load_cache.php
Textlink updated in surfbar
[mailer.git] / inc / load_cache.php
index 165bf9cca3c1c180bf1b875690e20a5802994f7a..bf4b34326bd954da0ed558dd4af1158d0ce03a4d 100644 (file)
@@ -98,7 +98,7 @@ if (($cacheInstance->cache_file("admins", true) == true)) {
                $cacheInstance->cache_destroy();
                unset($cacheArray['admins']);
        }
-} elseif (($_CONFIG['cache_admins'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) {
+} elseif (($_CONFIG['cache_admins'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file
        $cacheInstance->cache_init("ADMINS");
 
@@ -145,25 +145,28 @@ if ($cacheInstance->cache_file("mod_reg", true) == true) {
                unset($cacheArray['modules']);
        } else {
                // Rewrite module cache
-               $MOD = $cacheArray['modules'];
-               foreach ($cacheArray['modules']['module'] as $key=>$mod) {
-                       $cacheArray['modules']['id'][$mod] = $cacheArray['modules']['id'][$key];
+               $modArray = $cacheArray['modules'];
+               foreach ($modArray['module'] as $key=>$mod) {
+                       $cacheArray['modules']['id'][$mod] = $modArray['id'][$key];
                        unset($cacheArray['modules']['id'][$key]);
-                       $cacheArray['modules']['title'][$mod] = $cacheArray['modules']['title'][$key];
+                       $cacheArray['modules']['title'][$mod] = $modArray['title'][$key];
                        unset($cacheArray['modules']['title'][$key]);
-                       $cacheArray['modules']['locked'][$mod] = $cacheArray['modules']['locked'][$key];
+                       $cacheArray['modules']['locked'][$mod] = $modArray['locked'][$key];
                        unset($cacheArray['modules']['locked'][$key]);
-                       $cacheArray['modules']['hidden'][$mod] = $cacheArray['modules']['hidden'][$key];
+                       $cacheArray['modules']['hidden'][$mod] = $modArray['hidden'][$key];
                        unset($cacheArray['modules']['hidden'][$key]);
-                       $cacheArray['modules']['admin_only'][$mod] = $cacheArray['modules']['admin_only'][$key];
+                       $cacheArray['modules']['admin_only'][$mod] = $modArray['admin_only'][$key];
                        unset($cacheArray['modules']['admin_only'][$key]);
-                       $cacheArray['modules']['mem_only'][$mod] = $cacheArray['modules']['mem_only'][$key];
+                       $cacheArray['modules']['mem_only'][$mod] = $modArray['mem_only'][$key];
                        unset($cacheArray['modules']['mem_only'][$key]);
-                       $cacheArray['modules']['has_menu'][$mod] = $cacheArray['modules']['has_menu'][$key];
-                       unset($cacheArray['modules']['has_menu'][$key]);
+                       if (isset($cacheArray['modules']['has_menu'][$key])) {
+                               $cacheArray['modules']['has_menu'][$mod] = $modArray['has_menu'][$key];
+                               unset($cacheArray['modules']['has_menu'][$key]);
+                       } // END - if
                }
+               unset($modArray);
        }
-} elseif (($_CONFIG['cache_modreg'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) {
+} elseif (($_CONFIG['cache_modreg'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
        $cacheInstance->cache_init("MODULES");
 
@@ -193,11 +196,11 @@ $cacheInstance->cache_close();
 if ($cacheInstance->cache_file("config", true) == true) {
        // Load config from cache
        global $cacheArray;
-       $cacheArray = $cacheInstance->cache_load();
+       $cacheArrayConfig = $cacheInstance->cache_load();
 
        // Valid cache file
        $CNT = 0; $newCache = array();
-       foreach ($cacheArray as $key=>$array) {
+       foreach ($cacheArrayConfig as $key=>$array) {
                foreach ($array as $key2=>$value) {
                        $newCache[$key2][$key] = $value;
                }
@@ -206,17 +209,18 @@ if ($cacheInstance->cache_file("config", true) == true) {
 
        // Overwrite the config with the cache version
        $cacheArray['config'] = $newCache;
+       unset($newCache);
 
        // When there is a period (.) in the result this test will fail and so the cache file is
        // damaged/corrupted
        $TEST = "failed";
-       if (count($cacheArray) > 0 ) $TEST = ($CNT / (count($cacheArray)));
+       if (count($cacheArray['config']) > 0 ) $TEST = ($CNT / (count($cacheArray['config'])));
        if ($TEST != bigintval($TEST)) {
                // Cache file is corrupted!
                $cacheInstance->cache_destroy();
-               unset($cacheArray);
+               unset($cacheArray['config']);
        }
-} elseif (($_CONFIG['cache_config'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) {
+} elseif (($_CONFIG['cache_config'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
        $cacheInstance->cache_init("CONFIG");
 
@@ -237,27 +241,27 @@ $cacheInstance->cache_close();
 // Next cached table is the referral system (refsystem)...
 if ($cacheInstance->cache_file("refsystem", true) == true) {
        // Load referral system from cache
-       global $REF_SYSTEM;
-       $REF_SYSTEM = $cacheInstance->cache_load();
+       global $cacheArray;
+       $cacheArray['ref_system'] = $cacheInstance->cache_load();
 
        // Valid cache file
        $CNT = 0;
-       foreach ($REF_SYSTEM as $k=>$array) {
+       foreach ($cacheArray['ref_system'] as $k=>$array) {
                $CNT += count($array);
        }
 
        // When there is a period (.) in the result this test will fail and so the cache file is
        // damaged/corrupted
        $TEST = "failed";
-       if (count($REF_SYSTEM) > 0 ) $TEST = ($CNT / (count($REF_SYSTEM)));
+       if (count($cacheArray['ref_system']) > 0 ) $TEST = ($CNT / (count($cacheArray['ref_system'])));
        if ($TEST != bigintval($TEST)) {
                // Cache file is corrupted!
                $cacheInstance->cache_destroy();
-               unset($REF_SYSTEM);
+               unset($cacheArray['ref_system']);
        }
-} elseif (($_CONFIG['cache_refsys'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) {
+} elseif (($_CONFIG['cache_refsys'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
-       $cacheInstance->cache_init("REFSYSTEM");
+       $cacheInstance->cache_init("refsystem");
 
        // Load all modules and their data
        $result = SQL_QUERY("SELECT id, userid, level, counter FROM "._MYSQL_PREFIX."_refsystem ORDER BY userid, level", __FILE__, __LINE__);
@@ -276,25 +280,25 @@ $cacheInstance->cache_close();
 // Next cached table is the referral system (refdepths)...
 if ($cacheInstance->cache_file("refdepths", true) == true) {
        // Load referral system from cache
-       global $REF_DEPTHS;
-       $REF_DEPTHS = $cacheInstance->cache_load();
+       global $cacheArray;
+       $cacheArray['ref_depths'] = $cacheInstance->cache_load();
 
        // Valid cache file
        $CNT = 0;
-       foreach ($REF_DEPTHS as $k=>$array) {
+       foreach ($cacheArray['ref_depths'] as $k=>$array) {
                $CNT += count($array);
        }
 
        // When there is a period (.) in the result this test will fail and so the cache file is
        // damaged/corrupted
        $TEST = "failed";
-       if (count($REF_DEPTHS) > 0 ) $TEST = ($CNT / (count($REF_DEPTHS)));
+       if (count($cacheArray['ref_depths']) > 0 ) $TEST = ($CNT / (count($cacheArray['ref_depths'])));
        if ($TEST != bigintval($TEST)) {
                // Cache file is corrupted!
                $cacheInstance->cache_destroy();
-               unset($REF_DEPTHS);
+               unset($cacheArray['ref_depths']);
        }
-} elseif (($_CONFIG['cache_refdepth'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) {
+} elseif (($_CONFIG['cache_refdepth'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
        // Create cache file here
        $cacheInstance->cache_init("REFDEPTHS");
 
@@ -337,7 +341,7 @@ if (GET_EXT_VERSION("admins") >= "0.3") {
                                unset($cacheArray['admin_acls']);
                        }
                }
-       } elseif (($_CONFIG['cache_acls'] == 'Y') && ($CSS != "1") && ($CSS != "-1")) {
+       } elseif (($_CONFIG['cache_acls'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
                // Create cache file here
                $cacheInstance->cache_init("ADMINS_ACLS");