punbb/admin_groups.php
author Dan
Thu, 12 Jul 2007 01:04:01 -0400
changeset 2 a8a21e1c7afa
parent 0 f9ffdbd96607
child 3 c0c445d4a13e
permissions -rw-r--r--
Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
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
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    29
//define('PUN_ROOT', './');
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    30
//require PUN_ROOT.'include/common.php';
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    31
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    32
global $pun_db, $pun_user, $pun_config, $lang_common;
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    33
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    34
require PUN_ROOT.'include/common_admin.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    35
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    36
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    37
if ($pun_user['g_id'] < PUN_ADMIN)
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    38
	message($lang_common['No permission']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    39
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    40
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    41
// Add/edit a group (stage 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    42
if (isset($_POST['add_group']) || isset($_GET['edit_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    43
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    44
	if (isset($_POST['add_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    45
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    46
		$base_group = intval($_POST['base_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    47
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    48
		$result = $pun_db->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());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    49
		$group = $pun_db->fetch_assoc($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    50
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    51
		$mode = 'add';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    52
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    53
	else	// We are editing a group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    54
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    55
		$group_id = intval($_GET['edit_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    56
		if ($group_id < 1)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    57
			message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    58
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    59
		$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());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    60
		if (!$pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    61
			message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    62
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
    63
		$group = $pun_db->fetch_assoc($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    64
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    65
		$mode = 'edit';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    66
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    67
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    68
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    69
	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    70
	$required_fields = array('req_title' => 'Group title');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    71
	$focus_element = array('groups2', 'req_title');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    72
	require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    73
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    74
	generate_admin_menu('groups');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    75
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    76
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    77
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    78
		<h2><span>Group settings</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    79
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    80
			<form id="groups2" method="post" action="admin_groups.php" onsubmit="return process_form(this)">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    81
				<p class="submittop"><input type="submit" name="add_edit_group" value=" Save " /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    82
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    83
					<input type="hidden" name="mode" value="<?php echo $mode ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    84
<?php if ($mode == 'edit'): ?>				<input type="hidden" name="group_id" value="<?php echo $group_id ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    85
<?php endif; ?><?php if ($mode == 'add'): ?>				<input type="hidden" name="base_group" value="<?php echo $base_group ?>" />
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    86
<?php endif; ?>					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    87
						<legend>Setup group options and permissions</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    88
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    89
							<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
    90
							<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    91
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    92
									<th scope="row">Group title</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    93
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    94
										<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
    95
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    96
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    97
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    98
									<th scope="row">User title</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
    99
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   100
										<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
   101
										<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
   102
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   103
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   104
<?php if ($group['g_id'] != PUN_ADMIN): ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   105
									<th scope="row">Read board</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   106
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   107
										<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
   108
										<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
   109
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   110
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   111
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   112
									<th scope="row">Post replies</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   113
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   114
										<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
   115
										<span>Allow users in this group to post replies in topics.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   116
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   117
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   118
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   119
									<th scope="row">Post topics</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   120
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   121
										<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
   122
										<span>Allow users in this group to post new topics.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   123
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   124
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   125
<?php if ($group['g_id'] != PUN_GUEST): ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   126
									<th scope="row">Edit posts</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   127
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   128
										<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
   129
										<span>Allow users in this group to edit their own posts.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   130
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   131
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   132
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   133
									<th scope="row">Delete posts</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   134
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   135
										<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
   136
										<span>Allow users in this group to delete their own posts.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   137
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   138
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   139
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   140
									<th scope="row">Delete topics</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   141
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   142
										<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
   143
										<span>Allow users in this group to delete their own topics (including any replies).</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   144
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   145
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   146
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   147
									<th scope="row">Set user title</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   148
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   149
										<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
   150
										<span>Allow users in this group to set their own user title.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   151
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   152
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   153
<?php endif; ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   154
									<th scope="row">Use search</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   155
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   156
										<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
   157
										<span>Allow users in this group to use the search feature.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   158
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   159
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   160
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   161
									<th scope="row">Search user list</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   162
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   163
										<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
   164
										<span>Allow users in this group to freetext search for users in the user list.</span>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   165
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   166
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   167
<?php if ($group['g_id'] != PUN_GUEST): ?>								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   168
									<th scope="row">Edit subjects interval</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   169
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   170
										<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
   171
										<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
   172
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   173
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   174
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   175
									<th scope="row">Post flood interval</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   176
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   177
										<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
   178
										<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
   179
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   180
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   181
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   182
									<th scope="row">Search flood interval</th>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   183
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   184
										<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
   185
										<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
   186
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   187
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   188
<?php endif; ?><?php endif; ?>							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   189
<?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
   190
<?php endif; ?>						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   191
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   192
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   193
				<p class="submitend"><input type="submit" name="add_edit_group" value=" Save " tabindex="26" /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   194
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   195
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   196
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   197
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   198
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   199
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   200
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   201
	require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   202
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   203
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   204
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   205
// Add/edit a group (stage 2)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   206
else if (isset($_POST['add_edit_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   207
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   208
	confirm_referrer('admin_groups.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   209
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   210
	// Is this the admin group? (special rules apply)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   211
	$is_admin_group = (isset($_POST['group_id']) && $_POST['group_id'] == PUN_ADMIN) ? true : false;
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   212
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   213
	$title = trim($_POST['req_title']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   214
	$user_title = trim($_POST['user_title']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   215
	$read_board = isset($_POST['read_board']) ? intval($_POST['read_board']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   216
	$post_replies = isset($_POST['post_replies']) ? intval($_POST['post_replies']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   217
	$post_topics = isset($_POST['post_topics']) ? intval($_POST['post_topics']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   218
	$edit_posts = isset($_POST['edit_posts']) ? intval($_POST['edit_posts']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   219
	$delete_posts = isset($_POST['delete_posts']) ? intval($_POST['delete_posts']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   220
	$delete_topics = isset($_POST['delete_topics']) ? intval($_POST['delete_topics']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   221
	$set_title = isset($_POST['set_title']) ? intval($_POST['set_title']) : ($is_admin_group) ? '1' : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   222
	$search = isset($_POST['search']) ? intval($_POST['search']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   223
	$search_users = isset($_POST['search_users']) ? intval($_POST['search_users']) : '1';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   224
	$edit_subjects_interval = isset($_POST['edit_subjects_interval']) ? intval($_POST['edit_subjects_interval']) : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   225
	$post_flood = isset($_POST['post_flood']) ? intval($_POST['post_flood']) : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   226
	$search_flood = isset($_POST['search_flood']) ? intval($_POST['search_flood']) : '0';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   227
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   228
	if ($title == '')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   229
		message('You must enter a group title.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   230
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   231
	$user_title = ($user_title != '') ? '\''.$pun_db->escape($user_title).'\'' : 'NULL';
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   232
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   233
	if ($_POST['mode'] == 'add')
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   234
	{
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   235
		$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());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   236
		if ($pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   237
			message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   238
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   239
		$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());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   240
		$new_group_id = $pun_db->insert_id();
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   241
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   242
		// Now lets copy the forum specific permissions from the group which this group is based on
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   243
		$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());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   244
		while ($cur_forum_perm = $pun_db->fetch_assoc($result))
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   245
			$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());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   246
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   247
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   248
	{
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   249
		$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());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   250
		if ($pun_db->num_rows($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   251
			message('There is already a group with the title \''.pun_htmlspecialchars($title).'\'.');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   252
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   253
		$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());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   254
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   255
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   256
	// Regenerate the quickjump cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   257
	require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   258
	generate_quickjump_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   259
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   260
	pun_redirect('admin_groups.php', 'Group '.(($_POST['mode'] == 'edit') ? 'edited' : 'added').'. Redirecting &hellip;');
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   261
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   262
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   263
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   264
// Set default group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   265
else if (isset($_POST['set_default_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   266
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   267
	confirm_referrer('admin_groups.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   268
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   269
	$group_id = intval($_POST['default_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   270
	if ($group_id < 4)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   271
		message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   272
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   273
	$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());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   274
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   275
	// Regenerate the config cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   276
	require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   277
	generate_config_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   278
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   279
	pun_redirect('admin_groups.php', 'Default group set. Redirecting &hellip;');
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   280
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   281
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   282
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   283
// Remove a group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   284
else if (isset($_GET['del_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   285
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   286
	confirm_referrer('admin_groups.php');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   287
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   288
	$group_id = intval($_GET['del_group']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   289
	if ($group_id < 5)
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   290
		message($lang_common['Bad request']);
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   291
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   292
	// Make sure we don't remove the default group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   293
	if ($group_id == $pun_config['o_default_user_group'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   294
		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
   295
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   296
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   297
	// Check if this group has any members
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   298
	$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());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   299
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   300
	// If the group doesn't have any members or if we've already selected a group to move the members to
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   301
	if (!$pun_db->num_rows($result) || isset($_POST['del_group']))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   302
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   303
		if (isset($_POST['del_group']))
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   304
		{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   305
			$move_to_group = intval($_POST['move_to_group']);
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   306
			$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());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   307
		}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   308
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   309
		// Delete the group and any forum specific permissions
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   310
		$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());
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   311
		$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());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   312
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   313
		// Regenerate the quickjump cache
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   314
		require_once PUN_ROOT.'include/cache.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   315
		generate_quickjump_cache();
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   316
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   317
		pun_redirect('admin_groups.php', 'Group removed. Redirecting &hellip;');
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   318
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   319
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   320
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   321
	list($group_title, $group_members) = $pun_db->fetch_row($result);
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   322
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   323
	$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   324
	require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   325
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   326
	generate_admin_menu('groups');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   327
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   328
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   329
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   330
		<h2><span>Remove group</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   331
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   332
			<form id="groups" method="post" action="admin_groups.php?del_group=<?php echo $group_id ?>">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   333
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   334
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   335
						<legend>Move users currently in group</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   336
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   337
							<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
   338
							<label>Move users to
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   339
							<select name="move_to_group">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   340
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   341
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   342
	$result = $pun_db->query('SELECT g_id, g_title FROM '.$pun_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__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   343
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   344
	while ($cur_group = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   345
	{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   346
		if ($cur_group['g_id'] == PUN_MEMBER)	// Pre-select the pre-defined Members group
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   347
			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
   348
		else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   349
			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
   350
	}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   351
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   352
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   353
							</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   354
							</br></label>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   355
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   356
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   357
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   358
				<p><input type="submit" name="del_group" value="Delete group" /></p>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   359
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   360
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   361
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   362
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   363
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   364
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   365
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   366
	require PUN_ROOT.'footer.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   367
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   368
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   369
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   370
$page_title = pun_htmlspecialchars($pun_config['o_board_title']).' / Admin / User groups';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   371
require PUN_ROOT.'header.php';
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   372
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   373
generate_admin_menu('groups');
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   374
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   375
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   376
	<div class="blockform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   377
		<h2><span>Add/setup groups</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   378
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   379
			<form id="groups" method="post" action="admin_groups.php?action=foo">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   380
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   381
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   382
						<legend>Add new group</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   383
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   384
							<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   385
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   386
									<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
   387
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   388
										<select id="base_group" name="base_group" tabindex="1">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   389
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   390
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   391
$result = $pun_db->query('SELECT g_id, g_title FROM '.$pun_db->prefix.'groups WHERE g_id>'.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   392
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   393
while ($cur_group = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   394
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   395
	if ($cur_group['g_id'] == $pun_config['o_default_user_group'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   396
		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
   397
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   398
		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
   399
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   400
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   401
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   402
										</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   403
										<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
   404
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   405
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   406
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   407
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   408
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   409
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   410
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   411
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   412
						<legend>Set default group</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   413
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   414
							<table class="aligntop" cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   415
								<tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   416
									<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
   417
									<td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   418
										<select id="default_group" name="default_group" tabindex="3">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   419
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   420
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   421
$result = $pun_db->query('SELECT g_id, g_title FROM '.$pun_db->prefix.'groups WHERE g_id>'.PUN_GUEST.' ORDER BY g_title') or error('Unable to fetch user group list', __FILE__, __LINE__, $pun_db->error());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   422
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   423
while ($cur_group = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   424
{
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   425
	if ($cur_group['g_id'] == $pun_config['o_default_user_group'])
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   426
		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
   427
	else
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   428
		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
   429
}
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   430
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   431
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   432
										</select>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   433
										<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
   434
									</td>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   435
								</tr>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   436
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   437
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   438
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   439
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   440
			</form>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   441
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   442
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   443
		<h2 class="block2"><span>Existing groups</span></h2>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   444
		<div class="box">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   445
			<div class="fakeform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   446
				<div class="inform">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   447
					<fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   448
						<legend>Edit/remove groups</legend>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   449
						<div class="infldset">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   450
							<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
   451
							<table cellspacing="0">
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   452
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   453
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   454
$result = $pun_db->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());
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   455
2
a8a21e1c7afa Let's just say that the API loads. While a decent part of PunBB works, we've still got a LONG way to go, mainly with form validation and security. At this point, Punano is NOT secure as far as privileges and user levels go.
Dan
parents: 0
diff changeset
   456
while ($cur_group = $pun_db->fetch_assoc($result))
0
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   457
	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
   458
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   459
?>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   460
							</table>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   461
						</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   462
					</fieldset>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   463
				</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   464
			</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   465
		</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   466
	</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   467
	<div class="clearer"></div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   468
</div>
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   469
<?php
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   470
f9ffdbd96607 Initial population
Dan
parents:
diff changeset
   471
require PUN_ROOT.'footer.php';