Small update
[iDB.git] / inc / admin / forums.php
blobc03af4ddf2cf5324530a52982a30423ec17e89f5
1 <?php
2 /*
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2019 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2019 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
14 $FileInfo: forums.php - Last Update: 08/02/2019 SVN 905 - 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="number" 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="number" 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="url" name="RedirectURL" class="TextBox" id="RedirectURL" size="20" value="" /></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="number" 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="number" 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="number" 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 if($_POST['RedirectURL']=="") { $_POST['RedirectURL'] = "http://"; }
426 $_POST['ForumName'] = stripcslashes(htmlspecialchars($_POST['ForumName'], ENT_QUOTES, $Settings['charset']));
427 //$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
428 $_POST['ForumName'] = remove_spaces($_POST['ForumName']);
429 $_POST['ForumDesc'] = stripcslashes(htmlspecialchars($_POST['ForumDesc'], ENT_QUOTES, $Settings['charset']));
430 //$_POST['ForumDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumDesc']);
431 $_POST['ForumDesc'] = remove_spaces($_POST['ForumDesc']);
432 $sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
433 $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);
434 $id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
435 sql_free_result($sql_id_check); sql_free_result($sql_order_check);
436 $errorstr = "";
437 if ($_POST['NumPostView']==null||
438 !is_numeric($_POST['NumPostView'])) {
439 $_POST['NumPostView'] = 0; }
440 if ($_POST['NumKarmaView']==null||
441 !is_numeric($_POST['NumKarmaView'])) {
442 $_POST['NumKarmaView'] = 0; }
443 if ($Settings['hot_topic_num']==null||
444 !is_numeric($Settings['hot_topic_num'])) {
445 $Settings['hot_topic_num'] = 10; }
446 if ($_POST['NumPostHotTopic']==null||
447 !is_numeric($_POST['NumPostHotTopic'])) {
448 $_POST['NumPostHotTopic'] = $Settings['hot_topic_num']; }
449 if ($_POST['ForumName']==null||
450 $_POST['ForumName']=="ShowMe") { $Error="Yes";
451 $errorstr = $errorstr."You need to enter a forum name.<br />\n"; }
452 if ($_POST['ForumDesc']==null) { $Error="Yes";
453 $errorstr = $errorstr."You need to enter a description.<br />\n"; }
454 if ($_POST['ForumID']==null||
455 !is_numeric($_POST['ForumID'])) { $Error="Yes";
456 $errorstr = $errorstr."You need to enter a forum ID.<br />\n"; }
457 if($id_check > 0) { $Error="Yes";
458 $errorstr = $errorstr."This ID number is already used.<br />\n"; }
459 if($order_check > 0) { $Error="Yes";
460 $errorstr = $errorstr."This order number is already used.<br />\n"; }
461 if (pre_strlen($_POST['ForumName'])>"150") { $Error="Yes";
462 $errorstr = $errorstr."Your Forum Name is too big.<br />\n"; }
463 if (pre_strlen($_POST['ForumDesc'])>"300") { $Error="Yes";
464 $errorstr = $errorstr."Your Forum Description is too big.<br />\n"; }
465 if ($Error!="Yes") {
466 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
467 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
468 $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".
469 "(%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']));
470 sql_query($query,$SQLStat);
471 if(!is_numeric($_POST['CPermissions'])) { $_POST['CPermissions'] = "0"; }
472 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
473 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
474 $Settings['sqltype']=="sqlite3") {
475 $getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
476 if($Settings['sqltype']=="cubrid") {
477 $getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."permissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
478 $getperidr=sql_query($getperidq,$SQLStat);
479 $getperidnum=sql_num_rows($getperidr);
480 $getperidi = 0;
481 $nextperid = null;
483 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
484 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
485 $Settings['sqltype']=="sqlite3") {
486 $nextperid = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat); }
487 if($Settings['sqltype']=="sqlite") {
488 $nextperid = sql_get_next_id($Settings['sqltable'],"\"permissions\"",$SQLStat); }
490 while ($getperidi < $getperidnum) {
491 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
492 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
493 $Settings['sqltype']=="sqlite3") {
494 $getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
495 if($Settings['sqltype']=="sqlite") {
496 $getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
497 if($_POST['CPermissions']=="0") {
498 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i", array($getperidID)); }
499 if($_POST['CPermissions']!="0") {
500 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i", array($getperidID,$_POST['CPermissions'])); }
501 $getperidr2=sql_query($getperidq2,$SQLStat);
502 $getperidnum2=sql_num_rows($getperidr2);
503 $PermissionNum=sql_result($getperidr2,0,"id");
504 $PermissionID=sql_result($getperidr2,0,"PermissionID");
505 $PermissionName=sql_result($getperidr2,0,"Name");
506 $PermissionForumID=sql_result($getperidr2,0,"ForumID");
507 $CanViewForum=sql_result($getperidr2,0,"CanViewForum");
508 $CanMakePolls=sql_result($getperidr2,0,"CanMakePolls");
509 $CanMakeTopics=sql_result($getperidr2,0,"CanMakeTopics");
510 $CanMakeReplys=sql_result($getperidr2,0,"CanMakeReplys");
511 $CanMakeReplysCT=sql_result($getperidr2,0,"CanMakeReplysCT");
512 $CanEditTopics=sql_result($getperidr2,0,"CanEditTopics");
513 $CanEditTopicsCT=sql_result($getperidr2,0,"CanEditTopicsCT");
514 $CanEditReplys=sql_result($getperidr2,0,"CanEditReplys");
515 $CanEditReplysCT=sql_result($getperidr2,0,"CanEditReplysCT");
516 $CanDeleteTopics=sql_result($getperidr2,0,"CanDeleteTopics");
517 $CanDeleteTopicsCT=sql_result($getperidr2,0,"CanDeleteTopicsCT");
518 $CanDeleteReplys=sql_result($getperidr2,0,"CanDeleteReplys");
519 $CanDeleteReplysCT=sql_result($getperidr2,0,"CanDeleteReplysCT");
520 $CanCloseTopics=sql_result($getperidr2,0,"CanCloseTopics");
521 $CanPinTopics=sql_result($getperidr2,0,"CanPinTopics");
522 $CanExecPHP=sql_result($getperidr2,0,"CanExecPHP");
523 $CanDoHTML=sql_result($getperidr2,0,"CanDoHTML");
524 $CanUseBBTags=sql_result($getperidr2,0,"CanUseBBTags");
525 $CanModForum=sql_result($getperidr2,0,"CanModForum");
526 sql_free_result($getperidr2);
527 if($_POST['CPermissions']=="0") {
528 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$_POST['ForumID'])); }
529 if($_POST['CPermissions']!="0") {
530 if($getperidnum2>0) {
531 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", array($PermissionID,$PermissionName,$_POST['ForumID'],$CanViewForum,$CanMakePolls,$CanMakeTopics,$CanMakeReplys,$CanMakeReplysCT,$CanEditTopics,$CanEditTopicsCT,$CanEditReplys,$CanEditReplysCT,$CanDeleteTopics,$CanDeleteTopicsCT,$CanDeleteReplys,$CanDeleteReplysCT,$CanCloseTopics,$CanPinTopics,$CanExecPHP,$CanDoHTML,$CanUseBBTags,$CanModForum)); }
532 if($getperidnum2<=0) {
533 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES (%i, '%s', %i, 'yes', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no', 'no')", array($PermissionID,$PermissionName,$_POST['ForumID'])); } }
534 sql_query($query,$SQLStat);
535 ++$getperidi; /*++$nextperid;*/ }
536 sql_free_result($getperidr); } }
537 if($_GET['act']=="deleteforum"&&$_POST['update']!="now") {
538 $admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Forum";
540 <div class="TableMenuBorder">
541 <?php if($ThemeSet['TableStyle']=="div") { ?>
542 <div class="TableMenuRow1">
543 <?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>
544 <?php } ?>
545 <table class="TableMenu" style="width: 100%;">
546 <?php if($ThemeSet['TableStyle']=="table") { ?>
547 <tr class="TableMenuRow1">
548 <td class="TableMenuColumn1"><span style="float: left;">
549 <?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>
550 </span><span style="float: right;">&nbsp;</span></td>
551 </tr><?php } ?>
552 <tr class="TableMenuRow2">
553 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
554 <span style="float: left;">&nbsp;Deleting a Forum: </span>
555 <span style="float: right;">&nbsp;</span>
556 </th>
557 </tr>
558 <tr class="TableMenuRow3">
559 <td class="TableMenuColumn3">
560 <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']); ?>">
561 <table style="text-align: left;">
562 <tr style="text-align: left;">
563 <td style="width: 50%;"><label class="TextBoxLabel" for="DelForums">Delete all forums in subforum:</label></td>
564 <td style="width: 50%;"><select size="1" class="TextBox" name="DelForums" id="DelForums">
565 <option selected="selected" value="yes">yes</option>
566 <option value="no">no</option>
567 </select></td>
568 </tr><tr style="text-align: left;">
569 <td style="width: 50%;"><label class="TextBoxLabel" for="DelTopics">Delete all topics in (sub)forum:</label></td>
570 <td style="width: 50%;"><select size="1" class="TextBox" name="DelTopics" id="DelTopics">
571 <option selected="selected" value="yes">yes</option>
572 <option value="no">no</option>
573 </select></td>
574 </tr><tr style="text-align: left;">
575 <td style="width: 50%;"><label class="TextBoxLabel" for="DelPermission">Delete all permission sets in (sub)forum:</label></td>
576 <td style="width: 50%;"><select size="1" class="TextBox" name="DelPermission" id="DelPermission">
577 <option selected="selected" value="yes">yes</option>
578 <option value="no">no</option>
579 </select></td>
580 </tr><tr style="text-align: left;">
581 <td style="width: 50%;"><label class="TextBoxLabel" for="DelID">Delete Forum:</label></td>
582 <td style="width: 50%;"><select size="1" class="TextBox" name="DelID" id="DelID">
583 <?php
584 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
585 $fr=sql_query($fq,$SQLStat);
586 $ai=sql_num_rows($fr);
587 $fi=0;
588 while ($fi < $ai) {
589 $InForumID=sql_result($fr,$fi,"id");
590 $InForumName=sql_result($fr,$fi,"Name");
591 $InForumType=sql_result($fr,$fi,"ForumType");
592 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
594 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
595 <?php ++$fi; }
596 sql_free_result($fr); ?>
597 </select></td>
598 </tr></table>
599 <table style="text-align: left;">
600 <tr style="text-align: left;">
601 <td style="width: 100%;">
602 <input type="hidden" name="act" value="deleteforum" style="display: none;" />
603 <input type="hidden" name="update" value="now" style="display: none;" />
604 <input type="submit" class="Button" value="Delete Forum" name="Apply_Changes" />
605 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
606 </td></tr></table>
607 </form>
608 </td>
609 </tr>
610 <tr class="TableMenuRow4">
611 <td class="TableMenuColumn4">&nbsp;</td>
612 </tr>
613 </table>
614 </div>
615 <?php } if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") {
616 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
617 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['DelID']));
618 $preresult=sql_query($prequery,$SQLStat);
619 $prenum=sql_num_rows($preresult);
620 $errorstr = ""; $Error = null;
621 if (!is_numeric($_POST['DelID'])) { $Error="Yes";
622 $errorstr = $errorstr."You need to enter a forum ID.<br />\n"; }
623 if($prenum>0&&$Error!="Yes") {
624 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i", array($_POST['DelID']));
625 sql_query($dtquery,$SQLStat);
626 if($_POST['DelForums']=="yes") {
627 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
628 sql_query($dtquery,$SQLStat);
629 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
630 sql_query($dtquery,$SQLStat); }
631 if($_POST['DelPermission']=="yes") {
632 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($_POST['DelID']));
633 sql_query($dtquery,$SQLStat); }
634 if($_POST['DelForums']=="yes") {
635 $apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"InSubForum\"=%i ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_POST['DelID']));
636 $apcresult=sql_query($apcquery,$SQLStat);
637 $apcnum=sql_num_rows($apcresult);
638 $apci=0; $apcl=1; if($apcnum>=1) {
639 while ($apci < $apcnum) {
640 $DelSubsForumID=sql_result($apcresult,$apci,"id");
641 if($_POST['DelForums']=="yes") {
642 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
643 sql_query($dtquery,$SQLStat);
644 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
645 sql_query($dtquery,$SQLStat); }
646 if($_POST['DelPermission']=="yes") {
647 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($DelSubsForumID));
648 sql_query($dtquery,$SQLStat); }
649 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i", array($DelSubsForumID));
650 sql_query($dtquery,$SQLStat);
651 ++$apci; }
652 sql_free_result($apcresult); } }
654 <?php } } if($_GET['act']=="editforum"&&$_POST['update']!="now") {
655 $admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Forum";
656 if(!isset($_POST['id'])) {
658 <div class="TableMenuBorder">
659 <?php if($ThemeSet['TableStyle']=="div") { ?>
660 <div class="TableMenuRow1">
661 <?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>
662 <?php } ?>
663 <table class="TableMenu" style="width: 100%;">
664 <?php if($ThemeSet['TableStyle']=="table") { ?>
665 <tr class="TableMenuRow1">
666 <td class="TableMenuColumn1"><span style="float: left;">
667 <?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>
668 </span><span style="float: right;">&nbsp;</span></td>
669 </tr><?php } ?>
670 <tr class="TableMenuRow2">
671 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
672 <span style="float: left;">&nbsp;Editing a Forum: </span>
673 <span style="float: right;">&nbsp;</span>
674 </th>
675 </tr>
676 <tr class="TableMenuRow3">
677 <td class="TableMenuColumn3">
678 <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']); ?>">
679 <table style="text-align: left;">
680 <tr style="text-align: left;">
681 <td style="width: 50%;"><label class="TextBoxLabel" for="id">Forum to Edit:</label></td>
682 <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
683 <?php
684 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC, \"OrderID\" ASC", array(null));
685 $fr=sql_query($fq,$SQLStat);
686 $ai=sql_num_rows($fr);
687 $fi=0;
688 while ($fi < $ai) {
689 $InForumID=sql_result($fr,$fi,"id");
690 $InForumName=sql_result($fr,$fi,"Name");
691 $InForumType=sql_result($fr,$fi,"ForumType");
692 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
694 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
695 <?php ++$fi; }
696 sql_free_result($fr); ?>
697 </select></td>
698 </tr></table>
699 <table style="text-align: left;">
700 <tr style="text-align: left;">
701 <td style="width: 100%;">
702 <input type="hidden" name="act" value="editforum" style="display: none;" />
703 <input type="submit" class="Button" value="Edit Forum" name="Apply_Changes" />
704 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
705 </td></tr></table>
706 </form>
707 </td>
708 </tr>
709 <tr class="TableMenuRow4">
710 <td class="TableMenuColumn4">&nbsp;</td>
711 </tr>
712 </table>
713 </div>
714 <?php } if(isset($_POST['id'])) {
715 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
716 $preresult=sql_query($prequery,$SQLStat);
717 $prenum=sql_num_rows($preresult);
718 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);
719 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
720 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
721 if($prenum>=1) {
722 $ForumID=sql_result($preresult,0,"id");
723 $ForumCatID=sql_result($preresult,0,"CategoryID");
724 $ForumOrder=sql_result($preresult,0,"OrderID");
725 $ForumName=sql_result($preresult,0,"Name");
726 $ShowForum=sql_result($preresult,0,"ShowForum");
727 $ForumType=sql_result($preresult,0,"ForumType");
728 $InSubForum=sql_result($preresult,0,"InSubForum");
729 $RedirectURL=sql_result($preresult,0,"RedirectURL");
730 if($RedirectURL=="http://") { $RedirectURL = ""; }
731 $RedirectTimes=sql_result($preresult,0,"Redirects");
732 $NumberViews=sql_result($preresult,0,"NumViews");
733 $ForumDescription=sql_result($preresult,0,"Description");
734 $PostCountAdd=sql_result($preresult,0,"PostCountAdd");
735 $PostCountView=sql_result($preresult,0,"PostCountView");
736 $KarmaCountView=sql_result($preresult,0,"KarmaCountView");
737 $CanHaveTopics=sql_result($preresult,0,"CanHaveTopics");
738 $HotTopicPosts=sql_result($preresult,0,"HotTopicPosts");
739 $NumberPosts=sql_result($preresult,0,"NumPosts");
740 $NumberTopics=sql_result($preresult,0,"NumTopics");
741 sql_free_result($preresult);
742 $ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
744 <div class="TableMenuBorder">
745 <?php if($ThemeSet['TableStyle']=="div") { ?>
746 <div class="TableMenuRow1">
747 <?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>
748 <?php } ?>
749 <table class="TableMenu" style="width: 100%;">
750 <?php if($ThemeSet['TableStyle']=="table") { ?>
751 <tr class="TableMenuRow1">
752 <td class="TableMenuColumn1"><span style="float: left;">
753 <?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>
754 </span><span style="float: right;">&nbsp;</span></td>
755 </tr><?php } ?>
756 <tr class="TableMenuRow2">
757 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
758 <span style="float: left;">&nbsp;Editing a Forum: </span>
759 <span style="float: right;">&nbsp;</span>
760 </th>
761 </tr>
762 <tr class="TableMenuRow3">
763 <td class="TableMenuColumn3">
764 <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']); ?>">
765 <table style="text-align: left;">
766 <tr style="text-align: left;">
767 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumID">Insert ID for forum:</label></td>
768 <td style="width: 50%;"><input type="number" name="ForumID" class="TextBox" id="ForumID" size="20" value="<?php echo $ForumID; ?>" /></td>
769 </tr><tr style="text-align: left;">
770 <td style="width: 50%;"><label class="TextBoxLabel" for="OrderID">Insert order id forum:</label></td>
771 <td style="width: 50%;"><input type="number" name="OrderID" class="TextBox" id="OrderID" size="20" value="<?php echo $ForumOrder; ?>" /></td>
772 </tr><tr style="text-align: left;">
773 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumCatID">Select category for forum:</label></td>
774 <td style="width: 50%;"><select size="1" class="TextBox" name="ForumCatID" id="ForumCatID">
775 <?php
776 $cq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
777 $cr=sql_query($cq,$SQLStat);
778 $eu=sql_num_rows($cr);
779 $nu=0;
780 while ($nu < $eu) {
781 $InCatID=sql_result($cr,$nu,"id");
782 $InCatName=sql_result($cr,$nu,"Name");
783 $EuNuMai = "Eu nu mai vreau";
784 if($ForumCatID==$InCatID) {
786 <option value="<?php echo $InCatID; ?>" selected="selected"><?php echo $InCatName; ?></option>
787 <?php } if($ForumCatID!=$InCatID) { ?>
788 <option value="<?php echo $InCatID; ?>"><?php echo $InCatName; ?></option>
789 <?php } ++$nu; }
790 sql_free_result($cr); ?>
791 </select></td>
792 </tr><tr style="text-align: left;">
793 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumName">Insert name for forum:</label></td>
794 <td style="width: 50%;"><input type="text" name="ForumName" class="TextBox" id="ForumName" size="20" value="<?php echo $ForumName; ?>" /></td>
795 </tr><tr style="text-align: left;">
796 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumDesc">Insert description for forum:</label></td>
797 <td style="width: 50%;"><input type="text" name="ForumDesc" class="TextBox" id="ForumDesc" size="20" value="<?php echo $ForumDescription; ?>" /></td>
798 </tr><tr style="text-align: left;">
799 <td style="width: 50%;"><label class="TextBoxLabel" for="ShowForum">Show forum:</label></td>
800 <td style="width: 50%;"><select size="1" class="TextBox" name="ShowForum" id="ShowForum">
801 <option <?php if($ShowForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
802 <option <?php if($ShowForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
803 </select></td>
804 </tr><tr style="text-align: left;">
805 <td style="width: 50%;"><label class="TextBoxLabel" for="ForumType">Insert forum type:</label></td>
806 <td style="width: 50%;"><select size="1" class="TextBox" name="ForumType" id="ForumType">
807 <option <?php if($ForumType=="forum") { echo "selected=\"selected\" "; } ?>value="forum">Forum</option>
808 <option <?php if($ForumType=="subforum") { echo "selected=\"selected\" "; } ?>value="subforum">SubForum</option>
809 <option <?php if($ForumType=="redirect") { echo "selected=\"selected\" "; } ?>value="redirect">Redirect</option>
810 </select></td>
811 </tr><tr style="text-align: left;">
812 <td style="width: 50%;"><label class="TextBoxLabel" for="RedirectURL">Insert Redirect URL for redirect forum:</label></td>
813 <td style="width: 50%;"><input type="url" name="RedirectURL" class="TextBox" id="RedirectURL" size="20" value="<?php echo htmlentities($RedirectURL, ENT_QUOTES, $Settings['charset']); ?>" /></td>
814 </tr><tr style="text-align: left;">
815 <td style="width: 50%;"><label class="TextBoxLabel" for="InSubForum">In SubForum:</label></td>
816 <td style="width: 50%;"><select size="1" class="TextBox" name="InSubForum" id="InSubForum">
817 <option selected="selected" value="0">none</option>
818 <?php
819 $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));
820 $fr=sql_query($fq,$SQLStat);
821 $ai=sql_num_rows($fr);
822 $fi=0;
823 while ($fi < $ai) {
824 $InForumID=sql_result($fr,$fi,"id");
825 $InForumName=sql_result($fr,$fi,"Name");
826 $InForumType=sql_result($fr,$fi,"ForumType");
827 $AiFiInSubForum=sql_result($fr,$fi,"InSubForum");
828 if ($InForumType!="redirect"&&$AiFiInSubForum=="0") {
829 if($InSubForum==$InForumID) {
831 <option value="<?php echo $InForumID; ?>" selected="selected"><?php echo $InForumName; ?></option>
832 <?php } if($InSubForum!=$InForumID) { ?>
833 <option value="<?php echo $InForumID; ?>"><?php echo $InForumName; ?></option>
834 <?php } } ++$fi; }
835 sql_free_result($fr); ?>
836 </select></td>
837 </tr><tr style="text-align: left;">
838 <td style="width: 50%;"><label class="TextBoxLabel" for="PostCountAdd">Add to post count:</label></td>
839 <td style="width: 50%;"><select size="1" class="TextBox" name="PostCountAdd" id="PostCountAdd">
840 <option <?php if($PostCountAdd=="on") { echo "selected=\"selected\" "; } ?>value="on">yes</option>
841 <option <?php if($PostCountAdd=="off") { echo "selected=\"selected\" "; } ?>value="off">no</option>
842 </select></td>
843 </tr><tr style="text-align: left;">
844 <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostView">Number of posts to view forum:</label></td>
845 <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostView" id="NumPostView" value="<?php echo $PostCountView; ?>" /></td>
846 </tr><tr style="text-align: left;">
847 <td style="width: 50%;"><label class="TextBoxLabel" for="NumKarmaView">Amount of karma to view forum:</label></td>
848 <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumKarmaView" id="NumKarmaView" value="<?php echo $KarmaCountView; ?>" /></td>
849 </tr><tr style="text-align: left;">
850 <td style="width: 50%;"><label class="TextBoxLabel" for="CanHaveTopics">Allow topics in forum:</label></td>
851 <td style="width: 50%;"><select size="1" class="TextBox" name="CanHaveTopics" id="CanHaveTopics">
852 <option <?php if($CanHaveTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
853 <option <?php if($CanHaveTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
854 </select></td>
855 </tr><tr style="text-align: left;">
856 <td style="width: 50%;"><label class="TextBoxLabel" for="NumPostHotTopic">Number of posts for hot topic:</label></td>
857 <td style="width: 50%;"><input type="number" class="TextBox" size="20" name="NumPostHotTopic" id="NumPostHotTopic" value="<?php echo $HotTopicPosts; ?>" /></td>
858 </tr></table>
859 <table style="text-align: left;">
860 <tr style="text-align: left;">
861 <td style="width: 100%;">
862 <input type="hidden" name="act" value="editforum" style="display: none;" />
863 <input type="hidden" name="update" value="now" style="display: none;" />
864 <input type="hidden" name="id" value="<?php echo $ForumID; ?>" style="display: none;" />
865 <input type="submit" class="Button" value="Edit Forum" name="Apply_Changes" />
866 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
867 </td></tr></table>
868 </form>
869 </td>
870 </tr>
871 <tr class="TableMenuRow4">
872 <td class="TableMenuColumn4">&nbsp;</td>
873 </tr>
874 </table>
875 </div>
876 <?php } } } if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
877 isset($_POST['id'])) {
878 if($_POST['RedirectURL']=="") { $_POST['RedirectURL'] = "http://"; }
879 $_POST['ForumName'] = stripcslashes(htmlspecialchars($_POST['ForumName'], ENT_QUOTES, $Settings['charset']));
880 //$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
881 $_POST['ForumName'] = remove_spaces($_POST['ForumName']);
882 $_POST['ForumDesc'] = stripcslashes(htmlspecialchars($_POST['ForumDesc'], ENT_QUOTES, $Settings['charset']));
883 //$_POST['ForumDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumDesc']);
884 $_POST['ForumDesc'] = remove_spaces($_POST['ForumDesc']);
885 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
886 $preresult=sql_query($prequery,$SQLStat);
887 $prenum=sql_num_rows($preresult);
888 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);
889 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
890 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
891 if($prenum>=1) {
892 $OldID=sql_result($preresult,0,"id");
893 $OldOrder=sql_result($preresult,0,"OrderID");
894 sql_free_result($preresult);
895 $sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
896 $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);
897 $id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
898 sql_free_result($sql_id_check); sql_free_result($sql_order_check);
899 if ($_POST['NumPostView']==null||
900 !is_numeric($_POST['NumPostView'])) {
901 $_POST['NumPostView'] = 0; }
902 if ($_POST['NumKarmaView']==null||
903 !is_numeric($_POST['NumKarmaView'])) {
904 $_POST['NumKarmaView'] = 0; }
905 if ($Settings['hot_topic_num']==null||
906 !is_numeric($Settings['hot_topic_num'])) {
907 $Settings['hot_topic_num'] = 10; }
908 if ($_POST['NumPostHotTopic']==null||
909 !is_numeric($_POST['NumPostHotTopic'])) {
910 $_POST['NumPostHotTopic'] = $Settings['hot_topic_num']; }
911 if ($_POST['ForumName']==null||
912 $_POST['ForumName']=="ShowMe") { $Error="Yes";
913 $errorstr = $errorstr."You need to enter a forum name.<br />\n"; }
914 if ($_POST['ForumDesc']==null) { $Error="Yes";
915 $errorstr = $errorstr."You need to enter a description.<br />\n"; }
916 if ($_POST['ForumID']==null||
917 !is_numeric($_POST['ForumID'])) { $Error="Yes";
918 $errorstr = $errorstr."You need to enter a forum ID.<br />\n"; }
919 if($id_check > 0&&$_POST['ForumID']!=$OldID) { $Error="Yes";
920 $errorstr = $errorstr."This ID number is already used.<br />\n"; }
921 if($order_check > 0&&$_POST['OrderID']!=$OldOrder) { $Error="Yes";
922 $errorstr = $errorstr."This order number is already used.<br />\n"; }
923 if (pre_strlen($_POST['ForumName'])>"150") { $Error="Yes";
924 $errorstr = $errorstr."Your Forum Name is too big.<br />\n"; }
925 if (pre_strlen($_POST['ForumDesc'])>"300") { $Error="Yes";
926 $errorstr = $errorstr."Your Forum Description is too big.<br />\n"; }
927 if ($Error!="Yes") {
928 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
929 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
930 $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']));
931 sql_query($query,$SQLStat);
932 if($_POST['ForumID']!=$_POST['id']) {
933 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"InSubForum\"=%i WHERE \"InSubForum\"=%i", array($_POST['ForumID'],$_POST['id']));
934 sql_query($query,$SQLStat);
935 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"ForumID\"=%i,\"OldForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['ForumID'],$_POST['id']));
936 sql_query($query,$SQLStat);
937 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"ForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['id']));
938 sql_query($query,$SQLStat); }
939 $queryz = sql_pre_query("UPDATE \"".$Settings['sqltable']."permissions\" SET \"ForumID\"=%i WHERE \"ForumID\"=%i", array($_POST['ForumID'],$_POST['id']));
940 sql_query($queryz,$SQLStat); } } }
941 if($_GET['act']=="fpermissions"&&$_POST['update']!="now") {
942 $admincptitle = " ".$ThemeSet['TitleDivider']." Forum Permissions Manager";
943 if(!isset($_POST['id'])) {
945 <div class="TableMenuBorder">
946 <?php if($ThemeSet['TableStyle']=="div") { ?>
947 <div class="TableMenuRow1">
948 <?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>
949 <?php } ?>
950 <table class="TableMenu" style="width: 100%;">
951 <?php if($ThemeSet['TableStyle']=="table") { ?>
952 <tr class="TableMenuRow1">
953 <td class="TableMenuColumn1"><span style="float: left;">
954 <?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>
955 </span><span style="float: right;">&nbsp;</span></td>
956 </tr><?php } ?>
957 <tr class="TableMenuRow2">
958 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
959 <span style="float: left;">&nbsp;Forum Permissions Manager: </span>
960 <span style="float: right;">&nbsp;</span>
961 </th>
962 </tr>
963 <tr class="TableMenuRow3">
964 <td class="TableMenuColumn3">
965 <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']); ?>">
966 <table style="text-align: left;">
967 <tr style="text-align: left;">
968 <td style="width: 50%;"><label class="TextBoxLabel" for="id">Permission to view:</label></td>
969 <td style="width: 50%;"><select size="1" class="TextBox" name="id" id="id">
970 <?php
971 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
972 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="sqlite"||
973 $Settings['sqltype']=="sqlite3") {
974 $getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
975 if($Settings['sqltype']=="cubrid") {
976 $getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."permissions\"", array(null)); }
977 $getperidr=sql_query($getperidq,$SQLStat);
978 $getperidnum=sql_num_rows($getperidr);
979 $getperidi = 0;
980 while ($getperidi < $getperidnum) {
981 if($Settings['sqltype']=="mysql"||$Settings['sqltype']=="mysqli"||
982 $Settings['sqltype']=="pgsql"||$Settings['sqltype']=="cubrid"||
983 $Settings['sqltype']=="sqlite3") {
984 $getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
985 if($Settings['sqltype']=="sqlite") {
986 $getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
987 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i ORDER BY \"ForumID\" ASC", array($getperidID));
988 $getperidr2=sql_query($getperidq2,$SQLStat);
989 $getperidnum2=sql_num_rows($getperidr2);
990 $getperidName=sql_result($getperidr2,0,"Name");
991 sql_free_result($getperidr2);
993 <option value="<?php echo $getperidID; ?>"><?php echo $getperidName; ?></option>
994 <?php ++$getperidi; }
995 sql_free_result($getperidr); ?>
996 </select></td>
997 </tr></table>
998 <table style="text-align: left;">
999 <tr style="text-align: left;">
1000 <td style="width: 100%;">
1001 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1002 <input type="submit" class="Button" value="View Permission" name="Apply_Changes" />
1003 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1004 </td></tr></table>
1005 </form>
1006 </td>
1007 </tr>
1008 <tr class="TableMenuRow4">
1009 <td class="TableMenuColumn4">&nbsp;</td>
1010 </tr>
1011 </table>
1012 </div>
1013 <?php } if(isset($_POST['id'])&&$_POST['subact']==null) { ?>
1014 <div class="TableMenuBorder">
1015 <?php if($ThemeSet['TableStyle']=="div") { ?>
1016 <div class="TableMenuRow1">
1017 <?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>
1018 <?php } ?>
1019 <table class="TableMenu" style="width: 100%;">
1020 <?php if($ThemeSet['TableStyle']=="table") { ?>
1021 <tr class="TableMenuRow1">
1022 <td class="TableMenuColumn1"><span style="float: left;">
1023 <?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>
1024 </span><span style="float: right;">&nbsp;</span></td>
1025 </tr><?php } ?>
1026 <tr class="TableMenuRow2">
1027 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
1028 <span style="float: left;">&nbsp;Forum Permissions Manager: </span>
1029 <span style="float: right;">&nbsp;</span>
1030 </th>
1031 </tr>
1032 <tr class="TableMenuRow3">
1033 <td class="TableMenuColumn3">
1034 <?php
1035 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" ORDER BY \"id\" ASC, \"OrderID\" ASC", array(null));
1036 $fr=sql_query($fq,$SQLStat);
1037 $ai=sql_num_rows($fr);
1038 $fi=0;
1039 while ($fi < $ai) {
1040 $InForumID=sql_result($fr,$fi,"id");
1041 $InForumName=sql_result($fr,$fi,"Name");
1042 $getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i AND \"ForumID\"=%i LIMIT 1", array($_POST['id'],$InForumID));
1043 $getperidr=sql_query($getperidq,$SQLStat);
1044 $getperidnum=sql_num_rows($getperidr);
1045 $getperidNumz = null;
1046 $getperidID = null;
1047 if($getperidnum>0) {
1048 $getperidNumz=sql_result($getperidr,0,"id");
1049 $getperidID=sql_result($getperidr,0,"PermissionID"); }
1051 <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']); ?>">
1052 <table style="text-align: left;">
1053 <tr style="text-align: left;">
1054 <td style="width: 100%;">
1055 <?php if($getperidnum>0) { ?>
1056 Permissions for <?php echo $InForumName; ?> are set: <br />
1057 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1058 <input type="hidden" name="subact" value="edit" style="display: none;" />
1059 <input type="hidden" name="id" value="<?php echo $getperidNumz; ?>" style="display: none;" />
1060 <input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
1061 <?php } if($getperidnum<=0) { ?>
1062 Permissions for <?php echo $InForumName; ?> are not set: <br />
1063 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1064 <input type="hidden" name="subact" value="create" style="display: none;" />
1065 <input type="hidden" name="permid" value="<?php echo $_POST['id']; ?>" style="display: none;" />
1066 <input type="hidden" name="id" value="<?php echo $InForumID; ?>" style="display: none;" />
1067 <input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
1068 <?php } ?>
1069 </td></tr></table>
1070 </form>
1071 <?php
1072 sql_free_result($getperidr);
1073 ++$fi; }
1074 sql_free_result($fr); ?>
1075 </td>
1076 </tr>
1077 <tr class="TableMenuRow4">
1078 <td class="TableMenuColumn4">&nbsp;</td>
1079 </tr>
1080 </table>
1081 </div>
1082 <?php } if(isset($_POST['id'])&&$_POST['subact']=="edit") {
1083 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
1084 $preresult=sql_query($prequery,$SQLStat);
1085 $prenum=sql_num_rows($preresult);
1086 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);
1087 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1088 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1089 if($prenum>=1) {
1090 $PermissionNum=sql_result($preresult,0,"id");
1091 $PermissionID=sql_result($preresult,0,"PermissionID");
1092 $PermissionName=sql_result($preresult,0,"Name");
1093 $PermissionForumID=sql_result($preresult,0,"ForumID");
1094 $CanViewForum=sql_result($preresult,0,"CanViewForum");
1095 $CanMakePolls=sql_result($preresult,0,"CanMakePolls");
1096 $CanMakeTopics=sql_result($preresult,0,"CanMakeTopics");
1097 $CanMakeReplys=sql_result($preresult,0,"CanMakeReplys");
1098 $CanMakeReplysCT=sql_result($preresult,0,"CanMakeReplysCT");
1099 $CanEditTopics=sql_result($preresult,0,"CanEditTopics");
1100 $CanEditTopicsCT=sql_result($preresult,0,"CanEditTopicsCT");
1101 $CanEditReplys=sql_result($preresult,0,"CanEditReplys");
1102 $CanEditReplysCT=sql_result($preresult,0,"CanEditReplysCT");
1103 $CanDeleteTopics=sql_result($preresult,0,"CanDeleteTopics");
1104 $CanDeleteTopicsCT=sql_result($preresult,0,"CanDeleteTopicsCT");
1105 $CanDeleteReplys=sql_result($preresult,0,"CanDeleteReplys");
1106 $CanDeleteReplysCT=sql_result($preresult,0,"CanDeleteReplysCT");
1107 $CanCloseTopics=sql_result($preresult,0,"CanCloseTopics");
1108 $CanPinTopics=sql_result($preresult,0,"CanPinTopics");
1109 $CanExecPHP=sql_result($preresult,0,0,"CanExecPHP");
1110 $CanDoHTML=sql_result($preresult,0,"CanDoHTML");
1111 $CanUseBBTags=sql_result($preresult,0,"CanUseBBTags");
1112 $CanModForum=sql_result($preresult,0,"CanModForum");
1113 sql_free_result($preresult); }
1114 $PermissionName = stripcslashes(htmlspecialchars($PermissionName, ENT_QUOTES, $Settings['charset']));
1115 //$_POST['ForumName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ForumName']);
1117 <div class="TableMenuBorder">
1118 <?php if($ThemeSet['TableStyle']=="div") { ?>
1119 <div class="TableMenuRow1">
1120 <?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>
1121 <?php } ?>
1122 <table class="TableMenu" style="width: 100%;">
1123 <?php if($ThemeSet['TableStyle']=="table") { ?>
1124 <tr class="TableMenuRow1">
1125 <td class="TableMenuColumn1"><span style="float: left;">
1126 <?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>
1127 </span><span style="float: right;">&nbsp;</span></td>
1128 </tr><?php } ?>
1129 <tr class="TableMenuRow2">
1130 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
1131 <span style="float: left;">&nbsp;Editing Forum Permissions: </span>
1132 <span style="float: right;">&nbsp;</span>
1133 </th>
1134 </tr>
1135 <tr class="TableMenuRow3">
1136 <td class="TableMenuColumn3">
1137 <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']); ?>">
1138 <table style="text-align: left;">
1139 <tr style="text-align: left;">
1140 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewForum">Can view forum:</label></td>
1141 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewForum" id="CanViewForum">
1142 <option <?php if($CanViewForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1143 <option <?php if($CanViewForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1144 </select></td>
1145 </tr>
1146 <tr style="text-align: left;">
1147 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeTopics">Can make topics:</label></td>
1148 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeTopics" id="CanMakeTopics">
1149 <option <?php if($CanMakeTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1150 <option <?php if($CanMakeTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1151 </select></td>
1152 </tr>
1153 <tr style="text-align: left;">
1154 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakePolls">Can make polls:</label></td>
1155 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakePolls" id="CanMakePolls">
1156 <option <?php if($CanMakePolls=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1157 <option <?php if($CanMakePolls=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1158 </select></td>
1159 </tr>
1160 <tr style="text-align: left;">
1161 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplys">Can make replys in own:</label></td>
1162 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplys" id="CanMakeReplys">
1163 <option <?php if($CanMakeReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1164 <option <?php if($CanMakeReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1165 </select></td>
1166 </tr>
1167 <tr style="text-align: left;">
1168 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplysCT">Can make replys other users topic:</label></td>
1169 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplysCT" id="CanMakeReplysCT">
1170 <option <?php if($CanMakeReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1171 <option <?php if($CanMakeReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1172 </select></td>
1173 </tr>
1174 <tr style="text-align: left;">
1175 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopics">Can edit own topics:</label></td>
1176 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopics" id="CanEditTopics">
1177 <option <?php if($CanEditTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1178 <option <?php if($CanEditTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1179 </select></td>
1180 </tr>
1181 <tr style="text-align: left;">
1182 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopicsCT">Can edit other users topics:</label></td>
1183 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopicsCT" id="CanEditTopicsCT">
1184 <option <?php if($CanEditTopicsCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1185 <option <?php if($CanEditTopicsCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1186 </select></td>
1187 </tr>
1188 <tr style="text-align: left;">
1189 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplys">Can edit own replys:</label></td>
1190 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplys" id="CanEditReplys">
1191 <option <?php if($CanEditReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1192 <option <?php if($CanEditReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1193 </select></td>
1194 </tr>
1195 <tr style="text-align: left;">
1196 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplysCT">Can edit other users replys:</label></td>
1197 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplysCT" id="CanEditReplysCT">
1198 <option <?php if($CanEditReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1199 <option <?php if($CanEditReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1200 </select></td>
1201 </tr>
1202 <tr style="text-align: left;">
1203 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteTopics">Can delete own topics:</label></td>
1204 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopics" id="CanDeleteTopics">
1205 <option <?php if($CanDeleteTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1206 <option <?php if($CanDeleteTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1207 </select></td>
1208 </tr>
1209 <tr style="text-align: left;">
1210 <td style="width: 50%;"><label class="TextBoxLabel" for="Can delete other users topics">Can delete other users topics:</label></td>
1211 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopicsCT" id="CanDeleteTopicsCT">
1212 <option <?php if($CanDeleteTopicsCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1213 <option <?php if($CanDeleteTopicsCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1214 </select></td>
1215 </tr>
1216 <tr style="text-align: left;">
1217 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplys">Can delete own replys:</label></td>
1218 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplys" id="CanDeleteReplys">
1219 <option <?php if($CanDeleteReplys=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1220 <option <?php if($CanDeleteReplys=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1221 </select></td>
1222 </tr>
1223 <tr style="text-align: left;">
1224 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplysCT">Can delete other users replys:</label></td>
1225 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplysCT" id="CanDeleteReplysCT">
1226 <option <?php if($CanDeleteReplysCT=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1227 <option <?php if($CanDeleteReplysCT=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1228 </select></td>
1229 </tr>
1230 <tr style="text-align: left;">
1231 <td style="width: 50%;"><label class="TextBoxLabel" for="CanCloseTopics">Can close topics:</label></td>
1232 <td style="width: 50%;"><select size="1" class="TextBox" name="CanCloseTopics" id="CanCloseTopics">
1233 <option <?php if($CanCloseTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1234 <option <?php if($CanCloseTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1235 </select></td>
1236 </tr>
1237 <tr style="text-align: left;">
1238 <td style="width: 50%;"><label class="TextBoxLabel" for="CanPinTopics">Can pin topics:</label></td>
1239 <td style="width: 50%;"><select size="1" class="TextBox" name="CanPinTopics" id="CanPinTopics">
1240 <option <?php if($CanPinTopics=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1241 <option <?php if($CanPinTopics=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1242 </select></td>
1243 </tr>
1244 <tr style="text-align: left;">
1245 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
1246 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
1247 <option <?php if($CanDoHTML=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1248 <option <?php if($CanDoHTML=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1249 </select></td>
1250 </tr>
1251 <tr style="text-align: left;">
1252 <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
1253 <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
1254 <option <?php if($CanUseBBTags=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1255 <option <?php if($CanUseBBTags=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1256 </select></td>
1257 </tr>
1258 <tr style="text-align: left;">
1259 <td style="width: 50%;"><label class="TextBoxLabel" for="CanModForum">Can moderate forum:</label></td>
1260 <td style="width: 50%;"><select size="1" class="TextBox" name="CanModForum" id="CanModForum">
1261 <option <?php if($CanModForum=="yes") { echo "selected=\"selected\" "; } ?>value="yes">yes</option>
1262 <option <?php if($CanModForum=="no") { echo "selected=\"selected\" "; } ?>value="no">no</option>
1263 </select></td>
1264 </tr></table>
1265 <table style="text-align: left;">
1266 <tr style="text-align: left;">
1267 <td style="width: 100%;">
1268 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1269 <input type="hidden" name="subact" value="editnow" style="display: none;" />
1270 <input type="hidden" name="id" value="<?php echo $PermissionNum; ?>" style="display: none;" />
1271 <input type="submit" class="Button" value="Edit Permissions" name="Apply_Changes" />
1272 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1273 </td></tr></table>
1274 </form>
1275 </td>
1276 </tr>
1277 <tr class="TableMenuRow4">
1278 <td class="TableMenuColumn4">&nbsp;</td>
1279 </tr>
1280 </table>
1281 </div>
1282 <?php } if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
1283 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
1284 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
1285 $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', \"CanUseBBTags\"='%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['CanUseBBTags'], $_POST['CanModForum'], $_POST['id']));
1286 sql_query($query,$SQLStat); } if(isset($_POST['id'])&&$_POST['subact']=="create") {
1288 <div class="TableMenuBorder">
1289 <?php if($ThemeSet['TableStyle']=="div") { ?>
1290 <div class="TableMenuRow1">
1291 <?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>
1292 <?php } ?>
1293 <table class="TableMenu" style="width: 100%;">
1294 <?php if($ThemeSet['TableStyle']=="table") { ?>
1295 <tr class="TableMenuRow1">
1296 <td class="TableMenuColumn1"><span style="float: left;">
1297 <?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>
1298 </span><span style="float: right;">&nbsp;</span></td>
1299 </tr><?php } ?>
1300 <tr class="TableMenuRow2">
1301 <th class="TableMenuColumn2" style="width: 100%; text-align: left;">
1302 <span style="float: left;">&nbsp;Editing Forum Permissions: </span>
1303 <span style="float: right;">&nbsp;</span>
1304 </th>
1305 </tr>
1306 <tr class="TableMenuRow3">
1307 <td class="TableMenuColumn3">
1308 <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']); ?>">
1309 <table style="text-align: left;">
1310 <tr style="text-align: left;">
1311 <td style="width: 50%;"><label class="TextBoxLabel" for="CanViewForum">Can view forum:</label></td>
1312 <td style="width: 50%;"><select size="1" class="TextBox" name="CanViewForum" id="CanViewForum">
1313 <option value="yes">yes</option>
1314 <option value="no">no</option>
1315 </select></td>
1316 </tr>
1317 <tr style="text-align: left;">
1318 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakePolls">Can make polls:</label></td>
1319 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakePolls" id="CanMakePolls">
1320 <option value="yes">yes</option>
1321 <option value="no">no</option>
1322 </select></td>
1323 </tr>
1324 <tr style="text-align: left;">
1325 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeTopics">Can make topics:</label></td>
1326 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeTopics" id="CanMakeTopics">
1327 <option value="yes">yes</option>
1328 <option value="no">no</option>
1329 </select></td>
1330 </tr>
1331 <tr style="text-align: left;">
1332 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplys">Can make replys in own:</label></td>
1333 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplys" id="CanMakeReplys">
1334 <option value="yes">yes</option>
1335 <option value="no">no</option>
1336 </select></td>
1337 </tr>
1338 <tr style="text-align: left;">
1339 <td style="width: 50%;"><label class="TextBoxLabel" for="CanMakeReplysCT">Can make replys other users topic:</label></td>
1340 <td style="width: 50%;"><select size="1" class="TextBox" name="CanMakeReplysCT" id="CanMakeReplysCT">
1341 <option value="yes">yes</option>
1342 <option value="no">no</option>
1343 </select></td>
1344 </tr>
1345 <tr style="text-align: left;">
1346 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopics">Can edit own topics:</label></td>
1347 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopics" id="CanEditTopics">
1348 <option value="yes">yes</option>
1349 <option value="no">no</option>
1350 </select></td>
1351 </tr>
1352 <tr style="text-align: left;">
1353 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditTopicsCT">Can edit other users topics:</label></td>
1354 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditTopicsCT" id="CanEditTopicsCT">
1355 <option value="yes">yes</option>
1356 <option value="no">no</option>
1357 </select></td>
1358 </tr>
1359 <tr style="text-align: left;">
1360 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplys">Can edit own replys:</label></td>
1361 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplys" id="CanEditReplys">
1362 <option value="yes">yes</option>
1363 <option value="no">no</option>
1364 </select></td>
1365 </tr>
1366 <tr style="text-align: left;">
1367 <td style="width: 50%;"><label class="TextBoxLabel" for="CanEditReplysCT">Can edit other users replys:</label></td>
1368 <td style="width: 50%;"><select size="1" class="TextBox" name="CanEditReplysCT" id="CanEditReplysCT">
1369 <option value="yes">yes</option>
1370 <option value="no">no</option>
1371 </select></td>
1372 </tr>
1373 <tr style="text-align: left;">
1374 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteTopics">Can delete own topics:</label></td>
1375 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopics" id="CanDeleteTopics">
1376 <option value="yes">yes</option>
1377 <option value="no">no</option>
1378 </select></td>
1379 </tr>
1380 <tr style="text-align: left;">
1381 <td style="width: 50%;"><label class="TextBoxLabel" for="Can delete other users topics">Can delete other users topics:</label></td>
1382 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteTopicsCT" id="CanDeleteTopicsCT">
1383 <option value="yes">yes</option>
1384 <option value="no">no</option>
1385 </select></td>
1386 </tr>
1387 <tr style="text-align: left;">
1388 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplys">Can delete own replys:</label></td>
1389 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplys" id="CanDeleteReplys">
1390 <option value="yes">yes</option>
1391 <option value="no">no</option>
1392 </select></td>
1393 </tr>
1394 <tr style="text-align: left;">
1395 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDeleteReplysCT">Can delete other users replys:</label></td>
1396 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDeleteReplysCT" id="CanDeleteReplysCT">
1397 <option value="yes">yes</option>
1398 <option value="no">no</option>
1399 </select></td>
1400 </tr>
1401 <tr style="text-align: left;">
1402 <td style="width: 50%;"><label class="TextBoxLabel" for="CanCloseTopics">Can close topics:</label></td>
1403 <td style="width: 50%;"><select size="1" class="TextBox" name="CanCloseTopics" id="CanCloseTopics">
1404 <option value="yes">yes</option>
1405 <option value="no">no</option>
1406 </select></td>
1407 </tr>
1408 <tr style="text-align: left;">
1409 <td style="width: 50%;"><label class="TextBoxLabel" for="CanPinTopics">Can pin topics:</label></td>
1410 <td style="width: 50%;"><select size="1" class="TextBox" name="CanPinTopics" id="CanPinTopics">
1411 <option value="yes">yes</option>
1412 <option value="no">no</option>
1413 </select></td>
1414 </tr>
1415 <tr style="text-align: left;">
1416 <td style="width: 50%;"><label class="TextBoxLabel" for="CanDoHTML">Can DoHTML:</label></td>
1417 <td style="width: 50%;"><select size="1" class="TextBox" name="CanDoHTML" id="CanDoHTML">
1418 <option value="yes">yes</option>
1419 <option value="no">no</option>
1420 </select></td>
1421 </tr>
1422 <tr style="text-align: left;">
1423 <td style="width: 50%;"><label class="TextBoxLabel" for="CanUseBBTags">Can use BBTags:</label></td>
1424 <td style="width: 50%;"><select size="1" class="TextBox" name="CanUseBBTags" id="CanUseBBTags">
1425 <option value="yes">yes</option>
1426 <option value="no">no</option>
1427 </select></td>
1428 </tr>
1429 <tr style="text-align: left;">
1430 <td style="width: 50%;"><label class="TextBoxLabel" for="CanModForum">Can moderate forum:</label></td>
1431 <td style="width: 50%;"><select size="1" class="TextBox" name="CanModForum" id="CanModForum">
1432 <option value="yes">yes</option>
1433 <option value="no">no</option>
1434 </select></td>
1435 </tr></table>
1436 <table style="text-align: left;">
1437 <tr style="text-align: left;">
1438 <td style="width: 100%;">
1439 <input type="hidden" name="act" value="fpermissions" style="display: none;" />
1440 <input type="hidden" name="subact" value="makenow" style="display: none;" />
1441 <input type="hidden" name="id" value="<?php echo $_POST['id']; ?>" style="display: none;" />
1442 <input type="hidden" name="permid" value="<?php echo $_POST['permid']; ?>" style="display: none;" />
1443 <input type="submit" class="Button" value="Create Permissions" name="Apply_Changes" />
1444 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1445 </td></tr></table>
1446 </form>
1447 </td>
1448 </tr>
1449 <tr class="TableMenuRow4">
1450 <td class="TableMenuColumn4">&nbsp;</td>
1451 </tr>
1452 </table>
1453 </div>
1454 <?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
1455 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
1456 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=forums",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
1457 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['permid']));
1458 $preresult=sql_query($prequery,$SQLStat);
1459 $prenum=sql_num_rows($preresult);
1460 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);
1461 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1462 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1463 if($prenum>=1) {
1464 $PermissionName=sql_result($preresult,0,"Name");
1465 sql_free_result($preresult); }
1466 //$nextidnum = sql_get_next_id($Settings['sqltable'],"permissions",$SQLStat);
1467 $nextidnum = null;
1468 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."permissions\" (\"PermissionID\", \"Name\", \"ForumID\", \"CanViewForum\", \"CanMakePolls\", \"CanMakeTopics\", \"CanMakeReplys\", \"CanMakeReplysCT\", \"CanEditTopics\", \"CanEditTopicsCT\", \"CanEditReplys\", \"CanEditReplysCT\", \"CanDeleteTopics\", \"CanDeleteTopicsCT\", \"CanDeleteReplys\", \"CanDeleteReplysCT\", \"CanCloseTopics\", \"CanPinTopics\", \"CanExecPHP\", \"CanDoHTML\", \"CanUseBBTags\", \"CanModForum\") VALUES\n".
1469 "(%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['CanUseBBTags'], $_POST['CanModForum']));
1470 sql_query($query,$SQLStat); } }
1471 $doupdate = false;
1472 if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
1473 $doupdate = true; }
1474 if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
1475 $doupdate = true; }
1476 if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") {
1477 $doupdate = true; }
1478 if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") {
1479 $doupdate = true; }
1480 if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
1481 isset($_POST['id'])) {
1482 $doupdate = true; }
1483 if($doupdate===true&&$Error!="Yes") { ?>
1484 <div class="TableMenuBorder">
1485 <?php if($ThemeSet['TableStyle']=="div") { ?>
1486 <div class="TableMenuRow1">
1487 <?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>
1488 <?php } ?>
1489 <table class="TableMenu" style="width: 100%;">
1490 <?php if($ThemeSet['TableStyle']=="table") { ?>
1491 <tr class="TableMenuRow1">
1492 <td class="TableMenuColumn1"><span style="float: left;">
1493 <?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>
1494 </span><span style="float: right;">&nbsp;</span></td>
1495 </tr><?php } ?>
1496 <tr id="ProfileTitle" class="TableMenuRow2">
1497 <th class="TableMenuColumn2">Updating Settings</th>
1498 </tr>
1499 <tr class="TableMenuRow3" id="ProfileUpdate">
1500 <td class="TableMenuColumn3">
1501 <?php if(isset($_POST['id'])&&$_POST['subact']=="editnow") { ?>
1502 <div style="text-align: center;">
1503 <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;
1504 </div>
1505 <?php } if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { ?>
1506 <div style="text-align: center;">
1507 <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;
1508 </div>
1509 <?php } if($_POST['act']=="addforum"&&$_POST['update']=="now"&&$_GET['act']=="addforum") { ?>
1510 <div style="text-align: center;">
1511 <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;
1512 </div>
1513 <?php } if($_GET['act']=="deleteforum"&&$_POST['update']=="now"&&$_GET['act']=="deleteforum") { ?>
1514 <div style="text-align: center;">
1515 <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;
1516 </div>
1517 <?php } if($_POST['act']=="editforum"&&$_POST['update']=="now"&&$_GET['act']=="editforum"&&
1518 isset($_POST['id'])) { ?>
1519 <div style="text-align: center;">
1520 <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;
1521 </div>
1522 <?php } ?>
1523 </td></tr>
1524 <tr id="ProfileTitleEnd" class="TableMenuRow4">
1525 <td class="TableMenuColumn4">&nbsp;</td>
1526 </tr></table></div>
1527 <?php } if ($_GET['act']!=null&&$Error=="Yes") {
1528 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");
1529 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
1531 <div class="TableMenuBorder">
1532 <?php if($ThemeSet['TableStyle']=="div") { ?>
1533 <div class="TableMenuRow1">
1534 <?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>
1535 <?php } ?>
1536 <table class="TableMenu" style="width: 100%;">
1537 <?php if($ThemeSet['TableStyle']=="table") { ?>
1538 <tr class="TableMenuRow1">
1539 <td class="TableMenuColumn1"><span style="float: left;">
1540 <?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>
1541 </span><span style="float: right;">&nbsp;</span></td>
1542 </tr><?php } ?>
1543 <tr id="ProfileTitle" class="TableMenuRow2">
1544 <th class="TableMenuColumn2">Updating Settings</th>
1545 </tr>
1546 <tr class="TableMenuRow3" id="ProfileUpdate">
1547 <td class="TableMenuColumn3">
1548 <div style="text-align: center;">
1549 <br /><?php echo $errorstr; ?>
1550 <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;
1551 </div>
1552 </td></tr>
1553 <tr id="ProfileTitleEnd" class="TableMenuRow4">
1554 <td class="TableMenuColumn4">&nbsp;</td>
1555 </tr></table></div>
1556 <?php } ?>
1557 </td></tr>
1558 </table>
1559 <div>&nbsp;</div>