Referal overview finished and rewritten for refback extension
[mailer.git] / inc / loader / load_cache-admin.php
index 06689b6b81d735f4a2998063e4cb16406f526e84..59d7a09812b01156a926af2771ee478869583abc 100644 (file)
@@ -32,7 +32,7 @@
  ************************************************************************/
 
 // Some security stuff...
-if (ereg(basename(__FILE__), $_SERVER['PHP_SELF'])) {
+if (!defined('__SECURITY')) {
        $INC = substr(dirname(__FILE__), 0, strpos(dirname(__FILE__), "/inc") + 4) . "/security.php";
        require($INC);
 } // END - if
@@ -123,6 +123,9 @@ ORDER BY login", __FILE__, __LINE__);
        // Free memory
        SQL_FREERESULT($result_admins);
 
+       // Close cache
+       $cacheInstance->cache_close();
+
        // Reload the cache
        require(__FILE__);
 }
@@ -134,36 +137,18 @@ $cacheInstance->cache_close();
 if (GET_EXT_VERSION("admins") >= "0.3") {
        // Check for cache file
        if ($cacheInstance->cache_file("admins_acls", true) == true) {
-               // Load referral system from cache
+               // Load referal system from cache
                global $cacheArray;
                $cacheArray['admin_acls'] = $cacheInstance->cache_load();
-
-               // Valid cache file
-               $CNT = 0;
-               foreach ($cacheArray['admin_acls'] as $k => $array) {
-                       $CNT += count($array);
-               } // END - foreach
-
-               // When there is a period (.) in the result this test will fail and so the cache file is
-               // damaged/corrupted
-               if (count($cacheArray['admin_acls']) > 0) {
-                       $TEST = "failed";
-                       if (count($cacheArray['admin_acls']) > 0 ) $TEST = ($CNT / (count($cacheArray['admin_acls'])));
-                       if ($TEST != bigintval($TEST)) {
-                               // Cache file is corrupted!
-                               $cacheInstance->cache_destroy();
-                               unset($cacheArray['admin_acls']);
-                       } // END - if
-               } // END - if
        } elseif (($_CONFIG['cache_acls'] == "Y") && ($CSS != "1") && ($CSS != "-1")) {
                // Create cache file here
                $cacheInstance->cache_init("ADMINS_ACLS");
 
                // Load all modules and their data
                $result = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM "._MYSQL_PREFIX."_admins_acls ORDER BY admin_id, action_menu, what_menu", __FILE__, __LINE__);
-               while ($DATA = SQL_FETCHARRAY($result)) {
+               while ($data = SQL_FETCHARRAY($result)) {
                        // Add row to cache file
-                       $cacheInstance->add_row($DATA);
+                       $cacheInstance->add_row($data);
                } // END - while
 
                // Free memory