Small bug fix to Version Number. :)
[iDB.git] / inc / groupsetup.php
blobb2b0749b976c116a089693b5bc4b6105cdce2f33
1 <?php
2 /*
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2011 iDB Support - http://idb.berlios.de/
12 Copyright 2004-2011 Game Maker 2k - http://gamemaker2k.org/
14 $FileInfo: groupsetup.php - Last Update: 12/07/2010 SVN 600 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="groupsetup.php"||$File3Name=="/groupsetup.php") {
18 require('index.php');
19 exit(); }
20 //Set members temp location
21 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=view","&","=",$prexqstr['index'],$exqstr['index']);
22 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
23 $_SESSION['ViewingFile'] = $exfile['index'].$Settings['file_ext']; }
24 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
25 $_SESSION['ViewingFile'] = $exfile['index']; }
26 $_SESSION['PreViewingTitle'] = "Viewing";
27 $_SESSION['ViewingTitle'] = "Board index";
28 /*$ggidquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['GuestGroup']));
29 $ggidresult=sql_query($ggidquery,$SQLStat);
30 $Settings['GuestGroupID']=sql_result($ggidresult,0,"id");*/
31 // Check to make sure MemberInfo is right
32 $MyPostCountChk = null; $MyKarmaCount = null;
33 if(!isset($_SESSION['UserID'])) { $_SESSION['UserID'] = 0; }
34 if($_SESSION['UserID']!=0&&$_SESSION['UserID']!=null) { $BanError = null;
35 $kgbquerychkusr = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"Name\"='%s' AND \"UserPassword\"='%s' AND \"id\"=%i LIMIT 1", array($_SESSION['MemberName'],$_SESSION['UserPass'],$_SESSION['UserID']));
36 $resultchkusr=sql_query($kgbquerychkusr,$SQLStat);
37 $numchkusr=sql_num_rows($resultchkusr);
38 if($numchkusr==1) {
39 $ChkUsrID=sql_result($resultchkusr,0,"id");
40 $ChkUsrName=sql_result($resultchkusr,0,"Name");
41 $ChkUsrGroup=sql_result($resultchkusr,0,"GroupID");
42 $ChkUsrGroupID=$ChkUsrGroup;
43 $ChkUsrPass=sql_result($resultchkusr,0,"UserPassword");
44 $ChkUsrTimeZone=sql_result($resultchkusr,0,"TimeZone");
45 $ChkUsrTheme=sql_result($resultchkusr,0,"UseTheme");
46 $ChkUsrLastPostTime=sql_result($resultchkusr,0,"LastPostTime");
47 $MyPostCountChk=sql_result($resultchkusr,0,"PostCount");
48 $MyKarmaCount=sql_result($resultchkusr,0,"Karma");
49 $MyKarmaUpdate=sql_result($resultchkusr,0,"KarmaUpdate");
50 $MyRepliesPerPage=sql_result($resultchkusr,0,"RepliesPerPage");
51 $Settings['max_posts'] = $MyRepliesPerPage;
52 $MyTopicsPerPage=sql_result($resultchkusr,0,"TopicsPerPage");
53 $Settings['max_topics'] = $MyTopicsPerPage;
54 $MyMessagesPerPage=sql_result($resultchkusr,0,"MessagesPerPage");
55 $Settings['max_memlist'] = $MyMessagesPerPage;
56 $Settings['max_pmlist'] = $MyMessagesPerPage;
57 $ChkUsrDST=sql_result($resultchkusr,0,"DST");
58 $svrquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($ChkUsrGroup));
59 $svrgresultkgb=sql_query($svrquery,$SQLStat);
60 $ChkUsrGroup=sql_result($svrgresultkgb,0,"Name");
61 $ChkUsrBanTime=sql_result($resultchkusr,0,"BanTime");
62 $ChkUsrGMTime = GMTimeStamp();
63 if($ChkUsrBanTime!=0&&$ChkUsrBanTime!=null) {
64 if($ChkUsrBanTime>=$ChkUsrGMTime) { $BanError = "yes"; }
65 if($ChkUsrBanTime<0) { $BanError = "yes"; } }
66 if($BanError!="yes") {
67 $_SESSION['Theme']=$ChkUsrTheme;
68 $_SESSION['MemberName']=$ChkUsrName;
69 $_SESSION['UserID']=$ChkUsrID;
70 $_SESSION['UserIP']=$_SERVER['REMOTE_ADDR'];
71 $_SESSION['UserTimeZone']=$ChkUsrTimeZone;
72 $_SESSION['UserGroup']=$ChkUsrGroup;
73 $_SESSION['UserGroupID']=$ChkUsrGroupID;
74 $_SESSION['UserDST']=$ChkUsrDST;
75 $_SESSION['UserPass']=$ChkUsrPass;
76 $_SESSION['LastPostTime'] = $ChkUsrLastPostTime; } }
77 if($numchkusr<=0||$numchkusr>1||$BanError=="yes") { session_unset();
78 if($cookieDomain==null) {
79 setcookie("MemberName", null, GMTimeStamp() - 3600, $cbasedir);
80 setcookie("UserID", null, GMTimeStamp() - 3600, $cbasedir);
81 setcookie("SessPass", null, GMTimeStamp() - 3600, $cbasedir);
82 setcookie(session_name(), "", GMTimeStamp() - 3600, $cbasedir); }
83 if($cookieDomain!=null) {
84 if($cookieSecure===true) {
85 setcookie("MemberName", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1);
86 setcookie("UserID", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1);
87 setcookie("SessPass", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1);
88 setcookie(session_name(), "", GMTimeStamp() - 3600, $cbasedir, $cookieDomain, 1); }
89 if($cookieSecure===false) {
90 setcookie("MemberName", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain);
91 setcookie("UserID", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain);
92 setcookie("SessPass", null, GMTimeStamp() - 3600, $cbasedir, $cookieDomain);
93 setcookie(session_name(), "", GMTimeStamp() - 3600, $cbasedir, $cookieDomain); } }
94 unset($_COOKIE[session_name()]);
95 $_SESSION = array(); session_unset(); session_destroy();
96 redirect("location",$rbasedir.url_maker($exfile['member'],$Settings['file_ext'],"act=login",$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'],false)); sql_free_result($resultchkusr); sql_free_result($svrgresultkgb);
97 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
98 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
99 sql_free_result($resultchkusr); sql_free_result($svrgresultkgb); }
100 if($_SESSION['UserID']==0||$_SESSION['UserID']==null) {
101 $_SESSION['UserIP']=$_SERVER['REMOTE_ADDR'];
102 $_SESSION['MemberName'] = null;
103 $_SESSION['UserGroup'] = $Settings['GuestGroup'];
104 $gidquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['GuestGroup']));
105 $gidresult=sql_query($gidquery,$SQLStat);
106 $_SESSION['UserGroupID']=sql_result($gidresult,0,"id");
107 sql_free_result($gidresult); }
108 if($_SESSION['MemberName']==null) { $_SESSION['UserID'] = "0";
109 $_SESSION['UserIP']=$_SERVER['REMOTE_ADDR'];
110 $_SESSION['UserGroup'] = $Settings['GuestGroup'];
111 $gidquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($Settings['GuestGroup']));
112 $gidresult=sql_query($gidquery,$SQLStat);
113 $_SESSION['UserGroupID']=sql_result($gidresult,0,"id");
114 sql_free_result($gidresult); }
115 // Member Group Setup
116 if(!isset($_SESSION['UserGroup'])) { $_SESSION['UserGroup'] = null; }
117 if($_SESSION['UserGroup']==null) {
118 $_SESSION['UserGroup']=$Settings['GuestGroup']; } $GruError = null;
119 $gruquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"Name\"='%s' LIMIT 1", array($_SESSION['UserGroup']));
120 $gruresult=sql_query($gruquery,$SQLStat);
121 $grunum=sql_num_rows($gruresult);
122 if($grunum<=0) { $GruError = true; sql_free_result($gruresult);
123 header("Content-Type: text/plain; charset=".$Settings['charset']);
124 ob_clean(); echo "Sorry could not find group data in database.\nContact the board admin about error.";
125 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
126 if($grunum>=1) {
127 $GroupInfo['ID']=sql_result($gruresult,0,"id");
128 if(!is_numeric($GroupInfo['ID'])) { $GruError = true; }
129 $GroupInfo['Name']=sql_result($gruresult,0,"Name");
130 $GroupInfo['PermissionID']=sql_result($gruresult,0,"PermissionID");
131 if(!is_numeric($GroupInfo['PermissionID'])) { $GruError = true; }
132 $GroupInfo['NamePrefix']=sql_result($gruresult,0,"NamePrefix");
133 $GroupInfo['NameSuffix']=sql_result($gruresult,0,"NameSuffix");
134 $GroupInfo['CanViewBoard']=sql_result($gruresult,0,"CanViewBoard");
135 if($GroupInfo['CanViewBoard']!="yes"&&$GroupInfo['CanViewBoard']!="no") {
136 $GruError = true; }
137 $GroupInfo['CanViewOffLine']=sql_result($gruresult,0,"CanViewOffLine");
138 if($GroupInfo['CanViewOffLine']!="yes"&&$GroupInfo['CanViewOffLine']!="no") {
139 $GruError = true; }
140 $GroupInfo['FloodControl']=sql_result($gruresult,0,"FloodControl");
141 if(!is_numeric($GroupInfo['FloodControl'])) { $GroupInfo['FloodControl'] = 30; }
142 $GroupInfo['SearchFlood']=sql_result($gruresult,0,"SearchFlood");
143 if(!is_numeric($GroupInfo['SearchFlood'])) { $GroupInfo['SearchFlood'] = 30; }
144 $GroupInfo['CanEditProfile']=sql_result($gruresult,0,"CanEditProfile");
145 if($GroupInfo['CanEditProfile']!="yes"&&$GroupInfo['CanEditProfile']!="no") {
146 $GruError = true; }
147 $GroupInfo['CanAddEvents']=sql_result($gruresult,0,"CanAddEvents");
148 if($GroupInfo['CanAddEvents']!="yes"&&$GroupInfo['CanAddEvents']!="no") {
149 $GruError = true; }
150 $GroupInfo['CanPM']=sql_result($gruresult,0,"CanPM");
151 if($GroupInfo['CanPM']!="yes"&&$GroupInfo['CanPM']!="no") {
152 $GruError = true; }
153 $GroupInfo['CanSearch']=sql_result($gruresult,0,"CanSearch");
154 if($GroupInfo['CanSearch']!="yes"&&$GroupInfo['CanSearch']!="no") {
155 $GruError = true; }
156 $GroupInfo['CanDoHTML']=sql_result($gruresult,0,"CanDoHTML");
157 if($GroupInfo['CanDoHTML']!="yes"&&$GroupInfo['CanDoHTML']!="no") {
158 $GroupInfo['CanDoHTML'] = "no"; }
159 $GroupInfo['CanUseBBags']=sql_result($gruresult,0,"CanUseBBags");
160 if($GroupInfo['CanUseBBags']!="yes"&&$GroupInfo['CanUseBBags']!="no") {
161 $GroupInfo['CanUseBBags'] = "no"; }
162 $GroupInfo['PromoteTo']=sql_result($gruresult,0,"PromoteTo");
163 $GroupInfo['PromotePosts']=sql_result($gruresult,0,"PromotePosts");
164 if(!is_numeric($GroupInfo['PromotePosts'])) {
165 $GroupInfo['PromotePosts'] = 0; $GroupInfo['PromoteTo'] = 0; }
166 $GroupInfo['PromoteKarma']=sql_result($gruresult,0,"PromoteKarma");
167 if(!is_numeric($GroupInfo['PromoteKarma'])) {
168 $GroupInfo['PromoteKarma'] = 0; $GroupInfo['PromoteTo'] = 0; }
169 if(!isset($Settings['KarmaBoostDays'])) {
170 $Settings['KarmaBoostDays'] = null; }
171 $Settings['OldKarmaBoostDays'] = $Settings['KarmaBoostDays'];
172 if(!isset($Settings['KBoostPercent'])) {
173 $Settings['KBoostPercent'] = "6|10"; }
174 //Update karma and group upgrade on post count or karma count.
175 if($_SESSION['UserID']!=0) { $BoostTotal = null;
176 $KarmaExp = explode("&",$Settings['KarmaBoostDays']);
177 $KarmaNow = GMTimeGet("md",$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
178 $kupdate = false;
179 if(in_array($KarmaNow,$KarmaExp)) {
180 $KarmaNum = count($KarmaExp);
181 $Karmai = 0;
182 while ($Karmai < $KarmaNum) {
183 if($KarmaExp[$Karmai]==$KarmaNow) {
184 $Settings['KarmaBoostDays'] = $KarmaExp[$Karmai];
185 $kupdate = true; break 1; }
186 ++$Karmai; } }
187 if($kupdate===false) {
188 $Settings['KarmaBoostDays'] = $KarmaExp[0]; }
189 $NewKarmaUpdate = GMTimeGet("Ymd",$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
190 $ThisYearUpdate = GMTimeGet("Y",$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
191 if($MyKarmaUpdate<$NewKarmaUpdate&&$MyPostCountChk>0) {
192 $KarmaBoostDay = $Settings['KarmaBoostDays'];
193 $KBoostPercent = explode("|",$Settings['KBoostPercent']);
194 if(count($KBoostPercent)<1) {
195 $KBoostPercent[0] = rand(1,4); }
196 if(!is_numeric($KBoostPercent[0])) {
197 $KBoostPercent[0] = 6; }
198 if(count($KBoostPercent)==1) {
199 $KBoostPercent[1] = $KBoostPercent[0] + rand(3,6); }
200 if(!is_numeric($KBoostPercent[1])) {
201 $KBoostPercent[0] = 10; }
202 $KBoostPercent = rand($KBoostPercent[0],$KBoostPercent[1]);
203 if($ThisYearUpdate.$KarmaBoostDay==$NewKarmaUpdate&&
204 is_numeric($KarmaBoostDay)) {
205 $KBoostPercent = $KBoostPercent / 100;
206 $BoostTotal = $MyKarmaCount * $KBoostPercent;
207 $BoostTotal = round($BoostTotal,0); }
208 if($BoostTotal!=null) {
209 $MyKarmaCount = $MyKarmaCount + $BoostTotal; }
210 if($BoostTotal==null) {
211 $MyKarmaCount = $MyKarmaCount + 1; }
212 $querykarmaup = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"Karma\"=%i,\"KarmaUpdate\"=%i WHERE \"id\"=%i", array($MyKarmaCount,$NewKarmaUpdate,$_SESSION['UserID']));
213 sql_query($querykarmaup,$SQLStat); }
214 $Settings['KarmaBoostDays'] = $Settings['OldKarmaBoostDays'];
215 if($GroupInfo['PromoteTo']!=0&&$MyPostCountChk>=$GroupInfo['PromotePosts']) {
216 $sql_group_check = sql_query(sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($GroupInfo['PromoteTo'])),$SQLStat);
217 $group_check = sql_num_rows($sql_group_check);
218 sql_free_result($sql_group_check);
219 if($group_check > 0) {
220 $queryupgrade = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"GroupID\"=%i WHERE \"id\"=%i", array($GroupInfo['PromoteTo'],$_SESSION['UserID']));
221 sql_query($queryupgrade,$SQLStat); } }
222 if($GroupInfo['PromotePosts']==0&&$GroupInfo['PromoteTo']!=0&&$MyKarmaCount>=$GroupInfo['PromoteKarma']) {
223 $sql_group_check = sql_query(sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($GroupInfo['PromoteTo'])),$SQLStat);
224 $group_check = sql_num_rows($sql_group_check);
225 sql_free_result($sql_group_check);
226 if($group_check > 0) {
227 $queryupgrade = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"GroupID\"=%i WHERE \"id\"=%i", array($GroupInfo['PromoteTo'],$_SESSION['UserID']));
228 sql_query($queryupgrade,$SQLStat); } } }
229 $GroupInfo['HasModCP']=sql_result($gruresult,0,"HasModCP");
230 if($GroupInfo['HasModCP']!="yes"&&$GroupInfo['HasModCP']!="no") {
231 $GroupInfo['HasModCP'] = "no"; }
232 $GroupInfo['HasAdminCP']=sql_result($gruresult,0,"HasAdminCP");
233 if($GroupInfo['HasAdminCP']!="yes"&&$GroupInfo['HasAdminCP']!="no") {
234 $GroupInfo['HasAdminCP'] = "no"; }
235 $GroupInfo['ViewDBInfo']=sql_result($gruresult,0,"ViewDBInfo");
236 if($GroupInfo['ViewDBInfo']!="yes"&&$GroupInfo['ViewDBInfo']!="no") {
237 $GroupInfo['ViewDBInfo'] = "no"; }
238 if($GruError==true) {
239 header("Content-Type: text/plain; charset=".$Settings['charset']); sql_free_result($gruresult);
240 ob_clean(); echo "Sorry could not load all group data in database.\nContact the board admin about error.";
241 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
242 sql_free_result($gruresult);
243 if($GroupInfo['CanViewBoard']=="no") {
244 header("Content-Type: text/plain; charset=".$Settings['charset']);
245 ob_clean(); echo "Sorry you can not view the board.";
246 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
247 // Member Group Permissions Setup
248 $perquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i ORDER BY \"ForumID\" ASC", array($GroupInfo['PermissionID']));
249 $peresult=sql_query($perquery,$SQLStat);
250 $pernum=sql_num_rows($peresult);
251 $peri=0; $PerError = null;
252 if($pernum<0) { $PerError = true; sql_free_result($peresult);
253 header("Content-Type: text/plain; charset=".$Settings['charset']);
254 ob_clean(); echo "Sorry could not find permission data in database.\nContact the board admin about error.";
255 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
256 $ForumIgnoreList1 = null; $ForumIgnoreList2 = null;
257 $ForumIgnoreList3 = null; $ForumIgnoreList4 = null;
258 $ForumIgnoreList5 = null; $ForumIgnoreList6 = null;
259 $ModForumIgnoreList1 = null; $ModForumIgnoreList2 = null;
260 $ModForumIgnoreList3 = null; $ModForumIgnoreList4 = null;
261 if($pernum>=1) { while ($peri < $pernum) {
262 $PerForumID=sql_result($peresult,$peri,"ForumID");
263 if(!is_numeric($PerForumID)) { $PerError = true; }
264 $PermissionInfo['ID'][$PerForumID]=sql_result($peresult,$peri,"id");
265 if(!is_numeric($PermissionInfo['ID'][$PerForumID])) { $PerError = true; }
266 $PermissionInfo['PermissionID'][$PerForumID]=sql_result($peresult,$peri,"PermissionID");
267 if(!is_numeric($PermissionInfo['PermissionID'][$PerForumID])) { $PerError = true; }
268 $PermissionInfo['Name'][$PerForumID]=sql_result($peresult,$peri,"Name");
269 $PermissionInfo['ForumID'][$PerForumID]=sql_result($peresult,$peri,"ForumID");
270 if(!is_numeric($PermissionInfo['ForumID'][$PerForumID])) { $PerError = true; }
271 $PermissionInfo['CanViewForum'][$PerForumID]=sql_result($peresult,$peri,"CanViewForum");
272 if($PermissionInfo['CanViewForum'][$PerForumID]!="yes"&&$PermissionInfo['CanViewForum'][$PerForumID]!="no") {
273 $PerError = true; }
274 if($PermissionInfo['CanViewForum'][$PerForumID]=="no") {
275 if(strlen($ForumIgnoreList1)>1) { $ForumIgnoreList1 .= " AND \"id\"<>".$PerForumID; }
276 if(strlen($ForumIgnoreList1)<1) { $ForumIgnoreList1 = " \"id\"<>".$PerForumID; }
277 if(strlen($ForumIgnoreList2)>1) { $ForumIgnoreList2 .= " AND \"id\"<>".$PerForumID; }
278 if(strlen($ForumIgnoreList2)<1) { $ForumIgnoreList2 = " AND \"id\"<>".$PerForumID; }
279 if(strlen($ForumIgnoreList3)>1) { $ForumIgnoreList3 .= " AND \"ForumID\"<>".$PerForumID; }
280 if(strlen($ForumIgnoreList3)<1) { $ForumIgnoreList3 = " WHERE \"ForumID\"<>".$PerForumID; }
281 if(strlen($ForumIgnoreList4)>1) { $ForumIgnoreList4 .= " AND \"ForumID\"<>".$PerForumID; }
282 if(strlen($ForumIgnoreList4)<1) { $ForumIgnoreList4 = " AND \"ForumID\"<>".$PerForumID; }
283 if(strlen($ForumIgnoreList5)>1) { $ForumIgnoreList5 .= " AND \"OldForumID\"<>".$PerForumID; }
284 if(strlen($ForumIgnoreList5)<1) { $ForumIgnoreList5 = " WHERE \"OldForumID\"<>".$PerForumID; }
285 if(strlen($ForumIgnoreList6)>1) { $ForumIgnoreList6 .= " AND \"OldForumID\"<>".$PerForumID; }
286 if(strlen($ForumIgnoreList6)<1) { $ForumIgnoreList6 = " AND \"OldForumID\"<>".$PerForumID; } }
287 $PermissionInfo['CanMakeTopics'][$PerForumID]=sql_result($peresult,$peri,"CanMakeTopics");
288 if($PermissionInfo['CanMakeTopics'][$PerForumID]!="yes"&&$PermissionInfo['CanMakeTopics'][$PerForumID]!="no") {
289 $PerError = true; }
290 $PermissionInfo['CanMakeReplys'][$PerForumID]=sql_result($peresult,$peri,"CanMakeReplys");
291 if($PermissionInfo['CanMakeReplys'][$PerForumID]!="yes"&&$PermissionInfo['CanMakeReplys'][$PerForumID]!="no") {
292 $PerError = true; }
293 $PermissionInfo['CanMakeReplysClose'][$PerForumID]=sql_result($peresult,$peri,"CanMakeReplysCT");
294 if($PermissionInfo['CanMakeReplysClose'][$PerForumID]!="yes"&&$PermissionInfo['CanMakeReplysClose'][$PerForumID]!="no") {
295 $PerError = true; }
296 $PermissionInfo['CanEditTopics'][$PerForumID]=sql_result($peresult,$peri,"CanEditTopics");
297 if($PermissionInfo['CanEditTopics'][$PerForumID]!="yes"&&$PermissionInfo['CanEditTopics'][$PerForumID]!="no") {
298 $PermissionInfo['CanEditTopics'][$PerForumID] = "no"; }
299 $PermissionInfo['CanEditTopicsClose'][$PerForumID]=sql_result($peresult,$peri,"CanEditTopicsCT");
300 if($PermissionInfo['CanEditTopicsClose'][$PerForumID]!="yes"&&$PermissionInfo['CanEditTopicsClose'][$PerForumID]!="no") {
301 $PermissionInfo['CanEditTopicsClose'][$PerForumID] = "no"; }
302 $PermissionInfo['CanEditReplys'][$PerForumID]=sql_result($peresult,$peri,"CanEditReplys");
303 if($PermissionInfo['CanEditReplys'][$PerForumID]!="yes"&&$PermissionInfo['CanEditReplys'][$PerForumID]!="no") {
304 $PermissionInfo['CanEditReplys'][$PerForumID] = "no"; }
305 $PermissionInfo['CanEditReplysClose'][$PerForumID]=sql_result($peresult,$peri,"CanEditReplysCT");
306 if($PermissionInfo['CanEditReplysClose'][$PerForumID]!="yes"&&$PermissionInfo['CanEditReplysClose'][$PerForumID]!="no") {
307 $PermissionInfo['CanEditReplysClose'][$PerForumID] = "no"; }
308 $PermissionInfo['CanDeleteTopics'][$PerForumID]=sql_result($peresult,$peri,"CanDeleteTopics");
309 if($PermissionInfo['CanDeleteTopics'][$PerForumID]!="yes"&&$PermissionInfo['CanDeleteTopics'][$PerForumID]!="no") {
310 $PermissionInfo['CanDeleteTopics'][$PerForumID] = "no"; }
311 $PermissionInfo['CanDeleteTopicsClose'][$PerForumID]=sql_result($peresult,$peri,"CanDeleteTopicsCT");
312 if($PermissionInfo['CanDeleteTopicsClose'][$PerForumID]!="yes"&&$PermissionInfo['CanDeleteTopicsClose'][$PerForumID]!="no") {
313 $PermissionInfo['CanDeleteTopicsClose'][$PerForumID] = "no"; }
314 $PermissionInfo['CanDeleteReplys'][$PerForumID]=sql_result($peresult,$peri,"CanDeleteReplys");
315 if($PermissionInfo['CanDeleteReplys'][$PerForumID]!="yes"&&$PermissionInfo['CanDeleteReplys'][$PerForumID]!="no") {
316 $PermissionInfo['CanDeleteReplys'][$PerForumID] = "no"; }
317 $PermissionInfo['CanDeleteReplysClose'][$PerForumID]=sql_result($peresult,$peri,"CanDeleteReplysCT");
318 if($PermissionInfo['CanDeleteReplysClose'][$PerForumID]!="yes"&&$PermissionInfo['CanDeleteReplysClose'][$PerForumID]!="no") {
319 $PermissionInfo['CanDeleteReplysClose'][$PerForumID] = "no"; }
320 $PermissionInfo['CanCloseTopics'][$PerForumID]=sql_result($peresult,$peri,"CanCloseTopics");
321 if($PermissionInfo['CanCloseTopics'][$PerForumID]!="yes"&&$PermissionInfo['CanCloseTopics'][$PerForumID]!="no") {
322 $PermissionInfo['CanCloseTopics'][$PerForumID] = "no"; }
323 $PermissionInfo['CanPinTopics'][$PerForumID]=sql_result($peresult,$peri,"CanPinTopics");
324 if($PermissionInfo['CanPinTopics'][$PerForumID]!="yes"&&$PermissionInfo['CanPinTopics'][$PerForumID]!="no") {
325 $PermissionInfo['CanPinTopics'][$PerForumID] = "no"; }
326 $PermissionInfo['CanDoHTML'][$PerForumID]=sql_result($peresult,$peri,"CanDoHTML");
327 if($PermissionInfo['CanDoHTML'][$PerForumID]!="yes"&&$PermissionInfo['CanDoHTML'][$PerForumID]!="no") {
328 $PermissionInfo['CanDoHTML'][$PerForumID] = "no"; }
329 $PermissionInfo['CanUseBBags'][$PerForumID]=sql_result($peresult,$peri,"CanUseBBags");
330 if($PermissionInfo['CanUseBBags'][$PerForumID]!="yes"&&$PermissionInfo['CanUseBBags'][$PerForumID]!="no") {
331 $PermissionInfo['CanUseBBags'][$PerForumID] = "no"; }
332 $PermissionInfo['CanModForum'][$PerForumID]=sql_result($peresult,$peri,"CanModForum");
333 if($PermissionInfo['CanModForum'][$PerForumID]!="yes"&&$PermissionInfo['CanModForum'][$PerForumID]!="no") {
334 $PermissionInfo['CanModForum'][$PerForumID] = "no"; }
335 if($PermissionInfo['CanModForum'][$PerForumID]=="no") {
336 if(strlen($ModForumIgnoreList1)>1) { $ModForumIgnoreList1 .= " AND \"id\"<>".$PerForumID; }
337 if(strlen($ModForumIgnoreList1)<1) { $ModForumIgnoreList1 = " \"id\"<>".$PerForumID; }
338 if(strlen($ModForumIgnoreList2)>1) { $ModForumIgnoreList2 .= " AND \"id\"<>".$PerForumID; }
339 if(strlen($ModForumIgnoreList2)<1) { $ModForumIgnoreList2 = " AND \"id\"<>".$PerForumID; }
340 if(strlen($ModForumIgnoreList3)>1) { $ModForumIgnoreList3 .= " AND \"ForumID\"<>".$PerForumID; }
341 if(strlen($ModForumIgnoreList3)<1) { $ModForumIgnoreList3 = " WHERE \"ForumID\"<>".$PerForumID; }
342 if(strlen($ModForumIgnoreList4)>1) { $ModForumIgnoreList4 .= " AND \"ForumID\"<>".$PerForumID; }
343 if(strlen($ModForumIgnoreList4)<1) { $ModForumIgnoreList4 = " AND \"ForumID\"<>".$PerForumID; } }
344 if($PerError===true) { $peri = $pernum; }
345 ++$peri; } if($PerError===true) {
346 header("Content-Type: text/plain; charset=".$Settings['charset']); sql_free_result($peresult);
347 ob_clean(); echo "Sorry could not load all permission data in database.\nContact the board admin about error.";
348 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
349 sql_free_result($peresult);
350 $per2query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."catpermissions\" WHERE \"PermissionID\"=%i ORDER BY \"CategoryID\" ASC", array($GroupInfo['PermissionID']));
351 $per2esult=sql_query($per2query,$SQLStat);
352 $per2num=sql_num_rows($per2esult);
353 $per2i=0; $Per2Error = null;
354 if($per2num<=0) { $Per2Error = true; sql_free_result($per2esult);
355 header("Content-Type: text/plain; charset=".$Settings['charset']);
356 ob_clean(); echo "Sorry could not find permission data in database.\nContact the board admin about error.";
357 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
358 $CatIgnoreList1 = null; $CatIgnoreList2 = null;
359 $CatIgnoreList3 = null; $CatIgnoreList4 = null;
360 $CatIgnoreList5 = null; $CatIgnoreList6 = null;
361 if($per2num>=1) { while ($per2i < $per2num) {
362 $PerCatID=sql_result($per2esult,$per2i,"CategoryID");
363 if(!is_numeric($PerCatID)) { $Per2Error = true; }
364 $CatPermissionInfo['ID'][$PerCatID]=sql_result($per2esult,$per2i,"id");
365 if(!is_numeric($CatPermissionInfo['ID'][$PerCatID])) { $Per2Error = true; }
366 $CatPermissionInfo['PermissionID'][$PerCatID]=sql_result($per2esult,$per2i,"PermissionID");
367 if(!is_numeric($CatPermissionInfo['PermissionID'][$PerCatID])) { $Per2Error = true; }
368 $CatPermissionInfo['Name'][$PerCatID]=sql_result($per2esult,$per2i,"Name");
369 $CatPermissionInfo['CategoryID'][$PerCatID]=sql_result($per2esult,$per2i,"CategoryID");
370 if(!is_numeric($CatPermissionInfo['CategoryID'][$PerCatID])) { $Per2Error = true; }
371 $CatPermissionInfo['CanViewCategory'][$PerCatID]=sql_result($per2esult,$per2i,"CanViewCategory");
372 if($CatPermissionInfo['CanViewCategory'][$PerCatID]!="yes"&&$CatPermissionInfo['CanViewCategory'][$PerCatID]!="no") { $Per2Error = true; }
373 if($CatPermissionInfo['CanViewCategory'][$PerCatID]=="no") {
374 if(strlen($CatIgnoreList1)>1) { $CatIgnoreList1 .= " AND \"id\"<>".$PerCatID; }
375 if(strlen($CatIgnoreList1)<1) { $CatIgnoreList1 = " \"id\"<>".$PerCatID; }
376 if(strlen($CatIgnoreList2)>1) { $CatIgnoreList2 .= " AND \"id\"<>".$PerCatID; }
377 if(strlen($CatIgnoreList2)<1) { $CatIgnoreList2 = " AND \"id\"<>".$PerCatID; }
378 if(strlen($CatIgnoreList3)>1) { $CatIgnoreList3 .= " AND \"CategoryID\"<>".$PerCatID; }
379 if(strlen($CatIgnoreList3)<1) { $CatIgnoreList3 = " WHERE \"CategoryID\"<>".$PerCatID; }
380 if(strlen($CatIgnoreList4)>1) { $CatIgnoreList4 .= " AND \"CategoryID\"<>".$PerCatID; }
381 if(strlen($CatIgnoreList4)<1) { $CatIgnoreList4 = " AND \"CategoryID\"<>".$PerCatID; }
382 if(strlen($CatIgnoreList5)>1) { $CatIgnoreList5 .= " AND \"OldCategoryID\"<>".$PerCatID; }
383 if(strlen($CatIgnoreList5)<1) { $CatIgnoreList5 = " WHERE \"OldCategoryID\"<>".$PerCatID; }
384 if(strlen($CatIgnoreList6)>1) { $CatIgnoreList6 .= " AND \"OldCategoryID\"<>".$PerCatID; }
385 if(strlen($CatIgnoreList6)<1) { $CatIgnoreList6 = " AND \"OldCategoryID\"<>".$PerCatID; } }
386 if($Per2Error===true) { $per2i = $per2num; }
387 ++$per2i; } if($Per2Error===true) {
388 header("Content-Type: text/plain; charset=".$Settings['charset']); sql_free_result($per2esult);
389 ob_clean(); echo "Sorry could not load all permission data in database.\nContact the board admin about error.";
390 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
391 sql_free_result($per2esult);