diff --git a/phpBB/admin/admin_permissions.php b/phpBB/admin/admin_permissions.php index 9d629a4871..a33acca7b2 100644 --- a/phpBB/admin/admin_permissions.php +++ b/phpBB/admin/admin_permissions.php @@ -19,6 +19,13 @@ * ***************************************************************************/ +// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE +// +// Problem appears to exist with super moderators ... +// possibly related to general global issues +// +// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE + if (!empty($setmodules)) { $filename = basename(__FILE__); @@ -59,24 +66,28 @@ switch ($mode) $l_title = $user->lang['PERMISSIONS']; $l_title_explain = $user->lang['PERMISSIONS_EXPLAIN']; $which_acl = 'a_auth'; + $type_sql = 'f'; break; case 'moderators': $l_title = $user->lang['MODERATORS']; $l_title_explain = $user->lang['MODERATORS_EXPLAIN']; $which_acl = 'a_authmods'; + $type_sql = 'm'; break; case 'supermoderators': $l_title = $user->lang['SUPER_MODERATORS']; $l_title_explain = $user->lang['SUPER_MODERATORS_EXPLAIN']; $which_acl = 'a_authmods'; + $type_sql = 'm'; break; case 'administrators': $l_title = $user->lang['ADMINISTRATORS']; $l_title_explain = $user->lang['ADMINISTRATORS_EXPLAIN']; $which_acl = 'a_authadmins'; + $type_sql = 'a'; break; } @@ -141,6 +152,53 @@ else if (isset($_POST['delete'])) trigger_error('Permissions updated successfully'); } +else if (isset($_POST['presetsave'])) +{ + print_r($_POST['option']); + + $holding_ary = array(); + foreach ($_POST['option'] as $acl_option => $allow_deny) + { + switch ($allow_deny) + { + case ACL_ALLOW: + $holding_ary['allow'][] = $acl_option; + break; + case ACL_DENY: + $holding_ary['deny'][] = $acl_option; + break; + case ACL_INHERIT: + $holding_ary['inherit'][] = $acl_option; + break; + } + } + + $sql = array( + 'preset_user_id' => $user->data['user_id'], + 'preset_type' => $type_sql, + 'preset_data' => $db->sql_escape(serialize($holding_ary)) + ); + + if (!empty($_POST['presetname'])) + { + $sql['preset_name'] = $db->sql_escape($_POST['presetname']); + } + + if (!empty($_POST['presetname']) || $_POST['presetoption'] != -1) + { + $sql = ($_POST['presetoption'] == -1) ? 'INSERT INTO ' . ACL_PRESETS_TABLE . ' ' . $db->sql_build_array('INSERT', $sql) : 'UPDATE ' . ACL_PRESETS_TABLE . ' SET ' . $db->sql_build_array('UPDATE', $sql) . ' WHERE preset_id =' . $_POST['presetoption']; + $db->sql_query($sql); + } +} +else if (isset($_POST['presetdel'])) +{ + if (!empty($_POST['presetoption'])) + { + $sql = "DELETE FROM " . ACL_PRESETS_TABLE . " + WHERE preset_id = " . intval($_POST['presetoption']); + $db->sql_query($sql); + } +} // Get required information, either all forums if no id was // specified or just the requsted if it was @@ -174,22 +232,18 @@ if (!empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators' switch ($mode) { case 'forums': - $type_sql = 'f'; $forum_sql = "AND a.forum_id = $forum_id"; break; case 'moderators': - $type_sql = 'm'; $forum_sql = "AND a.forum_id = $forum_id"; break; case 'supermoderators': - $type_sql = 'm'; $forum_sql = ''; break; case 'administrators': - $type_sql = 'a'; $forum_sql = ''; break; } @@ -379,29 +433,61 @@ if (!empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators' } $db->sql_freeresult($result); + // Look for 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); + + $preset_options = $preset_js = ''; + $holding = $preset_ary = array(); + if ($row = $db->sql_fetchrow($result)) + { + do + { + $preset_ary[$row['preset_id']] = $row['preset_name']; + + $preset_options .= ''; + + $preset_data = unserialize($row['preset_data']); + + foreach ($preset_data as $preset_type => $preset_type_ary) + { + $holding[$preset_type] = ''; + foreach ($preset_type_ary as $preset_option) + { + $holding[$preset_type] .= "$preset_option, "; + } + } + + $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new Array();" . "\n"; + $preset_js .= "\tpresets['preset_" . $row['preset_id'] . "'] = new preset_obj('" . $holding['allow'] . "', '" . $holding['deny'] . "', '" . $holding['inherit'] . "');\n"; + } + while ($row = $db->sql_fetchrow($result)); + } + unset($holding); + ?>
lang['ACL_EXPLAIN']; ?>
-