Another small update. :P
[iDB.git] / inc / admin / forums.php
blobf7354a0d50c22cd361d58a8d2efec6b980502adf
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-2011 iDB Support - http://idb.berlios.de/
12 Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/
14 $FileInfo: forums.php - Last Update: 06/14/2011 SVN 672 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="forums.php"||$File3Name=="/forums.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']=="retopics") {
38 $admincptitle = " ".$ThemeSet['TitleDivider']." Recounting Topics";
39 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
40 $result=sql_query($query,$SQLStat);
41 $num=sql_num_rows($result);
42 $i=0;
43 while ($i < $num) {
44 $ForumID=sql_result($result,$i,"id");
45 $tquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i ORDER BY \"Pinned\" DESC, \"LastUpdate\" DESC", array($ForumID));
46 $tresult=sql_query($tquery,$SQLStat);
47 $tnum=sql_num_rows($tresult);
48 $rquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i ORDER BY \"TimeStamp\" ASC", array($ForumID));
49 $rresult=sql_query($rquery,$SQLStat);
50 $rnum=sql_num_rows($rresult);
51 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($rnum,$tnum,$ForumID));
52 sql_query($query,$SQLStat);
53 sql_free_result($tresult);
54 sql_free_result($rresult);
55 ++$i; }
56 sql_free_result($result);
58 <div class="TableMenuBorder">
59 <?php if($ThemeSet['TableStyle']=="div") { ?>
60 <div class="TableMenuRow1">
61 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Topics</a></div>
62 <?php } ?>
63 <table class="TableMenu" style="width: 100%;">
64 <?php if($ThemeSet['TableStyle']=="table") { ?>
65 <tr class="TableMenuRow1">
66 <td class="TableMenuColumn1"><span style="float: left;">
67 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Topics</a>
68 </span><span style="float: right;">&nbsp;</span></td>
69 </tr><?php } ?>
70 <tr class="TableMenuRow2">
71 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
72 <span style="float: left;">&nbsp;Recounting Topics: </span>
73 <span style="float: right;">&nbsp;</span>
74 </th>
75 </tr>
76 <tr class="TableMenuRow3">
77 <td class="TableMenuColumn3">
78 <div style="text-align: center;">
79 <br />Forums Topics &amp; Posts stats recounted.<br />
80 <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
81 </div>
82 </td>
83 </tr>
84 <tr class="TableMenuRow4">
85 <td class="TableMenuColumn4">&nbsp;</td>
86 </tr>
87 </table>
88 </div>
89 <?php } if($_GET['act']=="rereplies") {
90 $admincptitle = " ".$ThemeSet['TitleDivider']." Recounting Replies";
91 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" ORDER BY \"Pinned\" DESC, \"LastUpdate\" DESC", array(null));
92 $result=sql_query($query,$SQLStat);
93 $num=sql_num_rows($result);
94 $i=0;
95 while ($i < $num) {
96 $TopicID=sql_result($result,$i,"id");
97 $rquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC", array($TopicID));
98 $rresult=sql_query($rquery,$SQLStat);
99 $rnum=sql_num_rows($rresult);
100 $Nrnum = $rnum - 1;
101 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"NumReply\"=%i WHERE \"id\"=%i", array($Nrnum,$TopicID));
102 sql_query($query,$SQLStat);
103 sql_free_result($rresult);
104 ++$i; }
105 sql_free_result($result);
107 <div class="TableMenuBorder">
108 <?php if($ThemeSet['TableStyle']=="div") { ?>
109 <div class="TableMenuRow1">
110 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Replies</a></div>
111 <?php } ?>
112 <table class="TableMenu" style="width: 100%;">
113 <?php if($ThemeSet['TableStyle']=="table") { ?>
114 <tr class="TableMenuRow1">
115 <td class="TableMenuColumn1"><span style="float: left;">
116 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Recounting Replies</a>
117 </span><span style="float: right;">&nbsp;</span></td>
118 </tr><?php } ?>
119 <tr class="TableMenuRow2">
120 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
121 <span style="float: left;">&nbsp;Recounting Replies: </span>
122 <span style="float: right;">&nbsp;</span>
123 </th>
124 </tr>
125 <tr class="TableMenuRow3">
126 <td class="TableMenuColumn3">
127 <div style="text-align: center;">
128 <br />Topics Replys stats recounted.<br />
129 <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
130 </div>
131 </td>
132 </tr>
133 <tr class="TableMenuRow4">
134 <td class="TableMenuColumn4">&nbsp;</td>
135 </tr>
136 </table>
137 </div>
138 <?php } if($_GET['act']=="fixtnames") {
139 $admincptitle = " ".$ThemeSet['TitleDivider']." Fixing Topic User Names";
140 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" ORDER BY \"TimeStamp\" ASC", array(null));
141 $result=sql_query($query,$SQLStat);
142 $num=sql_num_rows($result);
143 $i=0;
144 while ($i < $num) {
145 $TopicID=sql_result($result,$i,"id");
146 $UsersID=sql_result($result,$i,"UserID");
147 $GuestsName=sql_result($result,$i,"GuestName");
148 $NewUserID = $UsersID;
149 $NewGuestsName = $GuestsName;
150 $NewGuestsName = GetUserName($NewUserID,$Settings['sqltable']);
151 $NewGuestsName = $NewGuestsName['Name'];
152 if($UsersID==-1&&$GuestsName!=null) { $NewGuestsName = $GuestsName; }
153 if($NewGuestsName==null&&$GuestsName!=null&&$UsersID!==0) {
154 $NewUserID = -1; $NewGuestsName = $GuestsName; }
155 if($UsersID==-1&&$GuestsName==null) {
156 $NewUserID = -1; $NewGuestsName = "Guest"; }
157 if($UsersID===0&&$GuestsName!=null) {
158 $NewUserID = -1; $NewGuestsName = "Guest"; }
159 if($UsersID===0&&$GuestsName==null) {
160 $NewUserID = -1; $NewGuestsName = "Guest"; }
161 if($UsersID==$NewUserID&&$GuestsName==$NewGuestsName) {
162 $NewUserID = $UsersID; $NewGuestsName = $GuestsName; }
163 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"UserID\"=%i,\"GuestName\"='%s' WHERE \"id\"=%i", array($NewUserID,$NewGuestsName,$TopicID));
164 sql_query($query,$SQLStat);
165 ++$i; }
166 sql_free_result($result);
168 <div class="TableMenuBorder">
169 <?php if($ThemeSet['TableStyle']=="div") { ?>
170 <div class="TableMenuRow1">
171 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Topic User Names</a></div>
172 <?php } ?>
173 <table class="TableMenu" style="width: 100%;">
174 <?php if($ThemeSet['TableStyle']=="table") { ?>
175 <tr class="TableMenuRow1">
176 <td class="TableMenuColumn1"><span style="float: left;">
177 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Topic User Names</a>
178 </span><span style="float: right;">&nbsp;</span></td>
179 </tr><?php } ?>
180 <tr class="TableMenuRow2">
181 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
182 <span style="float: left;">&nbsp;Fixing Topic User Names: </span>
183 <span style="float: right;">&nbsp;</span>
184 </th>
185 </tr>
186 <tr class="TableMenuRow3">
187 <td class="TableMenuColumn3">
188 <div style="text-align: center;">
189 <br />Topic User Names fixed.<br />
190 <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
191 </div>
192 </td>
193 </tr>
194 <tr class="TableMenuRow4">
195 <td class="TableMenuColumn4">&nbsp;</td>
196 </tr>
197 </table>
198 </div>
199 <?php } if($_GET['act']=="fixrnames") {
200 $admincptitle = " ".$ThemeSet['TitleDivider']." Fixing Reply User Names";
201 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" ORDER BY \"TimeStamp\" ASC", array(null));
202 $result=sql_query($query,$SQLStat);
203 $num=sql_num_rows($result);
204 $i=0;
205 while ($i < $num) {
206 $PostID=sql_result($result,$i,"id");
207 $UsersID=sql_result($result,$i,"UserID");
208 $GuestsName=sql_result($result,$i,"GuestName");
209 $NewUserID = $UsersID;
210 $NewGuestsName = $GuestsName;
211 $NewGuestsName = GetUserName($NewUserID,$Settings['sqltable']);
212 $NewGuestsName = $NewGuestsName['Name'];
213 if($UsersID==-1&&$GuestsName!=null) { $NewGuestsName = $GuestsName; }
214 if($NewGuestsName==null&&$GuestsName!=null&&$UsersID!==0) {
215 $NewUserID = -1; $NewGuestsName = $GuestsName; }
216 if($UsersID==-1&&$GuestsName==null) {
217 $NewUserID = -1; $NewGuestsName = "Guest"; }
218 if($UsersID===0&&$GuestsName!=null) {
219 $NewUserID = -1; $NewGuestsName = "Guest"; }
220 if($UsersID===0&&$GuestsName==null) {
221 $NewUserID = -1; $NewGuestsName = "Guest"; }
222 if($UsersID==$NewUserID&&$GuestsName==$NewGuestsName) {
223 $NewUserID = $UsersID; $NewGuestsName = $GuestsName; }
224 $EditUserID=sql_result($result,$i,"EditUser");
225 $EditUserName=sql_result($result,$i,"EditUserName");
226 $NewEditUserID = $EditUserID;
227 $NewEditUserName = $EditUserName;
228 $NewEditUserName = GetUserName($NewEditUserID,$Settings['sqltable']);
229 $NewEditUserName = $NewEditUserName['Name'];
230 if($EditUserID==-1&&$EditUserName!=null) { $NewEditUserName = $EditUserName; }
231 if($NewEditUserName==null&&$EditUserName!=null&&$EditUserID!==0) {
232 $NewEditUserID = -1; $NewEditUserName = $EditUserName; }
233 if($EditUserID==-1&&$EditUserName==null) {
234 $NewEditUserID = -1; $NewEditUserName = "Guest"; }
235 if($EditUserID===0&&$EditUserName!=null) {
236 $NewEditUserID = "0"; $NewEditUserName = null; }
237 if($EditUserID===0&&$EditUserName==null) {
238 $NewEditUserID = "0"; $NewEditUserName = null; }
239 if($EditUserID==$NewEditUserID&&$EditUserName==$NewEditUserName) {
240 $NewEditUserID = $EditUserID; $NewEditUserName = $EditUserName; }
241 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"UserID\"=%i,\"GuestName\"='%s',\"EditUser\"=%i,\"EditUserName\"='%s' WHERE \"id\"=%i", array($NewUserID,$NewGuestsName,$NewEditUserID,$NewEditUserName,$PostID));
242 sql_query($query,$SQLStat);
243 ++$i; }
244 sql_free_result($result);
246 <div class="TableMenuBorder">
247 <?php if($ThemeSet['TableStyle']=="div") { ?>
248 <div class="TableMenuRow1">
249 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Reply User Names</a></div>
250 <?php } ?>
251 <table class="TableMenu" style="width: 100%;">
252 <?php if($ThemeSet['TableStyle']=="table") { ?>
253 <tr class="TableMenuRow1">
254 <td class="TableMenuColumn1"><span style="float: left;">
255 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Fixing Reply User Names</a>
256 </span><span style="float: right;">&nbsp;</span></td>
257 </tr><?php } ?>
258 <tr class="TableMenuRow2">
259 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
260 <span style="float: left;">&nbsp;Fixing Reply User Names: </span>
261 <span style="float: right;">&nbsp;</span>
262 </th>
263 </tr>
264 <tr class="TableMenuRow3">
265 <td class="TableMenuColumn3">
266 <div style="text-align: center;">
267 <br />Reply User Names fixed.<br />
268 <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
269 </div>
270 </td>
271 </tr>
272 <tr class="TableMenuRow4">
273 <td class="TableMenuColumn4">&nbsp;</td>
274 </tr>
275 </table>
276 </div>
277 <?php } if($_GET['act']=="addforum"&&$_POST['update']!="now") {
278 $admincptitle = " ".$ThemeSet['TitleDivider']." Adding new Forum";
280 <div class="TableMenuBorder">
281 <?php if($ThemeSet['TableStyle']=="div") { ?>
282 <div class="TableMenuRow1">
283 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
284 <?php } ?>
285 <table class="TableMenu" style="width: 100%;">
286 <?php if($ThemeSet['TableStyle']=="table") { ?>
287 <tr class="TableMenuRow1">
288 <td class="TableMenuColumn1"><span style="float: left;">
289 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
290 </span><span style="float: right;">&nbsp;</span></td>
291 </tr><?php } ?>
292 <tr class="TableMenuRow2">
293 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
294 <span style="float: left;">&nbsp;Adding new Forum: </span>
295 <span style="float: right;">&nbsp;</span>
296 </th>
297 </tr>
298 <tr class="TableMenuRow3">
299 <td class="TableMenuColumn3">
300 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
301 <table style="text-align: left;">
302 <tr style="text-align: left;">
303 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumID">Insert ID for forum:</label></td>
304 <td style="width: 50%;"><input type="text" name="ForumID" class="TextBox" id="ForumID" size="20" /></td>
305 </tr><tr style="text-align: left;">
306 <td style="width: 50%;"><label class="TextBoxLabel" for="OrderID">Insert order id forum:</label></td>
307 <td style="width: 50%;"><input type="text" name="OrderID" class="TextBox" id="OrderID" size="20" /></td>
308 </tr><tr style="text-align: left;">
309 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumCatID">Select category for forum:</label></td>
310 <td style="width: 50%;"><select size="1" class="TextBox" name="ForumCatID" id="ForumCatID">
311 <?php
312 $cq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
313 $cr=sql_query($cq,$SQLStat);
314 $eu=sql_num_rows($cr);
315 $nu=0;
316 while ($nu < $eu) {
317 $InCatID=sql_result($cr,$nu,"id");
318 $InCatName=sql_result($cr,$nu,"Name");
319 $EuNuMai = "Eu nu mai vreau";
321 <option value="<?php echo $InCatID; ?>"><?php echo $InCatName; ?></option>
322 <?php ++$nu; }
323 sql_free_result($cr); ?>
324 </select></td>
325 </tr><tr style="text-align: left;">
326 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumName">Insert name for forum:</label></td>
327 <td style="width: 50%;"><input type="text" name="ForumName" class="TextBox" id="ForumName" size="20" /></td>
328 </tr><tr style="text-align: left;">
329 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumDesc">Insert description for forum:</label></td>
330 <td style="width: 50%;"><input type="text" name="ForumDesc" class="TextBox" id="ForumDesc" size="20" /></td>
331 </tr><tr style="text-align: left;">
332 <td style="width: 50%;"><label class="TextBoxLabel" for="ShowForum">Show forum:</label></td>
333 <td style="width: 50%;"><select size="1" class="TextBox" name="ShowForum" id="ShowForum">
334 <option selected="selected" value="yes">yes</option>
335 <option value="no">no</option>
336 </select></td>
337 </tr><tr style="text-align: left;">
338 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumType">Insert forum type:</label></td>
339 <td style="width: 50%;"><select size="1" class="TextBox" name="ForumType" id="ForumType">
340 <option selected="selected" value="forum">Forum</option>
341 <option value="subforum">SubForum</option>
342 <option value="redirect">Redirect</option>
343 </select></td>
344 </tr><tr style="text-align: left;">
345 <td style="width: 50%;"><label class="TextBoxLabel" for="RedirectURL">Insert Redirect URL for redirect forum:</label></td>
346 <td style="width: 50%;"><input type="text" name="RedirectURL" class="TextBox" id="RedirectURL" size="20" value="http://" /></td>
347 </tr><tr style="text-align: left;">
348 <td style="width: 50%;"><label class="TextBoxLabel" for="InSubForum">In SubForum:</label></td>
349 <td style="width: 50%;"><select size="1" class="TextBox" name="InSubForum" id="InSubForum">
350 <option selected="selected" value="0">none</option>
351 <?php
352 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"InSubForum\"=0 AND \"ForumType\"='subforum' ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
353 $fr=sql_query($fq,$SQLStat);
354 $ai=sql_num_rows($fr);
355 $fi=0;
356 while ($fi < $ai) {
357 $InForumID=sql_result($fr,$fi,"id");
358 $InForumName=sql_result($fr,$fi,"Name");
359 $InForumType=sql_result($fr,$fi,"ForumType");
360 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
361 if ($InForumType!="redirect"&&$AiFiInSubForum=="0") {
363 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
364 <?php } ++$fi; }
365 sql_free_result($fr); ?>
366 </select></td>
367 </tr><tr style="text-align: left;">
368 <td style="width: 50%;"><label class="TextBoxLabel" for="PostCountAdd">Add to post count:</label></td>
369 <td style="width: 50%;"><select size="1" class="TextBox" name="PostCountAdd" id="PostCountAdd">
370 <option selected="selected" value="on">yes</option>
371 <option value="off">no</option>
372 </select></td>
373 </tr><tr style="text-align: left;">
374 <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostView">Number of posts to view forum:</label></td>
375 <td style="width: 50%;"><input type="text" class="TextBox" size="20" name="NumPostView" id="NumPostView" /></td>
376 </tr><tr style="text-align: left;">
377 <td style="width: 50%;"><label class="TextBoxLabel" for="NumKarmaView">Amount of karma to view forum:</label></td>
378 <td style="width: 50%;"><input type="text" class="TextBox" size="20" name="NumKarmaView" id="NumKarmaView" /></td>
379 </tr><tr style="text-align: left;">
380 <td style="width: 50%;"><label class="TextBoxLabel" for="CanHaveTopics">Allow topics in forum:</label></td>
381 <td style="width: 50%;"><select size="1" class="TextBox" name="CanHaveTopics" id="CanHaveTopics">
382 <option selected="selected" value="yes">yes</option>
383 <option value="no">no</option>
384 </select></td>
385 </tr><tr style="text-align: left;">
386 <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostHotTopic">Number of posts for hot topic:</label></td>
387 <td style="width: 50%;"><input type="text" class="TextBox" size="20" name="NumPostHotTopic" id="NumPostHotTopic" /></td>
388 </tr><tr style="text-align: left;">
389 <td style="width: 50%;"><label class="TextBoxLabel" for="CPermissions">Copy permissions from:</label></td>
390 <td style="width: 50%;"><select size="1" class="TextBox" name="CPermissions" id="CPermissions">
391 <option selected="selected" value="0">none</option>
392 <?php
393 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
394 $fr=sql_query($fq,$SQLStat);
395 $ai=sql_num_rows($fr);
396 $fi=0;
397 while ($fi < $ai) {
398 $InForumID=sql_result($fr,$fi,"id");
399 $InForumName=sql_result($fr,$fi,"Name");
400 $InForumType=sql_result($fr,$fi,"ForumType");
401 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
403 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
404 <?php ++$fi; }
405 sql_free_result($fr); ?>
406 </select></td>
407 </tr></table>
408 <table style="text-align: left;">
409 <tr style="text-align: left;">
410 <td style="width: 100%;">
411 <input type="hidden" name="act" value="addforum" style="display: none;" />
412 <input type="hidden" name="update" value="now" style="display: none;" />
413 <input type="submit" class="Button" value="Add Forum" name="Apply_Changes" />
414 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
415 </td></tr></table>
416 </form>
417 </td>
418 </tr>
419 <tr class="TableMenuRow4">
420 <td class="TableMenuColumn4">&nbsp;</td>
421 </tr>
422 </table>
423 </div>
424 <?php } if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") {
425 $_POST['ForumName'] = stripcslashes(htmlspecialchars($_POST['ForumName'], ENT_QUOTES, $Settings['charset']));
426 //$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
427 $_POST['ForumName'] = remove_spaces($_POST['ForumName']);
428 $_POST['ForumDesc'] = stripcslashes(htmlspecialchars($_POST['ForumDesc'], ENT_QUOTES, $Settings['charset']));
429 //$_POST['ForumDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumDesc']);
430 $_POST['ForumDesc'] = remove_spaces($_POST['ForumDesc']);
431 $sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
432 $sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."forums\" WHERE \"OrderID\"=%i AND \"CategoryID\"=%i AND \"InSubForum\"=%i LIMIT 1", array($_POST['OrderID'],$_POST['ForumCatID'],$_POST['InSubForum'])),$SQLStat);
433 $id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
434 sql_free_result($sql_id_check); sql_free_result($sql_order_check);
435 $errorstr = "";
436 if ($_POST['NumPostView']==null||
437 !is_numeric($_POST['NumPostView'])) {
438 $_POST['NumPostView'] = 0; }
439 if ($_POST['NumKarmaView']==null||
440 !is_numeric($_POST['NumKarmaView'])) {
441 $_POST['NumKarmaView'] = 0; }
442 if ($Settings['hot_topic_num']==null||
443 !is_numeric($Settings['hot_topic_num'])) {
444 $Settings['hot_topic_num'] = 10; }
445 if ($_POST['NumPostHotTopic']==null||
446 !is_numeric($_POST['NumPostHotTopic'])) {
447 $_POST['NumPostHotTopic'] = $Settings['hot_topic_num']; }
448 if ($_POST['ForumName']==null||
449 $_POST['ForumName']=="ShowMe") { $Error="Yes";
450 $errorstr = $errorstr."You need to enter a forum name.<br />\n"; }
451 if ($_POST['ForumDesc']==null) { $Error="Yes";
452 $errorstr = $errorstr."You need to enter a description.<br />\n"; }
453 if ($_POST['ForumID']==null||
454 !is_numeric($_POST['ForumID'])) { $Error="Yes";
455 $errorstr = $errorstr."You need to enter a forum ID.<br />\n"; }
456 if($id_check > 0) { $Error="Yes";
457 $errorstr = $errorstr."This ID number is already used.<br />\n"; }
458 if($order_check > 0) { $Error="Yes";
459 $errorstr = $errorstr."This order number is already used.<br />\n"; }
460 if (pre_strlen($_POST['ForumName'])>"150") { $Error="Yes";
461 $errorstr = $errorstr."Your Forum Name is too big.<br />\n"; }
462 if (pre_strlen($_POST['ForumDesc'])>"300") { $Error="Yes";
463 $errorstr = $errorstr."Your Forum Description is too big.<br />\n"; }
464 if ($Error!="Yes") {
465 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
466 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
467 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."forums\" (\"id\", \"CategoryID\", \"OrderID\", \"Name\", \"ShowForum\", \"ForumType\", \"InSubForum\", \"RedirectURL\", \"Redirects\", \"NumViews\", \"Description\", \"PostCountAdd\", \"PostCountView\", \"KarmaCountView\", \"CanHaveTopics\", \"HotTopicPosts\", \"NumPosts\", \"NumTopics\") VALUES\n".
468 "(%i, %i, %i, '%s', '%s', '%s', %i, '%s', 0, 0, '%s', '%s', %i, %i, '%s', %i, 0, 0)", array($_POST['ForumID'],$_POST['ForumCatID'],$_POST['OrderID'],$_POST['ForumName'],$_POST['ShowForum'],$_POST['ForumType'],$_POST['InSubForum'],$_POST['RedirectURL'],$_POST['ForumDesc'],$_POST['PostCountAdd'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['CanHaveTopics'],$_POST['NumPostHotTopic']));
469 sql_query($query,$SQLStat);
470 if(!is_numeric($_POST['CPermissions'])) { $_POST['CPermissions'] = "0"; }
471 $getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\" ORDER BY \"PermissionID\" ASC", array(null));
472 $getperidr=sql_query($getperidq,$SQLStat);
473 $getperidnum=sql_num_rows($getperidr);
474 $getperidi = 0;
475 $nextperid = null;
477 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"
478 ||$Settings['sqltype']=="pgsql") {
479 $nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
480 if($Settings['sqltype']=="sqlite") {
481 $nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
483 while ($getperidi < $getperidnum) {
484 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"
485 ||$Settings['sqltype']=="pgsql") {
486 $getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
487 if($Settings['sqltype']=="sqlite") {
488 $getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
489 if($_POST['CPermissions']=="0") {
490 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i", array($getperidID)); }
491 if($_POST['CPermissions']!="0") {
492 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i", array($getperidID,$_POST['CPermissions'])); }
493 $getperidr2=sql_query($getperidq2,$SQLStat);
494 $getperidnum2=sql_num_rows($getperidr2);
495 $PermissionNum=sql_result($getperidr2,0,"id");
496 $PermissionID=sql_result($getperidr2,0,"PermissionID");
497 $PermissionName=sql_result($getperidr2,0,"Name");
498 $PermissionForumID=sql_result($getperidr2,0,"ForumID");
499 $CanViewForum=sql_result($getperidr2,0,"CanViewForum");
500 $CanMakePolls=sql_result($getperidr2,0,"CanMakePolls");
501 $CanMakeTopics=sql_result($getperidr2,0,"CanMakeTopics");
502 $CanMakeReplys=sql_result($getperidr2,0,"CanMakeReplys");
503 $CanMakeReplysCT=sql_result($getperidr2,0,"CanMakeReplysCT");
504 $CanEditTopics=sql_result($getperidr2,0,"CanEditTopics");
505 $CanEditTopicsCT=sql_result($getperidr2,0,"CanEditTopicsCT");
506 $CanEditReplys=sql_result($getperidr2,0,"CanEditReplys");
507 $CanEditReplysCT=sql_result($getperidr2,0,"CanEditReplysCT");
508 $CanDeleteTopics=sql_result($getperidr2,0,"CanDeleteTopics");
509 $CanDeleteTopicsCT=sql_result($getperidr2,0,"CanDeleteTopicsCT");
510 $CanDeleteReplys=sql_result($getperidr2,0,"CanDeleteReplys");
511 $CanDeleteReplysCT=sql_result($getperidr2,0,"CanDeleteReplysCT");
512 $CanCloseTopics=sql_result($getperidr2,0,"CanCloseTopics");
513 $CanPinTopics=sql_result($getperidr2,0,"CanPinTopics");
514 $CanExecPHP=sql_result($getperidr2,0,"CanExecPHP");
515 $CanDoHTML=sql_result($getperidr2,0,"CanDoHTML");
516 $CanUseBBags=sql_result($getperidr2,0,"CanUseBBags");
517 $CanModForum=sql_result($getperidr2,0,"CanModForum");
518 sql_free_result($getperidr2);
519 if($_POST['CPermissions']=="0") {
520 $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\", \"CanUseBBags\", \"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,$_POST['ForumID'])); }
521 if($_POST['CPermissions']!="0") {
522 if($getperidnum2>0) {
523 $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\", \"CanUseBBags\", \"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,$_POST['ForumID'],$CanViewForum,$CanMakePolls,$CanMakeTopics,$CanMakeReplys,$CanMakeReplysCT,$CanEditTopics,$CanEditTopicsCT,$CanEditReplys,$CanEditReplysCT,$CanDeleteTopics,$CanDeleteTopicsCT,$CanDeleteReplys,$CanDeleteReplysCT,$CanCloseTopics,$CanPinTopics,$CanExecPHP,$CanDoHTML,$CanUseBBags,$CanModForum)); }
524 if($getperidnum2<=0) {
525 $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\", \"CanUseBBags\", \"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,$_POST['ForumID'])); } }
526 sql_query($query,$SQLStat);
527 ++$getperidi; /*++$nextperid;*/ }
528 sql_free_result($getperidr); } }
529 if($_GET['act']=="deleteforum"&&$_POST['update']!="now") {
530 $admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Forum";
532 <div class="TableMenuBorder">
533 <?php if($ThemeSet['TableStyle']=="div") { ?>
534 <div class="TableMenuRow1">
535 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
536 <?php } ?>
537 <table class="TableMenu" style="width: 100%;">
538 <?php if($ThemeSet['TableStyle']=="table") { ?>
539 <tr class="TableMenuRow1">
540 <td class="TableMenuColumn1"><span style="float: left;">
541 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=addforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
542 </span><span style="float: right;">&nbsp;</span></td>
543 </tr><?php } ?>
544 <tr class="TableMenuRow2">
545 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
546 <span style="float: left;">&nbsp;Deleting a Forum: </span>
547 <span style="float: right;">&nbsp;</span>
548 </th>
549 </tr>
550 <tr class="TableMenuRow3">
551 <td class="TableMenuColumn3">
552 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=deleteforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
553 <table style="text-align: left;">
554 <tr style="text-align: left;">
555 <td style="width: 50%;"><label class="TextBoxLabel" for="DelForums">Delete all forums in subforum:</label></td>
556 <td style="width: 50%;"><select size="1" class="TextBox" name="DelForums" id="DelForums">
557 <option selected="selected" value="yes">yes</option>
558 <option value="no">no</option>
559 </select></td>
560 </tr><tr style="text-align: left;">
561 <td style="width: 50%;"><label class="TextBoxLabel" for="DelTopics">Delete all topics in (sub)forum:</label></td>
562 <td style="width: 50%;"><select size="1" class="TextBox" name="DelTopics" id="DelTopics">
563 <option selected="selected" value="yes">yes</option>
564 <option value="no">no</option>
565 </select></td>
566 </tr><tr style="text-align: left;">
567 <td style="width: 50%;"><label class="TextBoxLabel" for="DelPermission">Delete all permission sets in (sub)forum:</label></td>
568 <td style="width: 50%;"><select size="1" class="TextBox" name="DelPermission" id="DelPermission">
569 <option selected="selected" value="yes">yes</option>
570 <option value="no">no</option>
571 </select></td>
572 </tr><tr style="text-align: left;">
573 <td style="width: 50%;"><label class="TextBoxLabel" for="DelID">Delete Forum:</label></td>
574 <td style="width: 50%;"><select size="1" class="TextBox" name="DelID" id="DelID">
575 <?php
576 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
577 $fr=sql_query($fq,$SQLStat);
578 $ai=sql_num_rows($fr);
579 $fi=0;
580 while ($fi < $ai) {
581 $InForumID=sql_result($fr,$fi,"id");
582 $InForumName=sql_result($fr,$fi,"Name");
583 $InForumType=sql_result($fr,$fi,"ForumType");
584 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
586 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
587 <?php ++$fi; }
588 sql_free_result($fr); ?>
589 </select></td>
590 </tr></table>
591 <table style="text-align: left;">
592 <tr style="text-align: left;">
593 <td style="width: 100%;">
594 <input type="hidden" name="act" value="deleteforum" style="display: none;" />
595 <input type="hidden" name="update" value="now" style="display: none;" />
596 <input type="submit" class="Button" value="Delete Forum" name="Apply_Changes" />
597 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
598 </td></tr></table>
599 </form>
600 </td>
601 </tr>
602 <tr class="TableMenuRow4">
603 <td class="TableMenuColumn4">&nbsp;</td>
604 </tr>
605 </table>
606 </div>
607 <?php } if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") {
608 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
609 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['DelID']));
610 $preresult=sql_query($prequery,$SQLStat);
611 $prenum=sql_num_rows($preresult);
612 $errorstr = ""; $Error = null;
613 if (!is_numeric($_POST['DelID'])) { $Error="Yes";
614 $errorstr = $errorstr."You need to enter a forum ID.<br />\n"; }
615 if($prenum>0&&$Error!="Yes") {
616 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i", array($_POST['DelID']));
617 sql_query($dtquery,$SQLStat);
618 if($_POST['DelForums']=="yes") {
619 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
620 sql_query($dtquery,$SQLStat);
621 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
622 sql_query($dtquery,$SQLStat); }
623 if($_POST['DelPermission']=="yes") {
624 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
625 sql_query($dtquery,$SQLStat); }
626 if($_POST['DelForums']=="yes") {
627 $apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"InSubForum\"=%i ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_POST['DelID']));
628 $apcresult=sql_query($apcquery,$SQLStat);
629 $apcnum=sql_num_rows($apcresult);
630 $apci=0; $apcl=1; if($apcnum>=1) {
631 while ($apci < $apcnum) {
632 $DelSubsForumID=sql_result($apcresult,$apci,"id");
633 if($_POST['DelForums']=="yes") {
634 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
635 sql_query($dtquery,$SQLStat);
636 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
637 sql_query($dtquery,$SQLStat); }
638 if($_POST['DelPermission']=="yes") {
639 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
640 sql_query($dtquery,$SQLStat); }
641 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i", array($DelSubsForumID));
642 sql_query($dtquery,$SQLStat);
643 ++$apci; }
644 sql_free_result($apcresult); } }
646 <?php } } if($_GET['act']=="editforum"&&$_POST['update']!="now") {
647 $admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Forum";
648 if(!isset($_POST['id'])) {
650 <div class="TableMenuBorder">
651 <?php if($ThemeSet['TableStyle']=="div") { ?>
652 <div class="TableMenuRow1">
653 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
654 <?php } ?>
655 <table class="TableMenu" style="width: 100%;">
656 <?php if($ThemeSet['TableStyle']=="table") { ?>
657 <tr class="TableMenuRow1">
658 <td class="TableMenuColumn1"><span style="float: left;">
659 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
660 </span><span style="float: right;">&nbsp;</span></td>
661 </tr><?php } ?>
662 <tr class="TableMenuRow2">
663 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
664 <span style="float: left;">&nbsp;Editing a Forum: </span>
665 <span style="float: right;">&nbsp;</span>
666 </th>
667 </tr>
668 <tr class="TableMenuRow3">
669 <td class="TableMenuColumn3">
670 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
671 <table style="text-align: left;">
672 <tr style="text-align: left;">
673 <td style="width: 50%;"><label class="TextBoxLabel" for="id">Forum to Edit:</label></td>
674 <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
675 <?php
676 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC, \"OrderID\" ASC", array(null));
677 $fr=sql_query($fq,$SQLStat);
678 $ai=sql_num_rows($fr);
679 $fi=0;
680 while ($fi < $ai) {
681 $InForumID=sql_result($fr,$fi,"id");
682 $InForumName=sql_result($fr,$fi,"Name");
683 $InForumType=sql_result($fr,$fi,"ForumType");
684 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
686 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
687 <?php ++$fi; }
688 sql_free_result($fr); ?>
689 </select></td>
690 </tr></table>
691 <table style="text-align: left;">
692 <tr style="text-align: left;">
693 <td style="width: 100%;">
694 <input type="hidden" name="act" value="editforum" style="display: none;" />
695 <input type="submit" class="Button" value="Edit Forum" 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(isset($_POST['id'])) {
707 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
708 $preresult=sql_query($prequery,$SQLStat);
709 $prenum=sql_num_rows($preresult);
710 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);
711 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
712 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
713 if($prenum>=1) {
714 $ForumID=sql_result($preresult,0,"id");
715 $ForumCatID=sql_result($preresult,0,"CategoryID");
716 $ForumOrder=sql_result($preresult,0,"OrderID");
717 $ForumName=sql_result($preresult,0,"Name");
718 $ShowForum=sql_result($preresult,0,"ShowForum");
719 $ForumType=sql_result($preresult,0,"ForumType");
720 $InSubForum=sql_result($preresult,0,"InSubForum");
721 $RedirectURL=sql_result($preresult,0,"RedirectURL");
722 $RedirectTimes=sql_result($preresult,0,"Redirects");
723 $NumberViews=sql_result($preresult,0,"NumViews");
724 $ForumDescription=sql_result($preresult,0,"Description");
725 $PostCountAdd=sql_result($preresult,0,"PostCountAdd");
726 $PostCountView=sql_result($preresult,0,"PostCountView");
727 $KarmaCountView=sql_result($preresult,0,"KarmaCountView");
728 $CanHaveTopics=sql_result($preresult,0,"CanHaveTopics");
729 $HotTopicPosts=sql_result($preresult,0,"HotTopicPosts");
730 $NumberPosts=sql_result($preresult,0,"NumPosts");
731 $NumberTopics=sql_result($preresult,0,"NumTopics");
732 sql_free_result($preresult);
733 $ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
735 <div class="TableMenuBorder">
736 <?php if($ThemeSet['TableStyle']=="div") { ?>
737 <div class="TableMenuRow1">
738 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a></div>
739 <?php } ?>
740 <table class="TableMenu" style="width: 100%;">
741 <?php if($ThemeSet['TableStyle']=="table") { ?>
742 <tr class="TableMenuRow1">
743 <td class="TableMenuColumn1"><span style="float: left;">
744 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Forum Manager</a>
745 </span><span style="float: right;">&nbsp;</span></td>
746 </tr><?php } ?>
747 <tr class="TableMenuRow2">
748 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
749 <span style="float: left;">&nbsp;Editing a Forum: </span>
750 <span style="float: right;">&nbsp;</span>
751 </th>
752 </tr>
753 <tr class="TableMenuRow3">
754 <td class="TableMenuColumn3">
755 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=editforum",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
756 <table style="text-align: left;">
757 <tr style="text-align: left;">
758 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumID">Insert ID for forum:</label></td>
759 <td style="width: 50%;"><input type="text" name="ForumID" class="TextBox" id="ForumID" size="20" value="<?php echo $ForumID; ?>" /></td>
760 </tr><tr style="text-align: left;">
761 <td style="width: 50%;"><label class="TextBoxLabel" for="OrderID">Insert order id forum:</label></td>
762 <td style="width: 50%;"><input type="text" name="OrderID" class="TextBox" id="OrderID" size="20" value="<?php echo $ForumOrder; ?>" /></td>
763 </tr><tr style="text-align: left;">
764 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumCatID">Select category for forum:</label></td>
765 <td style="width: 50%;"><select size="1" class="TextBox" name="ForumCatID" id="ForumCatID">
766 <?php
767 $cq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
768 $cr=sql_query($cq,$SQLStat);
769 $eu=sql_num_rows($cr);
770 $nu=0;
771 while ($nu < $eu) {
772 $InCatID=sql_result($cr,$nu,"id");
773 $InCatName=sql_result($cr,$nu,"Name");
774 $EuNuMai = "Eu nu mai vreau";
775 if($ForumCatID==$InCatID) {
777 <option value="<?php echo $InCatID; ?>" selected="selected"><?php echo $InCatName; ?></option>
778 <?php } if($ForumCatID!=$InCatID) { ?>
779 <option value="<?php echo $InCatID; ?>"><?php echo $InCatName; ?></option>
780 <?php } ++$nu; }
781 sql_free_result($cr); ?>
782 </select></td>
783 </tr><tr style="text-align: left;">
784 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumName">Insert name for forum:</label></td>
785 <td style="width: 50%;"><input type="text" name="ForumName" class="TextBox" id="ForumName" size="20" value="<?php echo $ForumName; ?>" /></td>
786 </tr><tr style="text-align: left;">
787 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumDesc">Insert description for forum:</label></td>
788 <td style="width: 50%;"><input type="text" name="ForumDesc" class="TextBox" id="ForumDesc" size="20" value="<?php echo $ForumDescription; ?>" /></td>
789 </tr><tr style="text-align: left;">
790 <td style="width: 50%;"><label class="TextBoxLabel" for="ShowForum">Show forum:</label></td>
791 <td style="width: 50%;"><select size="1" class="TextBox" name="ShowForum" id="ShowForum">
792 <option <?php if($ShowForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
793 <option <?php if($ShowForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
794 </select></td>
795 </tr><tr style="text-align: left;">
796 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumType">Insert forum type:</label></td>
797 <td style="width: 50%;"><select size="1" class="TextBox" name="ForumType" id="ForumType">
798 <option <?php if($ForumType=="forum") { echo "selected=\"selected\" "; } ?>value="forum">Forum</option>
799 <option <?php if($ForumType=="subforum") { echo "selected=\"selected\" "; } ?>value="subforum">SubForum</option>
800 <option <?php if($ForumType=="redirect") { echo "selected=\"selected\" "; } ?>value="redirect">Redirect</option>
801 </select></td>
802 </tr><tr style="text-align: left;">
803 <td style="width: 50%;"><label class="TextBoxLabel" for="RedirectURL">Insert Redirect URL for redirect forum:</label></td>
804 <td style="width: 50%;"><input type="text" name="RedirectURL" class="TextBox" id="RedirectURL" size="20" value="<?php echo htmlentities($RedirectURL, ENT_QUOTES, $Settings['charset']); ?>" /></td>
805 </tr><tr style="text-align: left;">
806 <td style="width: 50%;"><label class="TextBoxLabel" for="InSubForum">In SubForum:</label></td>
807 <td style="width: 50%;"><select size="1" class="TextBox" name="InSubForum" id="InSubForum">
808 <option selected="selected" value="0">none</option>
809 <?php
810 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"InSubForum\"=0 AND \"id\"<>%i AND \"ForumType\"='subforum' ORDER BY \"id\" ASC, \"OrderID\" ASC", array($ForumID));
811 $fr=sql_query($fq,$SQLStat);
812 $ai=sql_num_rows($fr);
813 $fi=0;
814 while ($fi < $ai) {
815 $InForumID=sql_result($fr,$fi,"id");
816 $InForumName=sql_result($fr,$fi,"Name");
817 $InForumType=sql_result($fr,$fi,"ForumType");
818 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
819 if ($InForumType!="redirect"&&$AiFiInSubForum=="0") {
820 if($InSubForum==$InForumID) {
822 <option value="<?php echo $InForumID; ?>" selected="selected"><?php echo $InForumName; ?></option>
823 <?php } if($InSubForum!=$InForumID) { ?>
824 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
825 <?php } } ++$fi; }
826 sql_free_result($fr); ?>
827 </select></td>
828 </tr><tr style="text-align: left;">
829 <td style="width: 50%;"><label class="TextBoxLabel" for="PostCountAdd">Add to post count:</label></td>
830 <td style="width: 50%;"><select size="1" class="TextBox" name="PostCountAdd" id="PostCountAdd">
831 <option <?php if($PostCountAdd=="on") { echo "selected=\"selected\" "; } ?>value="on">yes</option>
832 <option <?php if($PostCountAdd=="off") { echo "selected=\"selected\" "; } ?>value="off">no</option>
833 </select></td>
834 </tr><tr style="text-align: left;">
835 <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostView">Number of posts to view forum:</label></td>
836 <td style="width: 50%;"><input type="text" class="TextBox" size="20" name="NumPostView" id="NumPostView" value="<?php echo $PostCountView; ?>" /></td>
837 </tr><tr style="text-align: left;">
838 <td style="width: 50%;"><label class="TextBoxLabel" for="NumKarmaView">Amount of karma to view forum:</label></td>
839 <td style="width: 50%;"><input type="text" class="TextBox" size="20" name="NumKarmaView" id="NumKarmaView" value="<?php echo $KarmaCountView; ?>" /></td>
840 </tr><tr style="text-align: left;">
841 <td style="width: 50%;"><label class="TextBoxLabel" for="CanHaveTopics">Allow topics in forum:</label></td>
842 <td style="width: 50%;"><select size="1" class="TextBox" name="CanHaveTopics" id="CanHaveTopics">
843 <option <?php if($CanHaveTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
844 <option <?php if($CanHaveTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
845 </select></td>
846 </tr><tr style="text-align: left;">
847 <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostHotTopic">Number of posts for hot topic:</label></td>
848 <td style="width: 50%;"><input type="text" class="TextBox" size="20" name="NumPostHotTopic" id="NumPostHotTopic" value="<?php echo $HotTopicPosts; ?>" /></td>
849 </tr></table>
850 <table style="text-align: left;">
851 <tr style="text-align: left;">
852 <td style="width: 100%;">
853 <input type="hidden" name="act" value="editforum" style="display: none;" />
854 <input type="hidden" name="update" value="now" style="display: none;" />
855 <input type="hidden" name="id" value="<?php echo $ForumID; ?>" style="display: none;" />
856 <input type="submit" class="Button" value="Edit Forum" name="Apply_Changes" />
857 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
858 </td></tr></table>
859 </form>
860 </td>
861 </tr>
862 <tr class="TableMenuRow4">
863 <td class="TableMenuColumn4">&nbsp;</td>
864 </tr>
865 </table>
866 </div>
867 <?php } } } if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
868 isset($_POST['id'])) {
869 $_POST['ForumName'] = stripcslashes(htmlspecialchars($_POST['ForumName'], ENT_QUOTES, $Settings['charset']));
870 //$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
871 $_POST['ForumName'] = remove_spaces($_POST['ForumName']);
872 $_POST['ForumDesc'] = stripcslashes(htmlspecialchars($_POST['ForumDesc'], ENT_QUOTES, $Settings['charset']));
873 //$_POST['ForumDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumDesc']);
874 $_POST['ForumDesc'] = remove_spaces($_POST['ForumDesc']);
875 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
876 $preresult=sql_query($prequery,$SQLStat);
877 $prenum=sql_num_rows($preresult);
878 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);
879 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
880 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
881 if($prenum>=1) {
882 $OldID=sql_result($preresult,0,"id");
883 $OldOrder=sql_result($preresult,0,"OrderID");
884 sql_free_result($preresult);
885 $sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
886 $sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."forums\" WHERE \"OrderID\"=%i AND \"CategoryID\"=%i AND \"InSubForum\"=%i LIMIT 1", array($_POST['OrderID'],$_POST['ForumCatID'],$_POST['InSubForum'])),$SQLStat);
887 $id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
888 sql_free_result($sql_id_check); sql_free_result($sql_order_check);
889 if ($_POST['NumPostView']==null||
890 !is_numeric($_POST['NumPostView'])) {
891 $_POST['NumPostView'] = 0; }
892 if ($_POST['NumKarmaView']==null||
893 !is_numeric($_POST['NumKarmaView'])) {
894 $_POST['NumKarmaView'] = 0; }
895 if ($Settings['hot_topic_num']==null||
896 !is_numeric($Settings['hot_topic_num'])) {
897 $Settings['hot_topic_num'] = 10; }
898 if ($_POST['NumPostHotTopic']==null||
899 !is_numeric($_POST['NumPostHotTopic'])) {
900 $_POST['NumPostHotTopic'] = $Settings['hot_topic_num']; }
901 if ($_POST['ForumName']==null||
902 $_POST['ForumName']=="ShowMe") { $Error="Yes";
903 $errorstr = $errorstr."You need to enter a forum name.<br />\n"; }
904 if ($_POST['ForumDesc']==null) { $Error="Yes";
905 $errorstr = $errorstr."You need to enter a description.<br />\n"; }
906 if ($_POST['ForumID']==null||
907 !is_numeric($_POST['ForumID'])) { $Error="Yes";
908 $errorstr = $errorstr."You need to enter a forum ID.<br />\n"; }
909 if($id_check > 0&&$_POST['ForumID']!=$OldID) { $Error="Yes";
910 $errorstr = $errorstr."This ID number is already used.<br />\n"; }
911 if($order_check > 0&&$_POST['OrderID']!=$OldOrder) { $Error="Yes";
912 $errorstr = $errorstr."This order number is already used.<br />\n"; }
913 if (pre_strlen($_POST['ForumName'])>"150") { $Error="Yes";
914 $errorstr = $errorstr."Your Forum Name is too big.<br />\n"; }
915 if (pre_strlen($_POST['ForumDesc'])>"300") { $Error="Yes";
916 $errorstr = $errorstr."Your Forum Description is too big.<br />\n"; }
917 if ($Error!="Yes") {
918 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
919 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
920 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"id\"=%i,\"CategoryID\"=%i,\"OrderID\"=%i,\"Name\"='%s',\"ShowForum\"='%s',\"ForumType\"='%s',\"InSubForum\"=%i,\"RedirectURL\"='%s',\"Description\"='%s',\"PostCountAdd\"='%s',\"PostCountView\"=%i,\"KarmaCountView\"=%i,\"CanHaveTopics\"='%s',\"HotTopicPosts\"=%i WHERE \"id\"=%i", array($_POST['ForumID'],$_POST['ForumCatID'],$_POST['OrderID'],$_POST['ForumName'],$_POST['ShowForum'],$_POST['ForumType'],$_POST['InSubForum'],$_POST['RedirectURL'],$_POST['ForumDesc'],$_POST['PostCountAdd'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['CanHaveTopics'],$_POST['NumPostHotTopic'],$_POST['id']));
921 sql_query($query,$SQLStat);
922 if($_POST['ForumID']!=$_POST['id']) {
923 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"InSubForum\"=%i WHERE \"InSubForum\"=%i", array($_POST['ForumID'],$_POST['id']));
924 sql_query($query,$SQLStat);
925 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"ForumID\"=%i,\"OldForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['ForumID'],$_POST['id']));
926 sql_query($query,$SQLStat);
927 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"ForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['id']));
928 sql_query($query,$SQLStat); }
929 $queryz = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"ForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['id']));
930 sql_query($queryz,$SQLStat); } } }
931 if($_GET['act']=="fpermissions"&&$_POST['update']!="now") {
932 $admincptitle = " ".$ThemeSet['TitleDivider']." Forum Permissions Manager";
933 if(!isset($_POST['id'])) {
935 <div class="TableMenuBorder">
936 <?php if($ThemeSet['TableStyle']=="div") { ?>
937 <div class="TableMenuRow1">
938 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
939 <?php } ?>
940 <table class="TableMenu" style="width: 100%;">
941 <?php if($ThemeSet['TableStyle']=="table") { ?>
942 <tr class="TableMenuRow1">
943 <td class="TableMenuColumn1"><span style="float: left;">
944 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
945 </span><span style="float: right;">&nbsp;</span></td>
946 </tr><?php } ?>
947 <tr class="TableMenuRow2">
948 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
949 <span style="float: left;">&nbsp;Forum Permissions Manager: </span>
950 <span style="float: right;">&nbsp;</span>
951 </th>
952 </tr>
953 <tr class="TableMenuRow3">
954 <td class="TableMenuColumn3">
955 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
956 <table style="text-align: left;">
957 <tr style="text-align: left;">
958 <td style="width: 50%;"><label class="TextBoxLabel" for="id">Permission to view:</label></td>
959 <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
960 <?php
961 $getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\"", array(null));
962 $getperidr=sql_query($getperidq,$SQLStat);
963 $getperidnum=sql_num_rows($getperidr);
964 $getperidi = 0;
965 while ($getperidi < $getperidnum) {
966 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"
967 ||$Settings['sqltype']=="pgsql") {
968 $getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
969 if($Settings['sqltype']=="sqlite") {
970 $getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
971 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i ORDER BY \"ForumID\" ASC", array($getperidID));
972 $getperidr2=sql_query($getperidq2,$SQLStat);
973 $getperidnum2=sql_num_rows($getperidr2);
974 $getperidName=sql_result($getperidr2,0,"Name");
975 sql_free_result($getperidr2);
977 <option value="<?php echo $getperidID; ?>"><?php echo $getperidName; ?></option>
978 <?php ++$getperidi; }
979 sql_free_result($getperidr); ?>
980 </select></td>
981 </tr></table>
982 <table style="text-align: left;">
983 <tr style="text-align: left;">
984 <td style="width: 100%;">
985 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
986 <input type="submit" class="Button" value="View Permission" name="Apply_Changes" />
987 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
988 </td></tr></table>
989 </form>
990 </td>
991 </tr>
992 <tr class="TableMenuRow4">
993 <td class="TableMenuColumn4">&nbsp;</td>
994 </tr>
995 </table>
996 </div>
997 <?php } if(isset($_POST['id'])&&$_POST['subact']==null) { ?>
998 <div class="TableMenuBorder">
999 <?php if($ThemeSet['TableStyle']=="div") { ?>
1000 <div class="TableMenuRow1">
1001 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
1002 <?php } ?>
1003 <table class="TableMenu" style="width: 100%;">
1004 <?php if($ThemeSet['TableStyle']=="table") { ?>
1005 <tr class="TableMenuRow1">
1006 <td class="TableMenuColumn1"><span style="float: left;">
1007 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
1008 </span><span style="float: right;">&nbsp;</span></td>
1009 </tr><?php } ?>
1010 <tr class="TableMenuRow2">
1011 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
1012 <span style="float: left;">&nbsp;Forum Permissions Manager: </span>
1013 <span style="float: right;">&nbsp;</span>
1014 </th>
1015 </tr>
1016 <tr class="TableMenuRow3">
1017 <td class="TableMenuColumn3">
1018 <?php
1019 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC, \"OrderID\" ASC", array(null));
1020 $fr=sql_query($fq,$SQLStat);
1021 $ai=sql_num_rows($fr);
1022 $fi=0;
1023 while ($fi < $ai) {
1024 $InForumID=sql_result($fr,$fi,"id");
1025 $InForumName=sql_result($fr,$fi,"Name");
1026 $getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i LIMIT 1", array($_POST['id'],$InForumID));
1027 $getperidr=sql_query($getperidq,$SQLStat);
1028 $getperidnum=sql_num_rows($getperidr);
1029 $getperidNumz = null;
1030 $getperidID = null;
1031 if($getperidnum>0) {
1032 $getperidNumz=sql_result($getperidr,0,"id");
1033 $getperidID=sql_result($getperidr,0,"PermissionID"); }
1035 <form style="display: inline;" method="post" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
1036 <table style="text-align: left;">
1037 <tr style="text-align: left;">
1038 <td style="width: 100%;">
1039 <?php if($getperidnum>0) { ?>
1040 Permissions for <?php echo $InForumName; ?> are set: <br />
1041 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1042 <input type="hidden" name="subact" value="edit" style="display: none;" />
1043 <input type="hidden" name="id" value="<?php echo $getperidNumz; ?>" style="display: none;" />
1044 <input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
1045 <?php } if($getperidnum<=0) { ?>
1046 Permissions for <?php echo $InForumName; ?> are not set: <br />
1047 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1048 <input type="hidden" name="subact" value="create" style="display: none;" />
1049 <input type="hidden" name="permid" value="<?php echo $_POST['id']; ?>" style="display: none;" />
1050 <input type="hidden" name="id" value="<?php echo $InForumID; ?>" style="display: none;" />
1051 <input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
1052 <?php } ?>
1053 </td></tr></table>
1054 </form>
1055 <?php
1056 sql_free_result($getperidr);
1057 ++$fi; }
1058 sql_free_result($fr); ?>
1059 </td>
1060 </tr>
1061 <tr class="TableMenuRow4">
1062 <td class="TableMenuColumn4">&nbsp;</td>
1063 </tr>
1064 </table>
1065 </div>
1066 <?php } if(isset($_POST['id'])&&$_POST['subact']=="edit") {
1067 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
1068 $preresult=sql_query($prequery,$SQLStat);
1069 $prenum=sql_num_rows($preresult);
1070 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);
1071 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1072 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1073 if($prenum>=1) {
1074 $PermissionNum=sql_result($preresult,0,"id");
1075 $PermissionID=sql_result($preresult,0,"PermissionID");
1076 $PermissionName=sql_result($preresult,0,"Name");
1077 $PermissionForumID=sql_result($preresult,0,"ForumID");
1078 $CanViewForum=sql_result($preresult,0,"CanViewForum");
1079 $CanMakePolls=sql_result($preresult,0,"CanMakePolls");
1080 $CanMakeTopics=sql_result($preresult,0,"CanMakeTopics");
1081 $CanMakeReplys=sql_result($preresult,0,"CanMakeReplys");
1082 $CanMakeReplysCT=sql_result($preresult,0,"CanMakeReplysCT");
1083 $CanEditTopics=sql_result($preresult,0,"CanEditTopics");
1084 $CanEditTopicsCT=sql_result($preresult,0,"CanEditTopicsCT");
1085 $CanEditReplys=sql_result($preresult,0,"CanEditReplys");
1086 $CanEditReplysCT=sql_result($preresult,0,"CanEditReplysCT");
1087 $CanDeleteTopics=sql_result($preresult,0,"CanDeleteTopics");
1088 $CanDeleteTopicsCT=sql_result($preresult,0,"CanDeleteTopicsCT");
1089 $CanDeleteReplys=sql_result($preresult,0,"CanDeleteReplys");
1090 $CanDeleteReplysCT=sql_result($preresult,0,"CanDeleteReplysCT");
1091 $CanCloseTopics=sql_result($preresult,0,"CanCloseTopics");
1092 $CanPinTopics=sql_result($preresult,0,"CanPinTopics");
1093 $CanExecPHP=sql_result($preresult,0,0,"CanExecPHP");
1094 $CanDoHTML=sql_result($preresult,0,"CanDoHTML");
1095 $CanUseBBags=sql_result($preresult,0,"CanUseBBags");
1096 $CanModForum=sql_result($preresult,0,"CanModForum");
1097 sql_free_result($preresult); }
1098 $PermissionName = stripcslashes(htmlspecialchars($PermissionName, ENT_QUOTES, $Settings['charset']));
1099 //$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
1101 <div class="TableMenuBorder">
1102 <?php if($ThemeSet['TableStyle']=="div") { ?>
1103 <div class="TableMenuRow1">
1104 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
1105 <?php } ?>
1106 <table class="TableMenu" style="width: 100%;">
1107 <?php if($ThemeSet['TableStyle']=="table") { ?>
1108 <tr class="TableMenuRow1">
1109 <td class="TableMenuColumn1"><span style="float: left;">
1110 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
1111 </span><span style="float: right;">&nbsp;</span></td>
1112 </tr><?php } ?>
1113 <tr class="TableMenuRow2">
1114 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
1115 <span style="float: left;">&nbsp;Editing Forum Permissions: </span>
1116 <span style="float: right;">&nbsp;</span>
1117 </th>
1118 </tr>
1119 <tr class="TableMenuRow3">
1120 <td class="TableMenuColumn3">
1121 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
1122 <table style="text-align: left;">
1123 <tr style="text-align: left;">
1124 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewForum">Can view forum:</label></td>
1125 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewForum" id="CanViewForum">
1126 <option <?php if($CanViewForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1127 <option <?php if($CanViewForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1128 </select></td>
1129 </tr>
1130 <tr style="text-align: left;">
1131 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeTopics">Can make topics:</label></td>
1132 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeTopics" id="CanMakeTopics">
1133 <option <?php if($CanMakeTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1134 <option <?php if($CanMakeTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1135 </select></td>
1136 </tr>
1137 <tr style="text-align: left;">
1138 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakePolls">Can make polls:</label></td>
1139 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakePolls" id="CanMakePolls">
1140 <option <?php if($CanMakePolls=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1141 <option <?php if($CanMakePolls=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1142 </select></td>
1143 </tr>
1144 <tr style="text-align: left;">
1145 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplys">Can make replys in own:</label></td>
1146 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplys" id="CanMakeReplys">
1147 <option <?php if($CanMakeReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1148 <option <?php if($CanMakeReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1149 </select></td>
1150 </tr>
1151 <tr style="text-align: left;">
1152 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplysCT">Can make replys other users topic:</label></td>
1153 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplysCT" id="CanMakeReplysCT">
1154 <option <?php if($CanMakeReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1155 <option <?php if($CanMakeReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1156 </select></td>
1157 </tr>
1158 <tr style="text-align: left;">
1159 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopics">Can edit own topics:</label></td>
1160 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopics" id="CanEditTopics">
1161 <option <?php if($CanEditTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1162 <option <?php if($CanEditTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1163 </select></td>
1164 </tr>
1165 <tr style="text-align: left;">
1166 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopicsCT">Can edit other users topics:</label></td>
1167 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopicsCT" id="CanEditTopicsCT">
1168 <option <?php if($CanEditTopicsCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1169 <option <?php if($CanEditTopicsCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1170 </select></td>
1171 </tr>
1172 <tr style="text-align: left;">
1173 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplys">Can edit own replys:</label></td>
1174 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplys" id="CanEditReplys">
1175 <option <?php if($CanEditReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1176 <option <?php if($CanEditReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1177 </select></td>
1178 </tr>
1179 <tr style="text-align: left;">
1180 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplysCT">Can edit other users replys:</label></td>
1181 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplysCT" id="CanEditReplysCT">
1182 <option <?php if($CanEditReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1183 <option <?php if($CanEditReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1184 </select></td>
1185 </tr>
1186 <tr style="text-align: left;">
1187 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteTopics">Can delete own topics:</label></td>
1188 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopics" id="CanDeleteTopics">
1189 <option <?php if($CanDeleteTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1190 <option <?php if($CanDeleteTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1191 </select></td>
1192 </tr>
1193 <tr style="text-align: left;">
1194 <td style="width: 50%;"><label class="TextBoxLabel" for="Can delete other users topics">Can delete other users topics:</label></td>
1195 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopicsCT" id="CanDeleteTopicsCT">
1196 <option <?php if($CanDeleteTopicsCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1197 <option <?php if($CanDeleteTopicsCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1198 </select></td>
1199 </tr>
1200 <tr style="text-align: left;">
1201 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplys">Can delete own replys:</label></td>
1202 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplys" id="CanDeleteReplys">
1203 <option <?php if($CanDeleteReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1204 <option <?php if($CanDeleteReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1205 </select></td>
1206 </tr>
1207 <tr style="text-align: left;">
1208 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplysCT">Can delete other users replys:</label></td>
1209 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplysCT" id="CanDeleteReplysCT">
1210 <option <?php if($CanDeleteReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1211 <option <?php if($CanDeleteReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1212 </select></td>
1213 </tr>
1214 <tr style="text-align: left;">
1215 <td style="width: 50%;"><label class="TextBoxLabel" for="CanCloseTopics">Can close topics:</label></td>
1216 <td style="width: 50%;"><select size="1" class="TextBox" name="CanCloseTopics" id="CanCloseTopics">
1217 <option <?php if($CanCloseTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1218 <option <?php if($CanCloseTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1219 </select></td>
1220 </tr>
1221 <tr style="text-align: left;">
1222 <td style="width: 50%;"><label class="TextBoxLabel" for="CanPinTopics">Can pin topics:</label></td>
1223 <td style="width: 50%;"><select size="1" class="TextBox" name="CanPinTopics" id="CanPinTopics">
1224 <option <?php if($CanPinTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1225 <option <?php if($CanPinTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1226 </select></td>
1227 </tr>
1228 <tr style="text-align: left;">
1229 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
1230 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
1231 <option <?php if($CanDoHTML=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1232 <option <?php if($CanDoHTML=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1233 </select></td>
1234 </tr>
1235 <tr style="text-align: left;">
1236 <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBags">Can use BBags:</label></td>
1237 <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBags" id="CanUseBBags">
1238 <option <?php if($CanUseBBags=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1239 <option <?php if($CanUseBBags=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1240 </select></td>
1241 </tr>
1242 <tr style="text-align: left;">
1243 <td style="width: 50%;"><label class="TextBoxLabel" for="CanModForum">Can moderate forum:</label></td>
1244 <td style="width: 50%;"><select size="1" class="TextBox" name="CanModForum" id="CanModForum">
1245 <option <?php if($CanModForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1246 <option <?php if($CanModForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1247 </select></td>
1248 </tr></table>
1249 <table style="text-align: left;">
1250 <tr style="text-align: left;">
1251 <td style="width: 100%;">
1252 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1253 <input type="hidden" name="subact" value="editnow" style="display: none;" />
1254 <input type="hidden" name="id" value="<?php echo $PermissionNum; ?>" style="display: none;" />
1255 <input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
1256 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1257 </td></tr></table>
1258 </form>
1259 </td>
1260 </tr>
1261 <tr class="TableMenuRow4">
1262 <td class="TableMenuColumn4">&nbsp;</td>
1263 </tr>
1264 </table>
1265 </div>
1266 <?php } if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
1267 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
1268 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
1269 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"CanViewForum\"='%s', \"CanMakePolls\"='%s', \"CanMakeTopics\"='%s', \"CanMakeReplys\"='%s', \"CanMakeReplysCT\"='%s', \"CanEditTopics\"='%s', \"CanEditTopicsCT\"='%s', \"CanEditReplys\"='%s', \"CanEditReplysCT\"='%s', \"CanDeleteTopics\"='%s', \"CanDeleteTopicsCT\"='%s', \"CanDeleteReplys\"='%s', \"CanDeleteReplysCT\"='%s', \"CanCloseTopics\"='%s', \"CanPinTopics\"='%s', \"CanDoHTML\"='%s', \"CanUseBBags\"='%s', \"CanModForum\"='%s' WHERE \"id\"=%i", array($_POST['CanViewForum'], $_POST['CanMakePolls'], $_POST['CanMakeTopics'], $_POST['CanMakeReplys'], $_POST['CanMakeReplysCT'], $_POST['CanEditTopics'], $_POST['CanEditTopicsCT'], $_POST['CanEditReplys'], $_POST['CanEditReplysCT'], $_POST['CanDeleteTopics'], $_POST['CanDeleteTopicsCT'], $_POST['CanDeleteReplys'], $_POST['CanDeleteReplysCT'], $_POST['CanCloseTopics'], $_POST['CanPinTopics'], $_POST['CanDoHTML'], $_POST['CanUseBBags'], $_POST['CanModForum'], $_POST['id']));
1270 sql_query($query,$SQLStat); } if(isset($_POST['id'])&&$_POST['subact']=="create") {
1272 <div class="TableMenuBorder">
1273 <?php if($ThemeSet['TableStyle']=="div") { ?>
1274 <div class="TableMenuRow1">
1275 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a></div>
1276 <?php } ?>
1277 <table class="TableMenu" style="width: 100%;">
1278 <?php if($ThemeSet['TableStyle']=="table") { ?>
1279 <tr class="TableMenuRow1">
1280 <td class="TableMenuColumn1"><span style="float: left;">
1281 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Forum Permissions Manager</a>
1282 </span><span style="float: right;">&nbsp;</span></td>
1283 </tr><?php } ?>
1284 <tr class="TableMenuRow2">
1285 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
1286 <span style="float: left;">&nbsp;Editing Forum Permissions: </span>
1287 <span style="float: right;">&nbsp;</span>
1288 </th>
1289 </tr>
1290 <tr class="TableMenuRow3">
1291 <td class="TableMenuColumn3">
1292 <form style="display: inline;" method="post" id="acptool" action="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=fpermissions",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
1293 <table style="text-align: left;">
1294 <tr style="text-align: left;">
1295 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewForum">Can view forum:</label></td>
1296 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewForum" id="CanViewForum">
1297 <option value="yes">yes</option>
1298 <option value="no">no</option>
1299 </select></td>
1300 </tr>
1301 <tr style="text-align: left;">
1302 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakePolls">Can make polls:</label></td>
1303 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakePolls" id="CanMakePolls">
1304 <option value="yes">yes</option>
1305 <option value="no">no</option>
1306 </select></td>
1307 </tr>
1308 <tr style="text-align: left;">
1309 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeTopics">Can make topics:</label></td>
1310 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeTopics" id="CanMakeTopics">
1311 <option value="yes">yes</option>
1312 <option value="no">no</option>
1313 </select></td>
1314 </tr>
1315 <tr style="text-align: left;">
1316 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplys">Can make replys in own:</label></td>
1317 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplys" id="CanMakeReplys">
1318 <option value="yes">yes</option>
1319 <option value="no">no</option>
1320 </select></td>
1321 </tr>
1322 <tr style="text-align: left;">
1323 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplysCT">Can make replys other users topic:</label></td>
1324 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplysCT" id="CanMakeReplysCT">
1325 <option value="yes">yes</option>
1326 <option value="no">no</option>
1327 </select></td>
1328 </tr>
1329 <tr style="text-align: left;">
1330 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopics">Can edit own topics:</label></td>
1331 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopics" id="CanEditTopics">
1332 <option value="yes">yes</option>
1333 <option value="no">no</option>
1334 </select></td>
1335 </tr>
1336 <tr style="text-align: left;">
1337 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopicsCT">Can edit other users topics:</label></td>
1338 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopicsCT" id="CanEditTopicsCT">
1339 <option value="yes">yes</option>
1340 <option value="no">no</option>
1341 </select></td>
1342 </tr>
1343 <tr style="text-align: left;">
1344 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplys">Can edit own replys:</label></td>
1345 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplys" id="CanEditReplys">
1346 <option value="yes">yes</option>
1347 <option value="no">no</option>
1348 </select></td>
1349 </tr>
1350 <tr style="text-align: left;">
1351 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplysCT">Can edit other users replys:</label></td>
1352 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplysCT" id="CanEditReplysCT">
1353 <option value="yes">yes</option>
1354 <option value="no">no</option>
1355 </select></td>
1356 </tr>
1357 <tr style="text-align: left;">
1358 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteTopics">Can delete own topics:</label></td>
1359 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopics" id="CanDeleteTopics">
1360 <option value="yes">yes</option>
1361 <option value="no">no</option>
1362 </select></td>
1363 </tr>
1364 <tr style="text-align: left;">
1365 <td style="width: 50%;"><label class="TextBoxLabel" for="Can delete other users topics">Can delete other users topics:</label></td>
1366 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopicsCT" id="CanDeleteTopicsCT">
1367 <option value="yes">yes</option>
1368 <option value="no">no</option>
1369 </select></td>
1370 </tr>
1371 <tr style="text-align: left;">
1372 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplys">Can delete own replys:</label></td>
1373 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplys" id="CanDeleteReplys">
1374 <option value="yes">yes</option>
1375 <option value="no">no</option>
1376 </select></td>
1377 </tr>
1378 <tr style="text-align: left;">
1379 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplysCT">Can delete other users replys:</label></td>
1380 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplysCT" id="CanDeleteReplysCT">
1381 <option value="yes">yes</option>
1382 <option value="no">no</option>
1383 </select></td>
1384 </tr>
1385 <tr style="text-align: left;">
1386 <td style="width: 50%;"><label class="TextBoxLabel" for="CanCloseTopics">Can close topics:</label></td>
1387 <td style="width: 50%;"><select size="1" class="TextBox" name="CanCloseTopics" id="CanCloseTopics">
1388 <option value="yes">yes</option>
1389 <option value="no">no</option>
1390 </select></td>
1391 </tr>
1392 <tr style="text-align: left;">
1393 <td style="width: 50%;"><label class="TextBoxLabel" for="CanPinTopics">Can pin topics:</label></td>
1394 <td style="width: 50%;"><select size="1" class="TextBox" name="CanPinTopics" id="CanPinTopics">
1395 <option value="yes">yes</option>
1396 <option value="no">no</option>
1397 </select></td>
1398 </tr>
1399 <tr style="text-align: left;">
1400 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
1401 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
1402 <option value="yes">yes</option>
1403 <option value="no">no</option>
1404 </select></td>
1405 </tr>
1406 <tr style="text-align: left;">
1407 <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBags">Can use BBags:</label></td>
1408 <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBags" id="CanUseBBags">
1409 <option value="yes">yes</option>
1410 <option value="no">no</option>
1411 </select></td>
1412 </tr>
1413 <tr style="text-align: left;">
1414 <td style="width: 50%;"><label class="TextBoxLabel" for="CanModForum">Can moderate forum:</label></td>
1415 <td style="width: 50%;"><select size="1" class="TextBox" name="CanModForum" id="CanModForum">
1416 <option value="yes">yes</option>
1417 <option value="no">no</option>
1418 </select></td>
1419 </tr></table>
1420 <table style="text-align: left;">
1421 <tr style="text-align: left;">
1422 <td style="width: 100%;">
1423 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1424 <input type="hidden" name="subact" value="makenow" style="display: none;" />
1425 <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" style="display: none;" />
1426 <input type="hidden" name="permid" value="<?php echo $_POST['permid']; ?>" style="display: none;" />
1427 <input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
1428 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1429 </td></tr></table>
1430 </form>
1431 </td>
1432 </tr>
1433 <tr class="TableMenuRow4">
1434 <td class="TableMenuColumn4">&nbsp;</td>
1435 </tr>
1436 </table>
1437 </div>
1438 <?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
1439 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
1440 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
1441 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['permid']));
1442 $preresult=sql_query($prequery,$SQLStat);
1443 $prenum=sql_num_rows($preresult);
1444 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);
1445 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1446 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1447 if($prenum>=1) {
1448 $PermissionName=sql_result($preresult,0,"Name");
1449 sql_free_result($preresult); }
1450 //$nextidnum = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat);
1451 $nextidnum = null;
1452 $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\", \"CanUseBBags\", \"CanModForum\") VALUES\n".
1453 "(%i, '%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', 'no', '%s', '%s', '%s')", array($_POST['permid'], $PermissionName, $_POST['id'], $_POST['CanViewForum'], $_POST['CanMakePolls'], $_POST['CanMakeTopics'], $_POST['CanMakeReplys'], $_POST['CanMakeReplysCT'], $_POST['CanEditTopics'], $_POST['CanEditTopicsCT'], $_POST['CanEditReplys'], $_POST['CanEditReplysCT'], $_POST['CanDeleteTopics'], $_POST['CanDeleteTopicsCT'], $_POST['CanDeleteReplys'], $_POST['CanDeleteReplysCT'], $_POST['CanCloseTopics'], $_POST['CanPinTopics'], $_POST['CanDoHTML'], $_POST['CanUseBBags'], $_POST['CanModForum']));
1454 sql_query($query,$SQLStat); } }
1455 $doupdate = false;
1456 if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
1457 $doupdate = true; }
1458 if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
1459 $doupdate = true; }
1460 if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") {
1461 $doupdate = true; }
1462 if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") {
1463 $doupdate = true; }
1464 if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
1465 isset($_POST['id'])) {
1466 $doupdate = true; }
1467 if($doupdate===true&&$Error!="Yes") { ?>
1468 <div class="TableMenuBorder">
1469 <?php if($ThemeSet['TableStyle']=="div") { ?>
1470 <div class="TableMenuRow1">
1471 <?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>
1472 <?php } ?>
1473 <table class="TableMenu" style="width: 100%;">
1474 <?php if($ThemeSet['TableStyle']=="table") { ?>
1475 <tr class="TableMenuRow1">
1476 <td class="TableMenuColumn1"><span style="float: left;">
1477 <?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>
1478 </span><span style="float: right;">&nbsp;</span></td>
1479 </tr><?php } ?>
1480 <tr id="ProfileTitle" class="TableMenuRow2">
1481 <th class="TableMenuColumn2">Updating Settings</th>
1482 </tr>
1483 <tr class="TableMenuRow3" id="ProfileUpdate">
1484 <td class="TableMenuColumn3">
1485 <?php if(isset($_POST['id'])&&$_POST['subact']=="editnow") { ?>
1486 <div style="text-align: center;">
1487 <br />The permission was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
1488 </div>
1489 <?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { ?>
1490 <div style="text-align: center;">
1491 <br />The permission was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
1492 </div>
1493 <?php } if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") { ?>
1494 <div style="text-align: center;">
1495 <br />The forum was created successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
1496 </div>
1497 <?php } if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") { ?>
1498 <div style="text-align: center;">
1499 <br />The forum was deleted successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
1500 </div>
1501 <?php } if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
1502 isset($_POST['id'])) { ?>
1503 <div style="text-align: center;">
1504 <br />The forum was edited successfully. <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to go back. ^_^<br />&nbsp;
1505 </div>
1506 <?php } ?>
1507 </td></tr>
1508 <tr id="ProfileTitleEnd" class="TableMenuRow4">
1509 <td class="TableMenuColumn4">&nbsp;</td>
1510 </tr></table></div>
1511 <?php } if ($_GET['act']!=null&&$Error=="Yes") {
1512 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
1513 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
1515 <div class="TableMenuBorder">
1516 <?php if($ThemeSet['TableStyle']=="div") { ?>
1517 <div class="TableMenuRow1">
1518 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a></div>
1519 <?php } ?>
1520 <table class="TableMenu" style="width: 100%;">
1521 <?php if($ThemeSet['TableStyle']=="table") { ?>
1522 <tr class="TableMenuRow1">
1523 <td class="TableMenuColumn1"><span style="float: left;">
1524 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings</a>
1525 </span><span style="float: right;">&nbsp;</span></td>
1526 </tr><?php } ?>
1527 <tr id="ProfileTitle" class="TableMenuRow2">
1528 <th class="TableMenuColumn2">Updating Settings</th>
1529 </tr>
1530 <tr class="TableMenuRow3" id="ProfileUpdate">
1531 <td class="TableMenuColumn3">
1532 <div style="text-align: center;">
1533 <br /><?php echo $errorstr; ?>
1534 <a href="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here</a> to back to admin cp.<br />&nbsp;
1535 </div>
1536 </td></tr>
1537 <tr id="ProfileTitleEnd" class="TableMenuRow4">
1538 <td class="TableMenuColumn4">&nbsp;</td>
1539 </tr></table></div>
1540 <?php } ?>
1541 </td></tr>
1542 </table>
1543 <div>&nbsp;</div>