Small update
[iDB.git] / inc / admin / groups.php
blob92c434ff19cfc583476d79c758b6674da7637c5e
1 <?php
2 /*
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2019 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2019 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
14 $FileInfo: groups.php - Last Update: 08/02/2019 SVN 905 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="groups.php"||$File3Name=="/groups.php") {
18 require('index.php');
19 exit(); }
21 // Check if we can goto admin cp
22 if($_SESSION['UserGroup']==$Settings['GuestGroup']||$GroupInfo['HasAdminCP']=="no") {
23 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
24 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
25 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
26 if(!isset($_POST['update'])) { $_POST['update'] = null; }
27 $Error = null; $errorstr = null;
29 <table class="Table3">
30 <tr style="width: 100%; vertical-align: top;">
31 <td style="width: 15%; vertical-align: top;">
32 <?php
33 require($SettDir['admin'].'table.php');
35 </td>
36 <td style="width: 85%; vertical-align: top;">
37 <?php if($_GET['act']=="addgroup"&&$_POST['update']!="now") {
38 $admincptitle = " ".$ThemeSet['TitleDivider']." Adding new Group";
40 <div class="TableMenuBorder">
41 <?php if($ThemeSet['TableStyle']=="div") { ?>
42 <div class="TableMenuRow1">
43 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
44 <?php } ?>
45 <table class="TableMenu" style="width: 100%;">
46 <?php if($ThemeSet['TableStyle']=="table") { ?>
47 <tr class="TableMenuRow1">
48 <td class="TableMenuColumn1"><span style="float: left;">
49 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
50 </span><span style="float: right;">&nbsp;</span></td>
51 </tr><?php } ?>
52 <tr class="TableMenuRow2">
53 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
54 <span style="float: left;">&nbsp;Adding new Group: </span>
55 <span style="float: right;">&nbsp;</span>
56 </th>
57 </tr>
58 <tr class="TableMenuRow3">
59 <td class="TableMenuColumn3">
60 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
61 <table style="text-align: left;">
62 <tr style="text-align: left;">
63 <td style="width: 50%;"><label class="TextBoxLabel" for="GroupName">Insert name for group:</label></td>
64 <td style="width: 50%;"><input type="text" name="GroupName" class="TextBox" id="GroupName" size="20" /></td>
65 </tr><tr style="text-align: left;">
66 <td style="width: 50%;"><label class="TextBoxLabel" for="GroupPerm">Copy Permissions from:</label></td>
67 <td style="width: 50%;"><select size="1" class="TextBox" name="GroupPerm" id="GroupPerm">
68 <option selected="selected" value="0">none</option>
69 <?php
70 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
71 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
72 $Settings['sqltype']=="sqlite3") {
73 $getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
74 if($Settings['sqltype']=="cubrid") {
75 $getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
76 $getperidr=sql_query($getperidq,$SQLStat);
77 $getperidnum=sql_num_rows($getperidr);
78 $getperidi = 0;
79 while ($getperidi < $getperidnum) {
80 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
81 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
82 $Settings['sqltype']=="sqlite3") {
83 $getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
84 if($Settings['sqltype']=="sqlite") {
85 $getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
86 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i ORDER BY \"ForumID\" ASC", array($getperidID));
87 $getperidr2=sql_query($getperidq2,$SQLStat);
88 $getperidnum2=sql_num_rows($getperidr2);
89 $getperidName=sql_result($getperidr2,0,"Name");
90 sql_free_result($getperidr2);
92 <option value="<?php echo $getperidID; ?>"><?php echo $getperidName; ?></option>
93 <?php ++$getperidi; }
94 sql_free_result($getperidr); ?>
95 </select></td>
96 </tr><tr style="text-align: left;">
97 <td style="width: 50%;"><label class="TextBoxLabel" for="PermissionID">Permission ID:</label></td>
98 <td style="width: 50%;"><input type="number" name="PermissionID" class="TextBox" id="PermissionID" size="20" /></td>
99 </tr><tr style="text-align: left;">
100 <td style="width: 50%;"><label class="TextBoxLabel" for="NamePrefix">Name Prefix:</label></td>
101 <td style="width: 50%;"><input type="text" name="NamePrefix" class="TextBox" id="NamePrefix" size="20" /></td>
102 </tr><tr style="text-align: left;">
103 <td style="width: 50%;"><label class="TextBoxLabel" for="NameSuffix">Name Subfix:</label></td>
104 <td style="width: 50%;"><input type="text" name="NameSuffix" class="TextBox" id="NameSuffix" size="20" /></td>
105 </tr><tr style="text-align: left;">
106 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewBoard">Can View Board:</label></td>
107 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewBoard" id="CanViewBoard">
108 <option selected="selected" value="yes">yes</option>
109 <option value="no">no</option>
110 </select></td>
111 </tr><tr style="text-align: left;">
112 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewOffLine">Can View OffLine Board:</label></td>
113 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewOffLine" id="CanViewOffLine">
114 <option selected="selected" value="yes">yes</option>
115 <option value="no">no</option>
116 </select></td>
117 </tr><tr style="text-align: left;">
118 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditProfile">Can Edit Profile:</label></td>
119 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditProfile" id="CanEditProfile">
120 <option selected="selected" value="yes">yes</option>
121 <option value="no">no</option>
122 </select></td>
123 </tr><tr style="text-align: left;">
124 <td style="width: 50%;"><label class="TextBoxLabel" for="CanAddEvents">Can Add Events:</label></td>
125 <td style="width: 50%;"><select size="1" class="TextBox" name="CanAddEvents" id="CanAddEvents">
126 <option selected="selected" value="yes">yes</option>
127 <option value="no">no</option>
128 </select></td>
129 </tr><tr style="text-align: left;">
130 <td style="width: 50%;"><label class="TextBoxLabel" for="CanPM">Can PM:</label></td>
131 <td style="width: 50%;"><select size="1" class="TextBox" name="CanPM" id="CanPM">
132 <option selected="selected" value="yes">yes</option>
133 <option value="no">no</option>
134 </select></td>
135 </tr><tr style="text-align: left;">
136 <td style="width: 50%;"><label class="TextBoxLabel" for="CanSearch">Can Search:</label></td>
137 <td style="width: 50%;"><select size="1" class="TextBox" name="CanSearch" id="CanSearch">
138 <option selected="selected" value="yes">yes</option>
139 <option value="no">no</option>
140 </select></td>
141 </tr><tr style="text-align: left;">
142 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
143 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
144 <option value="yes">yes</option>
145 <option value="no">no</option>
146 </select></td>
147 </tr><tr style="text-align: left;">
148 <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
149 <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
150 <option value="yes">yes</option>
151 <option value="no">no</option>
152 </select></td>
153 </tr><tr style="text-align: left;">
154 <td style="width: 50%;"><label class="TextBoxLabel" for="FloodControl">Flood Control in seconds:</label></td>
155 <td style="width: 50%;"><input type="text" name="FloodControl" class="TextBox" id="FloodControl" size="20" /></td>
156 </tr><tr style="text-align: left;">
157 <td style="width: 50%;"><label class="TextBoxLabel" for="SearchFlood">Search Flood Control in seconds:</label></td>
158 <td style="width: 50%;"><input type="text" name="SearchFlood" class="TextBox" id="SearchFlood" size="20" /></td>
159 </tr><tr style="text-align: left;">
160 <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteTo">Promote To Group:</label></td>
161 <td style="width: 50%;"><select size="1" class="TextBox" name="PromoteTo" id="PromoteTo">
162 <option selected="selected" value="0">none</option>
163 <?php
164 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
165 $fr=sql_query($fq,$SQLStat);
166 $ai=sql_num_rows($fr);
167 $fi=0;
168 while ($fi < $ai) {
169 $ProGroupID=sql_result($fr,$fi,"id");
170 $ProGroupName=sql_result($fr,$fi,"Name");
172 <option value="<?php echo $ProGroupID; ?>"><?php echo $ProGroupName; ?></option>
173 <?php ++$fi; }
174 sql_free_result($fr); ?>
175 </select></td>
176 </tr><tr style="text-align: left;">
177 <td style="width: 50%;"><label class="TextBoxLabel" for="PromotePosts">Amount of Posts needed:</label></td>
178 <td style="width: 50%;"><input type="number" name="PromotePosts" class="TextBox" id="PromotePosts" size="20" /></td>
179 </tr><tr style="text-align: left;">
180 <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteKarma">Amount of Karma needed:</label></td>
181 <td style="width: 50%;"><input type="number" name="PromoteKarma" class="TextBox" id="PromoteKarma" size="20" /></td>
182 </tr><tr style="text-align: left;">
183 <td style="width: 50%;"><label class="TextBoxLabel" for="HasModCP">Can view Mod CP:</label></td>
184 <td style="width: 50%;"><select size="1" class="TextBox" name="HasModCP" id="HasModCP">
185 <option selected="selected" value="off">no</option>
186 <option value="on">yes</option>
187 </select></td>
188 </tr><tr style="text-align: left;">
189 <td style="width: 50%;"><label class="TextBoxLabel" for="HasAdminCP">Can view Admin CP:</label></td>
190 <td style="width: 50%;"><select size="1" class="TextBox" name="HasAdminCP" id="HasAdminCP">
191 <option selected="selected" value="off">no</option>
192 <option value="on">yes</option>
193 </select></td>
194 </tr><tr style="text-align: left;">
195 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewIPAddress">Can view IP Address:</label></td>
196 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewIPAddress" id="CanViewIPAddress">
197 <option value="yes">yes</option>
198 <option value="no">no</option>
199 </select></td>
200 </tr><tr style="text-align: left;">
201 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewUserAgent">Can view user agent:</label></td>
202 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewUserAgent" id="CanViewUserAgent">
203 <option value="yes">yes</option>
204 <option value="no">no</option>
205 </select></td>
206 </tr><tr style="text-align: left;">
207 <td style="width: 50%;"><label class="TextBoxLabel" for="ViewDBInfo">Can view Database info:</label></td>
208 <td style="width: 50%;"><select size="1" class="TextBox" name="ViewDBInfo" id="ViewDBInfo">
209 <option selected="selected" value="off">no</option>
210 <option value="on">yes</option>
211 </select></td>
212 </tr></table>
213 <table style="text-align: left;">
214 <tr style="text-align: left;">
215 <td style="width: 100%;">
216 <input type="hidden" name="act" value="addgroup" style="display: none;" />
217 <input type="hidden" name="update" value="now" style="display: none;" />
218 <input type="submit" class="Button" value="Add Group" name="Apply_Changes" />
219 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
220 </td></tr></table>
221 </form>
222 </td>
223 </tr>
224 <tr class="TableMenuRow4">
225 <td class="TableMenuColumn4">&nbsp;</td>
226 </tr>
227 </table>
228 </div>
229 <?php } if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") {
230 $_POST['GroupName'] = stripcslashes(htmlspecialchars($_POST['GroupName'], ENT_QUOTES, $Settings['charset']));
231 //$_POST['GroupName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GroupName']);
232 $_POST['GroupName'] = remove_spaces($_POST['GroupName']);
233 $_POST['NamePrefix'] = stripcslashes(htmlspecialchars($_POST['NamePrefix'], ENT_QUOTES, $Settings['charset']));
234 //$_POST['NamePrefix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NamePrefix']);
235 $_POST['NamePrefix'] = remove_spaces($_POST['NamePrefix']);
236 $_POST['NameSuffix'] = stripcslashes(htmlspecialchars($_POST['NameSuffix'], ENT_QUOTES, $Settings['charset']));
237 //$_POST['NameSuffix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NameSuffix']);
238 $_POST['NameSuffix'] = remove_spaces($_POST['NameSuffix']);
239 $sql_name_check = sql_query(sql_pre_query("SELECT \"Name\" FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s'", array($_POST['GroupName'])),$SQLStat);
240 $sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i LIMIT 1", array($_POST['PermissionID'])),$SQLStat);
241 $name_check = sql_num_rows($sql_name_check); $id_check = sql_num_rows($sql_id_check);
242 sql_free_result($sql_name_check);
243 $errorstr = "";
244 if (!isset($_POST['PromotePosts'])) {
245 $_POST['PromotePosts'] = 0; }
246 if ($_POST['PromotePosts']==null||
247 !is_numeric($_POST['PromotePosts'])) {
248 $_POST['PromotePosts'] = 0; }
249 if (!isset($_POST['PromoteKarma'])) {
250 $_POST['PromoteKarma'] = 0; }
251 if ($_POST['PromoteKarma']==null||
252 !is_numeric($_POST['PromoteKarma'])) {
253 $_POST['NPromoteKarma'] = 0; }
254 if ($_POST['GroupName']==null||
255 $_POST['GroupName']=="ShowMe") { $Error="Yes";
256 $errorstr = $errorstr."You need to enter a forum name.<br />\n"; }
257 if($id_check > 0) { $Error="Yes";
258 $errorstr = $errorstr."This ID number is already used.<br />\n"; }
259 if($name_check > 0) { $Error="Yes";
260 $errorstr = $errorstr."This Group Name is already used.<br />\n"; }
261 if (pre_strlen($_POST['GroupName'])>"150") { $Error="Yes";
262 $errorstr = $errorstr."Your Group Name is too big.<br />\n"; }
263 if ($Error!="Yes") {
264 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
265 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
266 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."groups\" (\"Name\", \"PermissionID\", \"NamePrefix\", \"NameSuffix\", \"CanViewBoard\", \"CanViewOffLine\", \"CanEditProfile\", \"CanAddEvents\", \"CanPM\", \"CanSearch\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\", \"CanViewIPAddress\", \"CanViewUserAgent\", \"FloodControl\", \"SearchFlood\", \"PromoteTo\", \"PromotePosts\", \"PromoteKarma\", \"HasModCP\", \"HasAdminCP\", \"ViewDBInfo\") VALUES\n".
267 "('%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 'no', '%s', '%s', '%s', '%s', '%s', %i, %i, %i, %i, %i, '%s', '%s', '%s')", array($_POST['GroupName'],$_POST['PermissionID'],$_POST['NamePrefix'],$_POST['NameSuffix'],$_POST['CanViewBoard'],$_POST['CanViewOffLine'],$_POST['CanEditProfile'],$_POST['CanAddEvents'],$_POST['CanPM'],$_POST['CanSearch'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['HasModCP'],$_POST['CanViewIPAddress'],$_POST['CanViewUserAgent'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['PromoteTo'],$_POST['PromotePosts'],$_POST['PromoteKarma'],$_POST['HasModCP'],$_POST['HasAdminCP'],$_POST['ViewDBInfo']));
268 sql_query($query,$SQLStat);
269 if(!is_numeric($_POST['GroupPerm'])) { $_POST['GroupPerm'] = "0"; }
270 $getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC", array(null));
271 $getperidr=sql_query($getperidq,$SQLStat);
272 $getperidnum=sql_num_rows($getperidr);
273 $getperidi = 0;
274 $nextperid = null;
276 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
277 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
278 $Settings['sqltype']=="sqlite3") {
279 $nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
280 if($Settings['sqltype']=="sqlite") {
281 $nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
283 while ($getperidi < $getperidnum) {
284 $getperidID=sql_result($getperidr,$getperidi,"id");
285 if($_POST['GroupPerm']!="0") {
286 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i", array($_POST['GroupPerm'],$getperidID));
287 $getperidr2=sql_query($getperidq2,$SQLStat);
288 $getperidnum2=sql_num_rows($getperidr2);
289 $PermissionNum=sql_result($getperidr2,0,"id");
290 $PermissionID=$_POST['PermissionID'];
291 $PermissionName=$_POST['GroupName'];
292 $PermissionForumID=sql_result($getperidr2,0,"ForumID");
293 $CanViewForum=sql_result($getperidr2,0,"CanViewForum");
294 $CanMakePolls=sql_result($getperidr2,0,"CanMakePolls");
295 $CanMakeTopics=sql_result($getperidr2,0,"CanMakeTopics");
296 $CanMakeReplys=sql_result($getperidr2,0,"CanMakeReplys");
297 $CanMakeReplysCT=sql_result($getperidr2,0,"CanMakeReplysCT");
298 $CanEditTopics=sql_result($getperidr2,0,"CanEditTopics");
299 $CanEditTopicsCT=sql_result($getperidr2,0,"CanEditTopicsCT");
300 $CanEditReplys=sql_result($getperidr2,0,"CanEditReplys");
301 $CanEditReplysCT=sql_result($getperidr2,0,"CanEditReplysCT");
302 $CanDeleteTopics=sql_result($getperidr2,0,"CanDeleteTopics");
303 $CanDeleteTopicsCT=sql_result($getperidr2,0,"CanDeleteTopicsCT");
304 $CanDeleteReplys=sql_result($getperidr2,0,"CanDeleteReplys");
305 $CanDeleteReplysCT=sql_result($getperidr2,0,"CanDeleteReplysCT");
306 $CanCloseTopics=sql_result($getperidr2,0,"CanCloseTopics");
307 $CanPinTopics=sql_result($getperidr2,0,"CanPinTopics");
308 $CanExecPHP=sql_result($getperidr2,0,"CanExecPHP");
309 $CanDoHTML=sql_result($getperidr2,0,"CanDoHTML");
310 $CanUseBBTags=sql_result($getperidr2,0,"CanUseBBTags");
311 $CanModForum=sql_result($getperidr2,0,"CanModForum");
312 sql_free_result($getperidr2); }
313 if($_POST['GroupPerm']=="0") {
314 $PermissionID=$_POST['PermissionID'];
315 $PermissionName=$_POST['GroupName'];
316 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$getperidID)); }
317 if($_POST['GroupPerm']!="0") {
318 if($getperidnum2>0) {
319 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", array($PermissionID,$PermissionName,$getperidID,$CanViewForum,$CanMakePolls,$CanMakeTopics,$CanMakeReplys,$CanMakeReplysCT,$CanEditTopics,$CanEditTopicsCT,$CanEditReplys,$CanEditReplysCT,$CanDeleteTopics,$CanDeleteTopicsCT,$CanDeleteReplys,$CanDeleteReplysCT,$CanCloseTopics,$CanPinTopics,$CanExecPHP,$CanDoHTML,$CanUseBBTags,$CanModForum)); }
320 if($getperidnum2<=0) {
321 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$getperidID)); } }
322 sql_query($query,$SQLStat);
323 ++$getperidi; /*++$nextperid;*/ }
324 sql_free_result($getperidr);
325 if(!is_numeric($_POST['GroupPerm'])) { $_POST['GroupPerm'] = "0"; }
326 $getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"id\" ASC", array(null));
327 $getperidr=sql_query($getperidq,$SQLStat);
328 $getperidnum=sql_num_rows($getperidr);
329 $getperidi = 0;
330 $nextperid = null;
332 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
333 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
334 $Settings['sqltype']=="sqlite3") {
335 $nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
336 if($Settings['sqltype']=="sqlite") {
337 $nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
339 while ($getperidi < $getperidnum) {
340 $getperidID=sql_result($getperidr,$getperidi,"id");
341 if($_POST['GroupPerm']!="0") {
342 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i AND \"CategoryID\"=%i", array($_POST['GroupPerm'],$getperidID));
343 $getperidr2=sql_query($getperidq2,$SQLStat);
344 $getperidnum2=sql_num_rows($getperidr2);
345 $PermissionNum=sql_result($getperidr2,0,"id");
346 $PermissionID=$_POST['PermissionID'];
347 $PermissionName=$_POST['GroupName'];
348 $PermissionCatID=sql_result($getperidr2,0,"CategoryID");
349 $CanViewCategory=sql_result($getperidr2,0,"CanViewCategory");
350 sql_free_result($getperidr2); }
351 if($_POST['GroupPerm']=="0") {
352 $PermissionID=$_POST['PermissionID'];
353 $PermissionName=$_POST['GroupName'];
354 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($PermissionID,$PermissionName,$getperidID)); }
355 if($_POST['GroupPerm']!="0") {
356 if($getperidnum2>0) {
357 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, '%s')", array($PermissionID,$PermissionName,$getperidID,$CanViewCategory)); }
358 if($getperidnum2<=0) {
359 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($PermissionID,$PermissionName,$getperidID)); } }
360 sql_query($query,$SQLStat);
361 ++$getperidi; /*++$nextperid;*/ }
362 sql_free_result($getperidr); } }
363 if($_GET['act']=="deletegroup"&&$_POST['update']!="now") {
364 $admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Forum";
366 <div class="TableMenuBorder">
367 <?php if($ThemeSet['TableStyle']=="div") { ?>
368 <div class="TableMenuRow1">
369 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
370 <?php } ?>
371 <table class="TableMenu" style="width: 100%;">
372 <?php if($ThemeSet['TableStyle']=="table") { ?>
373 <tr class="TableMenuRow1">
374 <td class="TableMenuColumn1"><span style="float: left;">
375 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
376 </span><span style="float: right;">&nbsp;</span></td>
377 </tr><?php } ?>
378 <tr class="TableMenuRow2">
379 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
380 <span style="float: left;">&nbsp;Deleting a Group: </span>
381 <span style="float: right;">&nbsp;</span>
382 </th>
383 </tr>
384 <tr class="TableMenuRow3">
385 <td class="TableMenuColumn3">
386 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deletegroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
387 <table style="text-align: left;">
388 <tr style="text-align: left;">
389 <td style="width: 50%;"><label class="TextBoxLabel" for="DelID">Delete Group:</label></td>
390 <td style="width: 50%;"><select size="1" class="TextBox" name="DelID" id="DelID">
391 <?php
392 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE (\"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s') ORDER BY \"id\" ASC", array($Settings['GuestGroup'],$Settings['MemberGroup'],$Settings['ValidateGroup'],"Admin"));
393 $fr=sql_query($fq,$SQLStat);
394 $ai=sql_num_rows($fr);
395 $fi=0;
396 while ($fi < $ai) {
397 $GroupID=sql_result($fr,$fi,"id");
398 $GroupName=sql_result($fr,$fi,"Name");
400 <option value="<?php echo $GroupID; ?>"><?php echo $GroupName; ?></option>
401 <?php ++$fi; }
402 sql_free_result($fr); ?>
403 </select></td>
404 </tr></table>
405 <table style="text-align: left;">
406 <tr style="text-align: left;">
407 <td style="width: 100%;">
408 <input type="hidden" name="act" value="deletegroup" style="display: none;" />
409 <input type="hidden" name="update" value="now" style="display: none;" />
410 <input type="submit" class="Button" value="Delete Group" name="Apply_Changes" />
411 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
412 </td></tr></table>
413 </form>
414 </td>
415 </tr>
416 <tr class="TableMenuRow4">
417 <td class="TableMenuColumn4">&nbsp;</td>
418 </tr>
419 </table>
420 </div>
421 <?php } if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") {
422 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
423 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i AND (\"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s' AND \"Name\"<>'%s') LIMIT 1", array($_POST['DelID'],$Settings['GuestGroup'],$Settings['MemberGroup'],$Settings['ValidateGroup'],"Admin"));
424 $preresult=sql_query($prequery,$SQLStat);
425 $prenum=sql_num_rows($preresult);
426 $GroupName=sql_result($preresult,0,"Name");
427 $errorstr = ""; $Error = null;
428 if (!is_numeric($_POST['DelID'])) { $Error="Yes";
429 $errorstr = $errorstr."You need to enter a group ID.<br />\n"; }
430 if($prenum>0&&$Error!="Yes") {
431 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i", array($_POST['DelID']));
432 sql_query($dtquery,$SQLStat);
433 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"Name\"='%s'", array($GroupName));
434 sql_query($dtquery,$SQLStat);
435 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"Name\"='%s'", array($GroupName));
436 sql_query($dtquery,$SQLStat);
437 $gquerys = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['MemberGroup']));
438 $gresults=sql_query($gquerys,$SQLStat);
439 $MemGroup=sql_result($gresults,0,"id");
440 sql_free_result($gresults);
441 $dtquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"GroupID\"=%i WHERE \"GroupID\"=%i", array($MemGroup,$_POST['DelID']));
442 sql_query($dtquery,$SQLStat); } }
443 if($_GET['act']=="editgroup"&&$_POST['update']!="now") {
444 $admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Group";
445 if(!isset($_POST['id'])) {
447 <div class="TableMenuBorder">
448 <?php if($ThemeSet['TableStyle']=="div") { ?>
449 <div class="TableMenuRow1">
450 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
451 <?php } ?>
452 <table class="TableMenu" style="width: 100%;">
453 <?php if($ThemeSet['TableStyle']=="table") { ?>
454 <tr class="TableMenuRow1">
455 <td class="TableMenuColumn1"><span style="float: left;">
456 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
457 </span><span style="float: right;">&nbsp;</span></td>
458 </tr><?php } ?>
459 <tr class="TableMenuRow2">
460 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
461 <span style="float: left;">&nbsp;Editing a Group: </span>
462 <span style="float: right;">&nbsp;</span>
463 </th>
464 </tr>
465 <tr class="TableMenuRow3">
466 <td class="TableMenuColumn3">
467 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
468 <table style="text-align: left;">
469 <tr style="text-align: left;">
470 <td style="width: 50%;"><label class="TextBoxLabel" for="id">Group to Edit:</label></td>
471 <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
472 <?php
473 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
474 $fr=sql_query($fq,$SQLStat);
475 $ai=sql_num_rows($fr);
476 $fi=0;
477 while ($fi < $ai) {
478 $GroupID=sql_result($fr,$fi,"id");
479 $GroupName=sql_result($fr,$fi,"Name");
481 <option value="<?php echo $GroupID; ?>"><?php echo $GroupName; ?></option>
482 <?php ++$fi; }
483 sql_free_result($fr); ?>
484 </select></td>
485 </tr></table>
486 <table style="text-align: left;">
487 <tr style="text-align: left;">
488 <td style="width: 100%;">
489 <input type="hidden" name="act" value="editgroup" style="display: none;" />
490 <input type="submit" class="Button" value="Edit Group" name="Apply_Changes" />
491 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
492 </td></tr></table>
493 </form>
494 </td>
495 </tr>
496 <tr class="TableMenuRow4">
497 <td class="TableMenuColumn4">&nbsp;</td>
498 </tr>
499 </table>
500 </div>
501 <?php } if(isset($_POST['id'])) {
502 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
503 $preresult=sql_query($prequery,$SQLStat);
504 $prenum=sql_num_rows($preresult);
505 if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
506 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
507 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
508 if($prenum>=1) {
509 $GroupID = sql_result($preresult,0,"id");
510 $GroupName = sql_result($preresult,0,"Name");
511 $PermissionID = sql_result($preresult,0,"PermissionID");
512 $NamePrefix = sql_result($preresult,0,"NamePrefix");
513 $NameSuffix = sql_result($preresult,0,"NameSuffix");
514 $CanViewBoard = sql_result($preresult,0,"CanViewBoard");
515 $CanViewOffLine = sql_result($preresult,0,"CanViewOffLine");
516 $CanEditProfile = sql_result($preresult,0,"CanEditProfile");
517 $CanAddEvents = sql_result($preresult,0,"CanAddEvents");
518 $CanPM = sql_result($preresult,0,"CanPM");
519 $CanSearch = sql_result($preresult,0,"CanSearch");
520 $CanDoHTML = sql_result($preresult,0,"CanDoHTML");
521 $CanUseBBTags = sql_result($preresult,0,"CanUseBBTags");
522 $CanViewIPAddress = sql_result($preresult,0,"CanViewIPAddress");
523 $CanViewUserAgent = sql_result($preresult,0,"CanViewUserAgent");
524 $FloodControl = sql_result($preresult,0,"FloodControl");
525 $SearchFlood = sql_result($preresult,0,"SearchFlood");
526 $PromoteTo = sql_result($preresult,0,"PromoteTo");
527 $PromotePosts = sql_result($preresult,0,"PromotePosts");
528 $PromoteKarma = sql_result($preresult,0,"PromoteKarma");
529 $HasModCP = sql_result($preresult,0,"HasModCP");
530 $HasAdminCP = sql_result($preresult,0,"HasAdminCP");
531 $ViewDBInfo = sql_result($preresult,0,"ViewDBInfo");
532 sql_free_result($preresult);
534 <div class="TableMenuBorder">
535 <?php if($ThemeSet['TableStyle']=="div") { ?>
536 <div class="TableMenuRow1">
537 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a></div>
538 <?php } ?>
539 <table class="TableMenu" style="width: 100%;">
540 <?php if($ThemeSet['TableStyle']=="table") { ?>
541 <tr class="TableMenuRow1">
542 <td class="TableMenuColumn1"><span style="float: left;">
543 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Group Manager</a>
544 </span><span style="float: right;">&nbsp;</span></td>
545 </tr><?php } ?>
546 <tr class="TableMenuRow2">
547 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
548 <span style="float: left;">&nbsp;Editing a Group: </span>
549 <span style="float: right;">&nbsp;</span>
550 </th>
551 </tr>
552 <tr class="TableMenuRow3">
553 <td class="TableMenuColumn3">
554 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editgroup",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
555 <table style="text-align: left;">
556 <tr style="text-align: left;">
557 <td style="width: 50%;"><label class="TextBoxLabel" for="GroupName">Insert name for group:</label></td>
558 <td style="width: 50%;"><input type="text" name="GroupName" class="TextBox" id="GroupName" size="20" value="<?php echo $GroupName; ?>" /></td>
559 </tr><tr style="text-align: left;">
560 <td style="width: 50%;"><label class="TextBoxLabel" for="NamePrefix">Name Prefix:</label></td>
561 <td style="width: 50%;"><input type="text" name="NamePrefix" class="TextBox" id="NamePrefix" size="20" value="<?php echo $NamePrefix; ?>" /></td>
562 </tr><tr style="text-align: left;">
563 <td style="width: 50%;"><label class="TextBoxLabel" for="NameSuffix">Name Subfix:</label></td>
564 <td style="width: 50%;"><input type="text" name="NameSuffix" class="TextBox" id="NameSuffix" size="20" value="<?php echo $NameSuffix; ?>" /></td>
565 <?php if($GroupID!=1) { ?>
566 </tr><tr style="text-align: left;">
567 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewBoard">Can View Board:</label></td>
568 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewBoard" id="CanViewBoard">
569 <option selected="selected" value="<?php echo $CanViewBoard; ?>">Old Value (<?php echo $CanViewBoard; ?>)</option>
570 <option value="yes">yes</option>
571 <option value="no">no</option>
572 </select></td>
573 </tr><tr style="text-align: left;">
574 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewOffLine">Can View OffLine Board:</label></td>
575 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewOffLine" id="CanViewOffLine">
576 <option selected="selected" value="<?php echo $CanViewOffLine; ?>">Old Value (<?php echo $CanViewOffLine; ?>)</option>
577 <option value="yes">yes</option>
578 <option value="no">no</option>
579 </select></td>
580 </tr><tr style="text-align: left;">
581 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditProfile">Can Edit Profile:</label></td>
582 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditProfile" id="CanEditProfile">
583 <option selected="selected" value="<?php echo $CanEditProfile; ?>">Old Value (<?php echo $CanEditProfile; ?>)</option>
584 <option value="yes">yes</option>
585 <option value="no">no</option>
586 </select></td>
587 </tr><tr style="text-align: left;">
588 <td style="width: 50%;"><label class="TextBoxLabel" for="CanAddEvents">Can Add Events:</label></td>
589 <td style="width: 50%;"><select size="1" class="TextBox" name="CanAddEvents" id="CanAddEvents">
590 <option selected="selected" value="<?php echo $CanAddEvents; ?>">Old Value (<?php echo $CanAddEvents; ?>)</option>
591 <option value="yes">yes</option>
592 <option value="no">no</option>
593 </select></td>
594 </tr><tr style="text-align: left;">
595 <td style="width: 50%;"><label class="TextBoxLabel" for="CanPM">Can PM:</label></td>
596 <td style="width: 50%;"><select size="1" class="TextBox" name="CanPM" id="CanPM">
597 <option selected="selected" value="<?php echo $CanPM; ?>">Old Value (<?php echo $CanPM; ?>)</option>
598 <option value="yes">yes</option>
599 <option value="no">no</option>
600 </select></td>
601 </tr><tr style="text-align: left;">
602 <td style="width: 50%;"><label class="TextBoxLabel" for="CanSearch">Can Search:</label></td>
603 <td style="width: 50%;"><select size="1" class="TextBox" name="CanSearch" id="CanSearch">
604 <option selected="selected" value="<?php echo $CanSearch; ?>">Old Value (<?php echo $CanSearch; ?>)</option>
605 <option value="yes">yes</option>
606 <option value="no">no</option>
607 </select></td>
608 <?php } ?>
609 </tr><tr style="text-align: left;">
610 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
611 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
612 <option <?php if($CanDoHTML=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
613 <option <?php if($CanDoHTML=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
614 </select></td>
615 </tr><tr style="text-align: left;">
616 <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
617 <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
618 <option <?php if($CanUseBBTags=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
619 <option <?php if($CanUseBBTags=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
620 </select></td>
621 </tr><tr style="text-align: left;">
622 <td style="width: 50%;"><label class="TextBoxLabel" for="FloodControl">Flood Control in seconds:</label></td>
623 <td style="width: 50%;"><input type="text" name="FloodControl" class="TextBox" id="FloodControl" size="20" value="<?php echo $FloodControl; ?>" /></td>
624 </tr><tr style="text-align: left;">
625 <td style="width: 50%;"><label class="TextBoxLabel" for="SearchFlood">Search Flood Control in seconds:</label></td>
626 <td style="width: 50%;"><input type="text" name="SearchFlood" class="TextBox" id="SearchFlood" size="20" value="<?php echo $SearchFlood; ?>" /></td>
627 <?php if($GroupID!=1) { ?>
628 </tr><tr style="text-align: left;">
629 <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteTo">Promote To Group:</label></td>
630 <td style="width: 50%;"><select size="1" class="TextBox" name="PromoteTo" id="PromoteTo">
631 <option selected="selected" value="<?php echo $PromoteTo; ?>">Old Value (<?php echo $PromoteTo; ?>)</option>
632 <option value="0">none</option>
633 <?php
634 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
635 $fr=sql_query($fq,$SQLStat);
636 $ai=sql_num_rows($fr);
637 $fi=0;
638 while ($fi < $ai) {
639 $ProGroupID=sql_result($fr,$fi,"id");
640 $ProGroupName=sql_result($fr,$fi,"Name");
642 <option value="<?php echo $ProGroupID; ?>"><?php echo $ProGroupName; ?></option>
643 <?php ++$fi; }
644 sql_free_result($fr); ?>
645 </select></td>
646 </tr><tr style="text-align: left;">
647 <td style="width: 50%;"><label class="TextBoxLabel" for="PromotePosts">Amount of Posts needed:</label></td>
648 <td style="width: 50%;"><input type="number" name="PromotePosts" class="TextBox" id="PromotePosts" size="20" value="<?php echo $PromotePosts; ?>" /></td>
649 </tr><tr style="text-align: left;">
650 <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteKarma">Amount of Karma needed:</label></td>
651 <td style="width: 50%;"><input type="number" name="PromoteKarma" class="TextBox" id="PromoteKarma" size="20" value="<?php echo $PromoteKarma; ?>" /></td>
652 </tr><tr style="text-align: left;">
653 <td style="width: 50%;"><label class="TextBoxLabel" for="HasModCP">Can view Mod CP:</label></td>
654 <td style="width: 50%;"><select size="1" class="TextBox" name="HasModCP" id="HasModCP">
655 <option selected="selected" value="<?php echo $HasModCP; ?>">Old Value (<?php echo $HasModCP; ?>)</option>
656 <option value="yes">yes</option>
657 <option value="no">no</option>
658 </select></td>
659 </tr><tr style="text-align: left;">
660 <td style="width: 50%;"><label class="TextBoxLabel" for="HasAdminCP">Can view Admin CP:</label></td>
661 <td style="width: 50%;"><select size="1" class="TextBox" name="HasAdminCP" id="HasAdminCP">
662 <option selected="selected" value="<?php echo $HasAdminCP; ?>">Old Value (<?php echo $HasAdminCP; ?>)</option>
663 <option value="yes">yes</option>
664 <option value="no">no</option>
665 </select></td>
666 </tr><tr style="text-align: left;">
667 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewIPAddress">Can view IP Address:</label></td>
668 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewIPAddress" id="CanViewIPAddress">
669 <option selected="selected" value="<?php echo $CanViewIPAddress; ?>">Old Value (<?php echo $CanViewIPAddress; ?>)</option>
670 <option value="yes">yes</option>
671 <option value="no">no</option>
672 </select></td>
673 </tr><tr style="text-align: left;">
674 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewUserAgent">Can view user agent:</label></td>
675 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewUserAgent" id="CanViewUserAgent">
676 <option selected="selected" value="<?php echo $CanViewUserAgent; ?>">Old Value (<?php echo $CanViewUserAgent; ?>)</option>
677 <option value="yes">yes</option>
678 <option value="no">no</option>
679 </select></td>
680 </tr><tr style="text-align: left;">
681 <td style="width: 50%;"><label class="TextBoxLabel" for="ViewDBInfo">Can view Database info:</label></td>
682 <td style="width: 50%;"><select size="1" class="TextBox" name="ViewDBInfo" id="ViewDBInfo">
683 <option selected="selected" value="<?php echo $ViewDBInfo; ?>">Old Value (<?php echo $ViewDBInfo; ?>)</option>
684 <option value="yes">yes</option>
685 <option value="no">no</option>
686 </select></td>
687 <?php } ?>
688 </tr></table>
689 <table style="text-align: left;">
690 <tr style="text-align: left;">
691 <td style="width: 100%;">
692 <input type="hidden" name="act" value="editgroup" style="display: none;" />
693 <input type="hidden" name="update" value="now" style="display: none;" />
694 <input type="hidden" name="id" value="<?php echo $GroupID; ?>" style="display: none;" />
695 <input type="submit" class="Button" value="Edit Group" name="Apply_Changes" />
696 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
697 </td></tr></table>
698 </form>
699 </td>
700 </tr>
701 <tr class="TableMenuRow4">
702 <td class="TableMenuColumn4">&nbsp;</td>
703 </tr>
704 </table>
705 </div>
706 <?php } } } if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
707 isset($_POST['id'])) {
708 $_POST['GroupName'] = stripcslashes(htmlspecialchars($_POST['GroupName'], ENT_QUOTES, $Settings['charset']));
709 //$_POST['GroupName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GroupName']);
710 $_POST['GroupName'] = remove_spaces($_POST['GroupName']);
711 $_POST['NamePrefix'] = stripcslashes(htmlspecialchars($_POST['NamePrefix'], ENT_QUOTES, $Settings['charset']));
712 //$_POST['NamePrefix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NamePrefix']);
713 $_POST['NamePrefix'] = remove_spaces($_POST['NamePrefix']);
714 $_POST['NameSuffix'] = stripcslashes(htmlspecialchars($_POST['NameSuffix'], ENT_QUOTES, $Settings['charset']));
715 //$_POST['NameSuffix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NameSuffix']);
716 $_POST['NameSuffix'] = remove_spaces($_POST['NameSuffix']);
717 $name_check = 0;
718 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
719 $preresult=sql_query($prequery,$SQLStat);
720 $prenum=sql_num_rows($preresult);
721 if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],false)); sql_free_result($preresult);
722 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
723 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
724 if($prenum>=1) {
725 $OldGroupName=sql_result($preresult,0,"Name");
726 sql_free_result($preresult);
727 if($_POST['GroupName']!=$OldGroupName) {
728 $sql_name_check = sql_query(sql_pre_query("SELECT \"Name\" FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s'", array($_POST['GroupName'])),$SQLStat);
729 $name_check = sql_num_rows($sql_name_check);
730 sql_free_result($sql_name_check); }
731 $errorstr = "";
732 if (!isset($_POST['PromotePosts'])) {
733 $_POST['PromotePosts'] = 0; }
734 if ($_POST['PromotePosts']==null||
735 !is_numeric($_POST['PromotePosts'])) {
736 $_POST['PromotePosts'] = 0; }
737 if (!isset($_POST['PromoteKarma'])) {
738 $_POST['PromoteKarma'] = 0; }
739 if ($_POST['PromoteKarma']==null||
740 !is_numeric($_POST['PromoteKarma'])) {
741 $_POST['NPromoteKarma'] = 0; }
742 if ($_POST['GroupName']==null||
743 $_POST['GroupName']=="ShowMe") { $Error="Yes";
744 $errorstr = $errorstr."You need to enter a forum name.<br />\n"; }
745 if($name_check > 0) { $Error="Yes";
746 $errorstr = $errorstr."This Group Name is already used.<br />\n"; }
747 if (pre_strlen($_POST['GroupName'])>"150") { $Error="Yes";
748 $errorstr = $errorstr."Your Group Name is too big.<br />\n"; }
749 if ($Error!="Yes") {
750 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
751 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
752 if($_POST['GroupName']!=$OldGroupName) {
753 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"Name\"='%s' WHERE \"Name\"='%s'", array($_POST['GroupName'],$OldGroupName));
754 sql_query($query,$SQLStat);
755 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."catpermissions\" SET \"Name\"='%s' WHERE \"Name\"='%s'", array($_POST['GroupName'],$OldGroupName));
756 sql_query($query,$SQLStat); }
757 if($_POST['id']!=1) {
758 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."groups\" SET \"Name\"='%s',\"NamePrefix\"='%s',\"NameSuffix\"='%s',\"CanViewBoard\"='%s',\"CanViewOffLine\"='%s',\"CanEditProfile\"='%s',\"CanAddEvents\"='%s',\"CanPM\"='%s',\"CanSearch\"='%s',\"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',CanViewIPAddress='%s',CanViewUserAgent='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i,\"PromoteTo\"=%i,\"PromotePosts\"=%i,\"PromoteKarma\"=%i,\"HasModCP\"='%s',\"HasAdminCP\"='%s',\"ViewDBInfo\"='%s' WHERE \"id\"=%i", array($_POST['GroupName'],$_POST['NamePrefix'],$_POST['NameSuffix'],$_POST['CanViewBoard'],$_POST['CanViewOffLine'],$_POST['CanEditProfile'],$_POST['CanAddEvents'],$_POST['CanPM'],$_POST['CanSearch'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['CanViewIPAddress'],$_POST['CanViewUserAgent'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['PromoteTo'],$_POST['PromotePosts'],$_POST['PromoteKarma'],$_POST['HasModCP'],$_POST['HasAdminCP'],$_POST['ViewDBInfo'],$_POST['id'])); }
759 if($_POST['id']==1) {
760 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."groups\" SET \"Name\"='%s',\"NamePrefix\"='%s',\"NameSuffix\"='%s',\"CanDoHTML\"='%s',\"CanUseBBTags\"='%s',\"FloodControl\"=%i,\"SearchFlood\"=%i WHERE \"id\"=%i", array($_POST['GroupName'],$_POST['NamePrefix'],$_POST['NameSuffix'],$_POST['CanDoHTML'],$_POST['CanUseBBTags'],$_POST['FloodControl'],$_POST['SearchFlood'],$_POST['id'])); }
761 sql_query($query,$SQLStat); } } }
762 $doupdate = false;
763 if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
764 $doupdate = true; }
765 if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
766 $doupdate = true; }
767 if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") {
768 $doupdate = true; }
769 if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") {
770 $doupdate = true; }
771 if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
772 isset($_POST['id'])) {
773 $doupdate = true; }
774 if($doupdate===true&&$Error!="Yes") { ?>
775 <div class="TableMenuBorder">
776 <?php if($ThemeSet['TableStyle']=="div") { ?>
777 <div class="TableMenuRow1">
778 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
779 <?php } ?>
780 <table class="TableMenu" style="width: 100%;">
781 <?php if($ThemeSet['TableStyle']=="table") { ?>
782 <tr class="TableMenuRow1">
783 <td class="TableMenuColumn1"><span style="float: left;">
784 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
785 </span><span style="float: right;">&nbsp;</span></td>
786 </tr><?php } ?>
787 <tr id="ProfileTitle" class="TableMenuRow2">
788 <th class="TableMenuColumn2">Updating Settings</th>
789 </tr>
790 <tr class="TableMenuRow3" id="ProfileUpdate">
791 <td class="TableMenuColumn3">
792 <?php if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") { ?>
793 <div style="text-align: center;">
794 <br />The group was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
795 </div>
796 <?php } if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") { ?>
797 <div style="text-align: center;">
798 <br />The group was deleted successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
799 </div>
800 <?php } if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
801 isset($_POST['id'])) { ?>
802 <div style="text-align: center;">
803 <br />The group was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
804 </div>
805 <?php } ?>
806 </td></tr>
807 <tr id="ProfileTitleEnd" class="TableMenuRow4">
808 <td class="TableMenuColumn4">&nbsp;</td>
809 </tr></table></div>
810 <?php } if ($_GET['act']!=null&&$Error=="Yes") {
811 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
812 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
814 <div class="TableMenuBorder">
815 <?php if($ThemeSet['TableStyle']=="div") { ?>
816 <div class="TableMenuRow1">
817 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
818 <?php } ?>
819 <table class="TableMenu" style="width: 100%;">
820 <?php if($ThemeSet['TableStyle']=="table") { ?>
821 <tr class="TableMenuRow1">
822 <td class="TableMenuColumn1"><span style="float: left;">
823 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
824 </span><span style="float: right;">&nbsp;</span></td>
825 </tr><?php } ?>
826 <tr id="ProfileTitle" class="TableMenuRow2">
827 <th class="TableMenuColumn2">Updating Settings</th>
828 </tr>
829 <tr class="TableMenuRow3" id="ProfileUpdate">
830 <td class="TableMenuColumn3">
831 <div style="text-align: center;">
832 <br /><?php echo $errorstr; ?>
833 <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
834 </div>
835 </td></tr>
836 <tr id="ProfileTitleEnd" class="TableMenuRow4">
837 <td class="TableMenuColumn4">&nbsp;</td>
838 </tr></table></div>
839 <?php } ?>
840 </td></tr>
841 </table>
842 <div>&nbsp;</div>