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