OSDN Git Service

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