diff --git a/phpBB/adm/admin_permissions.php b/phpBB/adm/admin_permissions.php index 1be21c51de..c6c60429b5 100644 --- a/phpBB/adm/admin_permissions.php +++ b/phpBB/adm/admin_permissions.php @@ -231,11 +231,11 @@ if ($mode == 'deps') // Generate header page_header($l_title); - $chg_acl_type = (isset($_POST['chg_type'])) ? htmlspecialchars($_POST['chg_type']) : ''; - $chg_acl_option_id = (isset($_POST['chg_option'])) ? intval($_POST['chg_option']) : ''; - $chg_acl_value = (isset($_POST['chg_value'])) ? intval($_POST['chg_value']) : ''; - $chg_forum_id = (isset($_POST['f'])) ? intval($_POST['f']) : 0; - $chg_acl_options = (isset($_POST['option'])) ? $_POST['option'] : ''; + $dep_quick_access = (isset($_POST['dep_quick_access'])) ? htmlspecialchars($_POST['dep_quick_access']) : ''; + $dep_type = (isset($_POST['dep_type'])) ? htmlspecialchars($_POST['dep_type']) : -1; + $dep_option = (isset($_POST['dep_option'])) ? $_POST['dep_option'] : array(); + $dep_value = (isset($_POST['dep_value'])) ? intval($_POST['dep_value']) : -1; + $dep_forum_id = (isset($_POST['f'])) ? $_POST['f'] : array(0); $acl_types = $auth_options = $value_options = $forum_options = ''; @@ -243,131 +243,82 @@ if ($mode == 'deps') foreach ($types as $value => $option) { - $acl_types .= '' . $option . ''; + $acl_types .= '' . $option . ''; } - if (isset($_POST['chg_type'])) + if (!empty($dep_type)) { - switch ($chg_acl_type) + switch ($dep_type) { case 'admin': - $type_sql = 'a'; + $dep_type = 'a'; break; case 'supermod': case 'mod': - $type_sql = 'm'; + $dep_type = 'm'; break; } $founder_sql = ($user->data['user_founder']) ? ' AND founder_only <> 1' : ''; - $sql = "SELECT auth_option_id, auth_value + $sql = "SELECT auth_value FROM " . ACL_OPTIONS_TABLE . " - WHERE auth_value LIKE '" . $type_sql . "_%' + WHERE auth_value LIKE '" . $dep_type . "_%' $founder_sql"; $result = $db->sql_query($sql); while ($row = $db->sql_fetchrow($result)) - { - $auth_options .= '' . ((!empty($user->lang['acl_' . $row['auth_value']])) ? $user->lang['acl_' . $row['auth_value']] : (($row['auth_value'] == $chg_type_sql . '_') ? 'Any option' : ucfirst(preg_replace('#.*?_#', '', $row['auth_value'])))) . ''; + { + $auth_options .= '' . ((!empty($user->lang['acl_' . $row['auth_value']])) ? $user->lang['acl_' . $row['auth_value']] : (($row['auth_value'] == $dep_type . '_') ? 'Any option' : ucfirst(preg_replace('#.*?_#', '', $row['auth_value'])))) . ''; } $db->sql_freeresult($result); } - if (isset($_POST['chg_option']) && strstr($_POST['field'], 'options')) - { - $values = array(ACL_DENY => $user->lang['DENY'], ACL_ALLOW => $user->lang['ALLOW'], ACL_INHERIT => $user->lang['INHERIT']); + $values = array(ACL_DENY => $user->lang['NO'], ACL_ALLOW => $user->lang['YES'], ACL_INHERIT => $user->lang['UNSET']); - foreach ($values as $value => $option) + foreach ($values as $value => $option) + { + $value_options .= '' . $option . ''; + } + + $forum_options = make_forum_select($dep_forum_id, false, false); + + // Look for custom presets + $sql = "SELECT preset_id, preset_name, preset_data + FROM " . ACL_PRESETS_TABLE . " + WHERE preset_type = '$type_sql' + ORDER BY preset_id ASC"; + $result = $db->sql_query($sql); + + if ($row = $db->sql_fetchrow($result)) + { + do { - $value_options .= '' . $option . ''; - } - } + $preset_update_options .= '' . $row['preset_name'] . ''; + $preset_options .= '' . $row['preset_name'] . ''; - if (isset($_POST['chg_value']) && strstr($_POST['field'], 'values')) - { - $forum_options = make_forum_select(false, false, false); - } - -?> - -