Small update. :o
[iDB.git] / inc / lowcategories.php
blobb99417e2b3254959825615cdc25c82ee60d001a2
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: lowcategories.php - Last Update: 07/18/2011 SVN 719 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="lowcategories.php"||$File3Name=="/lowcategories.php") {
18 require('index.php');
19 exit(); }
20 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
21 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2." LIMIT 1", array($_GET['id']));
22 $preresult=sql_query($prequery,$SQLStat);
23 $prenum=sql_num_rows($preresult);
24 if($prenum==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($preresult);
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(); }
27 if($prenum>=1) {
28 $CategoryID=sql_result($preresult,0,"id");
29 $CategoryName=sql_result($preresult,0,"Name");
30 $CategoryShow=sql_result($preresult,0,"ShowCategory");
31 if($CategoryShow=="yes") { $_SESSION['ShowActHidden'] = "yes"; }
32 $CategoryType=sql_result($preresult,0,"CategoryType");
33 $InSubCategory=sql_result($preresult,0,"InSubCategory");
34 $SubShowForums=sql_result($preresult,0,"SubShowForums");
35 $CategoryDescription=sql_result($preresult,0,"Description");
36 $CategoryType = strtolower($CategoryType); $SubShowForums = strtolower($SubShowForums);
37 $CategoryPostCountView=sql_result($preresult,0,"PostCountView");
38 $CategoryKarmaCountView=sql_result($preresult,0,"KarmaCountView");
39 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
40 if($MyKarmaCount==null) { $MyKarmaCount = 0; }
41 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
42 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
43 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
44 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
45 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
46 if(!isset($CatPermissionInfo['CanViewCategory'][$CategoryID])) {
47 $CatPermissionInfo['CanViewCategory'][$CategoryID] = "no"; }
48 if($CatPermissionInfo['CanViewCategory'][$CategoryID]=="no"||
49 $CatPermissionInfo['CanViewCategory'][$CategoryID]!="yes") {
50 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
51 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
52 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
53 if($CatPermissionInfo['CanViewCategory'][$CategoryID]=="yes") {
54 if(!isset($CatCheck)) { $CatCheck = null; }
55 if($CatCheck!="skip") {
56 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=lowview&id=".$CategoryID,"&","=",$prexqstr[$CategoryType],$exqstr[$CategoryType]);
57 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
58 $_SESSION['ViewingFile'] = $exfile[$CategoryType].$Settings['file_ext']; }
59 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
60 $_SESSION['ViewingFile'] = $exfile[$CategoryType]; }
61 $_SESSION['PreViewingTitle'] = "Viewing Category:";
62 $_SESSION['ViewingTitle'] = $CategoryName;
63 if($InSubCategory!="0") {
64 $iscquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2." LIMIT 1", array($InSubCategory));
65 $iscresult=sql_query($iscquery,$SQLStat);
66 $iscnum=sql_num_rows($iscresult);
67 if($iscnum>=1) {
68 $iscCategoryID=sql_result($iscresult,0,"id");
69 $iscCategoryName=sql_result($iscresult,0,"Name");
70 $iscCategoryShow=sql_result($iscresult,0,"ShowCategory");
71 $iscCategoryType=sql_result($iscresult,0,"CategoryType");
72 $iscCategoryType = strtolower($iscCategoryType); }
73 if($iscnum<1) { $InSubCategory = "0"; }
74 sql_free_result($iscresult); }
76 <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>
77 <div style="font-size: 11px; font-weight: bold; padding: 10px; border: 1px solid gray;"><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>
78 <div>&nbsp;</div>
79 <div style="padding: 10px; border: 1px solid gray;">
80 <ul style="list-style-type: none;">
81 <?php
82 if($CategoryType=="subcategory") {
83 redirect("location",$rbasedir.url_maker($exfile['subcategory'],$Settings['file_ext'],"act=".$_GET['act']."&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['subcategory'],$exqstr['subcategory'],FALSE));
84 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
85 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
86 $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));
87 $result=sql_query($query,$SQLStat);
88 $num=sql_num_rows($result);
89 $i=0;
90 if($num>=1) {
92 <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>
93 <?php }
94 while ($i < $num) {
95 $ForumID=sql_result($result,$i,"id");
96 $ForumName=sql_result($result,$i,"Name");
97 $ForumShow=sql_result($result,$i,"ShowForum");
98 $ForumType=sql_result($result,$i,"ForumType");
99 $ForumShowTopics=sql_result($result,$i,"CanHaveTopics");
100 $ForumShowTopics = strtolower($ForumShowTopics);
101 $NumTopics=sql_result($result,$i,"NumTopics");
102 $NumPosts=sql_result($result,$i,"NumPosts");
103 $NumRedirects=sql_result($result,$i,"Redirects");
104 $ForumDescription=sql_result($result,$i,"Description");
105 $ForumType = strtolower($ForumType); $sflist = null;
106 $gltf = array(null); $gltf[0] = $ForumID;
107 if ($ForumType=="subforum") {
108 $apcquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"ShowForum\"='yes' AND \"InSubForum\"=%i".$ForumIgnoreList2." ORDER BY \"OrderID\" ASC, \"id\" ASC", array($ForumID));
109 $apcresult=sql_query($apcquery,$SQLStat);
110 $apcnum=sql_num_rows($apcresult);
111 $apci=0; $apcl=1; if($apcnum>=1) {
112 while ($apci < $apcnum) {
113 $NumsTopics=sql_result($apcresult,$apci,"NumTopics");
114 $NumTopics = $NumsTopics + $NumTopics;
115 $NumsPosts=sql_result($apcresult,$apci,"NumPosts");
116 $NumPosts = $NumsPosts + $NumPosts;
117 $SubsForumID=sql_result($apcresult,$apci,"id");
118 $SubsForumName=sql_result($apcresult,$apci,"Name");
119 $SubsForumType=sql_result($apcresult,$apci,"ForumType");
120 $SubsForumShowTopics=sql_result($result,$i,"CanHaveTopics");
121 if(isset($PermissionInfo['CanViewForum'][$SubsForumID])&&
122 $PermissionInfo['CanViewForum'][$SubsForumID]=="yes") {
123 $ExStr = ""; if ($SubsForumType!="redirect"&&
124 $SubsForumShowTopics!="no") { $ExStr = "&page=1"; }
125 $shownum = null;
126 if ($SubsForumType=="redirect") { $shownum = "(".$NumRedirects." redirects)"; }
127 if ($SubsForumType!="redirect") { $shownum = "(".$NumsPosts." posts)"; }
128 $sfurl = "<a href=\"";
129 $sfurl = url_maker($exfile[$SubsForumType],$Settings['file_ext'],"act=lowview&id=".$SubsForumID.$ExStr,$Settings['qstr'],$Settings['qsep'],$prexqstr[$SubsForumType],$exqstr[$SubsForumType]);
130 $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>";
131 if($apcl==1) {
132 $sflist = $sflist." ".$sfurl; }
133 if($apcl>1) {
134 $sflist = $sflist." ".$sfurl; }
135 $gltf[$apcl] = $SubsForumID; ++$apcl; }
136 ++$apci; }
137 sql_free_result($apcresult); } }
138 if(isset($PermissionInfo['CanViewForum'][$ForumID])&&
139 $PermissionInfo['CanViewForum'][$ForumID]=="yes") {
140 $LastTopic = "&nbsp;<br />&nbsp;<br />&nbsp;";
141 if(!isset($LastTopic)) { $LastTopic = null; }
142 $shownum = null;
143 if ($ForumType=="redirect") { $shownum = "(".$NumRedirects." redirects)"; }
144 if ($ForumType!="redirect") { $shownum = "(".$NumPosts." posts)"; }
145 $PreForum = $ThemeSet['ForumIcon'];
146 if ($ForumType=="forum") { $PreForum=$ThemeSet['ForumIcon']; }
147 if ($ForumType=="subforum") { $PreForum=$ThemeSet['SubForumIcon']; }
148 if ($ForumType=="redirect") { $PreForum=$ThemeSet['RedirectIcon']; }
149 $ExStr = ""; if ($ForumType!="redirect"&&
150 $ForumShowTopics!="no") { $ExStr = "&page=1"; }
152 <ul style="list-style-type: none;"><li>
153 <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>
154 <?php echo $sflist; ?></ul>
155 <?php } ++$i; } sql_free_result($result);
156 if($num>=1) { ?>
157 </li></ul></div>
158 <div>&nbsp;</div>
159 <?php } } }
160 sql_free_result($preresult); ?>