OSDN Git Service

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