Cache class rewritten to better convention
[mailer.git] / inc / modules / admin / what-config_admins.php
index 2ab08abfae87d3bae9d2f0be2313aa796e378e73..d74d041d96281c950ab87a8d6986528d30242405 100644 (file)
@@ -38,7 +38,7 @@ if ((!defined('__SECURITY')) || (!IS_ADMIN())) {
 }
 
 // Add description as navigation point
-ADD_DESCR("admin", basename(__FILE__));
+ADD_DESCR("admin", __FILE__);
 
 $SEL = 0;
 if (!empty($_POST['sel'])) $SEL = SELECTION_COUNT($_POST['sel']);
@@ -89,7 +89,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) {
 
        // Update cache when installed
        if (EXT_IS_ACTIVE("cache")) {
-               if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
 
                // Purge menu cache
                CACHE_PURGE_ADMIN_MENU($_POST['admin'][$id]);
@@ -110,8 +110,9 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) {
                // Prepare variables
                if (empty($act)) $act = "---";
                if (empty($wht)) $wht   = "---";
-               $eval = "\$mode = ADMINS_".strtoupper($mode)."_MODE;";
-               eval($eval);
+
+               // Get admin mode
+               $mode = constant('ADMINS_'.strtoupper($mode).'_MODE');
 
                // Load admin's data
                $login = GET_ADMIN_LOGIN($admin);
@@ -150,7 +151,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) {
 
        // Update cache when installed
        if (EXT_IS_ACTIVE("cache")) {
-               if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy();
+               if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
 
                // @TODO This causes the whole (!) menu cache being rebuild
                CACHE_PURGE_ADMIN_MENU();
@@ -160,10 +161,7 @@ if ((isset($_POST['edit'])) && ($SEL > 0)) {
        LOAD_TEMPLATE("admin_settings_saved", false, ADMIN_ADMINS_ENTRIES_DELETED);
 } elseif (isset($_POST['add'])) {
        // Check if everything is fine...
-       $result = SQL_QUERY_ESC("SELECT default_acl FROM "._MYSQL_PREFIX."_admins WHERE id=%s LIMIT 1",
-        array(bigintval($_POST['admin_id'])), __FILE__, __LINE__);
-       list($mode) = SQL_FETCHROW($result);
-       SQL_FREERESULT($result);
+       $mode = GET_ADMIN_DEFAULT_ACL(bigintval($_POST['admin_id']));
 
        // Default ACL is false
        $ACL = false;
@@ -193,7 +191,7 @@ VALUES ('%s','%s','%s','%s')",
 
                                // Update cache when installed
                                if (EXT_IS_ACTIVE("cache")) {
-                                       if ($cacheInstance->cache_file("admins_acls", true) == true) $cacheInstance->cache_destroy();
+                                       if ($cacheInstance->loadCacheFile("admins_acls")) $cacheInstance->destroyCacheFile();
 
                                        // Purge cache
                                        CACHE_PURGE_ADMIN_MENU($_POST['admin_id'], $_POST['action_menu'], $_POST['what_menu']);
@@ -228,8 +226,9 @@ VALUES ('%s','%s','%s','%s')",
                        // Prepare variables
                        if (empty($act)) $act = "---";
                        if (empty($wht))   $wht   = "---";
-                       $eval = "\$mode = ADMINS_".strtoupper($mode)."_MODE;";
-                       eval($eval);
+
+                       // Get mode
+                       $mode = constant('ADMINS_'.strtoupper($mode).'_MODE');
 
                        // Load admin's data
                        $login = GET_ADMIN_LOGIN($admin);