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']; ?>

-
"> +">
- + -
Quick settings: Quick settings:
+ diff --git a/phpBB/install/schemas/mysql_basic.sql b/phpBB/install/schemas/mysql_basic.sql index 2e471522f1..21b18ae5f1 100644 --- a/phpBB/install/schemas/mysql_basic.sql +++ b/phpBB/install/schemas/mysql_basic.sql @@ -116,6 +116,7 @@ INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_rate', 1); INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_print', 1); INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_ignoreflood', 1); INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_ignorequeue', 1); +INSERT INTO phpbb_auth_options (auth_value, is_local) VALUES ('f_viewonline', 1); INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_', 1, 1); INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_edit', 1, 1); @@ -127,6 +128,7 @@ INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_merg INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_approve', 1, 1); INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_unrate', 1, 1); INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_auth', 1, 1); +INSERT INTO phpbb_auth_options (auth_value, is_local, is_global) VALUES ('m_ip', 1, 1); INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_', 1); INSERT INTO phpbb_auth_options (auth_value, is_global) VALUES ('a_server', 1); diff --git a/phpBB/install/schemas/mysql_schema.sql b/phpBB/install/schemas/mysql_schema.sql index d0bbb77ca6..44768c5ae2 100644 --- a/phpBB/install/schemas/mysql_schema.sql +++ b/phpBB/install/schemas/mysql_schema.sql @@ -34,6 +34,7 @@ CREATE TABLE phpbb_auth_groups ( ); +# -------------------------------------------------------- # # Table structure for table `phpbb_auth_options` # @@ -48,6 +49,21 @@ CREATE TABLE phpbb_auth_options ( ); +# -------------------------------------------------------- +# +# Table structure for table phpbb_auth_presets +# +CREATE TABLE phpbb_auth_presets ( + preset_id tinyint(4) NOT NULL auto_increment, + preset_name varchar(50) NOT NULL, + preset_user_id mediumint(5) UNSIGNED NOT NULL, + preset_type varchar(2) NOT NULL, + preset_data text, + PRIMARY KEY (preset_id), + KEY preset_type (preset_type) +); + + # -------------------------------------------------------- # # Table structure for table `phpbb_auth_users`
@@ -465,9 +561,20 @@ if (!empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators' $l_can_cell = (!empty($user->lang['acl_' . $auth_options[$i]['auth_value']])) ? $user->lang['acl_' . $auth_options[$i]['auth_value']] : ucfirst(preg_replace('#.*?_#', '', $auth_options[$i]['auth_value'])); - $allow_type = ($auth[$auth_options[$i]['auth_value']] == ACL_ALLOW) ? ' checked="checked"' : ''; - $deny_type = ($auth[$auth_options[$i]['auth_value']] == ACL_DENY) ? ' checked="checked"' : ''; - $inherit_type = ($auth[$auth_options[$i]['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : ''; + if (!empty($_POST['presetsave']) || !empty($_POST['presetdel'])) + { + $allow_type = ($_POST['option'][$auth_options[$i]['auth_value']] == ACL_ALLOW) ? ' checked="checked"' : ''; + + $deny_type = ($_POST['option'][$auth_options[$i]['auth_value']] == ACL_DENY) ? ' checked="checked"' : ''; + + $inherit_type = ($_POST['option'][$auth_options[$i]['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : ''; + } + else + { + $allow_type = ($auth[$auth_options[$i]['auth_value']] == ACL_ALLOW) ? ' checked="checked"' : ''; + $deny_type = ($auth[$auth_options[$i]['auth_value']] == ACL_DENY) ? ' checked="checked"' : ''; + $inherit_type = ($auth[$auth_options[$i]['auth_value']] == ACL_INHERIT) ? ' checked="checked"' : ''; + } ?> @@ -520,7 +627,42 @@ if (!empty($forum_id) || $mode == 'administrators' || $mode == 'supermoderators' ?> - + + + + + + + + +
 lang['Option']; ?>   lang['Allow']; ?> 
    
lang['PRESETS']; ?>
+ + + + + + + + + + + +
lang['PRESETS_EXPLAIN']; ?>
lang['SELECT_PRESET']; ?>:
lang['PRESET_NAME']; ?>: