diff -r e3d7322305bf -r 5e1f1e916419 punbb/admin_groups.php --- a/punbb/admin_groups.php Sun Sep 02 11:00:57 2007 -0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,471 +0,0 @@ -query('SELECT * FROM '.$pun_db->prefix.'groups WHERE g_id='.$base_group) or error('Unable to fetch user group info', __FILE__, __LINE__, $pun_db->error()); - $group = $pun_db->fetch_assoc($result); - - $mode = 'add'; - } - else // We are editing a group - { - $group_id = intval($_GET['edit_group']); - if ($group_id < 1) - message($lang_common['Bad request']); - - $result = $pun_db->query('SELECT * FROM '.$pun_db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch user group info', __FILE__, __LINE__, $pun_db->error()); - if (!$pun_db->num_rows($result)) - message($lang_common['Bad request']); - - $group = $pun_db->fetch_assoc($result); - - $mode = 'edit'; - } - - - $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups'; - $required_fields = array('req_title' => 'Group title'); - $focus_element = array('groups2', 'req_title'); - require PUN_ROOT.'header.php'; - - generate_admin_menu('groups'); - -?> -
-

Group settings

-
-
-

-
- - - -
- Setup group options and permissions -
-

Below options and permissions are the default permissions for the user group. These options apply if no forum specific permissions are in effect.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Group title - -
User title - - This title will override any rank users in this group have attained. Leave blank to use default title or rank. -
Read board - tabindex="3" /> Yes    tabindex="4" /> No - Allow users in this group to view the board. This setting applies to every aspect of the board and can therefore not be overridden by forum specific settings. If this is set to "No", users in this group will only be able to login/logout and register. -
Post replies - tabindex="5" /> Yes    tabindex="6" /> No - Allow users in this group to post replies in topics. -
Post topics - tabindex="7" /> Yes    tabindex="8" /> No - Allow users in this group to post new topics. -
Edit posts - tabindex="11" /> Yes    tabindex="12" /> No - Allow users in this group to edit their own posts. -
Delete posts - tabindex="13" /> Yes    tabindex="14" /> No - Allow users in this group to delete their own posts. -
Delete topics - tabindex="15" /> Yes    tabindex="16" /> No - Allow users in this group to delete their own topics (including any replies). -
Set user title - tabindex="17" /> Yes    tabindex="18" /> No - Allow users in this group to set their own user title. -
Use search - tabindex="19" /> Yes    tabindex="20" /> No - Allow users in this group to use the search feature. -
Search user list - tabindex="21" /> Yes    tabindex="22" /> No - Allow users in this group to freetext search for users in the user list. -
Edit subjects interval - - Number of seconds after post time that users in this group may edit the subject of topics they've posted. Set to 0 to allow edits indefinitely. -
Post flood interval - - Number of seconds that users in this group have to wait between posts. Set to 0 to disable. -
Search flood interval - - Number of seconds that users in this group have to wait between searches. Set to 0 to disable. -
-

Please note that in order for a user in this group to have moderator abilities, he/she must be assigned to moderate one or more forums. This is done via the user administration page of the user's profile.

-
-
-
-

