From 64ac34f8ebcfef05d9b273dd2be693717483ba16 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Roland=20H=C3=A4der?= <roland@mxchange.org> Date: Mon, 20 Oct 2008 13:15:33 +0000 Subject: [PATCH] More fixes for admin functions, thanks to Piter01 --- img.php | 2 +- inc/databases.php | 2 +- inc/libs/admins_functions.php | 18 +++++------------- inc/modules/admin/what-config_admins.php | 2 +- inc/theme-manager.php | 2 +- 5 files changed, 9 insertions(+), 17 deletions(-) diff --git a/img.php b/img.php index 64919e4066..54b2173947 100644 --- a/img.php +++ b/img.php @@ -1,6 +1,6 @@ <?php /************************************************************************ - * MXChange v0.2.1 Start: 10/16/2008 * + * MXChange v0.2.1 Start: 10/12/2003 * * =============== Last change: 10/16/2008 * * * * -------------------------------------------------------------------- * diff --git a/inc/databases.php b/inc/databases.php index 651bb4fff4..e6ac4fb78c 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -114,7 +114,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "516"); +define('CURR_SVN_REVISION', "517"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/libs/admins_functions.php b/inc/libs/admins_functions.php index 550b8a69bc..c5d0db38d4 100644 --- a/inc/libs/admins_functions.php +++ b/inc/libs/admins_functions.php @@ -47,21 +47,13 @@ function ADMINS_CHECK_ACL($act, $wht) { // Default is deny $ret = false; - // Get admin's defult access right - if (!empty($cacheArray['admins']['def_acl'][get_session('admin_login')])) { - // Load from cache - $default = $cacheArray['admins']['def_acl'][get_session('admin_login')]; - - // Count cache hits - if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } - } elseif (!is_object($cacheInstance)) { - // Load from database - $default = GET_ADMIN_DEFAULT_ACL(get_session('admin_login')); - } - // Get admin's ID $aid = GET_ADMIN_ID(get_session('admin_login')); + // Get admin's defult access right + $default = GET_ADMIN_DEFAULT_ACL($aid); + + if (!empty($wht)) { // Check for parent menu: // First get it's action value @@ -212,7 +204,7 @@ function ADMINS_CHANGE_ADMIN_ACCOUNT($POST) { } // END - if // Get default ACL from admin to check if we can allow him to change the default ACL - $default = GET_ADMIN_DEFAULT_ACL(get_session('admin_login')); + $default = GET_ADMIN_DEFAULT_ACL(GET_ADMIN_ID(get_session('admin_login'))); // Update admin account if ($default == "allow") { diff --git a/inc/modules/admin/what-config_admins.php b/inc/modules/admin/what-config_admins.php index d88a2821f1..c531b3b30f 100644 --- a/inc/modules/admin/what-config_admins.php +++ b/inc/modules/admin/what-config_admins.php @@ -161,7 +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... - $mode = GET_ADMIN_DEFAULT_ACL(GET_ADMIN_LOGIN(bigintval($_POST['admin_id']))); + $mode = GET_ADMIN_DEFAULT_ACL(bigintval($_POST['admin_id'])); // Default ACL is false $ACL = false; diff --git a/inc/theme-manager.php b/inc/theme-manager.php index 2ba2d28b77..44b82d17dd 100644 --- a/inc/theme-manager.php +++ b/inc/theme-manager.php @@ -253,7 +253,7 @@ function GET_CURR_THEME_NAME () { if (isset($_CONFIG['cache_hits'])) { $_CONFIG['cache_hits']++; } else { $_CONFIG['cache_hits'] = 1; } } elseif (GET_EXT_VERSION("cache") != "0.1.8") { // Check if current theme is already imported or not - $result = SQL_QUERY_ESC("SELECT theme_name FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_name='Y' LIMIT 1", + $result = SQL_QUERY_ESC("SELECT theme_name FROM "._MYSQL_PREFIX."_themes WHERE theme_path='%s' AND theme_active='Y' LIMIT 1", array($name), __FILE__, __LINE__); // Is the theme active and installed? -- 2.39.5