OSDN Git Service

Added breadcrum support. mmm breadcrumbs yummy. :P
[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-2008 Cool Dude 2k - http://idb.berlios.de/
12     Copyright 2004-2008 Game Maker 2k - http://intdb.sourceforge.net/
13
14     $FileInfo: topics.php - Last Update: 11/18/2008 SVN 191 - Author: cooldude2k $
15 */
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="topics.php"||$File3Name=="/topics.php") {
18         require('index.php');
19         exit(); }
20 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
21 if(!is_numeric($_GET['page'])) { $_GET['page'] = null; }
22 $prequery = query("SELECT * FROM `".$Settings['sqltable']."forums` WHERE `id`=%i LIMIT 1", array($_GET['id']));
23 $preresult=mysql_query($prequery);
24 $prenum=mysql_num_rows($preresult);
25 if($prenum==0) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); @mysql_free_result($preresult);
26 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
27 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
28 if($prenum>=1) {
29 $ForumID=mysql_result($preresult,0,"id");
30 $ForumCatID=mysql_result($preresult,0,"CategoryID");
31 $ForumName=mysql_result($preresult,0,"Name");
32 $ForumType=mysql_result($preresult,0,"ForumType");
33 $RedirectURL=mysql_result($preresult,0,"RedirectURL");
34 $RedirectTimes=mysql_result($preresult,0,"Redirects");
35 $NumberViews=mysql_result($preresult,0,"NumViews");
36 $NumberPosts=mysql_result($preresult,0,"NumPosts");
37 $NumberTopics=mysql_result($preresult,0,"NumTopics");
38 $PostCountAdd=mysql_result($preresult,0,"PostCountAdd");
39 $CanHaveTopics=mysql_result($preresult,0,"CanHaveTopics");
40 $HotTopicPosts=mysql_result($preresult,0,"HotTopicPosts");
41 if($HotTopicPosts!=0&&is_numeric($HotTopicPosts)) {
42         $Settings['hot_topic_num'] = $HotTopicPosts; }
43 if(!is_numeric($Settings['hot_topic_num'])) {
44         $Settings['hot_topic_num'] = 15; }
45 $ForumPostCountView=mysql_result($preresult,0,"PostCountView");
46 $ForumKarmaCountView=mysql_result($preresult,0,"KarmaCountView");
47 @mysql_free_result($preresult);
48 $ForumType = strtolower($ForumType); $CanHaveTopics = strtolower($CanHaveTopics);
49 if($CanHaveTopics=="yes"&&$ForumType=="subforum") { 
50 if($_GET['act']=="create"||$_GET['act']=="maketopic"||
51         $_POST['act']=="maketopics") { $ForumCheck = "skip"; } }
52 $catcheck = query("SELECT * FROM `".$Settings['sqltable']."categories` WHERE `id`=%i  LIMIT 1", array($ForumCatID));
53 $catresult=mysql_query($catcheck);
54 $CategoryName=mysql_result($catresult,0,"Name");
55 $CategoryType=mysql_result($catresult,0,"CategoryType");
56 $CategoryPostCountView=mysql_result($catresult,0,"PostCountView");
57 $CategoryKarmaCountView=mysql_result($catresult,0,"KarmaCountView");
58 @mysql_free_result($catresult);
59 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
60 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
61 if($MyKarmaCount==null) { $MyKarmaCount = 0; }
62 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
63 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
64 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
65 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
66 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
67 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
68 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
69 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
70 ?>
71 <div class="NavLinks"><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>"><?php echo $ThemeSet['NavLinkIcon']; ?>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 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>
72 <div>&nbsp;</div>
73 <?php
74 if(!isset($CatPermissionInfo['CanViewCategory'][$ForumCatID])) {
75         $CatPermissionInfo['CanViewCategory'][$ForumCatID] = "no"; }
76 if($CatPermissionInfo['CanViewCategory'][$ForumCatID]=="no"||
77         $CatPermissionInfo['CanViewCategory'][$ForumCatID]!="yes") {
78 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
79 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
80 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
81 if(!isset($PermissionInfo['CanViewForum'][$ForumID])) {
82         $PermissionInfo['CanViewForum'][$ForumID] = "no"; }
83 if($PermissionInfo['CanViewForum'][$ForumID]=="no"||
84         $PermissionInfo['CanViewForum'][$ForumID]!="yes") {
85 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
86 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
87 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
88 if($CatPermissionInfo['CanViewCategory'][$ForumCatID]=="yes"&&
89         $PermissionInfo['CanViewForum'][$ForumID]=="yes") {
90 if($ForumType!="redirect") {
91 if($NumberViews==0||$NumberViews==null) { $NewNumberViews = 1; }
92 if($NumberViews!=0&&$NumberViews!=null) { $NewNumberViews = $NumberViews + 1; }
93 $viewup = query("UPDATE `".$Settings['sqltable']."forums` SET `NumViews`=%i WHERE `id`=%i", array($NewNumberViews,$_GET['id']));
94 mysql_query($viewup); }
95 if($ForumType=="redirect") {
96 if($RedirectTimes==0||$RedirectTimes==null) { $NewRedirTime = 1; }
97 if($RedirectTimes!=0&&$RedirectTimes!=null) { $NewRedirTime = $RedirectTimes + 1; }
98 $redirup = query("UPDATE `".$Settings['sqltable']."forums` SET `Redirects`=%i WHERE `id`=%i", array($NewRedirTime,$_GET['id']));
99 mysql_query($redirup);
100 if($RedirectURL!="http://"&&$RedirectURL!="") {
101 redirect("location",$RedirectURL,0,null,false); ob_clean();
102 @header("Content-Type: text/plain; charset=".$Settings['charset']);
103 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
104 if($RedirectURL=="http://"||$RedirectURL=="") {
105 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
106 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
107 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); } }
108 if($ForumCheck!="skip") {
109 if($ForumType=="subforum") {
110 redirect("location",$basedir.url_maker($exfile['subforum'],$Settings['file_ext'],"act=".$_GET['act']."&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['subforum'],$exqstr['subforum'],FALSE));
111 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
112 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); } }
113 if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") {
114 ?>
115 <table style="width: 100%;" class="Table2">
116 <tr>
117  <td style="width: 0%; text-align: left;">&nbsp;</td>
118  <td style="width: 100%; text-align: right;">
119  <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
120  <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>
121  <?php } ?></td>
122 </tr>
123 </table>
124 <div>&nbsp;</div>
125 <?php }
126 if($_GET['act']=="view") {
127 if($NumberTopics==null) { 
128         $NumberTopics = 0; }
129 $num=$NumberTopics;
130 //Start Topic Page Code
131 if(!isset($Settings['max_topics'])) { $Settings['max_topics'] = 10; }
132 if($_GET['page']==null) { $_GET['page'] = 1; } 
133 if($_GET['page']<=0) { $_GET['page'] = 1; }
134 $nums = $_GET['page'] * $Settings['max_topics'];
135 if($nums>$num) { $nums = $num; }
136 $numz = $nums - $Settings['max_topics'];
137 if($numz<=0) { $numz = 0; }
138 //$i=$numz;
139 if($nums<$num) { $nextpage = $_GET['page'] + 1; }
140 if($nums>=$num) { $nextpage = $_GET['page']; }
141 if($numz>=$Settings['max_topics']) { $backpage = $_GET['page'] - 1; }
142 if($_GET['page']<=1) { $backpage = 1; }
143 $pnum = $num; $l = 1; $Pages = null;
144 while ($pnum>0) {
145 if($pnum>=$Settings['max_topics']) { 
146         $pnum = $pnum - $Settings['max_topics']; 
147         $Pages[$l] = $l; ++$l; }
148 if($pnum<$Settings['max_topics']&&$pnum>0) { 
149         $pnum = $pnum - $pnum; 
150         $Pages[$l] = $l; ++$l; } }
151 $PageLimit = $nums - $Settings['max_topics'];
152 if($PageLimit<0) { $PageLimit = 0; }
153 //End Topic Page Code
154 $i=0;
155 $query = query("SELECT * FROM `".$Settings['sqltable']."topics` WHERE `ForumID`=%i ORDER BY `Pinned` DESC, `LastUpdate` DESC LIMIT %i,%i", array($_GET['id'],$PageLimit,$Settings['max_topics']));
156 $result=mysql_query($query);
157 $num=mysql_num_rows($result);
158 //List Page Number Code Start
159 $pagenum=count($Pages);
160 if($_GET['page']>$pagenum) {
161         $_GET['page'] = $pagenum; }
162 $pagei=0; $pstring = "<div class=\"PageList\">Pages: ";
163 if($_GET['page']<4) { $Pagez[0] = null; }
164 if($_GET['page']>=4) { $Pagez[0] = "First"; }
165 if($_GET['page']>=3) {
166 $Pagez[1] = $_GET['page'] - 2; }
167 if($_GET['page']<3) {
168 $Pagez[1] = null; }
169 if($_GET['page']>=2) {
170 $Pagez[2] = $_GET['page'] - 1; }
171 if($_GET['page']<2) {
172 $Pagez[2] = null; }
173 $Pagez[3] = $_GET['page'];
174 if($_GET['page']<$pagenum) {
175 $Pagez[4] = $_GET['page'] + 1; }
176 if($_GET['page']>=$pagenum) {
177 $Pagez[4] = null; }
178 $pagenext = $_GET['page'] + 1;
179 if($pagenext<$pagenum) {
180 $Pagez[5] = $_GET['page'] + 2; }
181 if($pagenext>=$pagenum) {
182 $Pagez[5] = null; }
183 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
184 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
185 $pagenumi=count($Pagez);
186 if($NumberTopics==0) {
187 $pagenumi = 0;
188 $pstring = $pstring."<a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">1</a> "; }
189 while ($pagei < $pagenumi) {
190 if($Pagez[$pagei]!=null&&
191    $Pagez[$pagei]!="First"&&
192    $Pagez[$pagei]!="Last") {
193 $pstring = $pstring."<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> "; }
194 if($Pagez[$pagei]=="First") {
195 $pstring = $pstring."<a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">&lt; First</a> ... "; }
196 if($Pagez[$pagei]=="Last") {
197 $pstring = $pstring."... <a href=\"".url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$pagenum,$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType])."\">Last &gt;</a> "; }
198         ++$pagei; } $pstring = $pstring."</div>";
199 echo $pstring;
200 //List Page Number Code end
201 ?>
202 <div class="Table1Border">
203 <table class="Table1" id="Forum<?php echo $ForumID; ?>">
204 <tr id="ForumStart<?php echo $ForumID; ?>" class="TableRow1">
205 <td class="TableRow1" colspan="6"><span style="float: left;">
206 <?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>
207 <?php echo "<span style=\"float: right;\">&nbsp;</span>"; ?></td>
208 </tr>
209 <tr id="TopicStatRow<?php echo $ForumID; ?>" class="TableRow2">
210 <th class="TableRow2" style="width: 4%;">State</th>
211 <th class="TableRow2" style="width: 36%;">Topic Name</th>
212 <th class="TableRow2" style="width: 15%;">Author</th>
213 <th class="TableRow2" style="width: 15%;">Time</th>
214 <th class="TableRow2" style="width: 5%;">Replys</th>
215 <th class="TableRow2" style="width: 25%;">Last Reply</th>
216 </tr>
217 <?php
218 while ($i < $num) {
219 $TopicID=mysql_result($result,$i,"id");
220 $UsersID=mysql_result($result,$i,"UserID");
221 $GuestName=mysql_result($result,$i,"GuestName");
222 $TheTime=mysql_result($result,$i,"TimeStamp");
223 $TheTime=GMTimeChange("F j, Y",$TheTime,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
224 $NumReply=mysql_result($result,$i,"NumReply");
225 $TopicName=mysql_result($result,$i,"TopicName");
226 $TopicDescription=mysql_result($result,$i,"Description");
227 $PinnedTopic=mysql_result($result,$i,"Pinned");
228 $TopicStat=mysql_result($result,$i,"Closed");
229 $UsersName = GetUserName($UsersID,$Settings['sqltable']);
230 if($UsersName=="Guest") { $UsersName=$GuestName;
231 if($UsersName==null) { $UsersName="Guest"; } }
232 $glrquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `TopicID`=%i ORDER BY `TimeStamp` DESC LIMIT 1", array($TopicID));
233 $glrresult=mysql_query($glrquery);
234 $glrnum=mysql_num_rows($glrresult);
235 if($glrnum>0){
236 $ReplyID1=mysql_result($glrresult,0,"id");
237 $UsersID1=mysql_result($glrresult,0,"UserID");
238 $GuestName1=mysql_result($glrresult,0,"GuestName");
239 $TimeStamp1=mysql_result($glrresult,0,"TimeStamp");
240 $TimeStamp1=GMTimeChange("F j, Y",$TimeStamp1,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
241 $UsersName1 = GetUserName($UsersID1,$Settings['sqltable']); }
242 $NumPages = null; $NumRPosts = $NumReply + 1;
243 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
244 if($NumRPosts>$Settings['max_posts']) {
245 $NumPages = ceil($NumRPosts/$Settings['max_posts']); }
246 if($NumRPosts<=$Settings['max_posts']) {
247 $NumPages = 1; }
248 $Users_Name1 = pre_substr($UsersName1,0,20);
249 if($UsersName1=="Guest") { $UsersName1=$GuestName1;
250 if($UsersName1==null) { $UsersName1="Guest"; } }
251 if (pre_strlen($UsersName1)>20) { $Users_Name1 = $Users_Name1."...";
252 $oldusername=$UsersName1; $UsersName1=$Users_Name1; } $lul = null;
253 if($TimeStamp1!=null) { $lul = null;
254 if($UsersID1!="-1") {
255 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
256 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."&#35;reply".$NumRPosts;
257 $LastReply = "User: <a href=\"".$lul."\" title=\"".$oldusername."\">".$UsersName1."</a><br />\nTime: <a href=\"".$luln."\">".$TimeStamp1."</a>"; }
258 if($UsersID1=="-1") {
259 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
260 $luln = url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."&#35;reply".$NumRPosts;
261 $LastReply = "Guest: <span title=\"".$oldusername."\">".$UsersName1."</span><br />\nTime: <a href=\"".$luln."\">".$TimeStamp1."</a>"; } }
262 @mysql_free_result($glrresult);
263 if(!isset($TimeStamp1)) { $TimeStamp1 = null; } if(!isset($LastReply)) { $LastReply = null; }
264 if($TimeStamp1==null) { $LastReply = "&nbsp;<br />&nbsp;"; }
265 $PreTopic = $ThemeSet['TopicIcon'];
266 if ($PinnedTopic>1) { $PinnedTopic = 1; } 
267 if ($PinnedTopic<0) { $PinnedTopic = 0; }
268 if(!is_numeric($PinnedTopic)) { $PinnedTopic = 0; }
269 if ($TopicStat>1) { $TopicStat = 1; } 
270 if ($TopicStat<0) { $TopicStat = 0; }
271 if(!is_numeric($TopicStat)) { $TopicStat = 1; }
272 if ($PinnedTopic==1&&$TopicStat==0) {
273         if($NumReply>=$Settings['hot_topic_num']) {
274                 $PreTopic=$ThemeSet['HotPinTopic']; }
275         if($NumReply<$Settings['hot_topic_num']) {
276                 $PreTopic=$ThemeSet['PinTopic']; } }
277 if ($TopicStat==1&&$PinnedTopic==0) {
278         if($NumReply>=$Settings['hot_topic_num']) {
279                 $PreTopic=$ThemeSet['HotClosedTopic']; }
280         if($NumReply<$Settings['hot_topic_num']) {
281                 $PreTopic=$ThemeSet['ClosedTopic']; } }
282 if ($PinnedTopic==0&&$TopicStat==0) {
283                 if($NumReply>=$Settings['hot_topic_num']) {
284                         $PreTopic=$ThemeSet['HotTopic']; }
285                 if($NumReply<$Settings['hot_topic_num']) {
286                         $PreTopic=$ThemeSet['TopicIcon']; } }
287 if ($PinnedTopic==1&&$TopicStat==1) {
288                 if($NumReply>=$Settings['hot_topic_num']) {
289                         $PreTopic=$ThemeSet['HotPinClosedTopic']; }
290                 if($NumReply<$Settings['hot_topic_num']) {
291                         $PreTopic=$ThemeSet['PinClosedTopic']; } }
292 ?>
293 <tr class="TableRow3" id="Topic<?php echo $TopicID; ?>">
294 <td class="TableRow3"><div class="topicstate">
295 <?php echo $PreTopic; ?></div></td>
296 <td class="TableRow3"><div class="topicname">
297 <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></div>
298 <div class="topicdescription"><?php echo $TopicDescription; ?></div></td>
299 <td class="TableRow3" style="text-align: center;"><?php
300 if($UsersID!="-1") {
301 echo "<a href=\"";
302 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
303 echo "\">".$UsersName."</a>"; }
304 if($UsersID=="-1") {
305 echo "<span>".$UsersName."</span>"; }
306 ?></td>
307 <td class="TableRow3" style="text-align: center;"><?php echo $TheTime; ?></td>
308 <td class="TableRow3" style="text-align: center;"><?php echo $NumReply; ?></td>
309 <td class="TableRow3"><?php echo $LastReply; ?></td>
310 </tr>
311 <?php ++$i; } 
312 ?>
313 <tr id="ForumEnd<?php echo $ForumID; ?>" class="TableRow4">
314 <td class="TableRow4" colspan="6">&nbsp;</td>
315 </tr>
316 </table></div>
317 <div>&nbsp;</div>
318 <?php
319 @mysql_free_result($result); }
320 if($_GET['act']=="create") {
321 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
322 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
323 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
324 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
325 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
326 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
327 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
328 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
329 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
330 if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
331 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
332 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
333 ?>
334 <div class="Table1Border">
335 <table class="Table1" id="MakeTopic<?php echo $ForumID; ?>">
336 <tr class="TableRow1" id="TopicStart<?php echo $ForumID; ?>">
337 <td class="TableRow1" colspan="2"><span style="float: left;">
338 <?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>
339 <?php echo "<span style=\"float: right;\">&nbsp;</span>"; ?></td>
340 </tr>
341 <tr id="MakeTopicRow<?php echo $ForumID; ?>" class="TableRow2">
342 <td class="TableRow2" colspan="2" style="width: 100%;">Making a Topic in <?php echo $ForumName; ?></td>
343 </tr>
344 <tr class="TableRow3" id="MkTopic<?php echo $ForumID; ?>">
345 <td class="TableRow3" style="width: 15%; vertical-align: middle; text-align: center;">
346 <div style="width: 100%; height: 160px; overflow: auto;">
347 <table style="width: 100%; text-align: center;"><?php
348 $renee_query=query("SELECT * FROM `".$Settings['sqltable']."smileys` WHERE `Show`='yes'", array(null));
349 $renee_result=mysql_query($renee_query);
350 $renee_num=mysql_num_rows($renee_result);
351 $renee_s=0; $SmileRow=0; $SmileCRow=0;
352 while ($renee_s < $renee_num) { ++$SmileRow;
353 $FileName=mysql_result($renee_result,$renee_s,"FileName");
354 $SmileName=mysql_result($renee_result,$renee_s,"SmileName");
355 $SmileText=mysql_result($renee_result,$renee_s,"SmileText");
356 $SmileDirectory=mysql_result($renee_result,$renee_s,"Directory");
357 $ShowSmile=mysql_result($renee_result,$renee_s,"Show");
358 $ReplaceType=mysql_result($renee_result,$renee_s,"ReplaceCI");
359 if($SmileRow==1) { ?><tr>
360         <?php } if($SmileRow<5) { ++$SmileCRow; ?>
361         <td>&nbsp;<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;')" />&nbsp;</td>
362         <?php } if($SmileRow==5) { ++$SmileCRow; ?>
363         <td>&nbsp;<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;')" />&nbsp;</td></tr>
364         <?php $SmileCRow=0; $SmileRow=0; }
365 ++$renee_s; }
366 if($SmileCRow<5&&$SmileCRow!=0) {
367 $SmileCRowL = 5 - $SmileCRow;
368 echo "<td colspan=\"".$SmileCRowL."\">&nbsp;</td></tr>"; }
369 echo "</table>";
370 @mysql_free_result($renee_result);
371 ?></div></td>
372 <td class="TableRow3" style="width: 85%;">
373 <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']); ?>">
374 <table style="text-align: left;">
375 <tr style="text-align: left;">
376         <td style="width: 50%;"><label class="TextBoxLabel" for="TopicName">Insert Topic Name:</label></td>
377         <td style="width: 50%;"><input maxlength="30" type="text" name="TopicName" class="TextBox" id="TopicName" size="20" /></td>
378 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
379         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
380         <?php if(!isset($_SESSION['GuestName'])) { ?>
381         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
382         <?php } if(isset($_SESSION['GuestName'])) { ?>
383         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
384 <?php } ?></tr><?php } ?><tr style="text-align: left;">
385         <td style="width: 50%;"><label class="TextBoxLabel" for="TopicDesc">Insert Topic Description:</label></td>
386         <td style="width: 50%;"><input maxlength="45" type="text" name="TopicDesc" class="TextBox" id="TopicDesc" size="20" /></td>
387 </tr>
388 </table>
389 <table style="text-align: left;">
390 <tr style="text-align: left;">
391 <td style="width: 100%;">
392 <label class="TextBoxLabel" for="TopicPost">Insert Your Post:</label><br />
393 <textarea rows="10" name="TopicPost" id="TopicPost" cols="40" class="TextBox"></textarea><br />
394 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
395 <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 />
396 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
397 <?php } ?>
398 <input type="hidden" name="act" value="maketopics" style="display: none;" />
399 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
400 <input type="hidden" name="GuestName" value="null" style="display: none;" />
401 <?php } ?>
402 <input type="submit" class="Button" value="Make Topic" name="make_topic" />
403 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
404 </td></tr></table>
405 </form></td></tr>
406 <tr id="MkTopicEnd<?php echo $ForumID; ?>" class="TableRow4">
407 <td class="TableRow4" colspan="2">&nbsp;</td>
408 </tr>
409 </table></div>
410 <div>&nbsp;</div>
411 <?php } if($_GET['act']=="maketopic"&&$_POST['act']=="maketopics") {
412 if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
413 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
414 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
415 $MyUserID = $_SESSION['UserID']; if($MyUserID=="0"||$MyUserID==null) { $MyUserID = -1; }
416 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
417 $URL['REFERER'] = $REFERERurl['host'];
418 $URL['HOST'] = $_SERVER["SERVER_NAME"];
419 $REFERERurl = null;
420 if(!isset($_POST['TopicName'])) { $_POST['TopicName'] = null; }
421 if(!isset($_POST['TopicDesc'])) { $_POST['TopicDesc'] = null; }
422 if(!isset($_POST['TopicPost'])) { $_POST['TopicPost'] = null; }
423 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
424 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
425         $Settings['captcha_guest']=="on") {
426 require($SettDir['inc']."captcha.php"); }
427 ?>
428 <div class="Table1Border">
429 <table class="Table1">
430 <tr class="TableRow1">
431 <td class="TableRow1"><span style="float: left;">
432 <?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>
433 <?php echo "<span style=\"float: right;\">&nbsp;</span>"; ?></td>
434 </tr>
435 <tr class="TableRow2">
436 <th class="TableRow2" style="width: 100%; text-align: left;">&nbsp;Make Topic Message: </th>
437 </tr>
438 <tr class="TableRow3">
439 <td class="TableRow3">
440 <table style="width: 100%; height: 25%; text-align: center;">
441 <?php if (pre_strlen($_POST['TopicName'])>="30") { $Error="Yes";  ?>
442 <tr>
443         <td><span class="TableMessage">
444         <br />Your Topic Name is too big.<br />
445         </span>&nbsp;</td>
446 </tr>
447 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
448         $Settings['captcha_guest']=="on") {
449 if (PhpCaptcha::Validate($_POST['signcode'])) {
450 //echo 'Valid code entered';
451 } else { $Error="Yes"; ?>
452 <tr>
453         <td><span class="TableMessage">
454         <br />Invalid code entered<br />
455         </span>&nbsp;</td>
456 </tr>
457 <?php } } if (pre_strlen($_POST['TopicDesc'])>="45") { $Error="Yes";  ?>
458 <tr>
459         <td><span class="TableMessage">
460         <br />Your Topic Description is too big.<br />
461         </span>&nbsp;</td>
462 </tr>
463 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
464         pre_strlen($_POST['GuestName'])>="25") { $Error="Yes"; ?>
465 <tr>
466         <td><span class="TableMessage">
467         <br />You Guest Name is too big.<br />
468         </span>&nbsp;</td>
469 </tr>
470 <?php } if ($Settings['TestReferer']===true) {
471         if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
472 <tr>
473         <td><span class="TableMessage">
474         <br />Sorry the referering url dose not match our host name.<br />
475         </span>&nbsp;</td>
476 </tr>
477 <?php } }
478 $_POST['TopicName'] = stripcslashes(htmlspecialchars($_POST['TopicName'], ENT_QUOTES, $Settings['charset']));
479 //$_POST['TopicName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicName']);
480 $_POST['TopicName'] = @remove_spaces($_POST['TopicName']);
481 $_POST['TopicDesc'] = stripcslashes(htmlspecialchars($_POST['TopicDesc'], ENT_QUOTES, $Settings['charset']));
482 //$_POST['TopicDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicDesc']);
483 $_POST['TopicDesc'] = @remove_spaces($_POST['TopicDesc']);
484 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
485 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
486 $_POST['GuestName'] = @remove_spaces($_POST['GuestName']);
487 $_POST['TopicPost'] = stripcslashes(htmlspecialchars($_POST['TopicPost'], ENT_QUOTES, $Settings['charset']));
488 //$_POST['TopicPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicPost']);
489 $_POST['TopicPost'] = remove_bad_entities($_POST['TopicPost']);
490 //$_POST['TopicPost'] = @remove_spaces($_POST['TopicPost']);
491 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
492 if(isset($_POST['GuestName'])&&$_POST['GuestName']!=null) {
493 @setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir);
494 $_SESSION['GuestName']=$_POST['GuestName']; } }
495 /*    <_<  iWordFilter  >_>      
496    by Kazuki Przyborowski - Cool Dude 2k */
497 $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
498 $katarzynart=mysql_query($katarzynaqy);
499 $katarzynanm=mysql_num_rows($katarzynart);
500 $katarzynas=0;
501 while ($katarzynas < $katarzynanm) {
502 $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
503 $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
504 $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
505 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
506 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
507 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
508 $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
509 if($WholeWord=="on") { $WholeWord = "yes"; }
510 if($WholeWord=="off") { $WholeWord = "no"; }
511 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
512 $Filter = preg_quote($Filter, "/");
513 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
514 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicDesc']); 
515 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicPost']); }
516 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
517 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicDesc']); 
518 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicPost']); }
519 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
520 $_POST['TopicDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicDesc']); 
521 $_POST['TopicPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicPost']); }
522 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
523 $_POST['TopicDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicDesc']); 
524 $_POST['TopicPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicPost']); }
525 ++$katarzynas; } @mysql_free_result($katarzynart);
526 $lonewolfqy=query("SELECT * FROM `".$Settings['sqltable']."restrictedwords` WHERE `RestrictedTopicName`='yes' or `RestrictedUserName`='yes'", array(null));
527 $lonewolfrt=mysql_query($lonewolfqy);
528 $lonewolfnm=mysql_num_rows($lonewolfrt);
529 $lonewolfs=0; $RMatches = null; $RGMatches = null;
530 while ($lonewolfs < $lonewolfnm) {
531 $RWord=mysql_result($lonewolfrt,$lonewolfs,"Word");
532 $RCaseInsensitive=mysql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
533 if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
534 if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
535 if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
536 $RWholeWord=mysql_result($lonewolfrt,$lonewolfs,"WholeWord");
537 if($RWholeWord=="on") { $RWholeWord = "yes"; }
538 if($RWholeWord=="off") { $RWholeWord = "no"; }
539 if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
540 $RestrictedTopicName=mysql_result($lonewolfrt,$lonewolfs,"RestrictedTopicName");
541 if($RestrictedTopicName=="on") { $RestrictedTopicName = "yes"; }
542 if($RestrictedTopicName=="off") { $RestrictedTopicName = "no"; }
543 if($RestrictedTopicName!="yes"||$RestrictedTopicName!="no") { $RestrictedTopicName = "no"; }
544 $RestrictedUserName=mysql_result($lonewolfrt,$lonewolfs,"RestrictedUserName");
545 if($RestrictedUserName=="on") { $RestrictedUserName = "yes"; }
546 if($RestrictedUserName=="off") { $RestrictedUserName = "no"; }
547 if($RestrictedUserName!="yes"||$RestrictedUserName!="no") { $RestrictedUserName = "no"; }
548 $RWord = preg_quote($RWord, "/");
549 if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
550 if($RestrictedTopicName=="yes") {
551 $RMatches = preg_match("/\b(".$RWord.")\b/", $_POST['TopicName']);
552         if($RMatches==true) { break 1; } }
553 if($RestrictedUserName=="yes") {
554 $RGMatches = preg_match("/\b(".$RWord.")\b/", $_POST['GuestName']);
555         if($RGMatches==true) { break 1; } } }
556 if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
557 if($RestrictedTopicName=="yes") {
558 $RMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['TopicName']);
559         if($RMatches==true) { break 1; } }
560 if($RestrictedUserName=="yes") {
561 $RGMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['GuestName']);
562         if($RGMatches==true) { break 1; } } }
563 if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
564 if($RestrictedTopicName=="yes") {
565 $RMatches = preg_match("/".$RWord."/", $_POST['TopicName']);
566         if($RMatches==true) { break 1; } }
567 if($RestrictedUserName=="yes") {
568 $RGMatches = preg_match("/".$RWord."/", $_POST['GuestName']);
569         if($RGMatches==true) { break 1; } } }
570 if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
571 if($RestrictedTopicName=="yes") {
572 $RMatches = preg_match("/".$RWord."/i", $_POST['TopicName']);
573         if($RMatches==true) { break 1; } }
574 if($RestrictedUserName=="yes") {
575 $RGMatches = preg_match("/".$RWord."/i", $_POST['GuestName']);
576         if($RGMatches==true) { break 1; } } }
577 ++$lonewolfs; } @mysql_free_result($lonewolfrt);
578 if ($_POST['TopicName']==null) { $Error="Yes"; ?>
579 <tr>
580         <td><span class="TableMessage">
581         <br />You need to enter a Topic Name.<br />
582         </span>&nbsp;</td>
583 </tr>
584 <?php } if ($_POST['TopicDesc']==null) { $Error="Yes"; ?>
585 <tr>
586         <td><span class="TableMessage">
587         <br />You need to enter a Topic Description.<br />
588         </span>&nbsp;</td>
589 </tr>
590 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
591         $_POST['GuestName']==null) { $Error="Yes"; ?>
592 <tr>
593         <td><span class="TableMessage">
594         <br />You need to enter a Guest Name.<br />
595         </span>&nbsp;</td>
596 </tr>
597 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
598         $RGMatches==true) { $Error="Yes"; ?>
599 <tr>
600         <td><span class="TableMessage">
601         <br />This Guest Name is restricted to use.<br />
602         </span>&nbsp;</td>
603 </tr>
604 <?php } if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { $Error="Yes"; ?>
605 <tr>
606         <td><span class="TableMessage">
607         <br />You do not have permission to make a topic here.<br />
608         </span>&nbsp;</td>
609 </tr>
610 <?php } if ($_POST['TopicPost']==null) { $Error="Yes"; ?>
611 <tr>
612         <td><span class="TableMessage">
613         <br />You need to enter a Topic Post.<br />
614         </span>&nbsp;</td>
615 </tr>
616 <?php } if($RMatches==true) { $Error="Yes"; ?>
617 <tr>
618         <td><span class="TableMessage">
619         <br />This Topic Name is restricted to use.<br />
620         </span>&nbsp;</td>
621 </tr>
622 <?php } if ($Error=="Yes") {
623 @redirect("refresh",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"4"); ?>
624 <tr>
625         <td><span class="TableMessage">
626         <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;
627         </span><br /></td>
628 </tr>
629 <?php } if ($Error!="Yes") { $LastActive = GMTimeStamp();
630 $topicid = getnextid($Settings['sqltable'],"topics");
631 $postid = getnextid($Settings['sqltable'],"posts");
632 $requery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($MyUserID));
633 $reresult=mysql_query($requery);
634 $renum=mysql_num_rows($reresult);
635 $rei=0;
636 while ($rei < $renum) {
637 $User1ID=$MyUserID;
638 $User1Name=mysql_result($reresult,$rei,"Name");
639 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
640 $User1Email=mysql_result($reresult,$rei,"Email");
641 $User1Title=mysql_result($reresult,$rei,"Title");
642 $User1GroupID=mysql_result($reresult,$rei,"GroupID");
643 $PostCount=mysql_result($reresult,$rei,"PostCount");
644 if($PostCountAdd=="on") { $NewPostCount = $PostCount + 1; }
645 if(!isset($NewPostCount)) { $NewPostCount = $PostCount; }
646 $gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($User1GroupID));
647 $gresult=mysql_query($gquery);
648 $User1Group=mysql_result($gresult,0,"Name");
649 @mysql_free_result($gresult);
650 $User1IP=$_SERVER['REMOTE_ADDR'];
651 ++$rei; } @mysql_free_result($reresult);
652 $query = query("INSERT INTO `".$Settings['sqltable']."topics` VALUES (".$topicid.",%i,%i,%i,'%s',%i,%i,'%s','%s',0,0,0,0)", array($ForumID,$ForumCatID,$User1ID,$User1Name,$LastActive,$LastActive,$_POST['TopicName'],$_POST['TopicDesc']));
653 mysql_query($query);
654 $query = query("INSERT INTO `".$Settings['sqltable']."posts` VALUES (".$postid.",".$topicid.",%i,%i,%i,'%s',%i,%i,0,'%s','%s','%s','0')", array($ForumID,$ForumCatID,$User1ID,$User1Name,$LastActive,$LastActive,$_POST['TopicPost'],$_POST['TopicDesc'],$User1IP));
655 mysql_query($query);
656 if($User1ID!=0&&$User1ID!=-1) {
657 $queryupd = query("UPDATE `".$Settings['sqltable']."members` SET `LastActive`=%i,`IP`='%s',`PostCount`=%i WHERE `id`=%i", array($LastActive,$User1IP,$NewPostCount,$User1ID));
658 mysql_query($queryupd); }
659 $NewNumPosts = $NumberPosts + 1; $NewNumTopics = $NumberTopics + 1;
660 $queryupd = query("UPDATE `".$Settings['sqltable']."forums` SET `NumPosts`=%i,`NumTopics`=%i WHERE `id`=%i", array($NewNumPosts,$NewNumTopics,$ForumID));
661 mysql_query($queryupd);
662 @redirect("refresh",$basedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$topicid."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],FALSE),"3");
663 ?><tr>
664         <td><span class="TableMessage"><br />
665         Topic <?php echo $_POST['TopicName']; ?> was started.<br />
666         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;
667         </span><br /></td>
668 </tr>
669 <?php } ?>
670 </table>
671 </td></tr>
672 <tr class="TableRow4">
673 <td class="TableRow4">&nbsp;</td>
674 </tr>
675 </table></div>
676 <div>&nbsp;</div>
677 <?php }
678 if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
679 <table class="Table2" style="width: 100%;">
680 <tr>
681  <td style="width: 0%; text-align: left;">&nbsp;</td>
682  <td style="width: 100%; text-align: right;">
683  <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
684  <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>
685  <?php } ?></td>
686 </tr>
687 </table>
688 <div>&nbsp;</div>
689 <?php } } } ?>