Small update
[iDB.git] / inc / topics.php
blobfb84e05bea8a73bd167f6442ccf0d784cfbdec63
1 <?php
2 /*
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2019 iDB Support - https://idb.osdn.jp/support/category.php?act=view&id=1
12 Copyright 2004-2019 Game Maker 2k - https://idb.osdn.jp/support/category.php?act=view&id=2
14 $FileInfo: topics.php - Last Update: 08/02/2019 SVN 905 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="topics.php"||$File3Name=="/topics.php") {
18 require('index.php');
19 exit(); }
20 $pstring = null; $pagenum = null;
21 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
22 if(!is_numeric($_GET['page'])) { $_GET['page'] = 1; }
23 if(!isset($_GET['st'])) { $_GET['st'] = 0; }
24 if(!is_numeric($_GET['st'])) { $_GET['st'] = 0; }
25 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($_GET['id']));
26 $preresult=sql_query($prequery,$SQLStat);
27 $prenum=sql_num_rows($preresult);
28 if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
29 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
30 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
31 if($prenum>=1) {
32 $ForumID=sql_result($preresult,0,"id");
33 $ForumCatID=sql_result($preresult,0,"CategoryID");
34 $ForumName=sql_result($preresult,0,"Name");
35 $ForumType=sql_result($preresult,0,"ForumType");
36 $ForumShow=sql_result($preresult,0,"ShowForum");
37 if($ForumShow=="no") { $_SESSION['ShowActHidden'] = "yes"; }
38 $InSubForum=sql_result($preresult,0,"InSubForum");
39 $RedirectURL=sql_result($preresult,0,"RedirectURL");
40 $RedirectTimes=sql_result($preresult,0,"Redirects");
41 $NumberViews=sql_result($preresult,0,"NumViews");
42 $NumberPosts=sql_result($preresult,0,"NumPosts");
43 $NumberTopics=sql_result($preresult,0,"NumTopics");
44 $PostCountAdd=sql_result($preresult,0,"PostCountAdd");
45 $CanHaveTopics=sql_result($preresult,0,"CanHaveTopics");
46 $HotTopicPosts=sql_result($preresult,0,"HotTopicPosts");
47 if($HotTopicPosts!=0&&is_numeric($HotTopicPosts)) {
48 $Settings['hot_topic_num'] = $HotTopicPosts; }
49 if(!is_numeric($Settings['hot_topic_num'])) {
50 $Settings['hot_topic_num'] = 15; }
51 $ForumPostCountView=sql_result($preresult,0,"PostCountView");
52 $ForumKarmaCountView=sql_result($preresult,0,"KarmaCountView");
53 sql_free_result($preresult);
54 $ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
55 if($CanHaveTopics=="yes"&&$ForumType=="subforum") {
56 if($_GET['act']=="create"||$_GET['act']=="maketopic"||
57 $_POST['act']=="maketopics") { $ForumCheck = "skip"; } }
58 $catcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2." LIMIT 1", array($ForumCatID));
59 $catresult=sql_query($catcheck,$SQLStat);
60 $CategoryID=sql_result($catresult,0,"id");
61 $CategoryName=sql_result($catresult,0,"Name");
62 $CategoryShow=sql_result($catresult,0,"ShowCategory");
63 if($CategoryShow=="no") { $_SESSION['ShowActHidden'] = "yes"; }
64 $CategoryType=sql_result($catresult,0,"CategoryType");
65 $InSubCategory=sql_result($catresult,0,"InSubCategory");
66 $CategoryPostCountView=sql_result($catresult,0,"PostCountView");
67 $CategoryKarmaCountView=sql_result($catresult,0,"KarmaCountView");
68 sql_free_result($catresult);
69 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
70 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
71 if($MyKarmaCount==null) { $MyKarmaCount = 0; }
72 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
73 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
74 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
75 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
76 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
77 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
78 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
79 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
80 if($InSubForum!="0") {
81 $isfquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($InSubForum));
82 $isfresult=sql_query($isfquery,$SQLStat);
83 $isfnum=sql_num_rows($isfresult);
84 if($isfnum>=1) {
85 $isfForumID=sql_result($isfresult,0,"id");
86 $isfForumCatID=sql_result($isfresult,0,"CategoryID");
87 $isfForumName=sql_result($isfresult,0,"Name");
88 $isfForumType=sql_result($isfresult,0,"ForumType");
89 $isfForumType = strtolower($isfForumType);
90 $isfRedirectURL=sql_result($isfresult,0,"RedirectURL"); }
91 if($isfnum<1) { $InSubForum = "0"; }
92 sql_free_result($isfresult); }
93 if($ForumCheck!="skip") {
94 if(isset($_SESSION['OldViewingPage'])) { $_SESSION['AncientViewingPage'] = $_SESSION['OldViewingPage']; } else { $_SESSION['AncientViewingPage'] = url_maker(null,"no+ext","act=view","&","=",$prexqstr['index'],$exqstr['index']); }
95 if(isset($_SESSION['OldViewingFile'])) { $_SESSION['AncientViewingFile'] = $_SESSION['OldViewingFile']; } else {
96 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
97 $_SESSION['AncientViewingFile'] = $exfile['index'].$Settings['file_ext']; }
98 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
99 $_SESSION['AncientViewingFile'] = $exfile['index']; } }
100 if(isset($_SESSION['OldPreViewingTitle'])) { $_SESSION['AncientPreViewingTitle'] = $_SESSION['OldPreViewingTitle']; } else { $_SESSION['AncientPreViewingTitle'] = "Viewing"; }
101 if(isset($_SESSION['OldViewingTitle'])) { $_SESSION['AncientViewingTitle'] = $_SESSION['OldViewingTitle']; } else { $_SESSION['AncientViewingTitle'] = "Board index"; }
102 if(isset($_SESSION['OldExtraData'])) { $_SESSION['AncientExtraData'] = $_SESSION['OldExtraData']; } else { $_SESSION['AncientExtraData'] = "currentact:view; currentcategoryid:0; currentforumid:0; currenttopicid:0; currentmessageid:0; currenteventid:0; currentmemberid:0;"; }
103 if(isset($_SESSION['ViewingPage'])) { $_SESSION['OldViewingPage'] = $_SESSION['ViewingPage']; } else { $_SESSION['OldViewingPage'] = url_maker(null,"no+ext","act=view","&","=",$prexqstr['index'],$exqstr['index']); }
104 if(isset($_SESSION['ViewingFile'])) { $_SESSION['OldViewingFile'] = $_SESSION['ViewingFile']; } else {
105 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
106 $_SESSION['OldViewingFile'] = $exfile['index'].$Settings['file_ext']; }
107 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
108 $_SESSION['OldViewingFile'] = $exfile['index']; } }
109 if(isset($_SESSION['PreViewingTitle'])) { $_SESSION['OldPreViewingTitle'] = $_SESSION['PreViewingTitle']; } else { $_SESSION['OldPreViewingTitle'] = "Viewing"; }
110 if(isset($_SESSION['ViewingTitle'])) { $_SESSION['OldViewingTitle'] = $_SESSION['ViewingTitle']; } else { $_SESSION['OldViewingTitle'] = "Board index"; }
111 if(isset($_SESSION['ExtraData'])) { $_SESSION['OldExtraData'] = $_SESSION['ExtraData']; } else { $_SESSION['OldExtraData'] = "currentact:view; currentcategoryid:0; currentforumid:0; currenttopicid:0; currentmessageid:0; currenteventid:0; currentmemberid:0;"; }
112 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=view&id=".$ForumID."&page=".$_GET['page'],"&","=",$prexqstr[$ForumType],$exqstr[$ForumType]);
113 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
114 $_SESSION['ViewingFile'] = $exfile[$ForumType].$Settings['file_ext']; }
115 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
116 $_SESSION['ViewingFile'] = $exfile[$ForumType]; }
117 $_SESSION['PreViewingTitle'] = "Viewing Forum:";
118 $_SESSION['ViewingTitle'] = $ForumName;
119 $_SESSION['ExtraData'] = "currentact:".$_GET['act']."; currentcategoryid:".$InSubCategory.",".$CategoryID."; currentforumid:".$InSubForum.",".$ForumID."; currenttopicid:0; currentmessageid:0; currenteventid:0; currentmemberid:0;";
121 <div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>"><?php echo $Settings['board_name']; ?></a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$CategoryType],$Settings['file_ext'],"act=view&id=".$ForumCatID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php echo $CategoryName; ?></a><?php if($InSubForum!="0") { echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$isfForumType],$Settings['file_ext'],"act=view&id=".$isfForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$isfForumType],$exqstr[$isfForumType]); ?>"><?php echo $isfForumName; ?></a><?php } echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"><?php echo $ForumName; ?></a></div>
122 <div class="DivNavLinks">&nbsp;</div>
123 <?php }
124 if(!isset($CatPermissionInfo['CanViewCategory'][$ForumCatID])) {
125 $CatPermissionInfo['CanViewCategory'][$ForumCatID] = "no"; }
126 if($CatPermissionInfo['CanViewCategory'][$ForumCatID]=="no"||
127 $CatPermissionInfo['CanViewCategory'][$ForumCatID]!="yes") {
128 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
129 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
130 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
131 if(!isset($PermissionInfo['CanViewForum'][$ForumID])) {
132 $PermissionInfo['CanViewForum'][$ForumID] = "no"; }
133 if($PermissionInfo['CanViewForum'][$ForumID]=="no"||
134 $PermissionInfo['CanViewForum'][$ForumID]!="yes") {
135 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
136 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
137 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
138 if($CatPermissionInfo['CanViewCategory'][$ForumCatID]=="yes"&&
139 $PermissionInfo['CanViewForum'][$ForumID]=="yes") {
140 if($ForumType!="redirect") {
141 if($NumberViews==0||$NumberViews==null) { $NewNumberViews = 1; }
142 if($NumberViews!=0&&$NumberViews!=null) { $NewNumberViews = $NumberViews + 1; }
143 $viewup = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumViews\"=%i WHERE \"id\"=%i", array($NewNumberViews,$_GET['id']));
144 sql_query($viewup,$SQLStat); }
145 if($ForumType=="redirect") {
146 if($RedirectTimes==0||$RedirectTimes==null) { $NewRedirTime = 1; }
147 if($RedirectTimes!=0&&$RedirectTimes!=null) { $NewRedirTime = $RedirectTimes + 1; }
148 $redirup = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"Redirects\"=%i WHERE \"id\"=%i", array($NewRedirTime,$_GET['id']));
149 sql_query($redirup,$SQLStat);
150 if($RedirectURL!="http://"&&$RedirectURL!="") {
151 redirect("location",$RedirectURL,0,null,false); ob_clean();
152 header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
153 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
154 if($RedirectURL=="http://"||$RedirectURL=="") {
155 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
156 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
157 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
158 if($ForumCheck!="skip") {
159 if($ForumType=="subforum") {
160 redirect("location",$rbasedir.url_maker($exfile['subforum'],$Settings['file_ext'],"act=".$_GET['act']."&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['subforum'],$exqstr['subforum'],FALSE));
161 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
162 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
163 if($_GET['act']!="view") { ?>
164 <table style="width: 100%;" class="Table2">
165 <tr>
166 <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
167 <td style="width: 70%; text-align: right;">
168 <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
169 <a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=create&id=".$ForumID,$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ThemeSet['NewTopic']; ?></a>
170 <?php } ?></td>
171 </tr>
172 </table>
173 <div class="DivTable2">&nbsp;</div>
174 <?php } if($_GET['act']=="view") {
175 if($NumberTopics==null) {
176 $NumberTopics = 0; }
177 $num=$NumberTopics;
178 //Start Topic Page Code
179 if(!isset($Settings['max_topics'])) { $Settings['max_topics'] = 10; }
180 if($_GET['page']==null) { $_GET['page'] = 1; }
181 if($_GET['page']<=0) { $_GET['page'] = 1; }
182 if($_GET['st']<=0||!isset($_GET['st'])) {
183 $nums = $_GET['page'] * $Settings['max_topics']; }
184 if($_GET['st']>0&&isset($_GET['st'])) {
185 $nums = $_GET['st']; }
186 if($nums>$num) { $nums = $num; }
187 $numz = $nums - $Settings['max_topics'];
188 if($numz<=0) { $numz = 0; }
189 //$i=$numz;
190 if($nums<$num) { $nextpage = $_GET['page'] + 1; }
191 if($nums>=$num) { $nextpage = $_GET['page']; }
192 if($numz>=$Settings['max_topics']) { $backpage = $_GET['page'] - 1; }
193 if($_GET['page']<=1) { $backpage = 1; }
194 $pnum = $num; $l = 1; $Pages = null;
195 while ($pnum>0) {
196 if($pnum>=$Settings['max_topics']) {
197 $pnum = $pnum - $Settings['max_topics'];
198 $Pages[$l] = $l; ++$l; }
199 if($pnum<$Settings['max_topics']&&$pnum>0) {
200 $pnum = $pnum - $pnum;
201 $Pages[$l] = $l; ++$l; } }
202 $snumber = $_GET['page'] - 1;
203 if($_GET['st']<=0||!isset($_GET['st'])) {
204 $PageLimit = $Settings['max_topics'] * $snumber; }
205 if($_GET['st']>0&&isset($_GET['st'])) {
206 $PageLimit = $_GET['st']; }
207 if($PageLimit<0) { $PageLimit = 0; }
208 //End Topic Page Code
209 $i=0;
210 $ExtraIgnores = null;
211 if($PermissionInfo['CanModForum'][$_GET['id']]=="no") {
212 $ExtraIgnores = " AND \"Closed\"<>3"; }
213 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE (\"ForumID\"=%i".$ExtraIgnores.$ForumIgnoreList4.") OR (\"OldForumID\"=%i".$ExtraIgnores.$ForumIgnoreList4.") OR (\"Pinned\"=2".$ExtraIgnores.$ForumIgnoreList4.") ORDER BY \"Pinned\" DESC, \"LastUpdate\" DESC ".$SQLimit, array($_GET['id'],$_GET['id'],$PageLimit,$Settings['max_topics']));
214 $result=sql_query($query,$SQLStat);
215 $num=sql_num_rows($result);
216 //List Page Number Code Start
217 $pagenum=count($Pages);
218 if($_GET['page']>$pagenum) {
219 $_GET['page'] = $pagenum; }
220 $pagei=0; $pstring = null;
221 if($pagenum>1) {
222 $pstring = "<div class=\"PageList\"><span class=\"pagelink\">".$pagenum." Pages:</span> "; }
223 if($_GET['page']<4) { $Pagez[0] = null; }
224 if($_GET['page']>=4) { $Pagez[0] = "First"; }
225 if($_GET['page']>=3) {
226 $Pagez[1] = $_GET['page'] - 2; }
227 if($_GET['page']<3) {
228 $Pagez[1] = null; }
229 if($_GET['page']>=2) {
230 $Pagez[2] = $_GET['page'] - 1; }
231 if($_GET['page']<2) {
232 $Pagez[2] = null; }
233 $Pagez[3] = $_GET['page'];
234 if($_GET['page']<$pagenum) {
235 $Pagez[4] = $_GET['page'] + 1; }
236 if($_GET['page']>=$pagenum) {
237 $Pagez[4] = null; }
238 $pagenext = $_GET['page'] + 1;
239 if($pagenext<$pagenum) {
240 $Pagez[5] = $_GET['page'] + 2; }
241 if($pagenext>=$pagenum) {
242 $Pagez[5] = null; }
243 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
244 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
245 $pagenumi=count($Pagez);
246 if($NumberTopics==0) {
247 $pagenumi = 0;
248 $pstring = null; }
249 if($pagenum>1) {
250 while ($pagei < $pagenumi) {
251 if($_GET['page']!=1&&$pagei==1) {
252 $Pback = $_GET['page'] - 1;
253 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pback,$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">&lt;</a></span> "; }
254 if($Pagez[$pagei]!=null&&
255 $Pagez[$pagei]!="First"&&
256 $Pagez[$pagei]!="Last") {
257 if($pagei!=3) {
258 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">".$Pagez[$pagei]."</a></span> "; }
259 if($pagei==3) {
260 $pstring = $pstring."<span class=\"pagecurrent\"><a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">".$Pagez[$pagei]."</a></span> "; } }
261 if($Pagez[$pagei]=="First") {
262 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">&laquo;</a></span> "; }
263 if($Pagez[$pagei]=="Last") {
264 $ptestnext = $pagenext + 1;
265 $paget = $pagei - 1;
266 $Pnext = $_GET['page'] + 1;
267 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pnext,$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">&gt;</a></span> ";
268 if($ptestnext<$pagenum) {
269 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$pagenum,$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">&raquo;</a></span> "; } }
270 ++$pagei; } $pstring = $pstring."</div>"; }
271 //List Page Number Code end
272 if($pstring!=null||$PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") {
274 <table style="width: 100%;" class="Table2">
275 <tr>
276 <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
277 <td style="width: 70%; text-align: right;">
278 <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
279 <a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=create&id=".$ForumID,$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ThemeSet['NewTopic']; ?></a>
280 <?php } ?></td>
281 </tr>
282 </table>
283 <?php
284 //List Page Number Code end
286 <?php /*<div class="DivPageLinks">&nbsp;</div>*/?>
287 <div class="DivTable2">&nbsp;</div>
288 <?php } ?>
289 <div class="Table1Border">
290 <?php if($ThemeSet['TableStyle']=="div") { ?>
291 <div class="TableRow1">
292 <span style="text-align: left;">
293 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>#<?php echo $ForumID; ?>"><?php echo $ForumName; ?></a></span></div>
294 <?php } ?>
295 <table class="Table1" id="Forum<?php echo $ForumID; ?>">
296 <?php if($ThemeSet['TableStyle']=="table") { ?>
297 <tr id="ForumStart<?php echo $ForumID; ?>" class="TableRow1">
298 <td class="TableColumn1" colspan="6"><span style="text-align: left;">
299 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>#<?php echo $ForumID; ?>"><?php echo $ForumName; ?></a></span>
300 </td>
301 </tr><?php } ?>
302 <tr id="TopicStatRow<?php echo $ForumID; ?>" class="TableRow2">
303 <th class="TableColumn2" style="width: 4%;">State</th>
304 <th class="TableColumn2" style="width: 36%;">Topic Name</th>
305 <th class="TableColumn2" style="width: 15%;">Author</th>
306 <th class="TableColumn2" style="width: 15%;">Time</th>
307 <th class="TableColumn2" style="width: 5%;">Replys</th>
308 <th class="TableColumn2" style="width: 25%;">Last Reply</th>
309 </tr>
310 <?php
311 while ($i < $num) {
312 $TopicID=sql_result($result,$i,"id");
313 $TForumID=sql_result($result,$i,"ForumID");
314 $OldForumID=sql_result($result,$i,"OldForumID");
315 $UsersID=sql_result($result,$i,"UserID");
316 $GuestsName=sql_result($result,$i,"GuestName");
317 $TheTime=sql_result($result,$i,"TimeStamp");
318 $tmpusrcurtime = new DateTime();
319 $tmpusrcurtime->setTimestamp($TheTime);
320 $tmpusrcurtime->setTimezone($usertz);
321 $TheTime=$tmpusrcurtime->format($_SESSION['iDBDateFormat'].", ".$_SESSION['iDBTimeFormat']);
322 $NumReply=sql_result($result,$i,"NumReply");
323 $NumberPosts=$NumReply + 1;
324 $prepagelist = null;
325 if(!isset($Settings['max_posts'])) {
326 $Settings['max_posts'] = 10; }
327 if(!isset($ThemeSet['MiniPageAltStyle'])) {
328 $ThemeSet['MiniPageAltStyle'] = "off"; }
329 if($ThemeSet['MiniPageAltStyle']!="on"&&
330 $ThemeSet['MiniPageAltStyle']!="off") {
331 $ThemeSet['MiniPageAltStyle'] = "off"; }
332 if($NumberPosts>$Settings['max_posts']) {
333 $NumberPages = ceil($NumberPosts/$Settings['max_posts']); }
334 if($NumberPosts<=$Settings['max_posts']) {
335 $NumberPages = 1; }
336 if($NumberPages>4) {
337 $prepagelist = " &nbsp;"; }
338 if($NumberPages>=2) {
339 if($ThemeSet['MiniPageAltStyle']=="off") {
340 $prepagelist = "<span class=\"small\">(Pages: "; }
341 if($ThemeSet['MiniPageAltStyle']=="on") {
342 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
343 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">1</a>";
344 if($ThemeSet['MiniPageAltStyle']=="on") {
345 $prepagelist = $prepagelist."</span>"; }
346 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
347 if($ThemeSet['MiniPageAltStyle']=="on") {
348 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
349 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=2",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">2</a>";
350 if($ThemeSet['MiniPageAltStyle']=="on") {
351 $prepagelist = $prepagelist."</span>"; }
352 if($NumberPages>=3) {
353 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
354 if($ThemeSet['MiniPageAltStyle']=="on") {
355 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
356 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=3",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">3</a>";
357 if($ThemeSet['MiniPageAltStyle']=="on") {
358 $prepagelist = $prepagelist."</span>"; } }
359 if($NumberPages==4) {
360 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
361 if($ThemeSet['MiniPageAltStyle']=="on") {
362 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
363 if($ThemeSet['MiniPageAltStyle']=="on") {
364 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=4",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">4</a>"; }
365 if($ThemeSet['MiniPageAltStyle']=="off") {
366 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=4",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\"> ...4</a>"; }
367 if($ThemeSet['MiniPageAltStyle']=="on") {
368 $prepagelist = $prepagelist."</span>"; } }
369 if($NumberPages>4) {
370 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
371 if($ThemeSet['MiniPageAltStyle']=="on") {
372 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
373 if($ThemeSet['MiniPageAltStyle']=="on") {
374 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumberPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&raquo; ".$NumberPages."</a>"; }
375 if($ThemeSet['MiniPageAltStyle']=="off") {
376 $prepagelist = $prepagelist."<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumberPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\"> ...".$NumberPages."</a>"; }
377 if($ThemeSet['MiniPageAltStyle']=="on") {
378 $prepagelist = $prepagelist."</span>"; } }
379 if($ThemeSet['MiniPageAltStyle']=="off") {
380 $prepagelist = $prepagelist.")</span>"; } }
381 $TopicName=sql_result($result,$i,"TopicName");
382 $TopicDescription=sql_result($result,$i,"Description");
383 $PinnedTopic=sql_result($result,$i,"Pinned");
384 $TopicStat=sql_result($result,$i,"Closed");
385 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($UsersID));
386 $reresult=sql_query($requery,$SQLStat);
387 $renum=sql_num_rows($reresult);
388 if($renum<1) { $UsersID = -1;
389 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($UsersID));
390 $reresult=sql_query($requery,$SQLStat);
391 $renum=sql_num_rows($reresult); }
392 $UserHidden=sql_result($reresult,0,"HiddenMember");
393 $UserGroupID=sql_result($reresult,0,"GroupID");
394 sql_free_result($reresult);
395 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($UserGroupID));
396 $gresult=sql_query($gquery,$SQLStat);
397 $User1Group=sql_result($gresult,0,"Name");
398 $GroupNamePrefix=sql_result($gresult,0,"NamePrefix");
399 $GroupNameSuffix=sql_result($gresult,0,"NameSuffix");
400 sql_free_result($gresult);
401 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat);
402 if($PreUsersName['Name']===null) { $UsersID = -1;
403 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat); }
404 $UsersName = $PreUsersName['Name'];
405 $UsersHidden = $PreUsersName['Hidden'];
406 if($UsersName=="Guest") { $UsersName=$GuestsName;
407 if($UsersName==null) { $UsersName="Guest"; } }
408 if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
409 $UsersName = $GroupNamePrefix.$UsersName; }
410 if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
411 $UsersName = $UsersName.$GroupNameSuffix; }
412 $LastReply = "&nbsp;<br />&nbsp;";
413 $glrquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" DESC LIMIT 1", array($TopicID));
414 $glrresult=sql_query($glrquery,$SQLStat);
415 $glrnum=sql_num_rows($glrresult);
416 if($glrnum>0){
417 $ReplyID1=sql_result($glrresult,0,"id");
418 $UsersID1=sql_result($glrresult,0,"UserID");
419 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat);
420 if($PreUsersName1['Name']===null) { $UsersID1 = -1;
421 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat); }
422 $UsersName1 = $PreUsersName1['Name'];
423 $UsersHidden1 = $PreUsersName1['Hidden'];
424 $GuestsName1=sql_result($glrresult,0,"GuestName");
425 $TimeStamp1=sql_result($glrresult,0,"TimeStamp");
426 $tmpusrcurtime = new DateTime();
427 $tmpusrcurtime->setTimestamp($TimeStamp1);
428 $tmpusrcurtime->setTimezone($usertz);
429 $TimeStamp1=$tmpusrcurtime->format($_SESSION['iDBDateFormat'].", ".$_SESSION['iDBTimeFormat']); }
430 $NumPages = null; $NumRPosts = $NumReply + 1;
431 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
432 if($NumRPosts>$Settings['max_posts']) {
433 $NumPages = ceil($NumRPosts/$Settings['max_posts']); }
434 if($NumRPosts<=$Settings['max_posts']) { $NumPages = 1; }
435 $Users_Name1 = pre_substr($UsersName1,0,20);
436 if($UsersName1=="Guest") { $UsersName1=$GuestsName1;
437 if($UsersName1==null) { $UsersName1="Guest"; } }
438 $oldusername=$UsersName1;
439 if (pre_strlen($UsersName1)>20) {
440 $Users_Name1 = $Users_Name1."..."; $UsersName1=$Users_Name1; } $lul = null;
441 if($TimeStamp1!=null) { $lul = null;
442 if($UsersID1>0&&$UsersHidden1=="no") {
443 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
444 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."&#35;reply".$NumRPosts;
445 $LastReply = "<a href=\"".$luln."\">".$TimeStamp1."</a><br />\nUser: <a href=\"".$lul."\" title=\"".$oldusername."\">".$UsersName1."</a>"; }
446 if($UsersID1<=0||$UsersHidden1=="yes") {
447 if($UsersID1==-1) { $UserPre = "Guest:"; }
448 if(($UsersID1<-1&&$UsersHidden1=="yes")||$UsersID1==0||($UsersID1>0&&$UsersHidden1=="yes")) {
449 $UserPre = "Hidden:"; }
450 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
451 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."&#35;reply".$NumRPosts;
452 $LastReply = "<a href=\"".$luln."\">".$TimeStamp1."</a><br />\n".$UserPre." <span title=\"".$oldusername."\">".$UsersName1."</span>"; } }
453 sql_free_result($glrresult);
454 if(!isset($TimeStamp1)) { $TimeStamp1 = null; } if(!isset($LastReply)) { $LastReply = "&nbsp;<br />&nbsp;"; }
455 if($TimeStamp1==null) { $LastReply = "&nbsp;<br />&nbsp;"; }
456 $PreTopic = $ThemeSet['TopicIcon'];
457 if ($PinnedTopic>2) { $PinnedTopic = 1; }
458 if ($PinnedTopic<0) { $PinnedTopic = 0; }
459 if(!is_numeric($PinnedTopic)) { $PinnedTopic = 0; }
460 if ($TopicStat>3) { $TopicStat = 1; }
461 if ($TopicStat<0) { $TopicStat = 0; }
462 if(!is_numeric($TopicStat)) { $TopicStat = 1; }
463 if(!is_numeric($OldForumID)) { $OldForumID = $ForumID; }
464 if($OldForumID=="0") { $OldForumID = $ForumID; }
465 if ($OldForumID!=$ForumID||$TForumID==$ForumID) {
466 $PreTopic = $ThemeSet['TopicIcon'];
467 $PreTopicText = null;
468 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat==0) {
469 if($NumReply>=$Settings['hot_topic_num']) {
470 $PreTopicText = "<span style=\"font-weight: bold;\">Pinned: </span>";
471 $PreTopic=$ThemeSet['HotPinTopic']; }
472 if($NumReply<$Settings['hot_topic_num']) {
473 $PreTopicText = "<span style=\"font-weight: bold;\">Pinned: </span>";
474 $PreTopic=$ThemeSet['PinTopic']; } }
475 if ($TopicStat>0&&$TopicStat<=3&&$PinnedTopic==0) {
476 if($NumReply>=$Settings['hot_topic_num']) {
477 $PreTopic=$ThemeSet['HotClosedTopic']; }
478 if($NumReply<$Settings['hot_topic_num']) {
479 $PreTopic=$ThemeSet['ClosedTopic']; } }
480 if ($PinnedTopic==0&&$TopicStat==0) {
481 if($NumReply>=$Settings['hot_topic_num']) {
482 $PreTopic=$ThemeSet['HotTopic']; }
483 if($NumReply<$Settings['hot_topic_num']) {
484 $PreTopic=$ThemeSet['TopicIcon']; } }
485 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat>0&&$TopicStat<=3) {
486 if($NumReply>=$Settings['hot_topic_num']) {
487 $PreTopicText = "<span style=\"font-weight: bold;\">Pinned: </span>";
488 $PreTopic=$ThemeSet['HotPinClosedTopic']; }
489 if($NumReply<$Settings['hot_topic_num']) {
490 $PreTopicText = "<span style=\"font-weight: bold;\">Pinned: </span>";
491 $PreTopic=$ThemeSet['PinClosedTopic']; } }
492 if($PinnedTopic==2) {
493 $PreTopicText = null;
494 $PreTopic=$ThemeSet['AnnouncementTopic']; } }
495 if ($OldForumID==$ForumID&&$TForumID!=$ForumID) {
496 $PreTopicText = "<span>Moved: </span>";
497 $PreTopic = $ThemeSet['MovedTopicIcon'];
498 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat==0) {
499 if($NumReply>=$Settings['hot_topic_num']) {
500 $PreTopic=$ThemeSet['MovedHotPinTopic']; }
501 if($NumReply<$Settings['hot_topic_num']) {
502 $PreTopic=$ThemeSet['MovedPinTopic']; } }
503 if ($TopicStat>0&&$TopicStat<=3&&$PinnedTopic==0) {
504 if($NumReply>=$Settings['hot_topic_num']) {
505 $PreTopic=$ThemeSet['MovedHotClosedTopic']; }
506 if($NumReply<$Settings['hot_topic_num']) {
507 $PreTopic=$ThemeSet['MovedClosedTopic']; } }
508 if ($PinnedTopic==0&&$TopicStat==0) {
509 if($NumReply>=$Settings['hot_topic_num']) {
510 $PreTopic=$ThemeSet['MovedHotTopic']; }
511 if($NumReply<$Settings['hot_topic_num']) {
512 $PreTopic=$ThemeSet['MovedTopicIcon']; } }
513 if ($PinnedTopic>0&&$PinnedTopic<3&&$TopicStat>0&&$TopicStat<=3) {
514 if($NumReply>=$Settings['hot_topic_num']) {
515 $PreTopic=$ThemeSet['MovedHotPinClosedTopic']; }
516 if($NumReply<$Settings['hot_topic_num']) {
517 $PreTopic=$ThemeSet['MovedPinClosedTopic']; } } }
519 <tr class="TableRow3" id="Topic<?php echo $TopicID; ?>">
520 <td class="TableColumn3"><div class="topicstate">
521 <?php echo $PreTopic; ?></div></td>
522 <td class="TableColumn3"><div class="topicname">
523 <?php echo $PreTopicText; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a>
524 <?php if($prepagelist!==null) { echo $prepagelist; } ?></div>
525 <div class="topicdescription"><?php echo $TopicDescription; ?></div></td>
526 <td class="TableColumn3" style="text-align: center;"><?php
527 if($UsersID>0&&$UserHidden=="no") {
528 echo "<a href=\"";
529 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
530 echo "\">".$UsersName."</a>"; }
531 if($UsersID<=0||$UserHidden=="yes") {
532 echo "<span>".$UsersName."</span>"; }
533 ?></td>
534 <td class="TableColumn3" style="text-align: center;"><?php echo $TheTime; ?></td>
535 <td class="TableColumn3" style="text-align: center;"><?php echo $NumReply; ?></td>
536 <td class="TableColumn3"><?php echo $LastReply; ?></td>
537 </tr>
538 <?php ++$i; }
540 <tr id="ForumEnd<?php echo $ForumID; ?>" class="TableRow4">
541 <td class="TableColumn4" colspan="6">&nbsp;</td>
542 </tr>
543 </table></div>
544 <div class="DivTopics">&nbsp;</div>
545 <?php
546 sql_free_result($result); }
547 if(($utccurtime->getTimestamp()<$_SESSION['LastPostTime']&&$_SESSION['LastPostTime']!=0)&&($_GET['act']=="create"||$_GET['act']=="maketopic")) {
548 $_GET['act'] = "view"; $_POST['act'] = null;
549 redirect("refresh",$rbasedir.url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum'],FALSE),"3"); ?>
550 <div class="Table1Border">
551 <?php if($ThemeSet['TableStyle']=="div") { ?>
552 <div class="TableRow1">
553 <span style="text-align: left;">
554 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ForumName; ?></a></span></div>
555 <?php } ?>
556 <table class="Table1">
557 <?php if($ThemeSet['TableStyle']=="table") { ?>
558 <tr class="TableRow1">
559 <td class="TableColumn1"><span style="text-align: left;">
560 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ForumName; ?></a></span>
561 </td>
562 </tr><?php } ?>
563 <tr class="TableRow2">
564 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Make Reply Message: </th>
565 </tr>
566 <tr class="TableRow3">
567 <td class="TableColumn3">
568 <table style="width: 100%; height: 25%; text-align: center;">
569 <tr>
570 <td><span class="TableMessage"><br />
571 You have to wait before making another topic.<br />
572 Click <a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>">here</a> to go back to forum.<br />&nbsp;
573 </span><br /></td>
574 </tr>
575 </table>
576 </td></tr>
577 <tr class="TableRow4">
578 <td class="TableColumn4">&nbsp;</td>
579 </tr>
580 </table></div>
581 <div class="DivMkReply">&nbsp;</div>
582 <?php } if($_GET['act']=="create") {
583 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
584 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
585 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
586 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
587 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
588 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
589 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
590 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
591 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
592 if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
593 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
594 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
595 $UFID = rand_uuid("rand");
596 $_SESSION['UserFormID'] = $UFID;
598 <div class="Table1Border">
599 <?php if($ThemeSet['TableStyle']=="div") { ?>
600 <div class="TableRow1">
601 <span style="text-align: left;">
602 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ForumName; ?></a></span></div>
603 <?php } ?>
604 <table class="Table1" id="MakeTopic<?php echo $ForumID; ?>">
605 <?php if($ThemeSet['TableStyle']=="table") { ?>
606 <tr class="TableRow1" id="TopicStart<?php echo $ForumID; ?>">
607 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
608 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ForumName; ?></a></span>
609 </td>
610 </tr><?php } ?>
611 <tr id="MakeTopicRow<?php echo $ForumID; ?>" class="TableRow2">
612 <td class="TableColumn2" colspan="2" style="width: 100%;">Making a Topic in <?php echo $ForumName; ?></td>
613 </tr>
614 <tr class="TableRow3" id="MkTopic<?php echo $ForumID; ?>">
615 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
616 <div style="width: 100%; height: 160px; overflow: auto;">
617 <table style="width: 100%; text-align: center;"><?php
618 $melanie_query=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."smileys\" WHERE \"Display\"='yes'", array(null));
619 $melanie_result=sql_query($melanie_query,$SQLStat);
620 $melanie_num=sql_num_rows($melanie_result);
621 $melanie_p=0; $SmileRow=0; $SmileCRow=0;
622 while ($melanie_p < $melanie_num) { ++$SmileRow;
623 $FileName=sql_result($melanie_result,$melanie_p,"FileName");
624 $SmileName=sql_result($melanie_result,$melanie_p,"SmileName");
625 $SmileText=sql_result($melanie_result,$melanie_p,"SmileText");
626 $SmileDirectory=sql_result($melanie_result,$melanie_p,"Directory");
627 $ShowSmile=sql_result($melanie_result,$melanie_p,"Display");
628 $ReplaceType=sql_result($melanie_result,$melanie_p,"ReplaceCI");
629 if($SmileRow==1) { ?><tr>
630 <?php } if($SmileRow<5) { ++$SmileCRow; ?>
631 <td><img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('TopicPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" /></td>
632 <?php } if($SmileRow==5) { ++$SmileCRow; ?>
633 <td><img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('TopicPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" /></td></tr>
634 <?php $SmileCRow=0; $SmileRow=0; }
635 ++$melanie_p; }
636 if($SmileCRow<5&&$SmileCRow!=0) {
637 $SmileCRowL = 5 - $SmileCRow;
638 echo "<td colspan=\"".$SmileCRowL."\">&nbsp;</td></tr>"; }
639 echo "</table>";
640 sql_free_result($melanie_result);
641 ?></div></td>
642 <td class="TableColumn3" style="width: 85%;">
643 <form style="display: inline;" method="post" id="MkTopicForm" action="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=maketopic&id=".$ForumID,$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>">
644 <table style="text-align: left;">
645 <tr style="text-align: left;">
646 <td style="width: 50%;"><label class="TextBoxLabel" for="TopicName">Insert Topic Name:</label></td>
647 <td style="width: 50%;"><input maxlength="30" type="text" name="TopicName" class="TextBox" id="TopicName" size="20" /></td>
648 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
649 <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
650 <?php if(!isset($_SESSION['GuestName'])) { ?>
651 <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
652 <?php } if(isset($_SESSION['GuestName'])) { ?>
653 <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
654 <?php } ?></tr><?php } ?><tr style="text-align: left;">
655 <td style="width: 50%;"><label class="TextBoxLabel" for="TopicDesc">Insert Topic Description:</label></td>
656 <td style="width: 50%;"><input maxlength="45" type="text" name="TopicDesc" class="TextBox" id="TopicDesc" size="20" /></td>
657 </tr>
658 </table>
659 <table style="text-align: left;">
660 <tr style="text-align: left;">
661 <td style="width: 100%;">
662 <label class="TextBoxLabel" for="TopicPost">Insert Your Post:</label><br />
663 <textarea rows="10" name="TopicPost" id="TopicPost" cols="40" class="TextBox"></textarea><br />
664 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
665 <label class="TextBoxLabel" for="signcode"><img src="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=MkCaptcha",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>" alt="CAPTCHA Code" title="CAPTCHA Code" /></label><br />
666 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
667 <?php } ?>
668 <input type="hidden" name="act" value="maketopics" style="display: none;" />
669 <input type="hidden" style="display: none;" name="fid" value="<?php echo $UFID; ?>" />
670 <input type="hidden" style="display: none;" name="ubid" value="<?php echo $Settings['BoardUUID']; ?>" />
671 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
672 <input type="hidden" name="GuestName" value="null" style="display: none;" />
673 <?php } ?>
674 <input type="submit" class="Button" value="Make Topic" name="make_topic" />
675 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
676 </td></tr></table>
677 </form></td></tr>
678 <tr id="MkTopicEnd<?php echo $ForumID; ?>" class="TableRow4">
679 <td class="TableColumn4" colspan="2">&nbsp;</td>
680 </tr>
681 </table></div>
682 <div class="DivMkTopics">&nbsp;</div>
683 <?php } if($_GET['act']=="maketopic"&&$_POST['act']=="maketopics") {
684 if($_POST['TopicDesc']==""&&$_POST['TopicName']!="") {
685 $_POST['TopicDesc'] = $_POST['TopicName']; }
686 if($_POST['TopicDesc']!=""&&$_POST['TopicName']=="") {
687 $_POST['TopicName'] = $_POST['TopicDesc']; }
688 if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
689 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
690 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
691 $MyUserID = $_SESSION['UserID']; if($MyUserID=="0"||$MyUserID==null) { $MyUserID = -1; }
692 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
693 $URL['REFERER'] = $REFERERurl['host'];
694 $URL['HOST'] = $_SERVER["SERVER_NAME"];
695 $REFERERurl = null;
696 if(!isset($_POST['TopicName'])) { $_POST['TopicName'] = null; }
697 if(!isset($_POST['TopicDesc'])) { $_POST['TopicDesc'] = null; }
698 if(!isset($_POST['TopicPost'])) { $_POST['TopicPost'] = null; }
699 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
700 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
701 $Settings['captcha_guest']=="on") {
702 require($SettDir['inc']."captcha.php"); }
704 <div class="Table1Border">
705 <?php if($ThemeSet['TableStyle']=="div") { ?>
706 <div class="TableRow1">
707 <span style="text-align: left;">
708 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ForumName; ?></a></span></div>
709 <?php } ?>
710 <table class="Table1">
711 <?php if($ThemeSet['TableStyle']=="table") { ?>
712 <tr class="TableRow1">
713 <td class="TableColumn1"><span style="text-align: left;">
714 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ForumName; ?></a></span>
715 </td>
716 </tr><?php } ?>
717 <tr class="TableRow2">
718 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Make Topic Message: </th>
719 </tr>
720 <tr class="TableRow3">
721 <td class="TableColumn3">
722 <table style="width: 100%; height: 25%; text-align: center;">
723 <?php if (pre_strlen($_POST['TopicName'])>"50") { $Error="Yes"; ?>
724 <tr>
725 <td><span class="TableMessage">
726 <br />Your Topic Name is too big.<br />
727 </span>&nbsp;</td>
728 </tr>
729 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
730 $Settings['captcha_guest']=="on") {
731 if (PhpCaptcha::Validate($_POST['signcode'])) {
732 //echo 'Valid code entered';
733 } else { $Error="Yes"; ?>
734 <tr>
735 <td><span class="TableMessage">
736 <br />Invalid code entered<br />
737 </span>&nbsp;</td>
738 </tr>
739 <?php } } if (pre_strlen($_POST['TopicDesc'])>"80") { $Error="Yes"; ?>
740 <tr>
741 <td><span class="TableMessage">
742 <br />Your Topic Description is too big.<br />
743 </span>&nbsp;</td>
744 </tr>
745 <?php } if($_POST['fid']!=$_SESSION['UserFormID']) { $Error="Yes"; ?>
746 <tr>
747 <td><span class="TableMessage">
748 <br />Sorry the referering url dose not match our host name.<br />
749 </span>&nbsp;</td>
750 </tr>
751 <?php } if($_POST['ubid']!=$Settings['BoardUUID']) { $Error="Yes"; ?>
752 <tr>
753 <td><span class="TableMessage">
754 <br />Sorry the referering url dose not match our host name.<br />
755 </span>&nbsp;</td>
756 </tr>
757 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
758 pre_strlen($_POST['GuestName'])>"30") { $Error="Yes"; ?>
759 <tr>
760 <td><span class="TableMessage">
761 <br />You Guest Name is too big.<br />
762 </span>&nbsp;</td>
763 </tr>
764 <?php } if ($Settings['TestReferer']=="on") {
765 if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes"; ?>
766 <tr>
767 <td><span class="TableMessage">
768 <br />Sorry the referering url dose not match our host name.<br />
769 </span>&nbsp;</td>
770 </tr>
771 <?php } }
772 $_POST['TopicName'] = stripcslashes(htmlspecialchars($_POST['TopicName'], ENT_QUOTES, $Settings['charset']));
773 //$_POST['TopicName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicName']);
774 $_POST['TopicName'] = remove_spaces($_POST['TopicName']);
775 $_POST['TopicDesc'] = stripcslashes(htmlspecialchars($_POST['TopicDesc'], ENT_QUOTES, $Settings['charset']));
776 //$_POST['TopicDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicDesc']);
777 $_POST['TopicDesc'] = remove_spaces($_POST['TopicDesc']);
778 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
779 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
780 $_POST['GuestName'] = remove_spaces($_POST['GuestName']);
781 $_POST['TopicPost'] = stripcslashes(htmlspecialchars($_POST['TopicPost'], ENT_QUOTES, $Settings['charset']));
782 //$_POST['TopicPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicPost']);
783 $_POST['TopicPost'] = remove_bad_entities($_POST['TopicPost']);
784 //$_POST['TopicPost'] = remove_spaces($_POST['TopicPost']);
785 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
786 if(isset($_POST['GuestName'])&&$_POST['GuestName']!=null) {
787 if($cookieDomain==null) {
788 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir); }
789 if($cookieDomain!=null) {
790 if($cookieSecure===true) {
791 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
792 if($cookieSecure===false) {
793 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain); } }
794 $_SESSION['GuestName']=$_POST['GuestName']; } }
795 /* <_< iWordFilter >_>
796 by Kazuki Przyborowski - Cool Dude 2k */
797 $melanieqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."wordfilter\"", array(null));
798 $melaniert=sql_query($melanieqy,$SQLStat);
799 $melanienm=sql_num_rows($melaniert);
800 $melanies=0;
801 while ($melanies < $melanienm) {
802 $Filter=sql_result($melaniert,$melanies,"FilterWord");
803 $Replace=sql_result($melaniert,$melanies,"Replacement");
804 $CaseInsensitive=sql_result($melaniert,$melanies,"CaseInsensitive");
805 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
806 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
807 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
808 $WholeWord=sql_result($melaniert,$melanies,"WholeWord");
809 if($WholeWord=="on") { $WholeWord = "yes"; }
810 if($WholeWord=="off") { $WholeWord = "no"; }
811 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
812 $Filter = preg_quote($Filter, "/");
813 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
814 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicDesc']);
815 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicPost']); }
816 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
817 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicDesc']);
818 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicPost']); }
819 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
820 $_POST['TopicDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicDesc']);
821 $_POST['TopicPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicPost']); }
822 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
823 $_POST['TopicDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicDesc']);
824 $_POST['TopicPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicPost']); }
825 ++$melanies; } sql_free_result($melaniert);
826 $lonewolfqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."restrictedwords\" WHERE \"RestrictedTopicName\"='yes' or \"RestrictedUserName\"='yes'", array(null));
827 $lonewolfrt=sql_query($lonewolfqy,$SQLStat);
828 $lonewolfnm=sql_num_rows($lonewolfrt);
829 $lonewolfs=0; $RMatches = null; $RGMatches = null;
830 while ($lonewolfs < $lonewolfnm) {
831 $RWord=sql_result($lonewolfrt,$lonewolfs,"Word");
832 $RCaseInsensitive=sql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
833 if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
834 if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
835 if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
836 $RWholeWord=sql_result($lonewolfrt,$lonewolfs,"WholeWord");
837 if($RWholeWord=="on") { $RWholeWord = "yes"; }
838 if($RWholeWord=="off") { $RWholeWord = "no"; }
839 if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
840 $RestrictedTopicName=sql_result($lonewolfrt,$lonewolfs,"RestrictedTopicName");
841 if($RestrictedTopicName=="on") { $RestrictedTopicName = "yes"; }
842 if($RestrictedTopicName=="off") { $RestrictedTopicName = "no"; }
843 if($RestrictedTopicName!="yes"||$RestrictedTopicName!="no") { $RestrictedTopicName = "no"; }
844 $RestrictedUserName=sql_result($lonewolfrt,$lonewolfs,"RestrictedUserName");
845 if($RestrictedUserName=="on") { $RestrictedUserName = "yes"; }
846 if($RestrictedUserName=="off") { $RestrictedUserName = "no"; }
847 if($RestrictedUserName!="yes"||$RestrictedUserName!="no") { $RestrictedUserName = "no"; }
848 $RWord = preg_quote($RWord, "/");
849 if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
850 if($RestrictedTopicName=="yes") {
851 $RMatches = preg_match("/\b(".$RWord.")\b/", $_POST['TopicName']);
852 if($RMatches==true) { break 1; } }
853 if($RestrictedUserName=="yes") {
854 $RGMatches = preg_match("/\b(".$RWord.")\b/", $_POST['GuestName']);
855 if($RGMatches==true) { break 1; } } }
856 if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
857 if($RestrictedTopicName=="yes") {
858 $RMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['TopicName']);
859 if($RMatches==true) { break 1; } }
860 if($RestrictedUserName=="yes") {
861 $RGMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['GuestName']);
862 if($RGMatches==true) { break 1; } } }
863 if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
864 if($RestrictedTopicName=="yes") {
865 $RMatches = preg_match("/".$RWord."/", $_POST['TopicName']);
866 if($RMatches==true) { break 1; } }
867 if($RestrictedUserName=="yes") {
868 $RGMatches = preg_match("/".$RWord."/", $_POST['GuestName']);
869 if($RGMatches==true) { break 1; } } }
870 if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
871 if($RestrictedTopicName=="yes") {
872 $RMatches = preg_match("/".$RWord."/i", $_POST['TopicName']);
873 if($RMatches==true) { break 1; } }
874 if($RestrictedUserName=="yes") {
875 $RGMatches = preg_match("/".$RWord."/i", $_POST['GuestName']);
876 if($RGMatches==true) { break 1; } } }
877 ++$lonewolfs; } sql_free_result($lonewolfrt);
878 if ($_POST['TopicName']==null) { $Error="Yes"; ?>
879 <tr>
880 <td><span class="TableMessage">
881 <br />You need to enter a Topic Name.<br />
882 </span>&nbsp;</td>
883 </tr>
884 <?php } if ($_POST['TopicDesc']==null) { $Error="Yes"; ?>
885 <tr>
886 <td><span class="TableMessage">
887 <br />You need to enter a Topic Description.<br />
888 </span>&nbsp;</td>
889 </tr>
890 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
891 $_POST['GuestName']==null) { $Error="Yes"; ?>
892 <tr>
893 <td><span class="TableMessage">
894 <br />You need to enter a Guest Name.<br />
895 </span>&nbsp;</td>
896 </tr>
897 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
898 $RGMatches==true) { $Error="Yes"; ?>
899 <tr>
900 <td><span class="TableMessage">
901 <br />This Guest Name is restricted to use.<br />
902 </span>&nbsp;</td>
903 </tr>
904 <?php } if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { $Error="Yes"; ?>
905 <tr>
906 <td><span class="TableMessage">
907 <br />You do not have permission to make a topic here.<br />
908 </span>&nbsp;</td>
909 </tr>
910 <?php } if ($_POST['TopicPost']==null) { $Error="Yes"; ?>
911 <tr>
912 <td><span class="TableMessage">
913 <br />You need to enter a Topic Post.<br />
914 </span>&nbsp;</td>
915 </tr>
916 <?php } if($RMatches==true) { $Error="Yes"; ?>
917 <tr>
918 <td><span class="TableMessage">
919 <br />This Topic Name is restricted to use.<br />
920 </span>&nbsp;</td>
921 </tr>
922 <?php } if ($Error=="Yes") {
923 redirect("refresh",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"4"); ?>
924 <tr>
925 <td><span class="TableMessage">
926 <br />Click <a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">here</a> to goto index page.<br />&nbsp;
927 </span><br /></td>
928 </tr>
929 <?php } if ($Error!="Yes") { $LastActive = $utccurtime->getTimestamp();
930 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
931 $reresult=sql_query($requery,$SQLStat);
932 $renum=sql_num_rows($reresult);
933 $rei=0;
934 while ($rei < $renum) {
935 $User1ID=$MyUserID;
936 $User1Name=sql_result($reresult,$rei,"Name");
937 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
938 $User1Email=sql_result($reresult,$rei,"Email");
939 $User1Title=sql_result($reresult,$rei,"Title");
940 $User1GroupID=sql_result($reresult,$rei,"GroupID");
941 $PostCount=sql_result($reresult,$rei,"PostCount");
942 if($PostCountAdd=="on") { $NewPostCount = $PostCount + 1; }
943 if(!isset($NewPostCount)) { $NewPostCount = $PostCount; }
944 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($User1GroupID));
945 $gresult=sql_query($gquery,$SQLStat);
946 $User1Group=sql_result($gresult,0,"Name");
947 sql_free_result($gresult);
948 $User1IP=$_SERVER['REMOTE_ADDR'];
949 ++$rei; } sql_free_result($reresult);
950 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."topics\" (\"PollID\", \"ForumID\", \"CategoryID\", \"OldForumID\", \"OldCategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"TopicName\", \"Description\", \"NumReply\", \"NumViews\", \"Pinned\", \"Closed\") VALUES\n".
951 "(0, %i, %i, %i, %i, %i, '%s', %i, %i, '%s', '%s', 0, 0, 0, 0)", array($ForumID,$ForumCatID,$ForumID,$ForumCatID,$User1ID,$User1Name,$LastActive,$LastActive,$_POST['TopicName'],$_POST['TopicDesc']));
952 sql_query($query,$SQLStat);
953 $topicid = sql_get_next_id($Settings['sqltable'],"topics",$SQLStat);
954 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."posts\" (\"TopicID\", \"ForumID\", \"CategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"EditUser\", \"EditUserName\", \"Post\", \"Description\", \"IP\", \"EditIP\") VALUES\n".
955 "(".$topicid.", %i, %i, %i, '%s', %i, %i, 0, '', '%s', '%s', '%s', '0')", array($ForumID,$ForumCatID,$User1ID,$User1Name,$LastActive,$LastActive,$_POST['TopicPost'],$_POST['TopicDesc'],$User1IP));
956 sql_query($query,$SQLStat);
957 $postid = sql_get_next_id($Settings['sqltable'],"posts",$SQLStat);
958 $_SESSION['LastPostTime'] = $utccurtime->getTimestamp() + $GroupInfo['FloodControl'];
959 if($User1ID!=0&&$User1ID!=-1) {
960 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"LastActive\"=%i,\"IP\"='%s',\"PostCount\"=%i,\"LastPostTime\"=%i WHERE \"id\"=%i", array($LastActive,$User1IP,$NewPostCount,$_SESSION['LastPostTime'],$User1ID));
961 sql_query($queryupd,$SQLStat); }
962 $NewNumPosts = $NumberPosts + 1; $NewNumTopics = $NumberTopics + 1;
963 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($NewNumPosts,$NewNumTopics,$ForumID));
964 sql_query($queryupd,$SQLStat);
965 redirect("refresh",$rbasedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$topicid."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],FALSE),"3");
966 ?><tr>
967 <td><span class="TableMessage"><br />
968 Topic <?php echo $_POST['TopicName']; ?> was started.<br />
969 Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$topicid."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">here</a> to continue to topic.<br />&nbsp;
970 </span><br /></td>
971 </tr>
972 <?php } ?>
973 </table>
974 </td></tr>
975 <tr class="TableRow4">
976 <td class="TableColumn4">&nbsp;</td>
977 </tr>
978 </table></div>
979 <div class="DivMkTopics">&nbsp;</div>
980 <?php } ?>
981 <table style="width: 100%;" class="Table2">
982 <tr>
983 <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
984 <td style="width: 70%; text-align: right;">
985 <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
986 <a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=create&id=".$ForumID,$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ThemeSet['NewTopic']; ?></a>
987 <?php } ?></td>
988 </tr>
989 </table>
990 <?php
991 //List Page Number Code end
992 if($pstring!=null||$_GET['act']!="view"||
993 $PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") {
995 <?php /*<div class="DivPageLinks">&nbsp;</div>*/ ?>
996 <div class="DivTable2">&nbsp;</div>
997 <?php }
998 $uviewlcuttime = $utccurtime->getTimestamp();
999 $uviewltime = $uviewlcuttime - ini_get("session.gc_maxlifetime");
1000 if($InSubForum==0) {
1001 $uviewlquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."sessions\" WHERE \"expires\" >= %i AND \"session_id\"<>'%s' AND (\"serialized_data\" LIKE '%s' OR \"serialized_data\" LIKE '%s') ORDER BY \"expires\" DESC", array($uviewltime, session_id(), "%currentforumid:0,".$ForumID.";%", "%currentforumid:".$ForumID.",%")); }
1002 if($InSubForum!=0) {
1003 $uviewlquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."sessions\" WHERE \"expires\" >= %i AND \"session_id\"<>'%s' AND (\"serialized_data\" LIKE '%s' OR \"serialized_data\" LIKE '%s') ORDER BY \"expires\" DESC", array($uviewltime, session_id(), "%currentforumid:".$InSubForum.",".$ForumID.";%", "%currentforumid:0,".$ForumID.";")); }
1004 $uviewlresult=sql_query($uviewlquery,$SQLStat);
1005 $uviewlnum=sql_num_rows($uviewlresult);
1006 $uviewli=0; $uviewlmn = 0; $uviewlgn = 0; $uviewlan = 0; $uviewlmbn = 0;
1007 $MembersViewList = null; $GuestsOnline = null;
1008 while ($uviewli < $uviewlnum) {
1009 $session_data=sql_result($uviewlresult,$uviewli,"session_data");
1010 $serialized_data=sql_result($uviewlresult,$uviewli,"serialized_data");
1011 $session_user_agent=sql_result($uviewlresult,$uviewli,"user_agent");
1012 $session_ip_address=sql_result($uviewlresult,$uviewli,"ip_address");
1013 //$UserSessInfo = unserialize_session($session_data);
1014 $UserSessInfo = unserialize($serialized_data);
1015 if(!isset($UserSessInfo['UserGroup'])) { $UserSessInfo['UserGroup'] = $Settings['GuestGroup']; }
1016 $AmIHiddenUser = "no";
1017 $user_agent_check = false;
1018 if(user_agent_check($session_user_agent)) {
1019 $user_agent_check = user_agent_check($session_user_agent); }
1020 if($UserSessInfo['UserGroup']!=$Settings['GuestGroup']||$user_agent_check!==false) {
1021 $PreAmIHiddenUser = GetUserName($UserSessInfo['UserID'],$Settings['sqltable'],$SQLStat);
1022 $AmIHiddenUser = $PreAmIHiddenUser['Hidden'];
1023 if(($AmIHiddenUser=="no"&&$UserSessInfo['UserID']>0)||$user_agent_check!==false) {
1024 if($uviewlmbn>0) { $MembersViewList .= ", "; }
1025 if($user_agent_check===false) {
1026 $uatitleadd = null;
1027 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($session_user_agent, ENT_QUOTES, $Settings['charset'])."\""; }
1028 $MembersViewList .= "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UserSessInfo['UserID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$UserSessInfo['MemberName']."</a>";
1029 if($GroupInfo['CanViewIPAddress']=="yes") {
1030 $MembersViewList .= " (<a title=\"".$session_ip_address."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$session_ip_address)."\">".$session_ip_address."</a>)"; }
1031 ++$uviewlmn; ++$uviewlmbn; }
1032 if($user_agent_check!==false) {
1033 $uatitleadd = null;
1034 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($session_user_agent, ENT_QUOTES, $Settings['charset'])."\""; }
1035 $MembersViewList .= "<span".$uatitleadd.">".$user_agent_check."</span>";
1036 if($GroupInfo['CanViewIPAddress']=="yes") {
1037 $MembersViewList .= " (<a title=\"".$session_ip_address."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$session_ip_address)."\">".$session_ip_address."</a>)"; }
1038 ++$uviewlmbn; } }
1039 if($UserSessInfo['UserID']<=0||$AmIHiddenUser=="yes") {
1040 if($user_agent_check===false) {
1041 ++$uviewlan; } } }
1042 if($UserSessInfo['UserGroup']==$Settings['GuestGroup']) {
1043 /*$uatitleadd = null;
1044 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($session_user_agent, ENT_QUOTES, $Settings['charset'])."\""; }
1045 $GuestsViewList .= "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$MemList['ID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$MemList['Name']."</a>";
1046 if($GroupInfo['CanViewIPAddress']=="yes") {
1047 $GuestsViewList .= " (<a title=\"".$session_ip_address."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$session_ip_address)."\">".$session_ip_address."</a>)"; } */
1048 ++$uviewlgn; }
1049 ++$uviewli; }
1050 if(!isset($_SESSION['UserGroup'])) { $_SESSION['UserGroup'] = $Settings['GuestGroup']; }
1051 $AmIHiddenUser = "no";
1052 $user_agent_check = false;
1053 if(user_agent_check($_SERVER['HTTP_USER_AGENT'])) {
1054 $user_agent_check = user_agent_check($_SERVER['HTTP_USER_AGENT']); }
1055 if($_SESSION['UserGroup']!=$Settings['GuestGroup']||$user_agent_check!==false) {
1056 $PreAmIHiddenUser = GetUserName($_SESSION['UserID'],$Settings['sqltable'],$SQLStat);
1057 $AmIHiddenUser = $PreAmIHiddenUser['Hidden'];
1058 if(($AmIHiddenUser=="no"&&$_SESSION['UserID']>0)||$user_agent_check!==false) {
1059 if($uviewlmbn>0) { $MembersViewList = ", ".$MembersViewList; }
1060 if($user_agent_check===false) {
1061 $uatitleadd = null;
1062 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $Settings['charset'])."\""; }
1063 if($GroupInfo['CanViewIPAddress']=="yes") {
1064 $MembersViewList = " (<a title=\"".$_SERVER['REMOTE_ADDR']."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$_SERVER['REMOTE_ADDR'])."\">".$_SERVER['REMOTE_ADDR']."</a>)".$MembersViewList; }
1065 $MembersViewList = "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$_SESSION['UserID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$_SESSION['MemberName']."</a>".$MembersViewList;
1066 ++$uviewlmn; ++$uviewlmbn; }
1067 if($user_agent_check!==false) {
1068 $uatitleadd = null;
1069 if($GroupInfo['CanViewIPAddress']=="yes") {
1070 $MembersViewList = " (<a title=\"".$_SERVER['REMOTE_ADDR']."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$_SERVER['REMOTE_ADDR'])."\">".$_SERVER['REMOTE_ADDR']."</a>)".$MembersViewList; }
1071 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $Settings['charset'])."\""; }
1072 $MembersViewList = "<span".$uatitleadd.">".$user_agent_check."</span>".$MembersViewList;
1073 ++$uviewlmbn; } }
1074 if($_SESSION['UserID']<=0||$AmIHiddenUser=="yes") {
1075 if($user_agent_check===false) {
1076 ++$uviewlan; } } }
1077 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
1078 /*$uatitleadd = null;
1079 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $Settings['charset'])."\""; }
1080 if($GroupInfo['CanViewIPAddress']=="yes") {
1081 $GuestsViewList = " (<a title=\"".$_SERVER['REMOTE_ADDR']."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$_SERVER['REMOTE_ADDR'])."\">".$_SERVER['REMOTE_ADDR']."</a>)".$GuestsViewList; }
1082 $GuestsViewList = "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$MemList['ID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$MemList['Name']."</a>".$GuestsViewList; */
1083 ++$uviewlgn; }
1084 ++$uviewlnum;
1086 <div class="StatsBorder">
1087 <?php if($ThemeSet['TableStyle']=="div") { ?>
1088 <div class="TableStatsRow1">
1089 <span style="text-align: left;">
1090 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>">Forum Statistics</a></span></div>
1091 <?php } ?>
1092 <table id="BoardStats" class="TableStats1">
1093 <?php if($ThemeSet['TableStyle']=="table") { ?>
1094 <tr class="TableStatsRow1">
1095 <td class="TableStatsColumn1" colspan="2"><span style="text-align: left;">
1096 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$ForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>">Forum Statistics</a></span>
1097 </td>
1098 </tr><?php } ?>
1099 <tr id="Stats1" class="TableStatsRow2">
1100 <td class="TableStatsColumn2" colspan="2" style="width: 100%; font-weight: bold;"><?php echo $uviewlnum; ?> users viewing forum</td>
1101 </tr>
1102 <tr class="TableStatsRow3" id="Stats2">
1103 <td style="width: 4%;" class="TableStatsColumn3"><div class="statsicon">
1104 <?php echo $ThemeSet['BoardStatsIcon']; ?></div></td>
1105 <td style="width: 96%;" class="TableStatsColumn3"><div class="statsinfo">
1106 &nbsp;<span style="font-weight: bold;"><?php echo $uviewlgn; ?></span> guests, <span style="font-weight: bold;"><?php echo $uviewlmn; ?></span> members, <span style="font-weight: bold;"><?php echo $uviewlan; ?></span> anonymous members <br />
1107 <?php if($MembersViewList!=null) { ?>&nbsp;<?php echo $MembersViewList."\n<br />"; } ?>
1108 </div></td>
1109 </tr>
1110 <tr id="Stats7" class="TableStatsRow4">
1111 <td class="TableStatsColumn4" colspan="2">&nbsp;</td>
1112 </tr>
1113 </table></div>
1114 <div class="DivStats">&nbsp;</div>
1115 <?php } } ?>