Update killglobals.php
[iDB.git] / inc / admin / groups.php
blobcd76df160a8156ca8d085b2ac2ca94e4e7000227
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-2023 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2023 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
14 $FileInfo: groups.php - Last Update: 6/28/2023 SVN 996 - 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;">&#160;</span></td>
51 </tr><?php } ?>
52 <tr class="TableMenuRow2">
53 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
54 <span style="float: left;">&#160;Adding new Group: </span>
55 <span style="float: right;">&#160;</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"||$Settings['sqltype']=="pdo_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"||$Settings['sqltype']=="pdo_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">&#160;</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"||$Settings['sqltype']=="pdo_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 $HideEditPostInfo=sql_result($getperidr2,0,"HideEditPostInfo");
299 $CanEditTopics=sql_result($getperidr2,0,"CanEditTopics");
300 $CanEditTopicsCT=sql_result($getperidr2,0,"CanEditTopicsCT");
301 $CanEditReplys=sql_result($getperidr2,0,"CanEditReplys");
302 $CanEditReplysCT=sql_result($getperidr2,0,"CanEditReplysCT");
303 $CanDeleteTopics=sql_result($getperidr2,0,"CanDeleteTopics");
304 $CanDeleteTopicsCT=sql_result($getperidr2,0,"CanDeleteTopicsCT");
305 $CanDeleteReplys=sql_result($getperidr2,0,"CanDeleteReplys");
306 $CanDeleteReplysCT=sql_result($getperidr2,0,"CanDeleteReplysCT");
307 $CanDoublePost=sql_result($getperidr2,0,"CanDoublePost");
308 $CanDoublePostCT=sql_result($getperidr2,0,"CanDoublePostCT");
309 $GotoEditPost=sql_result($getperidr2,0,"GotoEditPost");
310 $CanCloseTopics=sql_result($getperidr2,0,"CanCloseTopics");
311 $CanPinTopics=sql_result($getperidr2,0,"CanPinTopics");
312 $CanExecPHP=sql_result($getperidr2,0,"CanExecPHP");
313 $CanDoHTML=sql_result($getperidr2,0,"CanDoHTML");
314 $CanUseBBTags=sql_result($getperidr2,0,"CanUseBBTags");
315 $CanModForum=sql_result($getperidr2,0,"CanModForum");
316 $CanReportPost=sql_result($getperidr2,0,"CanReportPost");
317 sql_free_result($getperidr2); }
318 if($_POST['GroupPerm']=="0") {
319 $PermissionID=$_POST['PermissionID'];
320 $PermissionName=$_POST['GroupName'];
321 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"HideEditPostInfo\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDoublePost\", \"CanDoublePostCT\", \"GotoEditPost\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\", \"CanReportPost\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no, 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$getperidID)); }
322 if($_POST['GroupPerm']!="0") {
323 if($getperidnum2>0) {
324 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"HideEditPostInfo\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDoublePost\", \"CanDoublePostCT\", \"GotoEditPost\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\", \"CanReportPost\") VALUES (%i, '%s', %i, '%s', '%s', '%s', '%s', '%s', '%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,$HideEditPostInfo,$CanEditTopics,$CanEditTopicsCT,$CanEditReplys,$CanEditReplysCT,$CanDeleteTopics,$CanDeleteTopicsCT,$CanDeleteReplys,$CanDeleteReplysCT,$CanDoublePost,$CanDoublePostCT,$GotoEditPost,$CanCloseTopics,$CanPinTopics,$CanExecPHP,$CanDoHTML,$CanUseBBTags,$CanModForum,$CanReportPost)); }
325 if($getperidnum2<=0) {
326 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"HideEditPostInfo\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDoublePost\", \"CanDoublePostCT\", \"GotoEditPost\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\", \"CanReportPost\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$getperidID)); } }
327 sql_query($query,$SQLStat);
328 ++$getperidi; /*++$nextperid;*/ }
329 sql_free_result($getperidr);
330 if(!is_numeric($_POST['GroupPerm'])) { $_POST['GroupPerm'] = "0"; }
331 $getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"id\" ASC", array(null));
332 $getperidr=sql_query($getperidq,$SQLStat);
333 $getperidnum=sql_num_rows($getperidr);
334 $getperidi = 0;
335 $nextperid = null;
337 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
338 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
339 $Settings['sqltype']=="sqlite3"||$Settings['sqltype']=="pdo_sqlite3") {
340 $nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
341 if($Settings['sqltype']=="sqlite") {
342 $nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
344 while ($getperidi < $getperidnum) {
345 $getperidID=sql_result($getperidr,$getperidi,"id");
346 if($_POST['GroupPerm']!="0") {
347 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i AND \"CategoryID\"=%i", array($_POST['GroupPerm'],$getperidID));
348 $getperidr2=sql_query($getperidq2,$SQLStat);
349 $getperidnum2=sql_num_rows($getperidr2);
350 $PermissionNum=sql_result($getperidr2,0,"id");
351 $PermissionID=$_POST['PermissionID'];
352 $PermissionName=$_POST['GroupName'];
353 $PermissionCatID=sql_result($getperidr2,0,"CategoryID");
354 $CanViewCategory=sql_result($getperidr2,0,"CanViewCategory");
355 sql_free_result($getperidr2); }
356 if($_POST['GroupPerm']=="0") {
357 $PermissionID=$_POST['PermissionID'];
358 $PermissionName=$_POST['GroupName'];
359 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($PermissionID,$PermissionName,$getperidID)); }
360 if($_POST['GroupPerm']!="0") {
361 if($getperidnum2>0) {
362 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, '%s')", array($PermissionID,$PermissionName,$getperidID,$CanViewCategory)); }
363 if($getperidnum2<=0) {
364 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($PermissionID,$PermissionName,$getperidID)); } }
365 sql_query($query,$SQLStat);
366 ++$getperidi; /*++$nextperid;*/ }
367 sql_free_result($getperidr); } }
368 if($_GET['act']=="deletegroup"&&$_POST['update']!="now") {
369 $admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Forum";
371 <div class="TableMenuBorder">
372 <?php if($ThemeSet['TableStyle']=="div") { ?>
373 <div class="TableMenuRow1">
374 <?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>
375 <?php } ?>
376 <table class="TableMenu" style="width: 100%;">
377 <?php if($ThemeSet['TableStyle']=="table") { ?>
378 <tr class="TableMenuRow1">
379 <td class="TableMenuColumn1"><span style="float: left;">
380 <?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>
381 </span><span style="float: right;">&#160;</span></td>
382 </tr><?php } ?>
383 <tr class="TableMenuRow2">
384 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
385 <span style="float: left;">&#160;Deleting a Group: </span>
386 <span style="float: right;">&#160;</span>
387 </th>
388 </tr>
389 <tr class="TableMenuRow3">
390 <td class="TableMenuColumn3">
391 <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']); ?>">
392 <table style="text-align: left;">
393 <tr style="text-align: left;">
394 <td style="width: 50%;"><label class="TextBoxLabel" for="DelID">Delete Group:</label></td>
395 <td style="width: 50%;"><select size="1" class="TextBox" name="DelID" id="DelID">
396 <?php
397 $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"));
398 $fr=sql_query($fq,$SQLStat);
399 $ai=sql_num_rows($fr);
400 $fi=0;
401 while ($fi < $ai) {
402 $GroupID=sql_result($fr,$fi,"id");
403 $GroupName=sql_result($fr,$fi,"Name");
405 <option value="<?php echo $GroupID; ?>"><?php echo $GroupName; ?></option>
406 <?php ++$fi; }
407 sql_free_result($fr); ?>
408 </select></td>
409 </tr></table>
410 <table style="text-align: left;">
411 <tr style="text-align: left;">
412 <td style="width: 100%;">
413 <input type="hidden" name="act" value="deletegroup" style="display: none;" />
414 <input type="hidden" name="update" value="now" style="display: none;" />
415 <input type="submit" class="Button" value="Delete Group" name="Apply_Changes" />
416 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
417 </td></tr></table>
418 </form>
419 </td>
420 </tr>
421 <tr class="TableMenuRow4">
422 <td class="TableMenuColumn4">&#160;</td>
423 </tr>
424 </table>
425 </div>
426 <?php } if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") {
427 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
428 $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"));
429 $preresult=sql_query($prequery,$SQLStat);
430 $prenum=sql_num_rows($preresult);
431 $GroupName=sql_result($preresult,0,"Name");
432 $errorstr = ""; $Error = null;
433 if (!is_numeric($_POST['DelID'])) { $Error="Yes";
434 $errorstr = $errorstr."You need to enter a group ID.<br />\n"; }
435 if($prenum>0&&$Error!="Yes") {
436 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i", array($_POST['DelID']));
437 sql_query($dtquery,$SQLStat);
438 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"Name\"='%s'", array($GroupName));
439 sql_query($dtquery,$SQLStat);
440 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"Name\"='%s'", array($GroupName));
441 sql_query($dtquery,$SQLStat);
442 $gquerys = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['MemberGroup']));
443 $gresults=sql_query($gquerys,$SQLStat);
444 $MemGroup=sql_result($gresults,0,"id");
445 sql_free_result($gresults);
446 $dtquery = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"GroupID\"=%i WHERE \"GroupID\"=%i", array($MemGroup,$_POST['DelID']));
447 sql_query($dtquery,$SQLStat); } }
448 if($_GET['act']=="editgroup"&&$_POST['update']!="now") {
449 $admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Group";
450 if(!isset($_POST['id'])) {
452 <div class="TableMenuBorder">
453 <?php if($ThemeSet['TableStyle']=="div") { ?>
454 <div class="TableMenuRow1">
455 <?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>
456 <?php } ?>
457 <table class="TableMenu" style="width: 100%;">
458 <?php if($ThemeSet['TableStyle']=="table") { ?>
459 <tr class="TableMenuRow1">
460 <td class="TableMenuColumn1"><span style="float: left;">
461 <?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>
462 </span><span style="float: right;">&#160;</span></td>
463 </tr><?php } ?>
464 <tr class="TableMenuRow2">
465 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
466 <span style="float: left;">&#160;Editing a Group: </span>
467 <span style="float: right;">&#160;</span>
468 </th>
469 </tr>
470 <tr class="TableMenuRow3">
471 <td class="TableMenuColumn3">
472 <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']); ?>">
473 <table style="text-align: left;">
474 <tr style="text-align: left;">
475 <td style="width: 50%;"><label class="TextBoxLabel" for="id">Group to Edit:</label></td>
476 <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
477 <?php
478 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
479 $fr=sql_query($fq,$SQLStat);
480 $ai=sql_num_rows($fr);
481 $fi=0;
482 while ($fi < $ai) {
483 $GroupID=sql_result($fr,$fi,"id");
484 $GroupName=sql_result($fr,$fi,"Name");
486 <option value="<?php echo $GroupID; ?>"><?php echo $GroupName; ?></option>
487 <?php ++$fi; }
488 sql_free_result($fr); ?>
489 </select></td>
490 </tr></table>
491 <table style="text-align: left;">
492 <tr style="text-align: left;">
493 <td style="width: 100%;">
494 <input type="hidden" name="act" value="editgroup" style="display: none;" />
495 <input type="submit" class="Button" value="Edit Group" name="Apply_Changes" />
496 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
497 </td></tr></table>
498 </form>
499 </td>
500 </tr>
501 <tr class="TableMenuRow4">
502 <td class="TableMenuColumn4">&#160;</td>
503 </tr>
504 </table>
505 </div>
506 <?php } if(isset($_POST['id'])) {
507 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
508 $preresult=sql_query($prequery,$SQLStat);
509 $prenum=sql_num_rows($preresult);
510 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);
511 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
512 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
513 if($prenum>=1) {
514 $GroupID = sql_result($preresult,0,"id");
515 $GroupName = sql_result($preresult,0,"Name");
516 $PermissionID = sql_result($preresult,0,"PermissionID");
517 $NamePrefix = sql_result($preresult,0,"NamePrefix");
518 $NameSuffix = sql_result($preresult,0,"NameSuffix");
519 $CanViewBoard = sql_result($preresult,0,"CanViewBoard");
520 $CanViewOffLine = sql_result($preresult,0,"CanViewOffLine");
521 $CanEditProfile = sql_result($preresult,0,"CanEditProfile");
522 $CanAddEvents = sql_result($preresult,0,"CanAddEvents");
523 $CanPM = sql_result($preresult,0,"CanPM");
524 $CanSearch = sql_result($preresult,0,"CanSearch");
525 $CanDoHTML = sql_result($preresult,0,"CanDoHTML");
526 $CanUseBBTags = sql_result($preresult,0,"CanUseBBTags");
527 $CanViewIPAddress = sql_result($preresult,0,"CanViewIPAddress");
528 $CanViewUserAgent = sql_result($preresult,0,"CanViewUserAgent");
529 $FloodControl = sql_result($preresult,0,"FloodControl");
530 $SearchFlood = sql_result($preresult,0,"SearchFlood");
531 $PromoteTo = sql_result($preresult,0,"PromoteTo");
532 $PromotePosts = sql_result($preresult,0,"PromotePosts");
533 $PromoteKarma = sql_result($preresult,0,"PromoteKarma");
534 $HasModCP = sql_result($preresult,0,"HasModCP");
535 $HasAdminCP = sql_result($preresult,0,"HasAdminCP");
536 $ViewDBInfo = sql_result($preresult,0,"ViewDBInfo");
537 sql_free_result($preresult);
539 <div class="TableMenuBorder">
540 <?php if($ThemeSet['TableStyle']=="div") { ?>
541 <div class="TableMenuRow1">
542 <?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>
543 <?php } ?>
544 <table class="TableMenu" style="width: 100%;">
545 <?php if($ThemeSet['TableStyle']=="table") { ?>
546 <tr class="TableMenuRow1">
547 <td class="TableMenuColumn1"><span style="float: left;">
548 <?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>
549 </span><span style="float: right;">&#160;</span></td>
550 </tr><?php } ?>
551 <tr class="TableMenuRow2">
552 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
553 <span style="float: left;">&#160;Editing a Group: </span>
554 <span style="float: right;">&#160;</span>
555 </th>
556 </tr>
557 <tr class="TableMenuRow3">
558 <td class="TableMenuColumn3">
559 <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']); ?>">
560 <table style="text-align: left;">
561 <tr style="text-align: left;">
562 <td style="width: 50%;"><label class="TextBoxLabel" for="GroupName">Insert name for group:</label></td>
563 <td style="width: 50%;"><input type="text" name="GroupName" class="TextBox" id="GroupName" size="20" value="<?php echo $GroupName; ?>" /></td>
564 </tr><tr style="text-align: left;">
565 <td style="width: 50%;"><label class="TextBoxLabel" for="NamePrefix">Name Prefix:</label></td>
566 <td style="width: 50%;"><input type="text" name="NamePrefix" class="TextBox" id="NamePrefix" size="20" value="<?php echo $NamePrefix; ?>" /></td>
567 </tr><tr style="text-align: left;">
568 <td style="width: 50%;"><label class="TextBoxLabel" for="NameSuffix">Name Subfix:</label></td>
569 <td style="width: 50%;"><input type="text" name="NameSuffix" class="TextBox" id="NameSuffix" size="20" value="<?php echo $NameSuffix; ?>" /></td>
570 <?php if($GroupID!=1) { ?>
571 </tr><tr style="text-align: left;">
572 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewBoard">Can View Board:</label></td>
573 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewBoard" id="CanViewBoard">
574 <option selected="selected" value="<?php echo $CanViewBoard; ?>">Old Value (<?php echo $CanViewBoard; ?>)</option>
575 <option value="yes">yes</option>
576 <option value="no">no</option>
577 </select></td>
578 </tr><tr style="text-align: left;">
579 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewOffLine">Can View OffLine Board:</label></td>
580 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewOffLine" id="CanViewOffLine">
581 <option selected="selected" value="<?php echo $CanViewOffLine; ?>">Old Value (<?php echo $CanViewOffLine; ?>)</option>
582 <option value="yes">yes</option>
583 <option value="no">no</option>
584 </select></td>
585 </tr><tr style="text-align: left;">
586 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditProfile">Can Edit Profile:</label></td>
587 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditProfile" id="CanEditProfile">
588 <option selected="selected" value="<?php echo $CanEditProfile; ?>">Old Value (<?php echo $CanEditProfile; ?>)</option>
589 <option value="yes">yes</option>
590 <option value="no">no</option>
591 </select></td>
592 </tr><tr style="text-align: left;">
593 <td style="width: 50%;"><label class="TextBoxLabel" for="CanAddEvents">Can Add Events:</label></td>
594 <td style="width: 50%;"><select size="1" class="TextBox" name="CanAddEvents" id="CanAddEvents">
595 <option selected="selected" value="<?php echo $CanAddEvents; ?>">Old Value (<?php echo $CanAddEvents; ?>)</option>
596 <option value="yes">yes</option>
597 <option value="no">no</option>
598 </select></td>
599 </tr><tr style="text-align: left;">
600 <td style="width: 50%;"><label class="TextBoxLabel" for="CanPM">Can PM:</label></td>
601 <td style="width: 50%;"><select size="1" class="TextBox" name="CanPM" id="CanPM">
602 <option selected="selected" value="<?php echo $CanPM; ?>">Old Value (<?php echo $CanPM; ?>)</option>
603 <option value="yes">yes</option>
604 <option value="no">no</option>
605 </select></td>
606 </tr><tr style="text-align: left;">
607 <td style="width: 50%;"><label class="TextBoxLabel" for="CanSearch">Can Search:</label></td>
608 <td style="width: 50%;"><select size="1" class="TextBox" name="CanSearch" id="CanSearch">
609 <option selected="selected" value="<?php echo $CanSearch; ?>">Old Value (<?php echo $CanSearch; ?>)</option>
610 <option value="yes">yes</option>
611 <option value="no">no</option>
612 </select></td>
613 <?php } ?>
614 </tr><tr style="text-align: left;">
615 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
616 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
617 <option <?php if($CanDoHTML=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
618 <option <?php if($CanDoHTML=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
619 </select></td>
620 </tr><tr style="text-align: left;">
621 <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
622 <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
623 <option <?php if($CanUseBBTags=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
624 <option <?php if($CanUseBBTags=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
625 </select></td>
626 </tr><tr style="text-align: left;">
627 <td style="width: 50%;"><label class="TextBoxLabel" for="FloodControl">Flood Control in seconds:</label></td>
628 <td style="width: 50%;"><input type="text" name="FloodControl" class="TextBox" id="FloodControl" size="20" value="<?php echo $FloodControl; ?>" /></td>
629 </tr><tr style="text-align: left;">
630 <td style="width: 50%;"><label class="TextBoxLabel" for="SearchFlood">Search Flood Control in seconds:</label></td>
631 <td style="width: 50%;"><input type="text" name="SearchFlood" class="TextBox" id="SearchFlood" size="20" value="<?php echo $SearchFlood; ?>" /></td>
632 <?php if($GroupID!=1) { ?>
633 </tr><tr style="text-align: left;">
634 <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteTo">Promote To Group:</label></td>
635 <td style="width: 50%;"><select size="1" class="TextBox" name="PromoteTo" id="PromoteTo">
636 <option selected="selected" value="<?php echo $PromoteTo; ?>">Old Value (<?php echo $PromoteTo; ?>)</option>
637 <option value="0">none</option>
638 <?php
639 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" ORDER BY \"id\" ASC", array(null));
640 $fr=sql_query($fq,$SQLStat);
641 $ai=sql_num_rows($fr);
642 $fi=0;
643 while ($fi < $ai) {
644 $ProGroupID=sql_result($fr,$fi,"id");
645 $ProGroupName=sql_result($fr,$fi,"Name");
647 <option value="<?php echo $ProGroupID; ?>"><?php echo $ProGroupName; ?></option>
648 <?php ++$fi; }
649 sql_free_result($fr); ?>
650 </select></td>
651 </tr><tr style="text-align: left;">
652 <td style="width: 50%;"><label class="TextBoxLabel" for="PromotePosts">Amount of Posts needed:</label></td>
653 <td style="width: 50%;"><input type="number" name="PromotePosts" class="TextBox" id="PromotePosts" size="20" value="<?php echo $PromotePosts; ?>" /></td>
654 </tr><tr style="text-align: left;">
655 <td style="width: 50%;"><label class="TextBoxLabel" for="PromoteKarma">Amount of Karma needed:</label></td>
656 <td style="width: 50%;"><input type="number" name="PromoteKarma" class="TextBox" id="PromoteKarma" size="20" value="<?php echo $PromoteKarma; ?>" /></td>
657 </tr><tr style="text-align: left;">
658 <td style="width: 50%;"><label class="TextBoxLabel" for="HasModCP">Can view Mod CP:</label></td>
659 <td style="width: 50%;"><select size="1" class="TextBox" name="HasModCP" id="HasModCP">
660 <option selected="selected" value="<?php echo $HasModCP; ?>">Old Value (<?php echo $HasModCP; ?>)</option>
661 <option value="yes">yes</option>
662 <option value="no">no</option>
663 </select></td>
664 </tr><tr style="text-align: left;">
665 <td style="width: 50%;"><label class="TextBoxLabel" for="HasAdminCP">Can view Admin CP:</label></td>
666 <td style="width: 50%;"><select size="1" class="TextBox" name="HasAdminCP" id="HasAdminCP">
667 <option selected="selected" value="<?php echo $HasAdminCP; ?>">Old Value (<?php echo $HasAdminCP; ?>)</option>
668 <option value="yes">yes</option>
669 <option value="no">no</option>
670 </select></td>
671 </tr><tr style="text-align: left;">
672 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewIPAddress">Can view IP Address:</label></td>
673 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewIPAddress" id="CanViewIPAddress">
674 <option selected="selected" value="<?php echo $CanViewIPAddress; ?>">Old Value (<?php echo $CanViewIPAddress; ?>)</option>
675 <option value="yes">yes</option>
676 <option value="no">no</option>
677 </select></td>
678 </tr><tr style="text-align: left;">
679 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewUserAgent">Can view user agent:</label></td>
680 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewUserAgent" id="CanViewUserAgent">
681 <option selected="selected" value="<?php echo $CanViewUserAgent; ?>">Old Value (<?php echo $CanViewUserAgent; ?>)</option>
682 <option value="yes">yes</option>
683 <option value="no">no</option>
684 </select></td>
685 </tr><tr style="text-align: left;">
686 <td style="width: 50%;"><label class="TextBoxLabel" for="ViewDBInfo">Can view Database info:</label></td>
687 <td style="width: 50%;"><select size="1" class="TextBox" name="ViewDBInfo" id="ViewDBInfo">
688 <option selected="selected" value="<?php echo $ViewDBInfo; ?>">Old Value (<?php echo $ViewDBInfo; ?>)</option>
689 <option value="yes">yes</option>
690 <option value="no">no</option>
691 </select></td>
692 <?php } ?>
693 </tr></table>
694 <table style="text-align: left;">
695 <tr style="text-align: left;">
696 <td style="width: 100%;">
697 <input type="hidden" name="act" value="editgroup" style="display: none;" />
698 <input type="hidden" name="update" value="now" style="display: none;" />
699 <input type="hidden" name="id" value="<?php echo $GroupID; ?>" style="display: none;" />
700 <input type="submit" class="Button" value="Edit Group" name="Apply_Changes" />
701 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
702 </td></tr></table>
703 </form>
704 </td>
705 </tr>
706 <tr class="TableMenuRow4">
707 <td class="TableMenuColumn4">&#160;</td>
708 </tr>
709 </table>
710 </div>
711 <?php } } } if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
712 isset($_POST['id'])) {
713 $_POST['GroupName'] = stripcslashes(htmlspecialchars($_POST['GroupName'], ENT_QUOTES, $Settings['charset']));
714 //$_POST['GroupName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GroupName']);
715 $_POST['GroupName'] = remove_spaces($_POST['GroupName']);
716 $_POST['NamePrefix'] = stripcslashes(htmlspecialchars($_POST['NamePrefix'], ENT_QUOTES, $Settings['charset']));
717 //$_POST['NamePrefix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NamePrefix']);
718 $_POST['NamePrefix'] = remove_spaces($_POST['NamePrefix']);
719 $_POST['NameSuffix'] = stripcslashes(htmlspecialchars($_POST['NameSuffix'], ENT_QUOTES, $Settings['charset']));
720 //$_POST['NameSuffix'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['NameSuffix']);
721 $_POST['NameSuffix'] = remove_spaces($_POST['NameSuffix']);
722 $name_check = 0;
723 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
724 $preresult=sql_query($prequery,$SQLStat);
725 $prenum=sql_num_rows($preresult);
726 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);
727 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
728 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
729 if($prenum>=1) {
730 $OldGroupName=sql_result($preresult,0,"Name");
731 sql_free_result($preresult);
732 if($_POST['GroupName']!=$OldGroupName) {
733 $sql_name_check = sql_query(sql_pre_query("SELECT \"Name\" FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s'", array($_POST['GroupName'])),$SQLStat);
734 $name_check = sql_num_rows($sql_name_check);
735 sql_free_result($sql_name_check); }
736 $errorstr = "";
737 if (!isset($_POST['PromotePosts'])) {
738 $_POST['PromotePosts'] = 0; }
739 if ($_POST['PromotePosts']==null||
740 !is_numeric($_POST['PromotePosts'])) {
741 $_POST['PromotePosts'] = 0; }
742 if (!isset($_POST['PromoteKarma'])) {
743 $_POST['PromoteKarma'] = 0; }
744 if ($_POST['PromoteKarma']==null||
745 !is_numeric($_POST['PromoteKarma'])) {
746 $_POST['NPromoteKarma'] = 0; }
747 if ($_POST['GroupName']==null||
748 $_POST['GroupName']=="ShowMe") { $Error="Yes";
749 $errorstr = $errorstr."You need to enter a forum name.<br />\n"; }
750 if($name_check > 0) { $Error="Yes";
751 $errorstr = $errorstr."This Group Name is already used.<br />\n"; }
752 if (pre_strlen($_POST['GroupName'])>"150") { $Error="Yes";
753 $errorstr = $errorstr."Your Group Name is too big.<br />\n"; }
754 if ($Error!="Yes") {
755 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=groups",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
756 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
757 if($_POST['GroupName']!=$OldGroupName) {
758 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"Name\"='%s' WHERE \"Name\"='%s'", array($_POST['GroupName'],$OldGroupName));
759 sql_query($query,$SQLStat);
760 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."catpermissions\" SET \"Name\"='%s' WHERE \"Name\"='%s'", array($_POST['GroupName'],$OldGroupName));
761 sql_query($query,$SQLStat); }
762 if($_POST['id']!=1) {
763 $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'])); }
764 if($_POST['id']==1) {
765 $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'])); }
766 sql_query($query,$SQLStat); } } }
767 $doupdate = false;
768 if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
769 $doupdate = true; }
770 if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
771 $doupdate = true; }
772 if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") {
773 $doupdate = true; }
774 if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") {
775 $doupdate = true; }
776 if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
777 isset($_POST['id'])) {
778 $doupdate = true; }
779 if($doupdate===true&&$Error!="Yes") { ?>
780 <div class="TableMenuBorder">
781 <?php if($ThemeSet['TableStyle']=="div") { ?>
782 <div class="TableMenuRow1">
783 <?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>
784 <?php } ?>
785 <table class="TableMenu" style="width: 100%;">
786 <?php if($ThemeSet['TableStyle']=="table") { ?>
787 <tr class="TableMenuRow1">
788 <td class="TableMenuColumn1"><span style="float: left;">
789 <?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>
790 </span><span style="float: right;">&#160;</span></td>
791 </tr><?php } ?>
792 <tr id="ProfileTitle" class="TableMenuRow2">
793 <th class="TableMenuColumn2">Updating Settings</th>
794 </tr>
795 <tr class="TableMenuRow3" id="ProfileUpdate">
796 <td class="TableMenuColumn3">
797 <?php if($_POST['act']=="addgroup"&&$_POST['update']=="now"&&$_GET['act']=="addgroup") { ?>
798 <div style="text-align: center;">
799 <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 />&#160;
800 </div>
801 <?php } if($_GET['act']=="deletegroup"&&$_POST['update']=="now"&&$_GET['act']=="deletegroup") { ?>
802 <div style="text-align: center;">
803 <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 />&#160;
804 </div>
805 <?php } if($_POST['act']=="editgroup"&&$_POST['update']=="now"&&$_GET['act']=="editgroup"&&
806 isset($_POST['id'])) { ?>
807 <div style="text-align: center;">
808 <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 />&#160;
809 </div>
810 <?php } ?>
811 </td></tr>
812 <tr id="ProfileTitleEnd" class="TableMenuRow4">
813 <td class="TableMenuColumn4">&#160;</td>
814 </tr></table></div>
815 <?php } if ($_GET['act']!=null&&$Error=="Yes") {
816 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");
817 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
819 <div class="TableMenuBorder">
820 <?php if($ThemeSet['TableStyle']=="div") { ?>
821 <div class="TableMenuRow1">
822 <?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>
823 <?php } ?>
824 <table class="TableMenu" style="width: 100%;">
825 <?php if($ThemeSet['TableStyle']=="table") { ?>
826 <tr class="TableMenuRow1">
827 <td class="TableMenuColumn1"><span style="float: left;">
828 <?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>
829 </span><span style="float: right;">&#160;</span></td>
830 </tr><?php } ?>
831 <tr id="ProfileTitle" class="TableMenuRow2">
832 <th class="TableMenuColumn2">Updating Settings</th>
833 </tr>
834 <tr class="TableMenuRow3" id="ProfileUpdate">
835 <td class="TableMenuColumn3">
836 <div style="text-align: center;">
837 <br /><?php echo $errorstr; ?>
838 <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 />&#160;
839 </div>
840 </td></tr>
841 <tr id="ProfileTitleEnd" class="TableMenuRow4">
842 <td class="TableMenuColumn4">&#160;</td>
843 </tr></table></div>
844 <?php } ?>
845 </td></tr>
846 </table>
847 <div>&#160;</div>