X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fadmin%2Fwhat-config_admins.php;h=b5c0af248dfd7aa7425fd98d225872fb782d85e2;hb=e1235e719b767d6693976c3d24489beaa38a3667;hp=0fffe6b204d09bc9f585cdae30ab46163d77d1e8;hpb=1ebf518b9552f71ee95de6f4b80e6de3a27716d1;p=mailer.git diff --git a/inc/modules/admin/what-config_admins.php b/inc/modules/admin/what-config_admins.php index 0fffe6b204..b5c0af248d 100644 --- a/inc/modules/admin/what-config_admins.php +++ b/inc/modules/admin/what-config_admins.php @@ -1,7 +1,7 @@ 0)) { +if ((isPostRequestElementSet('edit')) && (countPostSelection() > 0)) { // Edit ACLs $OUT = ''; $SW = 2; foreach (postRequestElement('sel') as $id => $selected) { - // Load data for the ID + // Load data for the id $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); list($adminId, $action, $what, $mode) = SQL_FETCHROW($result); @@ -82,10 +79,10 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // Load main template loadTemplate('admin_config_admins_edit', false, $OUT); -} elseif ((isPostRequestElementSet('change')) && ($SEL > 0)) { +} elseif ((isPostRequestElementSet('change')) && (countPostSelection() > 0)) { // Change entries foreach (postRequestElement('sel') as $id => $selected) { - // Secure ID + // Secure id $id = bigintval($id); // Update entries @@ -101,16 +98,16 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // Update cache when installed if (isExtensionActive('cache')) { - if ($GLOBALS['cache_instance']->loadCacheFile('admins_acls')) $GLOBALS['cache_instance']->removeCacheFile(); + if ($GLOBALS['cache_instance']->loadCacheFile('admin_acls')) $GLOBALS['cache_instance']->removeCacheFile(); } // END - if // Entries changed loadTemplate('admin_settings_saved', false, getMessage('ADMIN_ADMINS_ENTRIES_CHANGED')); -} elseif ((isPostRequestElementSet('del')) && ($SEL > 0)) { +} elseif ((isPostRequestElementSet('del')) && (countPostSelection() > 0)) { // Delete ACLs $OUT = ''; $SW = 2; foreach (postRequestElement('sel') as $id => $selected) { - // Load data for the ID + // Load data for the id $result = SQL_QUERY_ESC("SELECT admin_id, action_menu, what_menu, access_mode FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE `id`=%s LIMIT 1", array(bigintval($id)), __FILE__, __LINE__); list($admin, $action, $what, $mode) = SQL_FETCHROW($result); @@ -143,7 +140,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // Load main template loadTemplate('admin_config_admins_del', false, $OUT); -} elseif ((isPostRequestElementSet('remove')) && ($SEL > 0)) { +} elseif ((isPostRequestElementSet('remove')) && (countPostSelection() > 0)) { // Remove entries // @TODO Rewrite this to filter 'run_sqls' foreach (postRequestElement('sel') as $id => $selected) { @@ -153,7 +150,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // Update cache when installed if (isExtensionActive('cache')) { - if ($GLOBALS['cache_instance']->loadCacheFile('admins_acls')) $GLOBALS['cache_instance']->removeCacheFile(); + if ($GLOBALS['cache_instance']->loadCacheFile('admin_acls')) $GLOBALS['cache_instance']->removeCacheFile(); } // END - if // Entries deleted @@ -176,7 +173,7 @@ if ((isPostRequestElementSet('edit')) && ($SEL > 0)) { // Main or sub menu selected $result = SQL_QUERY_ESC("SELECT `id` FROM `{?_MYSQL_PREFIX?}_admins_acls` WHERE admin_id=%s AND action_menu='%s' AND what_menu='%s' LIMIT 1", array(bigintval(postRequestElement('admin_id')), postRequestElement('action_menu'), postRequestElement('what_menu')), __FILE__, __LINE__); - if (SQL_NUMROWS($result) == 0) { + if (SQL_NUMROWS($result) == '0') { // Finally add the new ACL SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_admins_acls` (admin_id, action_menu, what_menu, access_mode) VALUES ('%s','%s','%s','%s')", @@ -190,7 +187,7 @@ VALUES ('%s','%s','%s','%s')", // Update cache when installed if (isExtensionActive('cache')) { - if ($GLOBALS['cache_instance']->loadCacheFile('admins_acls')) $GLOBALS['cache_instance']->removeCacheFile(); + if ($GLOBALS['cache_instance']->loadCacheFile('admin_acls')) $GLOBALS['cache_instance']->removeCacheFile(); } // END - if } else { // ACL does already exist! @@ -212,7 +209,7 @@ VALUES ('%s','%s','%s','%s')", loadTemplate('admin_settings_saved', false, $content); } else { // List all ACLs - $result_acls = SQL_QUERY("SELECT id, admin_id, action_menu, what_menu, access_mode FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY admin_id, id", __FILE__, __LINE__); + $result_acls = SQL_QUERY('SELECT `id`, `admin_id`, `action_menu`, `what_menu`, `access_mode` FROM `{?_MYSQL_PREFIX?}_admins_acls` ORDER BY `admin_id` ASC, `id` ASC', __FILE__, __LINE__); // Entries found? if (SQL_NUMROWS($result_acls) > 0) {