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-2010 iDB Support - http://idb.berlios.de/
12 Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
14 $FileInfo: topics.php - Last Update: 06/07/2010 SVN 520 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="topics.php"||$File3Name=="/topics.php") {
20 $pstring = null; $pagenum = null;
21 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
22 if(!is_numeric($_GET['page'])) { $_GET['page'] = 1; }
23 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($_GET['id']));
24 $preresult=sql_query($prequery,$SQLStat);
25 $prenum=sql_num_rows($preresult);
26 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);
27 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
28 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
30 $ForumID=sql_result($preresult,0,"id");
31 $ForumCatID=sql_result($preresult,0,"CategoryID");
32 $ForumName=sql_result($preresult,0,"Name");
33 $ForumType=sql_result($preresult,0,"ForumType");
34 $InSubForum=sql_result($preresult,0,"InSubForum");
35 $RedirectURL=sql_result($preresult,0,"RedirectURL");
36 $RedirectTimes=sql_result($preresult,0,"Redirects");
37 $NumberViews=sql_result($preresult,0,"NumViews");
38 $NumberPosts=sql_result($preresult,0,"NumPosts");
39 $NumberTopics=sql_result($preresult,0,"NumTopics");
40 $PostCountAdd=sql_result($preresult,0,"PostCountAdd");
41 $CanHaveTopics=sql_result($preresult,0,"CanHaveTopics");
42 $HotTopicPosts=sql_result($preresult,0,"HotTopicPosts");
43 if($HotTopicPosts!=0&&is_numeric($HotTopicPosts)) {
44 $Settings['hot_topic_num'] = $HotTopicPosts; }
45 if(!is_numeric($Settings['hot_topic_num'])) {
46 $Settings['hot_topic_num'] = 15; }
47 $ForumPostCountView=sql_result($preresult,0,"PostCountView");
48 $ForumKarmaCountView=sql_result($preresult,0,"KarmaCountView");
49 sql_free_result($preresult);
50 $ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
51 if($CanHaveTopics=="yes"&&$ForumType=="subforum") {
52 if($_GET['act']=="create"||$_GET['act']=="maketopic"||
53 $_POST['act']=="maketopics") { $ForumCheck = "skip"; } }
54 $catcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i LIMIT 1", array($ForumCatID));
55 $catresult=sql_query($catcheck,$SQLStat);
56 $CategoryName=sql_result($catresult,0,"Name");
57 $CategoryType=sql_result($catresult,0,"CategoryType");
58 $CategoryPostCountView=sql_result($catresult,0,"PostCountView");
59 $CategoryKarmaCountView=sql_result($catresult,0,"KarmaCountView");
60 sql_free_result($catresult);
61 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
62 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
63 if($MyKarmaCount==null) { $MyKarmaCount = 0; }
64 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
65 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
66 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
67 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
68 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
69 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
70 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
71 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
72 if($InSubForum!="0") {
73 $isfquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i LIMIT 1", array($InSubForum));
74 $isfresult=sql_query($isfquery,$SQLStat);
75 $isfnum=sql_num_rows($isfresult);
77 $isfForumID=sql_result($isfresult,0,"id");
78 $isfForumCatID=sql_result($isfresult,0,"CategoryID");
79 $isfForumName=sql_result($isfresult,0,"Name");
80 $isfForumType=sql_result($isfresult,0,"ForumType");
81 $isfForumType = strtolower($isfForumType);
82 $isfRedirectURL=sql_result($isfresult,0,"RedirectURL"); }
83 if($isfnum<1) { $InSubForum = "0"; }
84 sql_free_result($isfresult); }
85 if($ForumCheck!="skip") {
86 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=view&id=".$ForumID."&page=".$_GET['page'],"&","=",$prexqstr[$ForumType],$exqstr[$ForumType]);
87 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
88 $_SESSION['ViewingFile'] = $exfile[$ForumType].$Settings['file_ext']; }
89 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
90 $_SESSION['ViewingFile'] = $exfile[$ForumType]; }
91 $_SESSION['PreViewingTitle'] = "Viewing Forum:";
92 $_SESSION['ViewingTitle'] = $ForumName;
94 <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']); ?>">Board index</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>
95 <div class="DivNavLinks"> </div>
97 if(!isset($CatPermissionInfo['CanViewCategory'][$ForumCatID])) {
98 $CatPermissionInfo['CanViewCategory'][$ForumCatID] = "no"; }
99 if($CatPermissionInfo['CanViewCategory'][$ForumCatID]=="no"||
100 $CatPermissionInfo['CanViewCategory'][$ForumCatID]!="yes") {
101 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
102 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
103 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
104 if(!isset($PermissionInfo['CanViewForum'][$ForumID])) {
105 $PermissionInfo['CanViewForum'][$ForumID] = "no"; }
106 if($PermissionInfo['CanViewForum'][$ForumID]=="no"||
107 $PermissionInfo['CanViewForum'][$ForumID]!="yes") {
108 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
109 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
110 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
111 if($CatPermissionInfo['CanViewCategory'][$ForumCatID]=="yes"&&
112 $PermissionInfo['CanViewForum'][$ForumID]=="yes") {
113 if($ForumType!="redirect") {
114 if($NumberViews==0||$NumberViews==null) { $NewNumberViews = 1; }
115 if($NumberViews!=0&&$NumberViews!=null) { $NewNumberViews = $NumberViews + 1; }
116 $viewup = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumViews\"=%i WHERE \"id\"=%i", array($NewNumberViews,$_GET['id']));
117 sql_query($viewup,$SQLStat); }
118 if($ForumType=="redirect") {
119 if($RedirectTimes==0||$RedirectTimes==null) { $NewRedirTime = 1; }
120 if($RedirectTimes!=0&&$RedirectTimes!=null) { $NewRedirTime = $RedirectTimes + 1; }
121 $redirup = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"Redirects\"=%i WHERE \"id\"=%i", array($NewRedirTime,$_GET['id']));
122 sql_query($redirup,$SQLStat);
123 if($RedirectURL!="http://"&&$RedirectURL!="") {
124 redirect("location",$RedirectURL,0,null,false); ob_clean();
125 header("Content-Type: text/plain; charset=".$Settings['charset']);
126 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
127 if($RedirectURL=="http://"||$RedirectURL=="") {
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']);
130 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
131 if($ForumCheck!="skip") {
132 if($ForumType=="subforum") {
133 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));
134 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
135 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); } }
136 if($_GET['act']!="view") { ?>
137 <table style="width: 100%;" class="Table2">
139 <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
140 <td style="width: 70%; text-align: right;">
141 <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
142 <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>
146 <div class="DivTable2"> </div>
147 <?php } if($_GET['act']=="view") {
148 if($NumberTopics==null) {
151 //Start Topic Page Code
152 if(!isset($Settings['max_topics'])) { $Settings['max_topics'] = 10; }
153 if($_GET['page']==null) { $_GET['page'] = 1; }
154 if($_GET['page']<=0) { $_GET['page'] = 1; }
155 $nums = $_GET['page'] * $Settings['max_topics'];
156 if($nums>$num) { $nums = $num; }
157 $numz = $nums - $Settings['max_topics'];
158 if($numz<=0) { $numz = 0; }
160 if($nums<$num) { $nextpage = $_GET['page'] + 1; }
161 if($nums>=$num) { $nextpage = $_GET['page']; }
162 if($numz>=$Settings['max_topics']) { $backpage = $_GET['page'] - 1; }
163 if($_GET['page']<=1) { $backpage = 1; }
164 $pnum = $num; $l = 1; $Pages = null;
166 if($pnum>=$Settings['max_topics']) {
167 $pnum = $pnum - $Settings['max_topics'];
168 $Pages[$l] = $l; ++$l; }
169 if($pnum<$Settings['max_topics']&&$pnum>0) {
170 $pnum = $pnum - $pnum;
171 $Pages[$l] = $l; ++$l; } }
172 $snumber = $_GET['page'] - 1;
173 $PageLimit = $Settings['max_topics'] * $snumber;
174 if($PageLimit<0) { $PageLimit = 0; }
175 //End Topic Page Code
177 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE (\"ForumID\"=%i) OR (\"OldForumID\"=%i) ORDER BY \"Pinned\" DESC, \"LastUpdate\" DESC ".$SQLimit, array($_GET['id'],$_GET['id'],$PageLimit,$Settings['max_topics']));
178 $result=sql_query($query,$SQLStat);
179 $num=sql_num_rows($result);
180 //List Page Number Code Start
181 $pagenum=count($Pages);
182 if($_GET['page']>$pagenum) {
183 $_GET['page'] = $pagenum; }
184 $pagei=0; $pstring = null;
186 $pstring = "<div class=\"PageList\"><span class=\"pagelink\">".$pagenum." Pages:</span> "; }
187 if($_GET['page']<4) { $Pagez[0] = null; }
188 if($_GET['page']>=4) { $Pagez[0] = "First"; }
189 if($_GET['page']>=3) {
190 $Pagez[1] = $_GET['page'] - 2; }
191 if($_GET['page']<3) {
193 if($_GET['page']>=2) {
194 $Pagez[2] = $_GET['page'] - 1; }
195 if($_GET['page']<2) {
197 $Pagez[3] = $_GET['page'];
198 if($_GET['page']<$pagenum) {
199 $Pagez[4] = $_GET['page'] + 1; }
200 if($_GET['page']>=$pagenum) {
202 $pagenext = $_GET['page'] + 1;
203 if($pagenext<$pagenum) {
204 $Pagez[5] = $_GET['page'] + 2; }
205 if($pagenext>=$pagenum) {
207 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
208 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
209 $pagenumi=count($Pagez);
210 if($NumberTopics==0) {
214 while ($pagei < $pagenumi) {
215 if($_GET['page']!=1&&$pagei==1) {
216 $Pback = $_GET['page'] - 1;
217 $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])."\"><</a></span> "; }
218 if($Pagez[$pagei]!=null&&
219 $Pagez[$pagei]!="First"&&
220 $Pagez[$pagei]!="Last") {
222 $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> "; }
224 $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> "; } }
225 if($Pagez[$pagei]=="First") {
226 $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])."\">«</a></span> "; }
227 if($Pagez[$pagei]=="Last") {
228 $ptestnext = $pagenext + 1;
230 $Pnext = $_GET['page'] + 1;
231 $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])."\">></a></span> ";
232 if($ptestnext<$pagenum) {
233 $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])."\">»</a></span> "; } }
234 ++$pagei; } $pstring = $pstring."</div>"; }
235 //List Page Number Code end
236 if($pstring!=null||$PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") {
238 <table style="width: 100%;" class="Table2">
240 <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
241 <td style="width: 70%; text-align: right;">
242 <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
243 <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>
248 //List Page Number Code end
250 <?php /*<div class="DivPageLinks"> </div>*/?>
251 <div class="DivTable2"> </div>
253 <div class="Table1Border">
254 <?php if($ThemeSet['TableStyle']=="div") { ?>
255 <div class="TableRow1">
256 <span style="text-align: left;">
257 <?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>
259 <table class="Table1" id="Forum<?php echo $ForumID; ?>">
260 <?php if($ThemeSet['TableStyle']=="table") { ?>
261 <tr id="ForumStart<?php echo $ForumID; ?>" class="TableRow1">
262 <td class="TableColumn1" colspan="6"><span style="text-align: left;">
263 <?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>
266 <tr id="TopicStatRow<?php echo $ForumID; ?>" class="TableRow2">
267 <th class="TableColumn2" style="width: 4%;">State</th>
268 <th class="TableColumn2" style="width: 36%;">Topic Name</th>
269 <th class="TableColumn2" style="width: 15%;">Author</th>
270 <th class="TableColumn2" style="width: 15%;">Time</th>
271 <th class="TableColumn2" style="width: 5%;">Replys</th>
272 <th class="TableColumn2" style="width: 25%;">Last Reply</th>
276 $TopicID=sql_result($result,$i,"id");
277 $UsersID=sql_result($result,$i,"UserID");
278 $GuestsName=sql_result($result,$i,"GuestName");
279 $TheTime=sql_result($result,$i,"TimeStamp");
280 $TheTime=GMTimeChange("F j Y, g:i a",$TheTime,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
281 $NumReply=sql_result($result,$i,"NumReply");
282 $NumberPosts=$NumReply + 1;
284 if(!isset($Settings['max_posts'])) {
285 $Settings['max_posts'] = 10; }
286 if(!isset($ThemeSet['MiniPageAltStyle'])) {
287 $ThemeSet['MiniPageAltStyle'] = "off"; }
288 if($ThemeSet['MiniPageAltStyle']!="on"&&
289 $ThemeSet['MiniPageAltStyle']!="off") {
290 $ThemeSet['MiniPageAltStyle'] = "off"; }
291 if($NumberPosts>$Settings['max_posts']) {
292 $NumberPages = ceil($NumberPosts/$Settings['max_posts']); }
293 if($NumberPosts<=$Settings['max_posts']) {
296 $prepagelist = " "; }
297 if($NumberPages>=2) {
298 if($ThemeSet['MiniPageAltStyle']=="off") {
299 $prepagelist = "<span class=\"small\">(Pages: "; }
300 if($ThemeSet['MiniPageAltStyle']=="on") {
301 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
302 $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>";
303 if($ThemeSet['MiniPageAltStyle']=="on") {
304 $prepagelist = $prepagelist."</span>"; }
305 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
306 if($ThemeSet['MiniPageAltStyle']=="on") {
307 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
308 $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>";
309 if($ThemeSet['MiniPageAltStyle']=="on") {
310 $prepagelist = $prepagelist."</span>"; }
311 if($NumberPages>=3) {
312 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
313 if($ThemeSet['MiniPageAltStyle']=="on") {
314 $prepagelist = $prepagelist."<span class=\"minipagelink\">"; }
315 $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>";
316 if($ThemeSet['MiniPageAltStyle']=="on") {
317 $prepagelist = $prepagelist."</span>"; } }
318 if($NumberPages==4) {
319 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
320 if($ThemeSet['MiniPageAltStyle']=="on") {
321 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
322 if($ThemeSet['MiniPageAltStyle']=="on") {
323 $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>"; }
324 if($ThemeSet['MiniPageAltStyle']=="off") {
325 $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>"; }
326 if($ThemeSet['MiniPageAltStyle']=="on") {
327 $prepagelist = $prepagelist."</span>"; } }
329 if($ThemeSet['MiniPageAltStyle']=="off") { $prepagelist = $prepagelist." "; }
330 if($ThemeSet['MiniPageAltStyle']=="on") {
331 $prepagelist = $prepagelist."<span class=\"minipagelinklast\">"; }
332 if($ThemeSet['MiniPageAltStyle']=="on") {
333 $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>"; }
334 if($ThemeSet['MiniPageAltStyle']=="off") {
335 $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>"; }
336 if($ThemeSet['MiniPageAltStyle']=="on") {
337 $prepagelist = $prepagelist."</span>"; } }
338 if($ThemeSet['MiniPageAltStyle']=="off") {
339 $prepagelist = $prepagelist.")</span>"; } }
340 $TopicName=sql_result($result,$i,"TopicName");
341 $TopicDescription=sql_result($result,$i,"Description");
342 $PinnedTopic=sql_result($result,$i,"Pinned");
343 $TopicStat=sql_result($result,$i,"Closed");
344 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($UsersID));
345 $reresult=sql_query($requery,$SQLStat);
346 $renum=sql_num_rows($reresult);
347 if($renum<1) { $UsersID = -1;
348 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($UsersID));
349 $reresult=sql_query($requery,$SQLStat);
350 $renum=sql_num_rows($reresult); }
351 $UserHidden=sql_result($reresult,0,"HiddenMember");
352 $UserGroupID=sql_result($reresult,0,"GroupID");
353 sql_free_result($reresult);
354 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($UserGroupID));
355 $gresult=sql_query($gquery,$SQLStat);
356 $User1Group=sql_result($gresult,0,"Name");
357 $GroupNamePrefix=sql_result($gresult,0,"NamePrefix");
358 $GroupNameSuffix=sql_result($gresult,0,"NameSuffix");
359 sql_free_result($gresult);
360 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat);
361 if($PreUsersName['Name']===null) { $UsersID = -1;
362 $PreUsersName = GetUserName($UsersID,$Settings['sqltable'],$SQLStat); }
363 $UsersName = $PreUsersName['Name'];
364 $UsersHidden = $PreUsersName['Hidden'];
365 if($UsersName=="Guest") { $UsersName=$GuestsName;
366 if($UsersName==null) { $UsersName="Guest"; } }
367 if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
368 $UsersName = $GroupNamePrefix.$UsersName; }
369 if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
370 $UsersName = $UsersName.$GroupNameSuffix; }
371 $LastReply = " <br /> ";
372 $glrquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" DESC LIMIT 1", array($TopicID));
373 $glrresult=sql_query($glrquery,$SQLStat);
374 $glrnum=sql_num_rows($glrresult);
376 $ReplyID1=sql_result($glrresult,0,"id");
377 $UsersID1=sql_result($glrresult,0,"UserID");
378 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat);
379 if($PreUsersName1['Name']===null) { $UsersID1 = -1;
380 $PreUsersName1 = GetUserName($UsersID1,$Settings['sqltable'],$SQLStat); }
381 $UsersName1 = $PreUsersName1['Name'];
382 $UsersHidden1 = $PreUsersName1['Hidden'];
383 $GuestsName1=sql_result($glrresult,0,"GuestName");
384 $TimeStamp1=sql_result($glrresult,0,"TimeStamp");
385 $TimeStamp1=GMTimeChange("F j Y, g:i a",$TimeStamp1,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']); }
386 $NumPages = null; $NumRPosts = $NumReply + 1;
387 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
388 if($NumRPosts>$Settings['max_posts']) {
389 $NumPages = ceil($NumRPosts/$Settings['max_posts']); }
390 if($NumRPosts<=$Settings['max_posts']) { $NumPages = 1; }
391 $Users_Name1 = pre_substr($UsersName1,0,20);
392 if($UsersName1=="Guest") { $UsersName1=$GuestsName1;
393 if($UsersName1==null) { $UsersName1="Guest"; } }
394 $oldusername=$UsersName1;
395 if (pre_strlen($UsersName1)>20) {
396 $Users_Name1 = $Users_Name1."..."; $UsersName1=$Users_Name1; } $lul = null;
397 if($TimeStamp1!=null) { $lul = null;
398 if($UsersID1>0&&$UsersHidden1=="no") {
399 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
400 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."#reply".$NumRPosts;
401 $LastReply = "<a href=\"".$luln."\">".$TimeStamp1."</a><br />\nUser: <a href=\"".$lul."\" title=\"".$oldusername."\">".$UsersName1."</a>"; }
402 if($UsersID1<=0||$UsersHidden1=="yes") {
403 if($UsersID1==-1) { $UserPre = "Guest:"; }
404 if(($UsersID1<-1&&$UsersHidden1=="yes")||$UsersID1==0||($UsersID1>0&&$UsersHidden1=="yes")) {
405 $UserPre = "Hidden:"; }
406 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
407 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."#reply".$NumRPosts;
408 $LastReply = "<a href=\"".$luln."\">".$TimeStamp1."</a><br />\n".$UserPre." <span title=\"".$oldusername."\">".$UsersName1."</span>"; } }
409 sql_free_result($glrresult);
410 if(!isset($TimeStamp1)) { $TimeStamp1 = null; } if(!isset($LastReply)) { $LastReply = " <br /> "; }
411 if($TimeStamp1==null) { $LastReply = " <br /> "; }
412 $PreTopic = $ThemeSet['TopicIcon'];
413 if ($PinnedTopic>1) { $PinnedTopic = 1; }
414 if ($PinnedTopic<0) { $PinnedTopic = 0; }
415 if(!is_numeric($PinnedTopic)) { $PinnedTopic = 0; }
416 if ($TopicStat>1) { $TopicStat = 1; }
417 if ($TopicStat<0) { $TopicStat = 0; }
418 if(!is_numeric($TopicStat)) { $TopicStat = 1; }
419 if ($PinnedTopic==1&&$TopicStat==0) {
420 if($NumReply>=$Settings['hot_topic_num']) {
421 $PreTopic=$ThemeSet['HotPinTopic']; }
422 if($NumReply<$Settings['hot_topic_num']) {
423 $PreTopic=$ThemeSet['PinTopic']; } }
424 if ($TopicStat==1&&$PinnedTopic==0) {
425 if($NumReply>=$Settings['hot_topic_num']) {
426 $PreTopic=$ThemeSet['HotClosedTopic']; }
427 if($NumReply<$Settings['hot_topic_num']) {
428 $PreTopic=$ThemeSet['ClosedTopic']; } }
429 if ($PinnedTopic==0&&$TopicStat==0) {
430 if($NumReply>=$Settings['hot_topic_num']) {
431 $PreTopic=$ThemeSet['HotTopic']; }
432 if($NumReply<$Settings['hot_topic_num']) {
433 $PreTopic=$ThemeSet['TopicIcon']; } }
434 if ($PinnedTopic==1&&$TopicStat==1) {
435 if($NumReply>=$Settings['hot_topic_num']) {
436 $PreTopic=$ThemeSet['HotPinClosedTopic']; }
437 if($NumReply<$Settings['hot_topic_num']) {
438 $PreTopic=$ThemeSet['PinClosedTopic']; } }
440 <tr class="TableRow3" id="Topic<?php echo $TopicID; ?>">
441 <td class="TableColumn3"><div class="topicstate">
442 <?php echo $PreTopic; ?></div></td>
443 <td class="TableColumn3"><div class="topicname">
444 <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>
445 <?php if($prepagelist!==null) { echo $prepagelist; } ?></div>
446 <div class="topicdescription"><?php echo $TopicDescription; ?></div></td>
447 <td class="TableColumn3" style="text-align: center;"><?php
448 if($UsersID>0&&$UserHidden=="no") {
450 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
451 echo "\">".$UsersName."</a>"; }
452 if($UsersID<=0||$UserHidden=="yes") {
453 echo "<span>".$UsersName."</span>"; }
455 <td class="TableColumn3" style="text-align: center;"><?php echo $TheTime; ?></td>
456 <td class="TableColumn3" style="text-align: center;"><?php echo $NumReply; ?></td>
457 <td class="TableColumn3"><?php echo $LastReply; ?></td>
461 <tr id="ForumEnd<?php echo $ForumID; ?>" class="TableRow4">
462 <td class="TableColumn4" colspan="6"> </td>
465 <div class="DivTopics"> </div>
467 sql_free_result($result); }
468 if((GMTimeStamp()<$_SESSION['LastPostTime']&&$_SESSION['LastPostTime']!=0)&&($_GET['act']=="create"||$_GET['act']=="maketopic")) {
469 $_GET['act'] = "view"; $_POST['act'] = null;
470 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"); ?>
471 <div class="Table1Border">
472 <?php if($ThemeSet['TableStyle']=="div") { ?>
473 <div class="TableRow1">
474 <span style="text-align: left;">
475 <?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>
477 <table class="Table1">
478 <?php if($ThemeSet['TableStyle']=="table") { ?>
479 <tr class="TableRow1">
480 <td class="TableColumn1"><span style="text-align: left;">
481 <?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>
484 <tr class="TableRow2">
485 <th class="TableColumn2" style="width: 100%; text-align: left;"> Make Reply Message: </th>
487 <tr class="TableRow3">
488 <td class="TableColumn3">
489 <table style="width: 100%; height: 25%; text-align: center;">
491 <td><span class="TableMessage"><br />
492 You have to wait before making another topic.<br />
493 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 />
498 <tr class="TableRow4">
499 <td class="TableColumn4"> </td>
502 <div class="DivMkReply"> </div>
503 <?php } if($_GET['act']=="create") {
504 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
505 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
506 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
507 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
508 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
509 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
510 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
511 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
512 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
513 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));
514 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
515 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
516 $UFID = rand_uuid("rand");
517 $_SESSION['UserFormID'] = $UFID;
519 <div class="Table1Border">
520 <?php if($ThemeSet['TableStyle']=="div") { ?>
521 <div class="TableRow1">
522 <span style="text-align: left;">
523 <?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>
525 <table class="Table1" id="MakeTopic<?php echo $ForumID; ?>">
526 <?php if($ThemeSet['TableStyle']=="table") { ?>
527 <tr class="TableRow1" id="TopicStart<?php echo $ForumID; ?>">
528 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
529 <?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>
532 <tr id="MakeTopicRow<?php echo $ForumID; ?>" class="TableRow2">
533 <td class="TableColumn2" colspan="2" style="width: 100%;">Making a Topic in <?php echo $ForumName; ?></td>
535 <tr class="TableRow3" id="MkTopic<?php echo $ForumID; ?>">
536 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
537 <div style="width: 100%; height: 160px; overflow: auto;">
538 <table style="width: 100%; text-align: center;"><?php
539 $renee_query=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."smileys\" WHERE \"Display\"='yes'", array(null));
540 $renee_result=sql_query($renee_query,$SQLStat);
541 $renee_num=sql_num_rows($renee_result);
542 $renee_s=0; $SmileRow=0; $SmileCRow=0;
543 while ($renee_s < $renee_num) { ++$SmileRow;
544 $FileName=sql_result($renee_result,$renee_s,"FileName");
545 $SmileName=sql_result($renee_result,$renee_s,"SmileName");
546 $SmileText=sql_result($renee_result,$renee_s,"SmileText");
547 $SmileDirectory=sql_result($renee_result,$renee_s,"Directory");
548 $ShowSmile=sql_result($renee_result,$renee_s,"Display");
549 $ReplaceType=sql_result($renee_result,$renee_s,"ReplaceCI");
550 if($SmileRow==1) { ?><tr>
551 <?php } if($SmileRow<5) { ++$SmileCRow; ?>
552 <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',' <?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?> ')" /></td>
553 <?php } if($SmileRow==5) { ++$SmileCRow; ?>
554 <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',' <?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?> ')" /></td></tr>
555 <?php $SmileCRow=0; $SmileRow=0; }
557 if($SmileCRow<5&&$SmileCRow!=0) {
558 $SmileCRowL = 5 - $SmileCRow;
559 echo "<td colspan=\"".$SmileCRowL."\"> </td></tr>"; }
561 sql_free_result($renee_result);
563 <td class="TableColumn3" style="width: 85%;">
564 <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']); ?>">
565 <table style="text-align: left;">
566 <tr style="text-align: left;">
567 <td style="width: 50%;"><label class="TextBoxLabel" for="TopicName">Insert Topic Name:</label></td>
568 <td style="width: 50%;"><input maxlength="30" type="text" name="TopicName" class="TextBox" id="TopicName" size="20" /></td>
569 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
570 <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
571 <?php if(!isset($_SESSION['GuestName'])) { ?>
572 <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
573 <?php } if(isset($_SESSION['GuestName'])) { ?>
574 <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
575 <?php } ?></tr><?php } ?><tr style="text-align: left;">
576 <td style="width: 50%;"><label class="TextBoxLabel" for="TopicDesc">Insert Topic Description:</label></td>
577 <td style="width: 50%;"><input maxlength="45" type="text" name="TopicDesc" class="TextBox" id="TopicDesc" size="20" /></td>
580 <table style="text-align: left;">
581 <tr style="text-align: left;">
582 <td style="width: 100%;">
583 <label class="TextBoxLabel" for="TopicPost">Insert Your Post:</label><br />
584 <textarea rows="10" name="TopicPost" id="TopicPost" cols="40" class="TextBox"></textarea><br />
585 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
586 <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 />
587 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
589 <input type="hidden" name="act" value="maketopics" style="display: none;" />
590 <input type="hidden" style="display: none;" name="fid" value="<?php echo $UFID; ?>" />
591 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
592 <input type="hidden" name="GuestName" value="null" style="display: none;" />
594 <input type="submit" class="Button" value="Make Topic" name="make_topic" />
595 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
598 <tr id="MkTopicEnd<?php echo $ForumID; ?>" class="TableRow4">
599 <td class="TableColumn4" colspan="2"> </td>
602 <div class="DivMkTopics"> </div>
603 <?php } if($_GET['act']=="maketopic"&&$_POST['act']=="maketopics") {
604 if($_POST['TopicDesc']==""&&$_POST['TopicName']!="") {
605 $_POST['TopicDesc'] = $_POST['TopicName']; }
606 if($_POST['TopicDesc']!=""&&$_POST['TopicName']=="") {
607 $_POST['TopicName'] = $_POST['TopicDesc']; }
608 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));
609 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
610 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
611 $MyUserID = $_SESSION['UserID']; if($MyUserID=="0"||$MyUserID==null) { $MyUserID = -1; }
612 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
613 $URL['REFERER'] = $REFERERurl['host'];
614 $URL['HOST'] = $_SERVER["SERVER_NAME"];
616 if(!isset($_POST['TopicName'])) { $_POST['TopicName'] = null; }
617 if(!isset($_POST['TopicDesc'])) { $_POST['TopicDesc'] = null; }
618 if(!isset($_POST['TopicPost'])) { $_POST['TopicPost'] = null; }
619 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
620 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
621 $Settings['captcha_guest']=="on") {
622 require($SettDir['inc']."captcha.php"); }
624 <div class="Table1Border">
625 <?php if($ThemeSet['TableStyle']=="div") { ?>
626 <div class="TableRow1">
627 <span style="text-align: left;">
628 <?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>
630 <table class="Table1">
631 <?php if($ThemeSet['TableStyle']=="table") { ?>
632 <tr class="TableRow1">
633 <td class="TableColumn1"><span style="text-align: left;">
634 <?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>
637 <tr class="TableRow2">
638 <th class="TableColumn2" style="width: 100%; text-align: left;"> Make Topic Message: </th>
640 <tr class="TableRow3">
641 <td class="TableColumn3">
642 <table style="width: 100%; height: 25%; text-align: center;">
643 <?php if (pre_strlen($_POST['TopicName'])>"50") { $Error="Yes"; ?>
645 <td><span class="TableMessage">
646 <br />Your Topic Name is too big.<br />
649 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
650 $Settings['captcha_guest']=="on") {
651 if (PhpCaptcha::Validate($_POST['signcode'])) {
652 //echo 'Valid code entered';
653 } else { $Error="Yes"; ?>
655 <td><span class="TableMessage">
656 <br />Invalid code entered<br />
659 <?php } } if (pre_strlen($_POST['TopicDesc'])>"80") { $Error="Yes"; ?>
661 <td><span class="TableMessage">
662 <br />Your Topic Description is too big.<br />
665 <?php } if($_POST['fid']!=$_SESSION['UserFormID']) { $Error="Yes"; ?>
667 <td><span class="TableMessage">
668 <br />Sorry the referering url dose not match our host name.<br />
671 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
672 pre_strlen($_POST['GuestName'])>"30") { $Error="Yes"; ?>
674 <td><span class="TableMessage">
675 <br />You Guest Name is too big.<br />
678 <?php } if ($Settings['TestReferer']=="on") {
679 if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes"; ?>
681 <td><span class="TableMessage">
682 <br />Sorry the referering url dose not match our host name.<br />
686 $_POST['TopicName'] = stripcslashes(htmlspecialchars($_POST['TopicName'], ENT_QUOTES, $Settings['charset']));
687 //$_POST['TopicName'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicName']);
688 $_POST['TopicName'] = remove_spaces($_POST['TopicName']);
689 $_POST['TopicDesc'] = stripcslashes(htmlspecialchars($_POST['TopicDesc'], ENT_QUOTES, $Settings['charset']));
690 //$_POST['TopicDesc'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicDesc']);
691 $_POST['TopicDesc'] = remove_spaces($_POST['TopicDesc']);
692 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
693 //$_POST['GuestName'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
694 $_POST['GuestName'] = remove_spaces($_POST['GuestName']);
695 $_POST['TopicPost'] = stripcslashes(htmlspecialchars($_POST['TopicPost'], ENT_QUOTES, $Settings['charset']));
696 //$_POST['TopicPost'] = preg_replace("/&#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicPost']);
697 $_POST['TopicPost'] = remove_bad_entities($_POST['TopicPost']);
698 //$_POST['TopicPost'] = remove_spaces($_POST['TopicPost']);
699 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
700 if(isset($_POST['GuestName'])&&$_POST['GuestName']!=null) {
701 if($cookieDomain==null) {
702 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir); }
703 if($cookieDomain!=null) {
704 if($cookieSecure===true) {
705 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
706 if($cookieSecure===false) {
707 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain); } }
708 $_SESSION['GuestName']=$_POST['GuestName']; } }
709 /* <_< iWordFilter >_>
710 by Kazuki Przyborowski - Cool Dude 2k */
711 $katarzynaqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."wordfilter\"", array(null));
712 $katarzynart=sql_query($katarzynaqy,$SQLStat);
713 $katarzynanm=sql_num_rows($katarzynart);
715 while ($katarzynas < $katarzynanm) {
716 $Filter=sql_result($katarzynart,$katarzynas,"FilterWord");
717 $Replace=sql_result($katarzynart,$katarzynas,"Replacement");
718 $CaseInsensitive=sql_result($katarzynart,$katarzynas,"CaseInsensitive");
719 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
720 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
721 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
722 $WholeWord=sql_result($katarzynart,$katarzynas,"WholeWord");
723 if($WholeWord=="on") { $WholeWord = "yes"; }
724 if($WholeWord=="off") { $WholeWord = "no"; }
725 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
726 $Filter = preg_quote($Filter, "/");
727 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
728 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicDesc']);
729 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicPost']); }
730 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
731 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicDesc']);
732 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicPost']); }
733 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
734 $_POST['TopicDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicDesc']);
735 $_POST['TopicPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicPost']); }
736 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
737 $_POST['TopicDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicDesc']);
738 $_POST['TopicPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicPost']); }
739 ++$katarzynas; } sql_free_result($katarzynart);
740 $lonewolfqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."restrictedwords\" WHERE \"RestrictedTopicName\"='yes' or \"RestrictedUserName\"='yes'", array(null));
741 $lonewolfrt=sql_query($lonewolfqy,$SQLStat);
742 $lonewolfnm=sql_num_rows($lonewolfrt);
743 $lonewolfs=0; $RMatches = null; $RGMatches = null;
744 while ($lonewolfs < $lonewolfnm) {
745 $RWord=sql_result($lonewolfrt,$lonewolfs,"Word");
746 $RCaseInsensitive=sql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
747 if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
748 if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
749 if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
750 $RWholeWord=sql_result($lonewolfrt,$lonewolfs,"WholeWord");
751 if($RWholeWord=="on") { $RWholeWord = "yes"; }
752 if($RWholeWord=="off") { $RWholeWord = "no"; }
753 if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
754 $RestrictedTopicName=sql_result($lonewolfrt,$lonewolfs,"RestrictedTopicName");
755 if($RestrictedTopicName=="on") { $RestrictedTopicName = "yes"; }
756 if($RestrictedTopicName=="off") { $RestrictedTopicName = "no"; }
757 if($RestrictedTopicName!="yes"||$RestrictedTopicName!="no") { $RestrictedTopicName = "no"; }
758 $RestrictedUserName=sql_result($lonewolfrt,$lonewolfs,"RestrictedUserName");
759 if($RestrictedUserName=="on") { $RestrictedUserName = "yes"; }
760 if($RestrictedUserName=="off") { $RestrictedUserName = "no"; }
761 if($RestrictedUserName!="yes"||$RestrictedUserName!="no") { $RestrictedUserName = "no"; }
762 $RWord = preg_quote($RWord, "/");
763 if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
764 if($RestrictedTopicName=="yes") {
765 $RMatches = preg_match("/\b(".$RWord.")\b/", $_POST['TopicName']);
766 if($RMatches==true) { break 1; } }
767 if($RestrictedUserName=="yes") {
768 $RGMatches = preg_match("/\b(".$RWord.")\b/", $_POST['GuestName']);
769 if($RGMatches==true) { break 1; } } }
770 if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
771 if($RestrictedTopicName=="yes") {
772 $RMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['TopicName']);
773 if($RMatches==true) { break 1; } }
774 if($RestrictedUserName=="yes") {
775 $RGMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['GuestName']);
776 if($RGMatches==true) { break 1; } } }
777 if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
778 if($RestrictedTopicName=="yes") {
779 $RMatches = preg_match("/".$RWord."/", $_POST['TopicName']);
780 if($RMatches==true) { break 1; } }
781 if($RestrictedUserName=="yes") {
782 $RGMatches = preg_match("/".$RWord."/", $_POST['GuestName']);
783 if($RGMatches==true) { break 1; } } }
784 if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
785 if($RestrictedTopicName=="yes") {
786 $RMatches = preg_match("/".$RWord."/i", $_POST['TopicName']);
787 if($RMatches==true) { break 1; } }
788 if($RestrictedUserName=="yes") {
789 $RGMatches = preg_match("/".$RWord."/i", $_POST['GuestName']);
790 if($RGMatches==true) { break 1; } } }
791 ++$lonewolfs; } sql_free_result($lonewolfrt);
792 if ($_POST['TopicName']==null) { $Error="Yes"; ?>
794 <td><span class="TableMessage">
795 <br />You need to enter a Topic Name.<br />
798 <?php } if ($_POST['TopicDesc']==null) { $Error="Yes"; ?>
800 <td><span class="TableMessage">
801 <br />You need to enter a Topic Description.<br />
804 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
805 $_POST['GuestName']==null) { $Error="Yes"; ?>
807 <td><span class="TableMessage">
808 <br />You need to enter a Guest Name.<br />
811 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
812 $RGMatches==true) { $Error="Yes"; ?>
814 <td><span class="TableMessage">
815 <br />This Guest Name is restricted to use.<br />
818 <?php } if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { $Error="Yes"; ?>
820 <td><span class="TableMessage">
821 <br />You do not have permission to make a topic here.<br />
824 <?php } if ($_POST['TopicPost']==null) { $Error="Yes"; ?>
826 <td><span class="TableMessage">
827 <br />You need to enter a Topic Post.<br />
830 <?php } if($RMatches==true) { $Error="Yes"; ?>
832 <td><span class="TableMessage">
833 <br />This Topic Name is restricted to use.<br />
836 <?php } if ($Error=="Yes") {
837 redirect("refresh",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"4"); ?>
839 <td><span class="TableMessage">
840 <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 />
843 <?php } if ($Error!="Yes") { $LastActive = GMTimeStamp();
844 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
845 $reresult=sql_query($requery,$SQLStat);
846 $renum=sql_num_rows($reresult);
848 while ($rei < $renum) {
850 $User1Name=sql_result($reresult,$rei,"Name");
851 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
852 $User1Email=sql_result($reresult,$rei,"Email");
853 $User1Title=sql_result($reresult,$rei,"Title");
854 $User1GroupID=sql_result($reresult,$rei,"GroupID");
855 $PostCount=sql_result($reresult,$rei,"PostCount");
856 if($PostCountAdd=="on") { $NewPostCount = $PostCount + 1; }
857 if(!isset($NewPostCount)) { $NewPostCount = $PostCount; }
858 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($User1GroupID));
859 $gresult=sql_query($gquery,$SQLStat);
860 $User1Group=sql_result($gresult,0,"Name");
861 sql_free_result($gresult);
862 $User1IP=$_SERVER['REMOTE_ADDR'];
863 ++$rei; } sql_free_result($reresult);
864 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."topics\" (\"ForumID\", \"CategoryID\", \"OldForumID\", \"OldCategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"TopicName\", \"Description\", \"NumReply\", \"NumViews\", \"Pinned\", \"Closed\") VALUES\n".
865 "(%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']));
866 sql_query($query,$SQLStat);
867 $topicid = sql_get_next_id($Settings['sqltable'],"topics",$SQLStat);
868 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."posts\" (\"TopicID\", \"ForumID\", \"CategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"EditUser\", \"EditUserName\", \"Post\", \"Description\", \"IP\", \"EditIP\") VALUES\n".
869 "(".$topicid.", %i, %i, %i, '%s', %i, %i, 0, '', '%s', '%s', '%s', '0')", array($ForumID,$ForumCatID,$User1ID,$User1Name,$LastActive,$LastActive,$_POST['TopicPost'],$_POST['TopicDesc'],$User1IP));
870 sql_query($query,$SQLStat);
871 $postid = sql_get_next_id($Settings['sqltable'],"posts",$SQLStat);
872 $_SESSION['LastPostTime'] = GMTimeStamp() + $GroupInfo['FloodControl'];
873 if($User1ID!=0&&$User1ID!=-1) {
874 $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));
875 sql_query($queryupd,$SQLStat); }
876 $NewNumPosts = $NumberPosts + 1; $NewNumTopics = $NumberTopics + 1;
877 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($NewNumPosts,$NewNumTopics,$ForumID));
878 sql_query($queryupd,$SQLStat);
879 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");
881 <td><span class="TableMessage"><br />
882 Topic <?php echo $_POST['TopicName']; ?> was started.<br />
883 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 />
889 <tr class="TableRow4">
890 <td class="TableColumn4"> </td>
893 <div class="DivMkTopics"> </div>
895 <table style="width: 100%;" class="Table2">
897 <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
898 <td style="width: 70%; text-align: right;">
899 <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
900 <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>
905 //List Page Number Code end
906 if($pstring!=null||$_GET['act']!="view"||
907 $PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") {
909 <?php /*<div class="DivPageLinks"> </div>*/ ?>
910 <div class="DivTable2"> </div>