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: categories.php - Last Update: 08/02/2019 SVN 905 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="categories.php"||
$File3Name=="/categories.php") {
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;">
33 require($SettDir['admin'].'table.php');
36 <td style
="width: 85%; vertical-align: top;">
37 <?php
if($_GET['act']=="addcategory"&&$_POST['update']!="now") {
38 $admincptitle = " ".$ThemeSet['TitleDivider']." Adding new Category";
40 <div
class="TableMenuBorder">
41 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
42 <div
class="TableMenuRow1">
43 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=addcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
></div
>
45 <table
class="TableMenu" style
="width: 100%;">
46 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
47 <tr
class="TableMenuRow1">
48 <td
class="TableMenuColumn1"><span style
="float: left;">
49 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=addcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
>
50 </span
><span style
="float: right;"> 
;</span
></td
>
52 <tr
class="TableMenuRow2">
53 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
54 <span style
="float: left;"> 
;Adding
new Category
: </span
>
55 <span style
="float: right;"> 
;</span
>
58 <tr
class="TableMenuRow3">
59 <td
class="TableMenuColumn3">
60 <form style
="display: inline;" method
="post" id
="acptool" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=addcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
61 <table style
="text-align: left;">
62 <tr style
="text-align: left;">
63 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryID">Insert ID
for category
:</label
></td
>
64 <td style
="width: 50%;"><input type
="number" name
="CategoryID" class="TextBox" id
="CategoryID" size
="20" /></td
>
65 </tr
><tr style
="text-align: left;">
66 <td style
="width: 50%;"><label
class="TextBoxLabel" for="OrderID">Insert order id category
:</label
></td
>
67 <td style
="width: 50%;"><input type
="number" name
="OrderID" class="TextBox" id
="OrderID" size
="20" /></td
>
68 </tr
><tr style
="text-align: left;">
69 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryName">Insert name
for category
:</label
></td
>
70 <td style
="width: 50%;"><input type
="text" name
="CategoryName" class="TextBox" id
="CategoryName" size
="20" /></td
>
71 </tr
><tr style
="text-align: left;">
72 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryDesc">Insert description
for category
:</label
></td
>
73 <td style
="width: 50%;"><input type
="text" name
="CategoryDesc" class="TextBox" id
="CategoryDesc" size
="20" /></td
>
74 </tr
><tr style
="text-align: left;">
75 <td style
="width: 50%;"><label
class="TextBoxLabel" for="ShowCategory">Show category
:</label
></td
>
76 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="ShowCategory" id
="ShowCategory">
77 <option selected
="selected" value
="yes">yes
</option
>
78 <option value
="no">no
</option
>
80 </tr
><tr style
="text-align: left;">
81 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryType">Insert category type
:</label
></td
>
82 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="CategoryType" id
="CategoryType">
83 <option selected
="selected" value
="category">Category
</option
>
84 <option value
="subcategory">SubCategory
</option
>
86 </tr
><tr style
="text-align: left;">
87 <td style
="width: 50%;"><label
class="TextBoxLabel" for="InSubCategory">In SubCategory
:</label
></td
>
88 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="InSubCategory" id
="InSubCategory">
89 <option selected
="selected" value
="0">none
</option
>
91 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=0 AND \"CategoryType\"='subcategory' ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
92 $fr=sql_query($fq,$SQLStat);
93 $ai=sql_num_rows($fr);
96 $InCategoryID=sql_result($fr,$fi,"id");
97 $InCategoryName=sql_result($fr,$fi,"Name");
98 $InCategoryType=sql_result($fr,$fi,"CategoryType");
99 $AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
100 if ($AiFiInSubCategory=="0") {
102 <option value
="<?php echo $InCategoryID; ?>"><?php
echo $InCategoryName; ?
></option
>
104 sql_free_result($fr); ?
>
106 </tr
><tr style
="text-align: left;">
107 <td style
="width: 50%;"><label
class="TextBoxLabel" for="NumPostView">Number of posts to view category
:</label
></td
>
108 <td style
="width: 50%;"><input type
="number" class="TextBox" size
="20" name
="NumPostView" id
="NumPostView" /></td
>
109 </tr
><tr style
="text-align: left;">
110 <td style
="width: 50%;"><label
class="TextBoxLabel" for="NumKarmaView">Amount of karma to view category
:</label
></td
>
111 <td style
="width: 50%;"><input type
="number" class="TextBox" size
="20" name
="NumKarmaView" id
="NumKarmaView" /></td
>
113 <table style
="text-align: left;">
114 <tr style
="text-align: left;">
115 <td style
="width: 100%;">
116 <input type
="hidden" name
="act" value
="addcategory" style
="display: none;" />
117 <input type
="hidden" name
="update" value
="now" style
="display: none;" />
118 <input type
="submit" class="Button" value
="Add Category" name
="Apply_Changes" />
119 <input type
="reset" value
="Reset Form" class="Button" name
="Reset_Form" />
124 <tr
class="TableMenuRow4">
125 <td
class="TableMenuColumn4"> 
;</td
>
129 <?php
} if($_POST['act']=="addcategory"&&$_POST['update']=="now"&&$_GET['act']=="addcategory") {
130 $_POST['CategoryName'] = stripcslashes(htmlspecialchars($_POST['CategoryName'], ENT_QUOTES
, $Settings['charset']));
131 //$_POST['CategoryName'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryName']);
132 $_POST['CategoryName'] = remove_spaces($_POST['CategoryName']);
133 $_POST['CategoryDesc'] = stripcslashes(htmlspecialchars($_POST['CategoryDesc'], ENT_QUOTES
, $Settings['charset']));
134 //$_POST['CategoryDesc'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryDesc']);
135 $_POST['CategoryDesc'] = remove_spaces($_POST['CategoryDesc']);
136 $sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['CategoryID'])),$SQLStat);
137 $sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."categories\" WHERE \"OrderID\"=%i LIMIT 1", array($_POST['OrderID'])),$SQLStat);
138 $id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
139 sql_free_result($sql_id_check); sql_free_result($sql_order_check);
141 if ($_POST['NumPostView']==null||
142 !is_numeric($_POST['NumPostView'])) {
143 $_POST['NumPostView'] = 0; }
144 if ($_POST['NumKarmaView']==null||
145 !is_numeric($_POST['NumKarmaView'])) {
146 $_POST['NumKarmaView'] = 0; }
147 if ($_POST['CategoryName']==null||
148 $_POST['CategoryName']=="ShowMe") { $Error="Yes";
149 $errorstr = $errorstr."You need to enter a category name.<br />\n"; }
150 if ($_POST['CategoryDesc']==null) { $Error="Yes";
151 $errorstr = $errorstr."You need to enter a description.<br />\n"; }
152 if ($_POST['CategoryID']==null||
153 !is_numeric($_POST['CategoryID'])) { $Error="Yes";
154 $errorstr = $errorstr."You need to enter a category id.<br />\n"; }
155 if($id_check > 0) { $Error="Yes";
156 $errorstr = $errorstr."This ID number is already used.<br />\n"; }
157 if($order_check > 0) { $Error="Yes";
158 $errorstr = $errorstr."This order number is already used.<br />\n"; }
159 if (pre_strlen($_POST['CategoryName'])>"150") { $Error="Yes";
160 $errorstr = $errorstr."Your category name is too big.<br />\n"; }
161 if (pre_strlen($_POST['CategoryDesc'])>"300") { $Error="Yes";
162 $errorstr = $errorstr."Your category description is too big.<br />\n"; }
164 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
165 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
166 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."categories\" (\"id\", \"OrderID\", \"Name\", \"ShowCategory\", \"CategoryType\", \"SubShowForums\", \"InSubCategory\", \"PostCountView\", \"KarmaCountView\", \"Description\") VALUES\n".
167 "(%i, %i, '%s', '%s', '%s', 'yes', %i, %i, %i, '%s')", array($_POST['CategoryID'],$_POST['OrderID'],$_POST['CategoryName'],$_POST['ShowCategory'],$_POST['CategoryType'],$_POST['InSubCategory'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['CategoryDesc']));
168 sql_query($query,$SQLStat);
169 if($Settings['sqltype']=="mysql"||
$Settings['sqltype']=="mysqli"||
170 $Settings['sqltype']=="pgsql"||
$Settings['sqltype']=="sqlite"||
171 $Settings['sqltype']=="sqlite3") {
172 $getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."catpermissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
173 if($Settings['sqltype']=="cubrid") {
174 $getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."catpermissions\" ORDER BY \"PermissionID\" ASC", array(null)); }
175 $getperidr=sql_query($getperidq,$SQLStat);
176 $getperidnum=sql_num_rows($getperidr);
178 //$nextperid = sql_get_next_id($Settings['sqltable'],"catpermissions",$SQLStat);
180 while ($getperidi < $getperidnum) {
181 if($Settings['sqltype']=="mysql"||
$Settings['sqltype']=="mysqli"||
182 $Settings['sqltype']=="pgsql"||
$Settings['sqltype']=="cubrid"||
183 $Settings['sqltype']=="sqlite3") {
184 $getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
185 if($Settings['sqltype']=="sqlite") {
186 $getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
187 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i", array($getperidID));
188 $getperidr2=sql_query($getperidq2,$SQLStat);
189 $getperidnum2=sql_num_rows($getperidr2);
190 $getperidName=sql_result($getperidr2,0,"Name");
191 sql_free_result($getperidr2);
192 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES (%i, '%s', %i, 'yes')", array($getperidID,$getperidName,$_POST['CategoryID']));
193 sql_query($query,$SQLStat);
194 ++
$getperidi; /*++$nextperid;*/ }
195 sql_free_result($getperidr); } }
196 if($_GET['act']=="deletecategory"&&$_POST['update']!="now") {
197 $admincptitle = " ".$ThemeSet['TitleDivider']." Deleting a Category";
199 <div
class="TableMenuBorder">
200 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
201 <div
class="TableMenuRow1">
202 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=addcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
></div
>
204 <table
class="TableMenu" style
="width: 100%;">
205 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
206 <tr
class="TableMenuRow1">
207 <td
class="TableMenuColumn1"><span style
="float: left;">
208 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=addcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
>
209 </span
><span style
="float: right;"> 
;</span
></td
>
211 <tr
class="TableMenuRow2">
212 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
213 <span style
="float: left;"> 
;Deleting a Category
: </span
>
214 <span style
="float: right;"> 
;</span
>
217 <tr
class="TableMenuRow3">
218 <td
class="TableMenuColumn3">
219 <form style
="display: inline;" method
="post" id
="acptool" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=deletecategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
220 <table style
="text-align: left;">
221 <tr style
="text-align: left;">
222 <td style
="width: 50%;"><label
class="TextBoxLabel" for="DelCategories">Delete all categories in subcategory
:</label
></td
>
223 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="DelCategories" id
="DelCategories">
224 <option selected
="selected" value
="yes">yes
</option
>
225 <option value
="no">no
</option
>
227 </tr
><tr style
="text-align: left;">
228 <td style
="width: 50%;"><label
class="TextBoxLabel" for="DelForums">Delete all forums
in (sub
)category
:</label
></td
>
229 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="DelForums" id
="DelForums">
230 <option selected
="selected" value
="yes">yes
</option
>
231 <option value
="no">no
</option
>
233 </tr
><tr style
="text-align: left;">
234 <td style
="width: 50%;"><label
class="TextBoxLabel" for="DelTopics">Delete all topics
in (sub
)category
:</label
></td
>
235 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="DelTopics" id
="DelTopics">
236 <option selected
="selected" value
="yes">yes
</option
>
237 <option value
="no">no
</option
>
239 </tr
><tr style
="text-align: left;">
240 <td style
="width: 50%;"><label
class="TextBoxLabel" for="DelPermission">Delete all permission sets
in (sub
)category
:</label
></td
>
241 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="DelPermission" id
="DelPermission">
242 <option selected
="selected" value
="yes">yes
</option
>
243 <option value
="no">no
</option
>
245 </tr
><tr style
="text-align: left;">
246 <td style
="width: 50%;"><label
class="TextBoxLabel" for="DelID">Delete Category
:</label
></td
>
247 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="DelID" id
="DelID">
249 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
250 $fr=sql_query($fq,$SQLStat);
251 $ai=sql_num_rows($fr);
254 $InCategoryID=sql_result($fr,$fi,"id");
255 $InCategoryName=sql_result($fr,$fi,"Name");
256 $InCategoryType=sql_result($fr,$fi,"CategoryType");
257 $AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
259 <option value
="<?php echo $InCategoryID; ?>"><?php
echo $InCategoryName; ?
></option
>
261 sql_free_result($fr); ?
>
264 <table style
="text-align: left;">
265 <tr style
="text-align: left;">
266 <td style
="width: 100%;">
267 <input type
="hidden" name
="act" value
="deletecategory" style
="display: none;" />
268 <input type
="hidden" name
="update" value
="now" style
="display: none;" />
269 <input type
="submit" class="Button" value
="Delete Category" name
="Apply_Changes" />
270 <input type
="reset" value
="Reset Form" class="Button" name
="Reset_Form" />
275 <tr
class="TableMenuRow4">
276 <td
class="TableMenuColumn4"> 
;</td
>
280 <?php
} if($_GET['act']=="deletecategory"&&$_POST['update']=="now"&&$_GET['act']=="deletecategory") {
281 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
282 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['DelID']));
283 $preresult=sql_query($prequery,$SQLStat);
284 $prenum=sql_num_rows($preresult);
285 $errorstr = ""; $Error = null;
286 if (!is_numeric($_POST['DelID'])) { $Error="Yes";
287 $errorstr = $errorstr."You need to enter a forum ID.<br />\n"; }
288 if($prenum>0&&$Error!="Yes") {
289 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i", array($_POST['DelID']));
290 sql_query($dtquery,$SQLStat);
291 if($_POST['DelCategories']=="yes") {
292 $dscquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=%i", array($_POST['DelID']));
293 sql_query($dscquery,$SQLStat); }
294 if($_POST['DelForums']=="yes") {
295 $dsfquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."forums\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
296 sql_query($dsfquery,$SQLStat); }
297 if($_POST['DelForums']=="yes") {
298 $dstquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
299 sql_query($dstquery,$SQLStat); }
300 if($_POST['DelForums']=="yes") {
301 $dstquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
302 sql_query($dstquery,$SQLStat);
303 $dstquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"CategoryID\"=%i", array($_POST['DelID']));
304 sql_query($dstquery,$SQLStat); }
305 if($_POST['DelPermission']=="yes") {
306 $apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"CategoryID\"=%i ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_POST['DelID']));
307 $apcresult=sql_query($apcquery,$SQLStat);
308 $apcnum=sql_num_rows($apcresult);
309 $apci=0; $apcl=1; if($apcnum>=1) {
310 while ($apci < $apcnum) {
311 $DelForumID=sql_result($apcresult,$apci,"id");
312 if($_POST['DelPermission']=="yes") {
313 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."permissions\" WHERE \"ForumID\"=%i", array($DelForumID));
314 sql_query($dtquery,$SQLStat); }
316 sql_free_result($apcresult); } }
317 if($_POST['DelPermission']=="yes") {
318 $apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=%i ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_POST['DelID']));
319 $apcresult=sql_query($apcquery,$SQLStat);
320 $apcnum=sql_num_rows($apcresult);
321 $apci=0; $apcl=1; if($apcnum>=1) {
322 while ($apci < $apcnum) {
323 $DelSubsCategoryID=sql_result($apcresult,$apci,"id");
324 if($_POST['DelPermission']=="yes") {
325 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"CategoryID\"=%i", array($DelSubsCategoryID));
326 sql_query($dtquery,$SQLStat); }
328 sql_free_result($apcresult); } }
330 <?php
} } if($_GET['act']=="editcategory"&&$_POST['update']!="now") {
331 $admincptitle = " ".$ThemeSet['TitleDivider']." Editing a Category";
332 if(!isset($_POST['id'])) {
334 <div
class="TableMenuBorder">
335 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
336 <div
class="TableMenuRow1">
337 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=editcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
></div
>
339 <table
class="TableMenu" style
="width: 100%;">
340 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
341 <tr
class="TableMenuRow1">
342 <td
class="TableMenuColumn1"><span style
="float: left;">
343 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=editcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
>
344 </span
><span style
="float: right;"> 
;</span
></td
>
346 <tr
class="TableMenuRow2">
347 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
348 <span style
="float: left;"> 
;Editing a Category
: </span
>
349 <span style
="float: right;"> 
;</span
>
352 <tr
class="TableMenuRow3">
353 <td
class="TableMenuColumn3">
354 <form style
="display: inline;" method
="post" id
="acptool" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=editcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
355 <table style
="text-align: left;">
356 <tr style
="text-align: left;">
357 <td style
="width: 50%;"><label
class="TextBoxLabel" for="id">Category to Edit
:</label
></td
>
358 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="id" id
="id">
360 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
361 $fr=sql_query($fq,$SQLStat);
362 $ai=sql_num_rows($fr);
365 $InCategoryID=sql_result($fr,$fi,"id");
366 $InCategoryName=sql_result($fr,$fi,"Name");
367 $InCategoryType=sql_result($fr,$fi,"CategoryType");
368 $AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
370 <option value
="<?php echo $InCategoryID; ?>"><?php
echo $InCategoryName; ?
></option
>
372 sql_free_result($fr); ?
>
375 <table style
="text-align: left;">
376 <tr style
="text-align: left;">
377 <td style
="width: 100%;">
378 <input type
="hidden" name
="act" value
="editcategory" style
="display: none;" />
379 <input type
="submit" class="Button" value
="Edit Category" name
="Apply_Changes" />
380 <input type
="reset" value
="Reset Form" class="Button" name
="Reset_Form" />
385 <tr
class="TableMenuRow4">
386 <td
class="TableMenuColumn4"> 
;</td
>
390 <?php
} if(isset($_POST['id'])) {
391 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
392 $preresult=sql_query($prequery,$SQLStat);
393 $prenum=sql_num_rows($preresult);
394 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);
395 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
396 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
398 $CategoryID=sql_result($preresult,0,"id");
399 $CategoryOrder=sql_result($preresult,0,"OrderID");
400 $CategoryName=sql_result($preresult,0,"Name");
401 $ShowCategory=sql_result($preresult,0,"ShowCategory");
402 $CategoryType=sql_result($preresult,0,"CategoryType");
403 $SubShowForums=sql_result($preresult,0,"SubShowForums");
404 $InSubCategory=sql_result($preresult,0,"InSubCategory");
405 $CategoryDescription=sql_result($preresult,0,"Description");
406 $KarmaCountView=sql_result($preresult,0,"KarmaCountView");
407 $PostCountView=sql_result($preresult,0,"PostCountView");
408 sql_free_result($preresult);
409 $CategoryType = strtolower($CategoryType);
411 <div
class="TableMenuBorder">
412 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
413 <div
class="TableMenuRow1">
414 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=editcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
></div
>
416 <table
class="TableMenu" style
="width: 100%;">
417 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
418 <tr
class="TableMenuRow1">
419 <td
class="TableMenuColumn1"><span style
="float: left;">
420 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=editcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">iDB Category Manager
</a
>
421 </span
><span style
="float: right;"> 
;</span
></td
>
423 <tr
class="TableMenuRow2">
424 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
425 <span style
="float: left;"> 
;Editing a Category
: </span
>
426 <span style
="float: right;"> 
;</span
>
429 <tr
class="TableMenuRow3">
430 <td
class="TableMenuColumn3">
431 <form style
="display: inline;" method
="post" id
="acptool" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=editcategory
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
432 <table style
="text-align: left;">
433 <tr style
="text-align: left;">
434 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryID">Insert id
for category
:</label
></td
>
435 <td style
="width: 50%;"><input type
="number" name
="CategoryID" class="TextBox" id
="CategoryID" size
="20" value
="<?php echo $CategoryID; ?>" /></td
>
436 </tr
><tr style
="text-align: left;">
437 <td style
="width: 50%;"><label
class="TextBoxLabel" for="OrderID">Insert order id category
:</label
></td
>
438 <td style
="width: 50%;"><input type
="number" name
="OrderID" class="TextBox" id
="OrderID" size
="20" value
="<?php echo $CategoryOrder; ?>" /></td
>
439 </tr
><tr style
="text-align: left;">
440 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryName">Insert name
for category
:</label
></td
>
441 <td style
="width: 50%;"><input type
="text" name
="CategoryName" class="TextBox" id
="CategoryName" size
="20" value
="<?php echo $CategoryName; ?>" /></td
>
442 </tr
><tr style
="text-align: left;">
443 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryDesc">Insert description
for category
:</label
></td
>
444 <td style
="width: 50%;"><input type
="text" name
="CategoryDesc" class="TextBox" id
="CategoryDesc" size
="20" value
="<?php echo $CategoryDescription; ?>" /></td
>
445 </tr
><tr style
="text-align: left;">
446 <td style
="width: 50%;"><label
class="TextBoxLabel" for="ShowCategory">Show category
:</label
></td
>
447 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="ShowCategory" id
="ShowCategory">
448 <option
<?php
if($ShowCategory=="yes") { echo "selected=\"selected\" "; } ?
>value
="yes">yes
</option
>
449 <option
<?php
if($ShowCategory=="no") { echo "selected=\"selected\" "; } ?
>value
="no">no
</option
>
451 </tr
><tr style
="text-align: left;">
452 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CategoryType">Insert category type
:</label
></td
>
453 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="CategoryType" id
="CategoryType">
454 <option
<?php
if($CategoryType=="category") { echo "selected=\"selected\" "; } ?
>value
="category">Category
</option
>
455 <option
<?php
if($CategoryType=="subcategory") { echo "selected=\"selected\" "; } ?
>value
="subcategory">SubCategory
</option
>
457 </tr
><tr style
="text-align: left;">
458 <td style
="width: 50%;"><label
class="TextBoxLabel" for="InSubCategory">In SubCategory
:</label
></td
>
459 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="InSubCategory" id
="InSubCategory">
460 <option selected
="selected" value
="0">none
</option
>
462 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"InSubCategory\"=0 AND \"id\"<>%i AND \"CategoryType\"='subcategory' ORDER BY \"OrderID\" ASC, \"id\" ASC", array($CategoryID));
463 $fr=sql_query($fq,$SQLStat);
464 $ai=sql_num_rows($fr);
467 $InCategoryID=sql_result($fr,$fi,"id");
468 $InCategoryName=sql_result($fr,$fi,"Name");
469 $InCategoryType=sql_result($fr,$fi,"CategoryType");
470 $AiFiInSubCategory=sql_result($fr,$fi,"InSubCategory");
471 if ($AiFiInSubCategory=="0") {
472 if($InSubCategory==$InCategoryID) {
474 <option value
="<?php echo $InCategoryID; ?>" selected
="selected"><?php
echo $InCategoryName; ?
></option
>
475 <?php
} if($InSubCategory!=$InCategoryID) { ?
>
476 <option value
="<?php echo $InCategoryID; ?>"><?php
echo $InCategoryName; ?
></option
>
478 sql_free_result($fr); ?
>
480 </tr
><tr style
="text-align: left;">
481 <td style
="width: 50%;"><label
class="TextBoxLabel" for="NumPostView">Number of posts to view categories
:</label
></td
>
482 <td style
="width: 50%;"><input type
="number" class="TextBox" size
="20" name
="NumPostView" id
="NumPostView" value
="<?php echo $PostCountView; ?>" /></td
>
483 </tr
><tr style
="text-align: left;">
484 <td style
="width: 50%;"><label
class="TextBoxLabel" for="NumKarmaView">Amount of karma to view categories
:</label
></td
>
485 <td style
="width: 50%;"><input type
="number" class="TextBox" size
="20" name
="NumKarmaView" id
="NumKarmaView" value
="<?php echo $KarmaCountView; ?>" /></td
>
487 <table style
="text-align: left;">
488 <tr style
="text-align: left;">
489 <td style
="width: 100%;">
490 <input type
="hidden" name
="act" value
="editcategory" style
="display: none;" />
491 <input type
="hidden" name
="update" value
="now" style
="display: none;" />
492 <input type
="hidden" name
="id" value
="<?php echo $CategoryID; ?>" style
="display: none;" />
493 <input type
="submit" class="Button" value
="Edit Category" name
="Apply_Changes" />
494 <input type
="reset" value
="Reset Form" class="Button" name
="Reset_Form" />
499 <tr
class="TableMenuRow4">
500 <td
class="TableMenuColumn4"> 
;</td
>
504 <?php
} } } if($_POST['act']=="editcategory"&&$_POST['update']=="now"&&$_GET['act']=="editcategory"&&
505 isset($_POST['id'])) {
506 $_POST['CategoryName'] = stripcslashes(htmlspecialchars($_POST['CategoryName'], ENT_QUOTES
, $Settings['charset']));
507 //$_POST['CategoryName'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryName']);
508 $_POST['CategoryName'] = remove_spaces($_POST['CategoryName']);
509 $_POST['CategoryDesc'] = stripcslashes(htmlspecialchars($_POST['CategoryDesc'], ENT_QUOTES
, $Settings['charset']));
510 //$_POST['CategoryDesc'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryDesc']);
511 $_POST['CategoryDesc'] = remove_spaces($_POST['CategoryDesc']);
512 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
513 $preresult=sql_query($prequery,$SQLStat);
514 $prenum=sql_num_rows($preresult);
515 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);
516 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
517 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
519 $OldID=sql_result($preresult,0,"id");
520 $OldOrder=sql_result($preresult,0,"OrderID");
521 sql_free_result($preresult);
522 $sql_id_check = sql_query(sql_pre_query("SELECT \"id\" FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($_POST['ForumID'])),$SQLStat);
523 $sql_order_check = sql_query(sql_pre_query("SELECT \"OrderID\" FROM \"".$Settings['sqltable']."categories\" WHERE \"OrderID\"=%i LIMIT 1", array($_POST['OrderID'])),$SQLStat);
524 $id_check = sql_num_rows($sql_id_check); $order_check = sql_num_rows($sql_order_check);
525 sql_free_result($sql_id_check); sql_free_result($sql_order_check);
526 if ($_POST['NumPostView']==null||
527 !is_numeric($_POST['NumPostView'])) {
528 $_POST['NumPostView'] = 0; }
529 if ($_POST['NumKarmaView']==null||
530 !is_numeric($_POST['NumKarmaView'])) {
531 $_POST['NumKarmaView'] = 0; }
532 if ($_POST['CategoryName']==null||
533 $_POST['CategoryName']=="ShowMe") { $Error="Yes";
534 $errorstr = $errorstr."You need to enter a category name.<br />\n"; }
535 if ($_POST['CategoryDesc']==null) { $Error="Yes";
536 $errorstr = $errorstr."You need to enter a description.<br />\n"; }
537 if ($_POST['CategoryID']==null||
538 !is_numeric($_POST['CategoryID'])) { $Error="Yes";
539 $errorstr = $errorstr."You need to enter a category ID.<br />\n"; }
540 if($id_check > 0&&$_POST['CategoryID']!=$OldID) { $Error="Yes";
541 $errorstr = $errorstr."This ID number is already used.<br />\n"; }
542 if($order_check > 0&&$_POST['OrderID']!=$OldOrder) { $Error="Yes";
543 $errorstr = $errorstr."This order number is already used.<br />\n"; }
544 if (pre_strlen($_POST['CategoryName'])>"150") { $Error="Yes";
545 $errorstr = $errorstr."Your category name is too big.<br />\n"; }
546 if (pre_strlen($_POST['CategoryDesc'])>"300") { $Error="Yes";
547 $errorstr = $errorstr."Your category description is too big.<br />\n"; }
549 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
550 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
551 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."categories\" SET \"id\"=%i,\"OrderID\"=%i,\"Name\"='%s',\"ShowCategory\"='%s',\"CategoryType\"='%s',\"InSubCategory\"=%i,\"Description\"='%s',\"PostCountView\"=%i,\"KarmaCountView\"=%i WHERE \"id\"=%i", array($_POST['CategoryID'],$_POST['OrderID'],$_POST['CategoryName'],$_POST['ShowCategory'],$_POST['CategoryType'],$_POST['InSubCategory'],$_POST['CategoryDesc'],$_POST['NumPostView'],$_POST['NumKarmaView'],$_POST['id']));
552 sql_query($query,$SQLStat);
553 $queryz = sql_pre_query("UPDATE \"".$Settings['sqltable']."catpermissions\" SET \"CategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['id']));
554 sql_query($queryz,$SQLStat);
555 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"CategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['id']));
556 sql_query($query,$SQLStat);
557 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"CategoryID\"=%i,\"OldCategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['CategoryID'],$_POST['id']));
558 sql_query($query,$SQLStat);
559 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"CategoryID\"=%i WHERE \"CategoryID\"=%i", array($_POST['CategoryID'],$_POST['id']));
560 sql_query($query,$SQLStat); } } }
561 if($_GET['act']=="cpermissions"&&$_POST['update']!="now") {
562 $admincptitle = " ".$ThemeSet['TitleDivider']." Category Permissions Manager";
563 if(!isset($_POST['id'])) {
565 <div
class="TableMenuBorder">
566 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
567 <div
class="TableMenuRow1">
568 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
></div
>
570 <table
class="TableMenu" style
="width: 100%;">
571 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
572 <tr
class="TableMenuRow1">
573 <td
class="TableMenuColumn1"><span style
="float: left;">
574 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
>
575 </span
><span style
="float: right;"> 
;</span
></td
>
577 <tr
class="TableMenuRow2">
578 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
579 <span style
="float: left;"> 
;Category Permissions Manager
: </span
>
580 <span style
="float: right;"> 
;</span
>
583 <tr
class="TableMenuRow3">
584 <td
class="TableMenuColumn3">
585 <form style
="display: inline;" method
="post" id
="acptool" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
586 <table style
="text-align: left;">
587 <tr style
="text-align: left;">
588 <td style
="width: 50%;"><label
class="TextBoxLabel" for="id">Permission to view
:</label
></td
>
589 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="id" id
="id">
591 if($Settings['sqltype']=="mysql"||
$Settings['sqltype']=="mysqli"||
592 $Settings['sqltype']=="pgsql"||
$Settings['sqltype']=="sqlite"||
593 $Settings['sqltype']=="sqlite3") {
594 $getperidq = sql_pre_query("SELECT DISTINCT \"PermissionID\" FROM \"".$Settings['sqltable']."catpermissions\"", array(null)); }
595 if($Settings['sqltype']=="cubrid") {
596 $getperidq = sql_pre_query("SELECT DISTINCT \"permissionid\" FROM \"".$Settings['sqltable']."catpermissions\"", array(null)); }
597 $getperidr=sql_query($getperidq,$SQLStat);
598 $getperidnum=sql_num_rows($getperidr);
600 while ($getperidi < $getperidnum) {
601 if($Settings['sqltype']=="mysql"||
$Settings['sqltype']=="mysqli"||
602 $Settings['sqltype']=="pgsql"||
$Settings['sqltype']=="cubrid"||
603 $Settings['sqltype']=="sqlite3") {
604 $getperidID=sql_result($getperidr,$getperidi,"PermissionID"); }
605 if($Settings['sqltype']=="sqlite") {
606 $getperidID=sql_result($getperidr,$getperidi,"\"PermissionID\""); }
607 $getperidq2 = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i ORDER BY \"CategoryID\" ASC", array($getperidID));
608 $getperidr2=sql_query($getperidq2,$SQLStat);
609 $getperidnum2=sql_num_rows($getperidr2);
610 $getperidName=sql_result($getperidr2,0,"Name");
611 sql_free_result($getperidr2);
613 <option value
="<?php echo $getperidID; ?>"><?php
echo $getperidName; ?
></option
>
614 <?php ++
$getperidi; }
615 sql_free_result($getperidr); ?
>
618 <table style
="text-align: left;">
619 <tr style
="text-align: left;">
620 <td style
="width: 100%;">
621 <input type
="hidden" name
="act" value
="cpermissions" style
="display: none;" />
622 <input type
="submit" class="Button" value
="View Permission" name
="Apply_Changes" />
623 <input type
="reset" value
="Reset Form" class="Button" name
="Reset_Form" />
628 <tr
class="TableMenuRow4">
629 <td
class="TableMenuColumn4"> 
;</td
>
633 <?php
} if(isset($_POST['id'])&&$_POST['subact']==null) { ?
>
634 <div
class="TableMenuBorder">
635 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
636 <div
class="TableMenuRow1">
637 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
></div
>
639 <table
class="TableMenu" style
="width: 100%;">
640 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
641 <tr
class="TableMenuRow1">
642 <td
class="TableMenuColumn1"><span style
="float: left;">
643 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
>
644 </span
><span style
="float: right;"> 
;</span
></td
>
646 <tr
class="TableMenuRow2">
647 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
648 <span style
="float: left;"> 
;Category Permissions Manager
: </span
>
649 <span style
="float: right;"> 
;</span
>
652 <tr
class="TableMenuRow3">
653 <td
class="TableMenuColumn3">
655 $fq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" ORDER BY \"OrderID\" ASC, \"id\" ASC", array(null));
656 $fr=sql_query($fq,$SQLStat);
657 $ai=sql_num_rows($fr);
660 $InCategoryID=sql_result($fr,$fi,"id");
661 $InCategoryName=sql_result($fr,$fi,"Name");
662 $getperidq = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i AND \"CategoryID\"=%i LIMIT 1", array($_POST['id'],$InCategoryID));
663 $getperidr=sql_query($getperidq,$SQLStat);
664 $getperidnum=sql_num_rows($getperidr);
665 $getperidNumz = null;
668 $getperidNumz=sql_result($getperidr,0,"id");
669 $getperidID=sql_result($getperidr,0,"PermissionID"); }
671 <form style
="display: inline;" method
="post" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
672 <table style
="text-align: left;">
673 <tr style
="text-align: left;">
674 <td style
="width: 100%;">
675 <?php
if($getperidnum>0) { ?
>
676 Permissions
for <?php
echo $InCategoryName; ?
> are set
: <br
/>
677 <input type
="hidden" name
="act" value
="cpermissions" style
="display: none;" />
678 <input type
="hidden" name
="subact" value
="edit" style
="display: none;" />
679 <input type
="hidden" name
="id" value
="<?php echo $getperidNumz; ?>" style
="display: none;" />
680 <input type
="submit" class="Button" value
="Edit Permissions" name
="Apply_Changes" />
681 <?php
} if($getperidnum<=0) { ?
>
682 Permissions
for <?php
echo $InCategoryName; ?
> are not set
: <br
/>
683 <input type
="hidden" name
="act" value
="cpermissions" style
="display: none;" />
684 <input type
="hidden" name
="subact" value
="create" style
="display: none;" />
685 <input type
="hidden" name
="permid" value
="<?php echo $_POST['id']; ?>" style
="display: none;" />
686 <input type
="hidden" name
="id" value
="<?php echo $InCategoryID; ?>" style
="display: none;" />
687 <input type
="submit" class="Button" value
="Create Permissions" name
="Apply_Changes" />
692 sql_free_result($getperidr);
694 sql_free_result($fr); ?
>
697 <tr
class="TableMenuRow4">
698 <td
class="TableMenuColumn4"> 
;</td
>
702 <?php
} if(isset($_POST['id'])&&$_POST['subact']=="edit") {
703 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['id']));
704 $preresult=sql_query($prequery,$SQLStat);
705 $prenum=sql_num_rows($preresult);
706 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);
707 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
708 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
710 $PermissionNum=sql_result($preresult,0,"id");
711 $PermissionID=sql_result($preresult,0,"PermissionID");
712 $PermissionName=sql_result($preresult,0,"Name");
713 $PermissionCategoryID=sql_result($preresult,0,"CategoryID");
714 $CanViewCategory=sql_result($preresult,0,"CanViewCategory");
715 sql_free_result($preresult); }
716 $PermissionName = stripcslashes(htmlspecialchars($PermissionName, ENT_QUOTES
, $Settings['charset']));
717 //$_POST['CategoryName'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['CategoryName']);
719 <div
class="TableMenuBorder">
720 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
721 <div
class="TableMenuRow1">
722 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
></div
>
724 <table
class="TableMenu" style
="width: 100%;">
725 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
726 <tr
class="TableMenuRow1">
727 <td
class="TableMenuColumn1"><span style
="float: left;">
728 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
>
729 </span
><span style
="float: right;"> 
;</span
></td
>
731 <tr
class="TableMenuRow2">
732 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
733 <span style
="float: left;"> 
;Editing Category Permissions
: </span
>
734 <span style
="float: right;"> 
;</span
>
737 <tr
class="TableMenuRow3">
738 <td
class="TableMenuColumn3">
739 <form style
="display: inline;" method
="post" id
="acptool" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
740 <table style
="text-align: left;">
741 <tr style
="text-align: left;">
742 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CanViewCategory">Can view Category
:</label
></td
>
743 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="CanViewCategory" id
="CanViewCategory">
744 <option
<?php
if($CanViewCategory=="yes") { echo "selected=\"selected\" "; } ?
>value
="yes">yes
</option
>
745 <option
<?php
if($CanViewCategory=="no") { echo "selected=\"selected\" "; } ?
>value
="no">no
</option
>
749 <table style
="text-align: left;">
750 <tr style
="text-align: left;">
751 <td style
="width: 100%;">
752 <input type
="hidden" name
="act" value
="cpermissions" style
="display: none;" />
753 <input type
="hidden" name
="subact" value
="editnow" style
="display: none;" />
754 <input type
="hidden" name
="id" value
="<?php echo $PermissionNum; ?>" style
="display: none;" />
755 <input type
="submit" class="Button" value
="Edit Permissions" name
="Apply_Changes" />
756 <input type
="reset" value
="Reset Form" class="Button" name
="Reset_Form" />
761 <tr
class="TableMenuRow4">
762 <td
class="TableMenuColumn4"> 
;</td
>
766 <?php
} if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
767 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
768 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
769 $query = sql_pre_query("UPDATE \"".$Settings['sqltable']."catpermissions\" SET \"CanViewCategory\"='%s' WHERE \"id\"=%i", array($_POST['CanViewCategory'], $_POST['id']));
770 sql_query($query,$SQLStat); } if(isset($_POST['id'])&&$_POST['subact']=="create") {
772 <div
class="TableMenuBorder">
773 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
774 <div
class="TableMenuRow1">
775 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
></div
>
777 <table
class="TableMenu" style
="width: 100%;">
778 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
779 <tr
class="TableMenuRow1">
780 <td
class="TableMenuColumn1"><span style
="float: left;">
781 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Category Permissions Manager
</a
>
782 </span
><span style
="float: right;"> 
;</span
></td
>
784 <tr
class="TableMenuRow2">
785 <th
class="TableMenuColumn2" style
="width: 100%; text-align: left;">
786 <span style
="float: left;"> 
;Editing Category Permissions
: </span
>
787 <span style
="float: right;"> 
;</span
>
790 <tr
class="TableMenuRow3">
791 <td
class="TableMenuColumn3">
792 <form style
="display: inline;" method
="post" id
="acptool" action
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=cpermissions
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">
793 <table style
="text-align: left;">
794 <tr style
="text-align: left;">
795 <td style
="width: 50%;"><label
class="TextBoxLabel" for="CanViewCategory">Can view category
:</label
></td
>
796 <td style
="width: 50%;"><select size
="1" class="TextBox" name
="CanViewCategory" id
="CanViewCategory">
797 <option value
="yes">yes
</option
>
798 <option value
="no">no
</option
>
801 <table style
="text-align: left;">
802 <tr style
="text-align: left;">
803 <td style
="width: 100%;">
804 <input type
="hidden" name
="act" value
="cpermissions" style
="display: none;" />
805 <input type
="hidden" name
="subact" value
="makenow" style
="display: none;" />
806 <input type
="hidden" name
="id" value
="<?php echo $_POST['id']; ?>" style
="display: none;" />
807 <input type
="hidden" name
="permid" value
="<?php echo $_POST['permid']; ?>" style
="display: none;" />
808 <input type
="submit" class="Button" value
="Create Permissions" name
="Apply_Changes" />
809 <input type
="reset" value
="Reset Form" class="Button" name
="Reset_Form" />
814 <tr
class="TableMenuRow4">
815 <td
class="TableMenuColumn4"> 
;</td
>
819 <?php
} if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
820 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
821 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=view&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
822 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"id\"=%i LIMIT 1", array($_POST['permid']));
823 $preresult=sql_query($prequery,$SQLStat);
824 $prenum=sql_num_rows($preresult);
825 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);
826 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
827 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
829 $PermissionName=sql_result($preresult,0,"Name");
830 sql_free_result($preresult); }
831 //$nextidnum = sql_get_next_id($Settings['sqltable'],"catpermissions",$SQLStat);
832 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."catpermissions\" (\"PermissionID\", \"Name\", \"CategoryID\", \"CanViewCategory\") VALUES\n".
833 "(%i, '%s', %i, '%s')", array($_POST['permid'], $PermissionName, $_POST['id'], $_POST['CanViewCategory']));
834 sql_query($query,$SQLStat); } } $doupdate = false;
835 if(isset($_POST['id'])&&$_POST['subact']=="editnow") {
837 if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") {
839 if($_POST['act']=="addcategory"&&$_POST['update']=="now"&&$_GET['act']=="addcategory") {
841 if($_GET['act']=="deletecategory"&&$_POST['update']=="now"&&$_GET['act']=="deletecategory") {
843 if($_POST['act']=="editcategory"&&$_POST['update']=="now"&&$_GET['act']=="editcategory"&&
844 isset($_POST['id'])) {
846 if($doupdate===true&&$Error!="Yes") { ?
>
847 <div
class="TableMenuBorder">
848 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
849 <div
class="TableMenuRow1">
850 <?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
>
852 <table
class="TableMenu" style
="width: 100%;">
853 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
854 <tr
class="TableMenuRow1">
855 <td
class="TableMenuColumn1"><span style
="float: left;">
856 <?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
>
857 </span
><span style
="float: right;"> 
;</span
></td
>
859 <tr id
="ProfileTitle" class="TableMenuRow2">
860 <th
class="TableMenuColumn2">Updating Settings
</th
>
862 <tr
class="TableMenuRow3" id
="ProfileUpdate">
863 <td
class="TableMenuColumn3">
864 <?php
if(isset($_POST['id'])&&$_POST['subact']=="editnow") { ?
>
865 <div style
="text-align: center;">
866 <br
/>The permission was edited successfully
. <a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here
</a
> to go back
. ^_^
<br
/> 
;
868 <?php
} if(isset($_POST['id'])&&isset($_POST['permid'])&&$_POST['subact']=="makenow") { ?
>
869 <div style
="text-align: center;">
870 <br
/>The permission was created successfully
. <a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here
</a
> to go back
. ^_^
<br
/> 
;
872 <?php
} if($_POST['act']=="addcategory"&&$_POST['update']=="now"&&$_GET['act']=="addcategory") { ?
>
873 <div style
="text-align: center;">
874 <br
/>The category was created successfully
. <a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here
</a
> to go back
. ^_^
<br
/> 
;
876 <?php
} if($_GET['act']=="deletecategory"&&$_POST['update']=="now"&&$_GET['act']=="deletecategory") { ?
>
877 <div style
="text-align: center;">
878 <br
/>The category was deleted successfully
. <a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here
</a
> to go back
. ^_^
<br
/> 
;
880 <?php
} if($_POST['act']=="editcategory"&&$_POST['update']=="now"&&$_GET['act']=="editcategory"&&
881 isset($_POST['id'])) { ?
>
882 <div style
="text-align: center;">
883 <br
/>The category was edited successfully
. <a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here
</a
> to go back
. ^_^
<br
/> 
;
887 <tr id
="ProfileTitleEnd" class="TableMenuRow4">
888 <td
class="TableMenuColumn4"> 
;</td
>
890 <?php
} if ($_GET['act']!=null&&$Error=="Yes") {
891 redirect("refresh",$rbasedir.url_maker($exfile['admin'],$Settings['file_ext'],"act=".$_GET['act']."&menu=categories",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin'],FALSE),"4");
892 $admincptitle = " ".$ThemeSet['TitleDivider']." Updating Settings";
894 <div
class="TableMenuBorder">
895 <?php
if($ThemeSet['TableStyle']=="div") { ?
>
896 <div
class="TableMenuRow1">
897 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings
</a
></div
>
899 <table
class="TableMenu" style
="width: 100%;">
900 <?php
if($ThemeSet['TableStyle']=="table") { ?
>
901 <tr
class="TableMenuRow1">
902 <td
class="TableMenuColumn1"><span style
="float: left;">
903 <?php
echo $ThemeSet['TitleIcon']; ?
><a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Updating Settings
</a
>
904 </span
><span style
="float: right;"> 
;</span
></td
>
906 <tr id
="ProfileTitle" class="TableMenuRow2">
907 <th
class="TableMenuColumn2">Updating Settings
</th
>
909 <tr
class="TableMenuRow3" id
="ProfileUpdate">
910 <td
class="TableMenuColumn3">
911 <div style
="text-align: center;">
912 <br
/><?php
echo $errorstr; ?
>
913 <a href
="<?php echo url_maker($exfile['admin'],$Settings['file_ext'],"act
=".$_GET['act']."&menu
=categories
",$Settings['qstr'],$Settings['qsep'],$prexqstr['admin'],$exqstr['admin']); ?>">Click here
</a
> to back to admin cp
.<br
/> 
;
916 <tr id
="ProfileTitleEnd" class="TableMenuRow4">
917 <td
class="TableMenuColumn4"> 
;</td
>