punbb/admin_groups.php
author Dan
Wed, 11 Jul 2007 21:01:48 -0400
changeset 0 f9ffdbd96607
child 2 a8a21e1c7afa
permissions -rw-r--r--
Initial population
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     1
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     2
/***********************************************************************
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     3
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     4
  Copyright (C) 2002-2005  Rickard Andersson (rickard@punbb.org)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     5
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     6
  This file is part of PunBB.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     7
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     8
  PunBB is free software; you can redistribute it and/or modify it
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
     9
  under the terms of the GNU General Public License as published
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    10
  by the Free Software Foundation; either version 2 of the License,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    11
  or (at your option) any later version.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    12
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    13
  PunBB is distributed in the hope that it will be useful, but
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    14
  WITHOUT ANY WARRANTY; without even the implied warranty of
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    15
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    16
  GNU General Public License for more details.
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    17
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    18
  You should have received a copy of the GNU General Public License
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    19
  along with this program; if not, write to the Free Software
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    20
  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    21
  MA  02111-1307  USA
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    22
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    23
************************************************************************/
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    24
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    25
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    26
// Tell header.php to use the admin template
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    27
define('PUN_ADMIN_CONSOLE', 1);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    28
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    29
define('PUN_ROOT', './');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    30
require PUN_ROOT.'include/common.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    31
require PUN_ROOT.'include/common_admin.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    32
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    33
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
if ($pun_user['g_id'] > PUN_ADMIN)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
	message($lang_common['No permission']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    37
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
// Add/edit a group (stage 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
if (isset($_POST['add_group']) || isset($_GET['edit_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
	if (isset($_POST['add_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
		$base_group = intval($_POST['base_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
		$result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$base_group) or error('Unable to fetch user group info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
		$group = $db->fetch_assoc($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    48
		$mode = 'add';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    49
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
	else	// We are editing a group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
		$group_id = intval($_GET['edit_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
		if ($group_id < 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
			message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
		$result = $db->query('SELECT * FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to fetch user group info', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
		if (!$db->num_rows($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
			message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    59
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    60
		$group = $db->fetch_assoc($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
		$mode = 'edit';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    63
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
	$required_fields = array('req_title' => 'Group title');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
	$focus_element = array('groups2', 'req_title');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
	require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
	generate_admin_menu('groups');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
		<h2><span>Group settings</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
			<form id="groups2" method="post" action="admin_groups.php" onsubmit="return process_form(this)">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
				<p class="submittop"><input type="submit" name="add_edit_group" value=" Save " /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
					<input type="hidden" name="mode" value="<?php echo $mode ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
<?php if ($mode == 'edit'): ?>				<input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
<?php endif; ?><?php if ($mode == 'add'): ?>				<input type="hidden" name="base_group" value="<?php echo $base_group ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
<?php endif; ?>					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
						<legend>Setup group options and permissions</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
							<p>Below options and permissions are the default permissions for the user group. These options apply if no forum specific permissions are in effect.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
							<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
									<th scope="row">Group title</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    90
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
										<input type="text" name="req_title" size="25" maxlength="50" value="<?php if ($mode == 'edit') echo pun_htmlspecialchars($group['g_title']); ?>" tabindex="1" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    95
									<th scope="row">User title</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
										<input type="text" name="user_title" size="25" maxlength="50" value="<?php echo pun_htmlspecialchars($group['g_user_title']) ?>" tabindex="2" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
										<span>This title will override any rank users in this group have attained. Leave blank to use default title or rank.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   101
<?php if ($group['g_id'] != PUN_ADMIN): ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   102
									<th scope="row">Read board</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
										<input type="radio" name="read_board" value="1"<?php if ($group['g_read_board'] == '1') echo ' checked="checked"' ?> tabindex="3" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="read_board" value="0"<?php if ($group['g_read_board'] == '0') echo ' checked="checked"' ?> tabindex="4" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
										<span>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.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   108
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   109
									<th scope="row">Post replies</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
										<input type="radio" name="post_replies" value="1"<?php if ($group['g_post_replies'] == '1') echo ' checked="checked"' ?> tabindex="5" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="post_replies" value="0"<?php if ($group['g_post_replies'] == '0') echo ' checked="checked"' ?> tabindex="6" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
										<span>Allow users in this group to post replies in topics.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   115
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
									<th scope="row">Post topics</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
										<input type="radio" name="post_topics" value="1"<?php if ($group['g_post_topics'] == '1') echo ' checked="checked"' ?> tabindex="7" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="post_topics" value="0"<?php if ($group['g_post_topics'] == '0') echo ' checked="checked"' ?> tabindex="8" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
										<span>Allow users in this group to post new topics.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   122
<?php if ($group['g_id'] != PUN_GUEST): ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
									<th scope="row">Edit posts</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
										<input type="radio" name="edit_posts" value="1"<?php if ($group['g_edit_posts'] == '1') echo ' checked="checked"' ?> tabindex="11" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="edit_posts" value="0"<?php if ($group['g_edit_posts'] == '0') echo ' checked="checked"' ?> tabindex="12" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
										<span>Allow users in this group to edit their own posts.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   129
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
									<th scope="row">Delete posts</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
										<input type="radio" name="delete_posts" value="1"<?php if ($group['g_delete_posts'] == '1') echo ' checked="checked"' ?> tabindex="13" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="delete_posts" value="0"<?php if ($group['g_delete_posts'] == '0') echo ' checked="checked"' ?> tabindex="14" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
										<span>Allow users in this group to delete their own posts.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   136
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
									<th scope="row">Delete topics</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
										<input type="radio" name="delete_topics" value="1"<?php if ($group['g_delete_topics'] == '1') echo ' checked="checked"' ?> tabindex="15" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="delete_topics" value="0"<?php if ($group['g_delete_topics'] == '0') echo ' checked="checked"' ?> tabindex="16" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
										<span>Allow users in this group to delete their own topics (including any replies).</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   143
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
									<th scope="row">Set user title</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
										<input type="radio" name="set_title" value="1"<?php if ($group['g_set_title'] == '1') echo ' checked="checked"' ?> tabindex="17" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="set_title" value="0"<?php if ($group['g_set_title'] == '0') echo ' checked="checked"' ?> tabindex="18" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
										<span>Allow users in this group to set their own user title.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   150
<?php endif; ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
									<th scope="row">Use search</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
										<input type="radio" name="search" value="1"<?php if ($group['g_search'] == '1') echo ' checked="checked"' ?> tabindex="19" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="search" value="0"<?php if ($group['g_search'] == '0') echo ' checked="checked"' ?> tabindex="20" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
										<span>Allow users in this group to use the search feature.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   157
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
									<th scope="row">Search user list</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
										<input type="radio" name="search_users" value="1"<?php if ($group['g_search_users'] == '1') echo ' checked="checked"' ?> tabindex="21" />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="search_users" value="0"<?php if ($group['g_search_users'] == '0') echo ' checked="checked"' ?> tabindex="22" />&nbsp;<strong>No</strong>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
										<span>Allow users in this group to freetext search for users in the user list.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   164
<?php if ($group['g_id'] != PUN_GUEST): ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
									<th scope="row">Edit subjects interval</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
										<input type="text" name="edit_subjects_interval" size="5" maxlength="5" value="<?php echo $group['g_edit_subjects_interval'] ?>" tabindex="23" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
										<span>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.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   171
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   172
									<th scope="row">Post flood interval</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
										<input type="text" name="post_flood" size="5" maxlength="4" value="<?php echo $group['g_post_flood'] ?>" tabindex="24" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
										<span>Number of seconds that users in this group have to wait between posts. Set to 0 to disable.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   178
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   179
									<th scope="row">Search flood interval</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
										<input type="text" name="search_flood" size="5" maxlength="4" value="<?php echo $group['g_search_flood'] ?>" tabindex="25" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
										<span>Number of seconds that users in this group have to wait between searches. Set to 0 to disable.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   185
<?php endif; ?><?php endif; ?>							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   186
<?php if ($group['g_id'] == PUN_MOD ): ?>							<p class="warntext">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.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
<?php endif; ?>						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   190
				<p class="submitend"><input type="submit" name="add_edit_group" value=" Save " tabindex="26" /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
	require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
// Add/edit a group (stage 2)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
else if (isset($_POST['add_edit_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
	confirm_referrer('admin_groups.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
	// Is this the admin group? (special rules apply)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
	$is_admin_group = (isset($_POST['group_id']) && $_POST['group_id'] == PUN_ADMIN) ? true : false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
	$title = trim($_POST['req_title']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
	$user_title = trim($_POST['user_title']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
	$read_board = isset($_POST['read_board']) ? intval($_POST['read_board']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
	$post_replies = isset($_POST['post_replies']) ? intval($_POST['post_replies']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
	$post_topics = isset($_POST['post_topics']) ? intval($_POST['post_topics']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
	$edit_posts = isset($_POST['edit_posts']) ? intval($_POST['edit_posts']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
	$delete_posts = isset($_POST['delete_posts']) ? intval($_POST['delete_posts']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
	$delete_topics = isset($_POST['delete_topics']) ? intval($_POST['delete_topics']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
	$set_title = isset($_POST['set_title']) ? intval($_POST['set_title']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
	$search = isset($_POST['search']) ? intval($_POST['search']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
	$search_users = isset($_POST['search_users']) ? intval($_POST['search_users']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
	$edit_subjects_interval = isset($_POST['edit_subjects_interval']) ? intval($_POST['edit_subjects_interval']) : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
	$post_flood = isset($_POST['post_flood']) ? intval($_POST['post_flood']) : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
	$search_flood = isset($_POST['search_flood']) ? intval($_POST['search_flood']) : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
	if ($title == '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
		message('You must enter a group title.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
	$user_title = ($user_title != '') ? '\''.$db->escape($user_title).'\'' : 'NULL';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
	if ($_POST['mode'] == 'add')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   231
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
		$result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\'') or error('Unable to check group title collision', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
		if ($db->num_rows($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
			message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   235
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   236
		$db->query('INSERT INTO '.$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(\''.$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__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
		$new_group_id = $db->insert_id();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   239
		// Now lets copy the forum specific permissions from the group which this group is based on
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   240
		$result = $db->query('SELECT forum_id, read_forum, post_replies, post_topics FROM '.$db->prefix.'forum_perms WHERE group_id='.intval($_POST['base_group'])) or error('Unable to fetch group forum permission list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
		while ($cur_forum_perm = $db->fetch_assoc($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
			$db->query('INSERT INTO '.$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__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   243
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   244
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   245
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
		$result = $db->query('SELECT 1 FROM '.$db->prefix.'groups WHERE g_title=\''.$db->escape($title).'\' AND g_id!='.intval($_POST['group_id'])) or error('Unable to check group title collision', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
		if ($db->num_rows($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
			message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   249
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   250
		$db->query('UPDATE '.$db->prefix.'groups SET g_title=\''.$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__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   253
	// Regenerate the quickjump cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
	require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
	generate_quickjump_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
	redirect('admin_groups.php', 'Group '.(($_POST['mode'] == 'edit') ? 'edited' : 'added').'. Redirecting &hellip;');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   260
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   261
// Set default group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   262
else if (isset($_POST['set_default_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   263
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   264
	confirm_referrer('admin_groups.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   265
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   266
	$group_id = intval($_POST['default_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   267
	if ($group_id < 4)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   268
		message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   269
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   270
	$db->query('UPDATE '.$db->prefix.'config SET conf_value='.$group_id.' WHERE conf_name=\'o_default_user_group\'') or error('Unable to update board config', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   271
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   272
	// Regenerate the config cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   273
	require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   274
	generate_config_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   275
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   276
	redirect('admin_groups.php', 'Default group set. Redirecting &hellip;');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   277
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   278
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   279
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   280
// Remove a group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   281
else if (isset($_GET['del_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   282
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   283
	confirm_referrer('admin_groups.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   284
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   285
	$group_id = intval($_GET['del_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   286
	if ($group_id < 5)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   287
		message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   288
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   289
	// Make sure we don't remove the default group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   290
	if ($group_id == $pun_config['o_default_user_group'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   291
		message('The default group cannot be removed. In order to delete this group, you must first setup a different group as the default.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   292
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   293
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   294
	// Check if this group has any members
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   295
	$result = $db->query('SELECT g.g_title, COUNT(u.id) FROM '.$db->prefix.'groups AS g INNER JOIN '.$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__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   296
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   297
	// If the group doesn't have any members or if we've already selected a group to move the members to
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   298
	if (!$db->num_rows($result) || isset($_POST['del_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   299
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   300
		if (isset($_POST['del_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   301
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   302
			$move_to_group = intval($_POST['move_to_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   303
			$db->query('UPDATE '.$db->prefix.'users SET group_id='.$move_to_group.' WHERE group_id='.$group_id) or error('Unable to move users into group', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   304
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   305
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   306
		// Delete the group and any forum specific permissions
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   307
		$db->query('DELETE FROM '.$db->prefix.'groups WHERE g_id='.$group_id) or error('Unable to delete group', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   308
		$db->query('DELETE FROM '.$db->prefix.'forum_perms WHERE group_id='.$group_id) or error('Unable to delete group forum permissions', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   309
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   310
		// Regenerate the quickjump cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   311
		require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   312
		generate_quickjump_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   313
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   314
		redirect('admin_groups.php', 'Group removed. Redirecting &hellip;');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   315
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   316
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   317
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   318
	list($group_title, $group_members) = $db->fetch_row($result);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   319
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   320
	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   321
	require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   322
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   323
	generate_admin_menu('groups');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   324
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   325
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   326
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   327
		<h2><span>Remove group</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   328
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   329
			<form id="groups" method="post" action="admin_groups.php?del_group=<?php echo $group_id ?>">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   330
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   331
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   332
						<legend>Move users currently in group</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   333
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   334
							<p>The group "<?php echo pun_htmlspecialchars($group_title) ?>" currently has <?php echo $group_members ?> members. Please select a group to which these members will be assigned upon removal.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   335
							<label>Move users to
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   336
							<select name="move_to_group">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   337
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   338
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   339
	$result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id!='.PUN_GUEST.' AND g_id!='.$group_id.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   340
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   341
	while ($cur_group = $db->fetch_assoc($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   342
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   343
		if ($cur_group['g_id'] == PUN_MEMBER)	// Pre-select the pre-defined Members group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   344
			echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   345
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   346
			echo "\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   347
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   348
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   349
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   350
							</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   351
							</br></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   352
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   353
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   354
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   355
				<p><input type="submit" name="del_group" value="Delete group" /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   356
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   357
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   358
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   359
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   360
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   361
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   362
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   363
	require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   364
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   365
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   366
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   367
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   368
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   369
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   370
generate_admin_menu('groups');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   371
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   372
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   373
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   374
		<h2><span>Add/setup groups</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   375
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   376
			<form id="groups" method="post" action="admin_groups.php?action=foo">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   377
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   378
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   379
						<legend>Add new group</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   380
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   381
							<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   382
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   383
									<th scope="row">Base new group on<div><input type="submit" name="add_group" value=" Add " tabindex="2" /></div></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   384
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   385
										<select id="base_group" name="base_group" tabindex="1">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   386
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   387
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   388
$result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id>'.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   389
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   390
while ($cur_group = $db->fetch_assoc($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   391
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   392
	if ($cur_group['g_id'] == $pun_config['o_default_user_group'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   393
		echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   394
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   395
		echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   396
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   397
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   398
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   399
										</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   400
										<span>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.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   401
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   402
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   403
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   404
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   405
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   406
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   407
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   408
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   409
						<legend>Set default group</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   410
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   411
							<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   412
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   413
									<th scope="row">Default group<div><input type="submit" name="set_default_group" value=" Save " tabindex="4" /></div></th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   414
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   415
										<select id="default_group" name="default_group" tabindex="3">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   416
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   417
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   418
$result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups WHERE g_id>'.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   419
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   420
while ($cur_group = $db->fetch_assoc($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   421
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   422
	if ($cur_group['g_id'] == $pun_config['o_default_user_group'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   423
		echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'" selected="selected">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   424
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   425
		echo "\t\t\t\t\t\t\t\t\t\t\t".'<option value="'.$cur_group['g_id'].'">'.pun_htmlspecialchars($cur_group['g_title']).'</option>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   426
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   427
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   428
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   429
										</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   430
										<span>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.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   431
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   432
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   433
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   434
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   435
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   436
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   437
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   438
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   439
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   440
		<h2 class="block2"><span>Existing groups</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   441
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   442
			<div class="fakeform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   443
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   444
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   445
						<legend>Edit/remove groups</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   446
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   447
							<p>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 <em>edit posts</em> permission for guests). Administrators always have full permissions.</p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   448
							<table cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   449
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   450
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   451
$result = $db->query('SELECT g_id, g_title FROM '.$db->prefix.'groups ORDER BY g_id') or error('Unable to fetch user group list', __FILE__, __LINE__, $db->error());
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   452
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   453
while ($cur_group = $db->fetch_assoc($result))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   454
	echo "\t\t\t\t\t\t\t\t".'<tr><th scope="row"><a href="admin_groups.php?edit_group='.$cur_group['g_id'].'">Edit</a>'.(($cur_group['g_id'] > PUN_MEMBER) ? ' - <a href="admin_groups.php?del_group='.$cur_group['g_id'].'">Remove</a>' : '').'</th><td>'.pun_htmlspecialchars($cur_group['g_title']).'</td></tr>'."\n";
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   455
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   456
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   457
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   458
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   459
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   460
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   461
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   462
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   463
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   464
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   465
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   466
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   467
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   468
require PUN_ROOT.'footer.php';