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: lowsubcategories.php - Last Update: 07/18/2011 SVN 719 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="lowsubcategories.php"||
$File3Name=="/lowsubcategories.php") {
20 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
21 $checkquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2." LIMIT 1", array($_GET['id']));
22 $checkresult=sql_query($checkquery,$SQLStat);
23 $checknum=sql_num_rows($checkresult);
24 if($checknum==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($checkresult);
25 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
26 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
28 $CategoryID=sql_result($checkresult,0,"id");
29 $CategoryName=sql_result($checkresult,0,"Name");
30 $CategoryShow=sql_result($checkresult,0,"ShowCategory");
31 if($CategoryShow=="yes") { $_SESSION['ShowActHidden'] = "yes"; }
32 $CategoryType=sql_result($checkresult,0,"CategoryType");
33 $InSubCategory=sql_result($checkresult,0,"InSubCategory");
34 $SubShowForums=sql_result($checkresult,0,"SubShowForums");
35 $CategoryType = strtolower($CategoryType); $SubShowForums = strtolower($SubShowForums);
36 $SCategoryName = $CategoryName;
37 if(!isset($CatPermissionInfo['CanViewCategory'][$CategoryID])) {
38 $CatPermissionInfo['CanViewCategory'][$CategoryID] = "no"; }
39 if($CatPermissionInfo['CanViewCategory'][$CategoryID]=="no"||
40 $CatPermissionInfo['CanViewCategory'][$CategoryID]!="yes") {
41 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
42 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
43 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
44 if($CatPermissionInfo['CanViewCategory'][$CategoryID]=="yes") {
45 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=lowview&id=".$CategoryID,"&","=",$prexqstr[$CategoryType],$exqstr[$CategoryType]);
46 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
47 $_SESSION['ViewingFile'] = $exfile[$CategoryType].$Settings['file_ext']; }
48 if($Settings['file_ext']=="no+ext"||
$Settings['file_ext']=="no ext") {
49 $_SESSION['ViewingFile'] = $exfile[$CategoryType]; }
50 $_SESSION['PreViewingTitle'] = "Viewing SubCategory:";
51 $_SESSION['ViewingTitle'] = $CategoryName;
52 if($InSubCategory!="0") {
53 $iscquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2." LIMIT 1", array($InSubCategory));
54 $iscresult=sql_query($iscquery,$SQLStat);
55 $iscnum=sql_num_rows($iscresult);
57 $iscCategoryID=sql_result($iscresult,0,"id");
58 $iscCategoryName=sql_result($iscresult,0,"Name");
59 $iscCategoryShow=sql_result($iscresult,0,"ShowCategory");
60 $iscCategoryType=sql_result($iscresult,0,"CategoryType");
61 $iscCategoryType = strtolower($iscCategoryType); }
62 if($iscnum<1) { $InSubCategory = "0"; }
63 sql_free_result($iscresult); }
65 <div style
="font-size: 1.0em; font-weight: bold; margin-bottom: 10px; padding-top: 3px; width: auto;">Full Version
: <a href
="<?php echo url_maker($exfile[$CategoryType],$Settings['file_ext'],"act
=view
&id
=".$CategoryID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php
echo $CategoryName; ?
></a
></div
>
66 <div style
="font-size: 11px; font-weight: bold; padding: 10px; border: 1px solid gray;"><?php
echo $ThemeSet['NavLinkIcon']; ?
><a href
="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act
=lowview
",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>"><?php
echo $Settings['board_name']; ?
></a
><?php
if($InSubCategory!="0") { echo $ThemeSet['NavLinkDivider']; ?
><a href
="<?php echo url_maker($exfile[$iscCategoryType],$Settings['file_ext'],"act
=view
&id
=".$iscCategoryID."&page
=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$iscCategoryType],$exqstr[$iscCategoryType]); ?>"><?php
echo $iscCategoryName; ?
></a
><?php
} echo $ThemeSet['NavLinkDivider']; ?
><a href
="<?php echo url_maker($exfile[$CategoryType],$Settings['file_ext'],"act
=lowview
&id
=".$CategoryID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php
echo $CategoryName; ?
></a
></div
>
68 <div style
="padding: 10px; border: 1px solid gray;">
69 <ul style
="list-style-type: none;">
71 if($CategoryType=="category") {
72 redirect("location",$rbasedir.url_maker($exfile['category'],$Settings['file_ext'],"act=".$_GET['act']."&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['category'],$exqstr['category'],FALSE));
73 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
74 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
75 sql_free_result($checkresult);
76 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"ShowCategory\"='yes' AND \"InSubCategory\"=%i".$CatIgnoreList2." ORDER BY \"OrderID\" ASC, \"id\" ASC", array($_GET['id']));
77 $preresult=sql_query($prequery,$SQLStat);
78 $prenum=sql_num_rows($preresult);
80 while ($prei < $prenum) {
81 $CategoryID=sql_result($preresult,$prei,"id");
82 $CategoryName=sql_result($preresult,$prei,"Name");
83 $CategoryShow=sql_result($preresult,$prei,"ShowCategory");
84 $CategoryType=sql_result($preresult,$prei,"CategoryType");
85 $SSubShowForums=sql_result($preresult,$prei,"SubShowForums");
86 $CategoryDescription=sql_result($preresult,$prei,"Description");
87 $CategoryType = strtolower($CategoryType); $SubShowForums = strtolower($SubShowForums);
88 if(isset($CatPermissionInfo['CanViewCategory'][$CategoryID])&&
89 $CatPermissionInfo['CanViewCategory'][$CategoryID]=="yes") {
90 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"ShowForum\"='yes' AND \"CategoryID\"=%i AND \"InSubForum\"=0".$ForumIgnoreList2." ORDER BY \"OrderID\" ASC, \"id\" ASC", array($CategoryID));
91 $result=sql_query($query,$SQLStat);
92 $num=sql_num_rows($result);
96 <li style
="font-weight: bold;"><a href
="<?php echo url_maker($exfile[$CategoryType],$Settings['file_ext'],"act
=lowview
&id
=".$CategoryID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php
echo $CategoryName; ?
></a
></li
><li
>
99 $ForumID=sql_result($result,$i,"id");
100 $ForumName=sql_result($result,$i,"Name");
101 $ForumShow=sql_result($result,$i,"ShowForum");
102 $ForumType=sql_result($result,$i,"ForumType");
103 $ForumShowTopics=sql_result($result,$i,"CanHaveTopics");
104 $ForumShowTopics = strtolower($ForumShowTopics);
105 $NumTopics=sql_result($result,$i,"NumTopics");
106 $NumPosts=sql_result($result,$i,"NumPosts");
107 $NumRedirects=sql_result($result,$i,"Redirects");
108 $ForumDescription=sql_result($result,$i,"Description");
109 $ForumType = strtolower($ForumType); $sflist = null;
110 $gltf = array(null); $gltf[0] = $ForumID;
111 if ($ForumType=="subforum") {
112 $apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"ShowForum\"='yes' AND \"InSubForum\"=%i".$ForumIgnoreList2." ORDER BY \"OrderID\" ASC, \"id\" ASC", array($ForumID));
113 $apcresult=sql_query($apcquery,$SQLStat);
114 $apcnum=sql_num_rows($apcresult);
115 $apci=0; $apcl=1; if($apcnum>=1) {
116 while ($apci < $apcnum) {
117 $NumsTopics=sql_result($apcresult,$apci,"NumTopics");
118 $NumTopics = $NumsTopics +
$NumTopics;
119 $NumsPosts=sql_result($apcresult,$apci,"NumPosts");
120 $NumPosts = $NumsPosts +
$NumPosts;
121 $SubsForumID=sql_result($apcresult,$apci,"id");
122 $SubsForumName=sql_result($apcresult,$apci,"Name");
123 $SubsForumType=sql_result($apcresult,$apci,"ForumType");
124 $SubsForumShowTopics=sql_result($result,$i,"CanHaveTopics");
125 if(isset($PermissionInfo['CanViewForum'][$SubsForumID])&&
126 $PermissionInfo['CanViewForum'][$SubsForumID]=="yes") {
127 $ExStr = ""; if ($SubsForumType!="redirect"&&
128 $SubsForumShowTopics!="no") { $ExStr = "&page=1"; }
130 if ($SubsForumType=="redirect") { $shownum = "(".$NumRedirects." redirects)"; }
131 if ($SubsForumType!="redirect") { $shownum = "(".$NumsPosts." posts)"; }
132 $sfurl = "<a href=\"";
133 $sfurl = url_maker($exfile[$SubsForumType],$Settings['file_ext'],"act=view&id=".$SubsForumID.$ExStr,$Settings['qstr'],$Settings['qsep'],$prexqstr[$SubsForumType],$exqstr[$SubsForumType]);
134 $sfurl = "<li><ul style=\"list-style-type: none;\"><li><a href=\"".$sfurl."\">".$SubsForumName."</a> <span style=\"color: gray; font-size: 10px;\">".$shownum."</span></li></ul></li>";
136 $sflist = $sflist." ".$sfurl; }
138 $sflist = $sflist." ".$sfurl; }
139 $gltf[$apcl] = $SubsForumID; ++
$apcl; }
141 sql_free_result($apcresult); } }
142 if ($ForumType=="subforum") {
143 $apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"ShowForum\"='yes' AND \"InSubForum\"=%i".$ForumIgnoreList2." ORDER BY \"OrderID\" ASC, \"id\" ASC", array($ForumID));
144 $apcresult=sql_query($apcquery,$SQLStat);
145 $apcnum=sql_num_rows($apcresult);
146 $apci=0; $apcl=1; if($apcnum>=1) {
147 while ($apci < $apcnum) {
148 $NumsTopics=sql_result($apcresult,$apci,"NumTopics");
149 $NumTopics = $NumsTopics +
$NumTopics;
150 $NumsPosts=sql_result($apcresult,$apci,"NumPosts");
151 $NumPosts = $NumsPosts +
$NumPosts;
152 $SubsForumID=sql_result($apcresult,$apci,"id");
153 if(isset($PermissionInfo['CanViewForum'][$SubsForumID])&&
154 $PermissionInfo['CanViewForum'][$SubsForumID]=="yes") {
155 $gltf[$apcl] = $SubsForumID; ++
$apcl; }
157 sql_free_result($apcresult); } }
158 if(isset($PermissionInfo['CanViewForum'][$ForumID])&&
159 $PermissionInfo['CanViewForum'][$ForumID]=="yes") {
160 $LastTopic = " <br /> <br /> ";
161 if(!isset($LastTopic)) { $LastTopic = null; }
162 $gltnum = count($gltf); $glti = 0;
163 $OldUpdateTime = 0; $UseThisFonum = null;
164 if ($ForumType=="subforum") {
165 while ($glti < $gltnum) {
166 $ExtraIgnores = null;
167 if($PermissionInfo['CanModForum'][$gltf[$glti]]=="no") {
168 $ExtraIgnores = " AND \"Closed\"<>3"; }
169 $gltfoquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"CategoryID\"=%i AND \"ForumID\"=%i".$ExtraIgnores." ORDER BY \"LastUpdate\" DESC LIMIT 1", array($CategoryID,$gltf[$glti]));
170 $gltforesult=sql_query($gltfoquery,$SQLStat);
171 $gltfonum=sql_num_rows($gltforesult);
173 $NewUpdateTime=sql_result($gltforesult,0,"LastUpdate");
174 if($NewUpdateTime>$OldUpdateTime) {
175 $UseThisFonum = $gltf[$glti];
176 $OldUpdateTime = $NewUpdateTime; } }
177 sql_free_result($gltforesult);
180 if ($ForumType=="redirect") { $shownum = "(".$NumRedirects." redirects)"; }
181 if ($ForumType!="redirect") { $shownum = "(".$NumPosts." posts)"; }
182 $PreForum = $ThemeSet['ForumIcon'];
183 if ($ForumType=="forum") { $PreForum=$ThemeSet['ForumIcon']; }
184 if ($ForumType=="subforum") { $PreForum=$ThemeSet['SubForumIcon']; }
185 if ($ForumType=="redirect") { $PreForum=$ThemeSet['RedirectIcon']; }
186 $ExStr = ""; if ($ForumType!="redirect"&&
187 $ForumShowTopics!="no") { $ExStr = "&page=1"; }
189 <ul style
="list-style-type: none;"><li
>
190 <a href
="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act
=lowview
&id
=".$ForumID.$ExStr,$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"<?php
if($ForumType=="redirect") { echo " onclick=\"window.open(this.href);return false;\""; } ?
>><?php
echo $ForumName; ?
></a
> <span style
="color: gray; font-size: 10px;"><?php
echo $shownum; ?
></span
></li
>
191 <?php
echo $sflist; ?
></ul
>
192 <?php
} ++
$i; } sql_free_result($result); } ?
>
194 <ul style
="list-style-type: none;">
195 <?php ++
$prei; } } ?
>
197 sql_free_result($preresult);
199 if($SubShowForums!="yes") {
200 $CategoryName = $SCategoryName; }
201 if($SubShowForums!="no") {
202 require($SettDir['inc'].'lowcategories.php'); } }