-
-
-
-
- -escape($user_title).'\'' : 'NULL'; - - if ($_POST['mode'] == 'add') - { - $result = $pun_db->query('SELECT 1 FROM '.$pun_db->prefix.'groups WHERE g_title=\''.$pun_db->escape($title).'\'') or error('Unable to check group title collision', __FILE__, __LINE__, $pun_db->error()); - if ($pun_db->num_rows($result)) - message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.'); - - $pun_db->query('INSERT INTO '.$pun_db->prefix.'groups (g_title, g_user_title, g_read_board, g_post_replies, g_post_topics, g_edit_posts, g_delete_posts, g_delete_topics, g_set_title, g_search, g_search_users, g_edit_subjects_interval, g_post_flood, g_search_flood) VALUES(\''.$pun_db->escape($title).'\', '.$user_title.', '.$read_board.', '.$post_replies.', '.$post_topics.', '.$edit_posts.', '.$delete_posts.', '.$delete_topics.', '.$set_title.', '.$search.', '.$search_users.', '.$edit_subjects_interval.', '.$post_flood.', '.$search_flood.')') or error('Unable to add group', __FILE__, __LINE__, $pun_db->error()); - $new_group_id = $pun_db->insert_id(); - - // Now lets copy the forum specific permissions from the group which this group is based on - $result = $pun_db->query('SELECT forum_id, read_forum, post_replies, post_topics FROM '.$pun_db->prefix.'forum_perms WHERE group_id='.intval($_POST['base_group'])) or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $pun_db->error()); - while ($cur_forum_perm = $pun_db->fetch_assoc($result)) - $pun_db->query('INSERT INTO '.$pun_db->prefix.'forum_perms (group_id, forum_id, read_forum, post_replies, post_topics) VALUES('.$new_group_id.', '.$cur_forum_perm['forum_id'].', '.$cur_forum_perm['read_forum'].', '.$cur_forum_perm['post_replies'].', '.$cur_forum_perm['post_topics'].')') or error('Unable to insert group forum permissions', __FILE__, __LINE__, $pun_db->error()); - } - else - { - $result = $pun_db->query('SELECT 1 FROM '.$pun_db->prefix.'groups WHERE g_title=\''.$pun_db->escape($title).'\' AND g_id!='.intval($_POST['group_id'])) or error('Unable to check group title collision', __FILE__, __LINE__, $pun_db->error()); - if ($pun_db->num_rows($result)) - message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.'); - - $pun_db->query('UPDATE '.$pun_db->prefix.'groups SET g_title=\''.$pun_db->escape($title).'\', g_user_title='.$user_title.', g_read_board='.$read_board.', g_post_replies='.$post_replies.', g_post_topics='.$post_topics.', g_edit_posts='.$edit_posts.', g_delete_posts='.$delete_posts.', g_delete_topics='.$delete_topics.', g_set_title='.$set_title.', g_search='.$search.', g_search_users='.$search_users.', g_edit_subjects_interval='.$edit_subjects_interval.', g_post_flood='.$post_flood.', g_search_flood='.$search_flood.' WHERE g_id='.intval($_POST['group_id'])) or error('Unable to update group', __FILE__, __LINE__, $pun_db->error()); - } - - // Regenerate the quickjump cache - require_once PUN_ROOT.'include/cache.php'; - generate_quickjump_cache(); - - pun_redirect('admin_groups.php', 'Group '.(($_POST['mode'] == 'edit') ? 'edited' : 'added').'. Redirecting …'); -} - - -// Set default group -else if (isset($_POST['set_default_group'])) -{ - confirm_referrer('admin_groups.php'); - - $group_id = intval($_POST['default_group']); - if ($group_id < 4) - message($lang_common['Bad request']); - - $pun_db->query('UPDATE '.$pun_db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Unable to update board config', __FILE__, __LINE__, $pun_db->error()); - - // Regenerate the config cache - require_once PUN_ROOT.'include/cache.php'; - generate_config_cache(); - - pun_redirect('admin_groups.php', 'Default group set. Redirecting …'); -} - - -// Remove a group -else if (isset($_GET['del_group'])) -{ - confirm_referrer('admin_groups.php'); - - $group_id = intval($_GET['del_group']); - if ($group_id < 5) - message($lang_common['Bad request']); - - // Make sure we don't remove the default group - if ($group_id == $pun_config['o_default_user_group']) - message('The default group cannot be removed. In order to delete this group, you must first setup a different group as the default.'); - - - // Check if this group has any members - $result = $pun_db->query('SELECT g.g_title, COUNT(u.id) FROM '.$pun_db->prefix.'groups AS g INNER JOIN '.$pun_db->prefix.'users AS u ON g.g_id=u.group_id WHERE g.g_id='.$group_id.' GROUP BY g.g_id, g_title') or error('Unable to fetch group info', __FILE__, __LINE__, $pun_db->error()); - - // If the group doesn't have any members or if we've already selected a group to move the members to - if (!$pun_db->num_rows($result) || isset($_POST['del_group'])) - { - if (isset($_POST['del_group'])) - { - $move_to_group = intval($_POST['move_to_group']); - $pun_db->query('UPDATE '.$pun_db->prefix.'users SET group_id='.$move_to_group.' WHERE group_id='.$group_id) or error('Unable to move users into group', __FILE__, __LINE__, $pun_db->error()); - } - - // Delete the group and any forum specific permissions - $pun_db->query('DELETE FROM '.$pun_db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $pun_db->error()); - $pun_db->query('DELETE FROM '.$pun_db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $pun_db->error()); - - // Regenerate the quickjump cache - require_once PUN_ROOT.'include/cache.php'; - generate_quickjump_cache(); - - pun_redirect('admin_groups.php', 'Group removed. Redirecting …'); - } - - - list($group_title, $group_members) = $pun_db->fetch_row($result); - - $page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups'; - require PUN_ROOT.'header.php'; - - generate_admin_menu('groups'); - -?> -
-

Remove group

-
-
-
-
- Move users currently in group -
-

The group "" currently has members. Please select a group to which these members will be assigned upon removal.

- -
-
-
-

-
-
-
-
- - -
-

Add/setup groups

-
-
-
-
- Add new group -
- - - - - -
Base new group on
- - Select a user group from which the new group will inherit it's permission settings. The next page will let you fine-tune said settings. -
-
-
-
-
-
- Set default group -
- - - - - -
Default group
- - This is the default user group, e.g. the group users are placed in when they register. For security reasons, users can't be placed in either the moderator or administrator user groups by default. -
-
-
-
-
-
- -

Existing groups

-
-
-
-
- Edit/remove groups -
-

The pre-defined groups Guests, Administrators, Moderators and Members cannot be removed. They can however be edited. Please note though, that in some groups, some options are unavailable (e.g. the edit posts permission for guests). Administrators always have full permissions.

- -query('SELECT g_id, g_title FROM '.$pun_db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $pun_db->error()); - -while ($cur_group = $pun_db->fetch_assoc($result)) - echo "\t\t\t\t\t\t\t\t".''."\n"; - -?> -
Edit'.(($cur_group['g_id'] > PUN_MEMBER) ? ' - Remove' : '').''.pun_htmlspecialchars($cur_group['g_title']).'
-
-
-
-
-
-
-
- -