First commit in 2 years. :P Small bug fix.
[iDB.git] / inc / topics.php
blob0e99a01c9a5d243ebd26caa9a9d367f371f8596b
1 <?php
2 /*
3 This program is free software; you can redistribute it and/or modify
4 it under the terms of the Revised BSD License.
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 Revised BSD License for more details.
11 Copyright 2004-2012 iDB Support - http://idb.berlios.de/
12 Copyright 2004-2012 Game Maker 2k - http://gamemaker2k.org/
14 $FileInfo: topics.php - Last Update: 02/04/2014 SVN 787 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="topics.php"||$File3Name=="/topics.php") {
18 require('index.php');
19 exit(); }
20 $pstring = null; $pagenum = null;
21 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
22 if(!is_numeric($_GET['page'])) { $_GET['page'] = 1; }
23 if(!isset($_GET['st'])) { $_GET['st'] = 0; }
24 if(!is_numeric($_GET['st'])) { $_GET['st'] = 0; }
25 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($_GET['id']));
26 $preresult=sql_query($prequery,$SQLStat);
27 $prenum=sql_num_rows($preresult);
28 if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
29 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
30 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
31 if($prenum>=1) {
32 $ForumID=sql_result($preresult,0,"id");
33 $ForumCatID=sql_result($preresult,0,"CategoryID");
34 $ForumName=sql_result($preresult,0,"Name");
35 $ForumType=sql_result($preresult,0,"ForumType");
36 $ForumShow=sql_result($preresult,0,"ShowForum");
37 if($ForumShow=="no") { $_SESSION['ShowActHidden'] = "yes"; }
38 $InSubForum=sql_result($preresult,0,"InSubForum");
39 $RedirectURL=sql_result($preresult,0,"RedirectURL");
40 $RedirectTimes=sql_result($preresult,0,"Redirects");
41 $NumberViews=sql_result($preresult,0,"NumViews");
42 $NumberPosts=sql_result($preresult,0,"NumPosts");
43 $NumberTopics=sql_result($preresult,0,"NumTopics");
44 $PostCountAdd=sql_result($preresult,0,"PostCountAdd");
45 $CanHaveTopics=sql_result($preresult,0,"CanHaveTopics");
46 $HotTopicPosts=sql_result($preresult,0,"HotTopicPosts");
47 if($HotTopicPosts!=0&&is_numeric($HotTopicPosts)) {
48 $Settings['hot_topic_num'] = $HotTopicPosts; }
49 if(!is_numeric($Settings['hot_topic_num'])) {
50 $Settings['hot_topic_num'] = 15; }
51 $ForumPostCountView=sql_result($preresult,0,"PostCountView");
52 $ForumKarmaCountView=sql_result($preresult,0,"KarmaCountView");
53 sql_free_result($preresult);
54 $ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
55 if($CanHaveTopics=="yes"&&$ForumType=="subforum") {
56 if($_GET['act']=="create"||$_GET['act']=="maketopic"||
57 $_POST['act']=="maketopics") { $ForumCheck = "skip"; } }
58 $catcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2." LIMIT 1", array($ForumCatID));
59 $catresult=sql_query($catcheck,$SQLStat);
60 $CategoryName=sql_result($catresult,0,"Name");
61 $CategoryShow=sql_result($catresult,0,"ShowCategory");
62 if($CategoryShow=="no") { $_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;
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") {
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
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']; } } }
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; }
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;
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 <input type="hidden" style="display: none;" name="ubid" value="<?php echo $Settings['BoardUUID']; ?>" />
644 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
645 <input type="hidden" name="GuestName" value="null" style="display: none;" />
646 <?php } ?>
647 <input type="submit" class="Button" value="Make Topic" name="make_topic" />
648 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
649 </td></tr></table>
650 </form></td></tr>
651 <tr id="MkTopicEnd<?php echo $ForumID; ?>" class="TableRow4">
652 <td class="TableColumn4" colspan="2">&nbsp;</td>
653 </tr>
654 </table></div>
655 <div class="DivMkTopics">&nbsp;</div>
656 <?php } if($_GET['act']=="maketopic"&&$_POST['act']=="maketopics") {
657 if($_POST['TopicDesc']==""&&$_POST['TopicName']!="") {
658 $_POST['TopicDesc'] = $_POST['TopicName']; }
659 if($_POST['TopicDesc']!=""&&$_POST['TopicName']=="") {
660 $_POST['TopicName'] = $_POST['TopicDesc']; }
661 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));
662 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
663 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
664 $MyUserID = $_SESSION['UserID']; if($MyUserID=="0"||$MyUserID==null) { $MyUserID = -1; }
665 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
666 $URL['REFERER'] = $REFERERurl['host'];
667 $URL['HOST'] = $_SERVER["SERVER_NAME"];
668 $REFERERurl = null;
669 if(!isset($_POST['TopicName'])) { $_POST['TopicName'] = null; }
670 if(!isset($_POST['TopicDesc'])) { $_POST['TopicDesc'] = null; }
671 if(!isset($_POST['TopicPost'])) { $_POST['TopicPost'] = null; }
672 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
673 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
674 $Settings['captcha_guest']=="on") {
675 require($SettDir['inc']."captcha.php"); }
677 <div class="Table1Border">
678 <?php if($ThemeSet['TableStyle']=="div") { ?>
679 <div class="TableRow1">
680 <span style="text-align: left;">
681 <?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>
682 <?php } ?>
683 <table class="Table1">
684 <?php if($ThemeSet['TableStyle']=="table") { ?>
685 <tr class="TableRow1">
686 <td class="TableColumn1"><span style="text-align: left;">
687 <?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>
688 </td>
689 </tr><?php } ?>
690 <tr class="TableRow2">
691 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Make Topic Message: </th>
692 </tr>
693 <tr class="TableRow3">
694 <td class="TableColumn3">
695 <table style="width: 100%; height: 25%; text-align: center;">
696 <?php if (pre_strlen($_POST['TopicName'])>"50") { $Error="Yes"; ?>
697 <tr>
698 <td><span class="TableMessage">
699 <br />Your Topic Name is too big.<br />
700 </span>&nbsp;</td>
701 </tr>
702 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
703 $Settings['captcha_guest']=="on") {
704 if (PhpCaptcha::Validate($_POST['signcode'])) {
705 //echo 'Valid code entered';
706 } else { $Error="Yes"; ?>
707 <tr>
708 <td><span class="TableMessage">
709 <br />Invalid code entered<br />
710 </span>&nbsp;</td>
711 </tr>
712 <?php } } if (pre_strlen($_POST['TopicDesc'])>"80") { $Error="Yes"; ?>
713 <tr>
714 <td><span class="TableMessage">
715 <br />Your Topic Description is too big.<br />
716 </span>&nbsp;</td>
717 </tr>
718 <?php } if($_POST['fid']!=$_SESSION['UserFormID']) { $Error="Yes"; ?>
719 <tr>
720 <td><span class="TableMessage">
721 <br />Sorry the referering url dose not match our host name.<br />
722 </span>&nbsp;</td>
723 </tr>
724 <?php } if($_POST['ubid']!=$Settings['BoardUUID']) { $Error="Yes"; ?>
725 <tr>
726 <td><span class="TableMessage">
727 <br />Sorry the referering url dose not match our host name.<br />
728 </span>&nbsp;</td>
729 </tr>
730 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
731 pre_strlen($_POST['GuestName'])>"30") { $Error="Yes"; ?>
732 <tr>
733 <td><span class="TableMessage">
734 <br />You Guest Name is too big.<br />
735 </span>&nbsp;</td>
736 </tr>
737 <?php } if ($Settings['TestReferer']=="on") {
738 if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes"; ?>
739 <tr>
740 <td><span class="TableMessage">
741 <br />Sorry the referering url dose not match our host name.<br />
742 </span>&nbsp;</td>
743 </tr>
744 <?php } }
745 $_POST['TopicName'] = stripcslashes(htmlspecialchars($_POST['TopicName'], ENT_QUOTES, $Settings['charset']));
746 //$_POST['TopicName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicName']);
747 $_POST['TopicName'] = remove_spaces($_POST['TopicName']);
748 $_POST['TopicDesc'] = stripcslashes(htmlspecialchars($_POST['TopicDesc'], ENT_QUOTES, $Settings['charset']));
749 //$_POST['TopicDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicDesc']);
750 $_POST['TopicDesc'] = remove_spaces($_POST['TopicDesc']);
751 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
752 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
753 $_POST['GuestName'] = remove_spaces($_POST['GuestName']);
754 $_POST['TopicPost'] = stripcslashes(htmlspecialchars($_POST['TopicPost'], ENT_QUOTES, $Settings['charset']));
755 //$_POST['TopicPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicPost']);
756 $_POST['TopicPost'] = remove_bad_entities($_POST['TopicPost']);
757 //$_POST['TopicPost'] = remove_spaces($_POST['TopicPost']);
758 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
759 if(isset($_POST['GuestName'])&&$_POST['GuestName']!=null) {
760 if($cookieDomain==null) {
761 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir); }
762 if($cookieDomain!=null) {
763 if($cookieSecure===true) {
764 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
765 if($cookieSecure===false) {
766 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain); } }
767 $_SESSION['GuestName']=$_POST['GuestName']; } }
768 /* <_< iWordFilter >_>
769 by Kazuki Przyborowski - Cool Dude 2k */
770 $katarzynaqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."wordfilter\"", array(null));
771 $katarzynart=sql_query($katarzynaqy,$SQLStat);
772 $katarzynanm=sql_num_rows($katarzynart);
773 $katarzynas=0;
774 while ($katarzynas < $katarzynanm) {
775 $Filter=sql_result($katarzynart,$katarzynas,"FilterWord");
776 $Replace=sql_result($katarzynart,$katarzynas,"Replacement");
777 $CaseInsensitive=sql_result($katarzynart,$katarzynas,"CaseInsensitive");
778 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
779 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
780 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
781 $WholeWord=sql_result($katarzynart,$katarzynas,"WholeWord");
782 if($WholeWord=="on") { $WholeWord = "yes"; }
783 if($WholeWord=="off") { $WholeWord = "no"; }
784 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
785 $Filter = preg_quote($Filter, "/");
786 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
787 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicDesc']);
788 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicPost']); }
789 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
790 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicDesc']);
791 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicPost']); }
792 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
793 $_POST['TopicDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicDesc']);
794 $_POST['TopicPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicPost']); }
795 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
796 $_POST['TopicDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicDesc']);
797 $_POST['TopicPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicPost']); }
798 ++$katarzynas; } sql_free_result($katarzynart);
799 $lonewolfqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."restrictedwords\" WHERE \"RestrictedTopicName\"='yes' or \"RestrictedUserName\"='yes'", array(null));
800 $lonewolfrt=sql_query($lonewolfqy,$SQLStat);
801 $lonewolfnm=sql_num_rows($lonewolfrt);
802 $lonewolfs=0; $RMatches = null; $RGMatches = null;
803 while ($lonewolfs < $lonewolfnm) {
804 $RWord=sql_result($lonewolfrt,$lonewolfs,"Word");
805 $RCaseInsensitive=sql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
806 if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
807 if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
808 if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
809 $RWholeWord=sql_result($lonewolfrt,$lonewolfs,"WholeWord");
810 if($RWholeWord=="on") { $RWholeWord = "yes"; }
811 if($RWholeWord=="off") { $RWholeWord = "no"; }
812 if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
813 $RestrictedTopicName=sql_result($lonewolfrt,$lonewolfs,"RestrictedTopicName");
814 if($RestrictedTopicName=="on") { $RestrictedTopicName = "yes"; }
815 if($RestrictedTopicName=="off") { $RestrictedTopicName = "no"; }
816 if($RestrictedTopicName!="yes"||$RestrictedTopicName!="no") { $RestrictedTopicName = "no"; }
817 $RestrictedUserName=sql_result($lonewolfrt,$lonewolfs,"RestrictedUserName");
818 if($RestrictedUserName=="on") { $RestrictedUserName = "yes"; }
819 if($RestrictedUserName=="off") { $RestrictedUserName = "no"; }
820 if($RestrictedUserName!="yes"||$RestrictedUserName!="no") { $RestrictedUserName = "no"; }
821 $RWord = preg_quote($RWord, "/");
822 if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
823 if($RestrictedTopicName=="yes") {
824 $RMatches = preg_match("/\b(".$RWord.")\b/", $_POST['TopicName']);
825 if($RMatches==true) { break 1; } }
826 if($RestrictedUserName=="yes") {
827 $RGMatches = preg_match("/\b(".$RWord.")\b/", $_POST['GuestName']);
828 if($RGMatches==true) { break 1; } } }
829 if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
830 if($RestrictedTopicName=="yes") {
831 $RMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['TopicName']);
832 if($RMatches==true) { break 1; } }
833 if($RestrictedUserName=="yes") {
834 $RGMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['GuestName']);
835 if($RGMatches==true) { break 1; } } }
836 if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
837 if($RestrictedTopicName=="yes") {
838 $RMatches = preg_match("/".$RWord."/", $_POST['TopicName']);
839 if($RMatches==true) { break 1; } }
840 if($RestrictedUserName=="yes") {
841 $RGMatches = preg_match("/".$RWord."/", $_POST['GuestName']);
842 if($RGMatches==true) { break 1; } } }
843 if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
844 if($RestrictedTopicName=="yes") {
845 $RMatches = preg_match("/".$RWord."/i", $_POST['TopicName']);
846 if($RMatches==true) { break 1; } }
847 if($RestrictedUserName=="yes") {
848 $RGMatches = preg_match("/".$RWord."/i", $_POST['GuestName']);
849 if($RGMatches==true) { break 1; } } }
850 ++$lonewolfs; } sql_free_result($lonewolfrt);
851 if ($_POST['TopicName']==null) { $Error="Yes"; ?>
852 <tr>
853 <td><span class="TableMessage">
854 <br />You need to enter a Topic Name.<br />
855 </span>&nbsp;</td>
856 </tr>
857 <?php } if ($_POST['TopicDesc']==null) { $Error="Yes"; ?>
858 <tr>
859 <td><span class="TableMessage">
860 <br />You need to enter a Topic Description.<br />
861 </span>&nbsp;</td>
862 </tr>
863 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
864 $_POST['GuestName']==null) { $Error="Yes"; ?>
865 <tr>
866 <td><span class="TableMessage">
867 <br />You need to enter a Guest Name.<br />
868 </span>&nbsp;</td>
869 </tr>
870 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
871 $RGMatches==true) { $Error="Yes"; ?>
872 <tr>
873 <td><span class="TableMessage">
874 <br />This Guest Name is restricted to use.<br />
875 </span>&nbsp;</td>
876 </tr>
877 <?php } if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { $Error="Yes"; ?>
878 <tr>
879 <td><span class="TableMessage">
880 <br />You do not have permission to make a topic here.<br />
881 </span>&nbsp;</td>
882 </tr>
883 <?php } if ($_POST['TopicPost']==null) { $Error="Yes"; ?>
884 <tr>
885 <td><span class="TableMessage">
886 <br />You need to enter a Topic Post.<br />
887 </span>&nbsp;</td>
888 </tr>
889 <?php } if($RMatches==true) { $Error="Yes"; ?>
890 <tr>
891 <td><span class="TableMessage">
892 <br />This Topic Name is restricted to use.<br />
893 </span>&nbsp;</td>
894 </tr>
895 <?php } if ($Error=="Yes") {
896 redirect("refresh",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"4"); ?>
897 <tr>
898 <td><span class="TableMessage">
899 <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;
900 </span><br /></td>
901 </tr>
902 <?php } if ($Error!="Yes") { $LastActive = GMTimeStamp();
903 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
904 $reresult=sql_query($requery,$SQLStat);
905 $renum=sql_num_rows($reresult);
906 $rei=0;
907 while ($rei < $renum) {
908 $User1ID=$MyUserID;
909 $User1Name=sql_result($reresult,$rei,"Name");
910 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
911 $User1Email=sql_result($reresult,$rei,"Email");
912 $User1Title=sql_result($reresult,$rei,"Title");
913 $User1GroupID=sql_result($reresult,$rei,"GroupID");
914 $PostCount=sql_result($reresult,$rei,"PostCount");
915 if($PostCountAdd=="on") { $NewPostCount = $PostCount + 1; }
916 if(!isset($NewPostCount)) { $NewPostCount = $PostCount; }
917 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($User1GroupID));
918 $gresult=sql_query($gquery,$SQLStat);
919 $User1Group=sql_result($gresult,0,"Name");
920 sql_free_result($gresult);
921 $User1IP=$_SERVER['REMOTE_ADDR'];
922 ++$rei; } sql_free_result($reresult);
923 $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".
924 "(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']));
925 sql_query($query,$SQLStat);
926 $topicid = sql_get_next_id($Settings['sqltable'],"topics",$SQLStat);
927 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."posts\" (\"TopicID\", \"ForumID\", \"CategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"EditUser\", \"EditUserName\", \"Post\", \"Description\", \"IP\", \"EditIP\") VALUES\n".
928 "(".$topicid.", %i, %i, %i, '%s', %i, %i, 0, '', '%s', '%s', '%s', '0')", array($ForumID,$ForumCatID,$User1ID,$User1Name,$LastActive,$LastActive,$_POST['TopicPost'],$_POST['TopicDesc'],$User1IP));
929 sql_query($query,$SQLStat);
930 $postid = sql_get_next_id($Settings['sqltable'],"posts",$SQLStat);
931 $_SESSION['LastPostTime'] = GMTimeStamp() + $GroupInfo['FloodControl'];
932 if($User1ID!=0&&$User1ID!=-1) {
933 $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));
934 sql_query($queryupd,$SQLStat); }
935 $NewNumPosts = $NumberPosts + 1; $NewNumTopics = $NumberTopics + 1;
936 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($NewNumPosts,$NewNumTopics,$ForumID));
937 sql_query($queryupd,$SQLStat);
938 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");
939 ?><tr>
940 <td><span class="TableMessage"><br />
941 Topic <?php echo $_POST['TopicName']; ?> was started.<br />
942 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;
943 </span><br /></td>
944 </tr>
945 <?php } ?>
946 </table>
947 </td></tr>
948 <tr class="TableRow4">
949 <td class="TableColumn4">&nbsp;</td>
950 </tr>
951 </table></div>
952 <div class="DivMkTopics">&nbsp;</div>
953 <?php } ?>
954 <table style="width: 100%;" class="Table2">
955 <tr>
956 <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
957 <td style="width: 70%; text-align: right;">
958 <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
959 <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>
960 <?php } ?></td>
961 </tr>
962 </table>
963 <?php
964 //List Page Number Code end
965 if($pstring!=null||$_GET['act']!="view"||
966 $PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") {
968 <?php /*<div class="DivPageLinks">&nbsp;</div>*/ ?>
969 <div class="DivTable2">&nbsp;</div>
970 <?php } } } ?>