OSDN Git Service

Small bug fix and updated Theme System.
[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: 12/06/2008 SVN 201 - 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"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$CategoryType],$Settings['file_ext'],"act=view&id=".$ForumCatID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php echo $CategoryName; ?></a><?php 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 class="DivNavLinks">&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 class="DivTable2">&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\"><span class=\"pagelink\">Pages:</span> ";
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."<span class=\"pagelink\"><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></span> "; }
189 while ($pagei < $pagenumi) {
190 if($Pagez[$pagei]!=null&&
191    $Pagez[$pagei]!="First"&&
192    $Pagez[$pagei]!="Last") {
193 if($pagei==1&$Pagez[$pagei]!=null&&$Pagez[$pagei]>=2) {
194 $Pback = $Pagez[$pagei] - 1;
195 $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> "; }
196 if($pagei!=3) { 
197 $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> "; }
198 if($pagei==3) { 
199 $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> "; } }
200 if($Pagez[$pagei]=="First") {
201 $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> "; }
202 if($Pagez[$pagei]=="Last") {
203 $ptestnext = $pagenext + 1;
204 if($ptestnext<$pagenum) {
205 $paget = $pagei - 1;
206 $Pnext = $Pagez[$paget] + 1;
207 $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> "; }
208 $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> "; }
209         ++$pagei; } $pstring = $pstring."</div>";
210 echo $pstring;
211 //List Page Number Code end
212 ?>
213 <div class="DivPageLinks">&nbsp;</div>
214 <div class="Table1Border">
215 <?php if($ThemeSet['TableStyle']=="div") { ?>
216 <div class="TableRow1">
217 <span style="text-align: left;">
218 <?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>
219 <?php } ?>
220 <table class="Table1" id="Forum<?php echo $ForumID; ?>">
221 <?php if($ThemeSet['TableStyle']=="table") { ?>
222 <tr id="ForumStart<?php echo $ForumID; ?>" class="TableRow1">
223 <td class="TableColumn1" colspan="6"><span style="text-align: left;">
224 <?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>
225 </td>
226 </tr><?php } ?>
227 <tr id="TopicStatRow<?php echo $ForumID; ?>" class="TableRow2">
228 <th class="TableColumn2" style="width: 4%;">State</th>
229 <th class="TableColumn2" style="width: 36%;">Topic Name</th>
230 <th class="TableColumn2" style="width: 15%;">Author</th>
231 <th class="TableColumn2" style="width: 15%;">Time</th>
232 <th class="TableColumn2" style="width: 5%;">Replys</th>
233 <th class="TableColumn2" style="width: 25%;">Last Reply</th>
234 </tr>
235 <?php
236 while ($i < $num) {
237 $TopicID=mysql_result($result,$i,"id");
238 $UsersID=mysql_result($result,$i,"UserID");
239 $GuestName=mysql_result($result,$i,"GuestName");
240 $TheTime=mysql_result($result,$i,"TimeStamp");
241 $TheTime=GMTimeChange("F j, Y",$TheTime,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
242 $NumReply=mysql_result($result,$i,"NumReply");
243 $TopicName=mysql_result($result,$i,"TopicName");
244 $TopicDescription=mysql_result($result,$i,"Description");
245 $PinnedTopic=mysql_result($result,$i,"Pinned");
246 $TopicStat=mysql_result($result,$i,"Closed");
247 $requery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($UsersID));
248 $reresult=mysql_query($requery);
249 $renum=mysql_num_rows($reresult);
250 $UserGroupID=mysql_result($reresult,0,"GroupID");
251 @mysql_free_result($reresult);
252 $gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($UserGroupID));
253 $gresult=mysql_query($gquery);
254 $User1Group=mysql_result($gresult,0,"Name");
255 $GroupNamePrefix=mysql_result($gresult,0,"NamePrefix");
256 $GroupNameSuffix=mysql_result($gresult,0,"NameSuffix");
257 @mysql_free_result($gresult);
258 $UsersName = GetUserName($UsersID,$Settings['sqltable']);
259 if($UsersName=="Guest") { $UsersName=$GuestName;
260 if($UsersName==null) { $UsersName="Guest"; } }
261 if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
262         $UsersName = $GroupNamePrefix.$UsersName; }
263 if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
264         $UsersName = $UsersName.$GroupNameSuffix; }
265 $glrquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `TopicID`=%i ORDER BY `TimeStamp` DESC LIMIT 1", array($TopicID));
266 $glrresult=mysql_query($glrquery);
267 $glrnum=mysql_num_rows($glrresult);
268 if($glrnum>0){
269 $ReplyID1=mysql_result($glrresult,0,"id");
270 $UsersID1=mysql_result($glrresult,0,"UserID");
271 $GuestName1=mysql_result($glrresult,0,"GuestName");
272 $TimeStamp1=mysql_result($glrresult,0,"TimeStamp");
273 $TimeStamp1=GMTimeChange("F j, Y",$TimeStamp1,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
274 $UsersName1 = GetUserName($UsersID1,$Settings['sqltable']); }
275 $NumPages = null; $NumRPosts = $NumReply + 1;
276 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
277 if($NumRPosts>$Settings['max_posts']) {
278 $NumPages = ceil($NumRPosts/$Settings['max_posts']); }
279 if($NumRPosts<=$Settings['max_posts']) {
280 $NumPages = 1; }
281 $Users_Name1 = pre_substr($UsersName1,0,20);
282 if($UsersName1=="Guest") { $UsersName1=$GuestName1;
283 if($UsersName1==null) { $UsersName1="Guest"; } }
284 $oldusername=$UsersName1;
285 if (pre_strlen($UsersName1)>20) { 
286 $Users_Name1 = $Users_Name1."..."; $UsersName1=$Users_Name1; } $lul = null;
287 if($TimeStamp1!=null) { $lul = null;
288 if($UsersID1!="-1") {
289 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
290 $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;
291 $LastReply = "User: <a href=\"".$lul."\" title=\"".$oldusername."\">".$UsersName1."</a><br />\nTime: <a href=\"".$luln."\">".$TimeStamp1."</a>"; }
292 if($UsersID1=="-1") {
293 $lul = url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID1,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
294 $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;
295 $LastReply = "Guest: <span title=\"".$oldusername."\">".$UsersName1."</span><br />\nTime: <a href=\"".$luln."\">".$TimeStamp1."</a>"; } }
296 @mysql_free_result($glrresult);
297 if(!isset($TimeStamp1)) { $TimeStamp1 = null; } if(!isset($LastReply)) { $LastReply = null; }
298 if($TimeStamp1==null) { $LastReply = "&nbsp;<br />&nbsp;"; }
299 $PreTopic = $ThemeSet['TopicIcon'];
300 if ($PinnedTopic>1) { $PinnedTopic = 1; } 
301 if ($PinnedTopic<0) { $PinnedTopic = 0; }
302 if(!is_numeric($PinnedTopic)) { $PinnedTopic = 0; }
303 if ($TopicStat>1) { $TopicStat = 1; } 
304 if ($TopicStat<0) { $TopicStat = 0; }
305 if(!is_numeric($TopicStat)) { $TopicStat = 1; }
306 if ($PinnedTopic==1&&$TopicStat==0) {
307         if($NumReply>=$Settings['hot_topic_num']) {
308                 $PreTopic=$ThemeSet['HotPinTopic']; }
309         if($NumReply<$Settings['hot_topic_num']) {
310                 $PreTopic=$ThemeSet['PinTopic']; } }
311 if ($TopicStat==1&&$PinnedTopic==0) {
312         if($NumReply>=$Settings['hot_topic_num']) {
313                 $PreTopic=$ThemeSet['HotClosedTopic']; }
314         if($NumReply<$Settings['hot_topic_num']) {
315                 $PreTopic=$ThemeSet['ClosedTopic']; } }
316 if ($PinnedTopic==0&&$TopicStat==0) {
317                 if($NumReply>=$Settings['hot_topic_num']) {
318                         $PreTopic=$ThemeSet['HotTopic']; }
319                 if($NumReply<$Settings['hot_topic_num']) {
320                         $PreTopic=$ThemeSet['TopicIcon']; } }
321 if ($PinnedTopic==1&&$TopicStat==1) {
322                 if($NumReply>=$Settings['hot_topic_num']) {
323                         $PreTopic=$ThemeSet['HotPinClosedTopic']; }
324                 if($NumReply<$Settings['hot_topic_num']) {
325                         $PreTopic=$ThemeSet['PinClosedTopic']; } }
326 ?>
327 <tr class="TableRow3" id="Topic<?php echo $TopicID; ?>">
328 <td class="TableColumn3"><div class="topicstate">
329 <?php echo $PreTopic; ?></div></td>
330 <td class="TableColumn3"><div class="topicname">
331 <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>
332 <div class="topicdescription"><?php echo $TopicDescription; ?></div></td>
333 <td class="TableColumn3" style="text-align: center;"><?php
334 if($UsersID!="-1") {
335 echo "<a href=\"";
336 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UsersID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
337 echo "\">".$UsersName."</a>"; }
338 if($UsersID=="-1") {
339 echo "<span>".$UsersName."</span>"; }
340 ?></td>
341 <td class="TableColumn3" style="text-align: center;"><?php echo $TheTime; ?></td>
342 <td class="TableColumn3" style="text-align: center;"><?php echo $NumReply; ?></td>
343 <td class="TableColumn3"><?php echo $LastReply; ?></td>
344 </tr>
345 <?php ++$i; } 
346 ?>
347 <tr id="ForumEnd<?php echo $ForumID; ?>" class="TableRow4">
348 <td class="TableColumn4" colspan="6">&nbsp;</td>
349 </tr>
350 </table></div>
351 <div class="DivTopics">&nbsp;</div>
352 <?php
353 @mysql_free_result($result); }
354 if($_GET['act']=="create") {
355 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
356 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
357 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
358 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
359 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
360 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
361 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
362 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
363 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
364 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));
365 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
366 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
367 ?>
368 <div class="Table1Border">
369 <?php if($ThemeSet['TableStyle']=="div") { ?>
370 <div class="TableRow1">
371 <span style="text-align: left;">
372 <?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>
373 <?php } ?>
374 <table class="Table1" id="MakeTopic<?php echo $ForumID; ?>">
375 <?php if($ThemeSet['TableStyle']=="table") { ?>
376 <tr class="TableRow1" id="TopicStart<?php echo $ForumID; ?>">
377 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
378 <?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>
379 </td>
380 </tr><?php } ?>
381 <tr id="MakeTopicRow<?php echo $ForumID; ?>" class="TableRow2">
382 <td class="TableColumn2" colspan="2" style="width: 100%;">Making a Topic in <?php echo $ForumName; ?></td>
383 </tr>
384 <tr class="TableRow3" id="MkTopic<?php echo $ForumID; ?>">
385 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
386 <div style="width: 100%; height: 160px; overflow: auto;">
387 <table style="width: 100%; text-align: center;"><?php
388 $renee_query=query("SELECT * FROM `".$Settings['sqltable']."smileys` WHERE `Show`='yes'", array(null));
389 $renee_result=mysql_query($renee_query);
390 $renee_num=mysql_num_rows($renee_result);
391 $renee_s=0; $SmileRow=0; $SmileCRow=0;
392 while ($renee_s < $renee_num) { ++$SmileRow;
393 $FileName=mysql_result($renee_result,$renee_s,"FileName");
394 $SmileName=mysql_result($renee_result,$renee_s,"SmileName");
395 $SmileText=mysql_result($renee_result,$renee_s,"SmileText");
396 $SmileDirectory=mysql_result($renee_result,$renee_s,"Directory");
397 $ShowSmile=mysql_result($renee_result,$renee_s,"Show");
398 $ReplaceType=mysql_result($renee_result,$renee_s,"ReplaceCI");
399 if($SmileRow==1) { ?><tr>
400         <?php } if($SmileRow<5) { ++$SmileCRow; ?>
401         <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>
402         <?php } if($SmileRow==5) { ++$SmileCRow; ?>
403         <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>
404         <?php $SmileCRow=0; $SmileRow=0; }
405 ++$renee_s; }
406 if($SmileCRow<5&&$SmileCRow!=0) {
407 $SmileCRowL = 5 - $SmileCRow;
408 echo "<td colspan=\"".$SmileCRowL."\">&nbsp;</td></tr>"; }
409 echo "</table>";
410 @mysql_free_result($renee_result);
411 ?></div></td>
412 <td class="TableColumn3" style="width: 85%;">
413 <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']); ?>">
414 <table style="text-align: left;">
415 <tr style="text-align: left;">
416         <td style="width: 50%;"><label class="TextBoxLabel" for="TopicName">Insert Topic Name:</label></td>
417         <td style="width: 50%;"><input maxlength="30" type="text" name="TopicName" class="TextBox" id="TopicName" size="20" /></td>
418 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
419         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
420         <?php if(!isset($_SESSION['GuestName'])) { ?>
421         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
422         <?php } if(isset($_SESSION['GuestName'])) { ?>
423         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
424 <?php } ?></tr><?php } ?><tr style="text-align: left;">
425         <td style="width: 50%;"><label class="TextBoxLabel" for="TopicDesc">Insert Topic Description:</label></td>
426         <td style="width: 50%;"><input maxlength="45" type="text" name="TopicDesc" class="TextBox" id="TopicDesc" size="20" /></td>
427 </tr>
428 </table>
429 <table style="text-align: left;">
430 <tr style="text-align: left;">
431 <td style="width: 100%;">
432 <label class="TextBoxLabel" for="TopicPost">Insert Your Post:</label><br />
433 <textarea rows="10" name="TopicPost" id="TopicPost" cols="40" class="TextBox"></textarea><br />
434 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
435 <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 />
436 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
437 <?php } ?>
438 <input type="hidden" name="act" value="maketopics" style="display: none;" />
439 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
440 <input type="hidden" name="GuestName" value="null" style="display: none;" />
441 <?php } ?>
442 <input type="submit" class="Button" value="Make Topic" name="make_topic" />
443 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
444 </td></tr></table>
445 </form></td></tr>
446 <tr id="MkTopicEnd<?php echo $ForumID; ?>" class="TableRow4">
447 <td class="TableColumn4" colspan="2">&nbsp;</td>
448 </tr>
449 </table></div>
450 <div class="DivMkTopics">&nbsp;</div>
451 <?php } if($_GET['act']=="maketopic"&&$_POST['act']=="maketopics") {
452 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));
453 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
454 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
455 $MyUserID = $_SESSION['UserID']; if($MyUserID=="0"||$MyUserID==null) { $MyUserID = -1; }
456 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
457 $URL['REFERER'] = $REFERERurl['host'];
458 $URL['HOST'] = $_SERVER["SERVER_NAME"];
459 $REFERERurl = null;
460 if(!isset($_POST['TopicName'])) { $_POST['TopicName'] = null; }
461 if(!isset($_POST['TopicDesc'])) { $_POST['TopicDesc'] = null; }
462 if(!isset($_POST['TopicPost'])) { $_POST['TopicPost'] = null; }
463 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
464 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
465         $Settings['captcha_guest']=="on") {
466 require($SettDir['inc']."captcha.php"); }
467 ?>
468 <div class="Table1Border">
469 <?php if($ThemeSet['TableStyle']=="div") { ?>
470 <div class="TableRow1">
471 <span style="text-align: left;">
472 <?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>
473 <?php } ?>
474 <table class="Table1">
475 <?php if($ThemeSet['TableStyle']=="table") { ?>
476 <tr class="TableRow1">
477 <td class="TableColumn1"><span style="text-align: left;">
478 <?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>
479 </td>
480 </tr><?php } ?>
481 <tr class="TableRow2">
482 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Make Topic Message: </th>
483 </tr>
484 <tr class="TableRow3">
485 <td class="TableColumn3">
486 <table style="width: 100%; height: 25%; text-align: center;">
487 <?php if (pre_strlen($_POST['TopicName'])>="30") { $Error="Yes";  ?>
488 <tr>
489         <td><span class="TableMessage">
490         <br />Your Topic Name is too big.<br />
491         </span>&nbsp;</td>
492 </tr>
493 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
494         $Settings['captcha_guest']=="on") {
495 if (PhpCaptcha::Validate($_POST['signcode'])) {
496 //echo 'Valid code entered';
497 } else { $Error="Yes"; ?>
498 <tr>
499         <td><span class="TableMessage">
500         <br />Invalid code entered<br />
501         </span>&nbsp;</td>
502 </tr>
503 <?php } } if (pre_strlen($_POST['TopicDesc'])>="45") { $Error="Yes";  ?>
504 <tr>
505         <td><span class="TableMessage">
506         <br />Your Topic Description is too big.<br />
507         </span>&nbsp;</td>
508 </tr>
509 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
510         pre_strlen($_POST['GuestName'])>="25") { $Error="Yes"; ?>
511 <tr>
512         <td><span class="TableMessage">
513         <br />You Guest Name is too big.<br />
514         </span>&nbsp;</td>
515 </tr>
516 <?php } if ($Settings['TestReferer']===true) {
517         if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
518 <tr>
519         <td><span class="TableMessage">
520         <br />Sorry the referering url dose not match our host name.<br />
521         </span>&nbsp;</td>
522 </tr>
523 <?php } }
524 $_POST['TopicName'] = stripcslashes(htmlspecialchars($_POST['TopicName'], ENT_QUOTES, $Settings['charset']));
525 //$_POST['TopicName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicName']);
526 $_POST['TopicName'] = @remove_spaces($_POST['TopicName']);
527 $_POST['TopicDesc'] = stripcslashes(htmlspecialchars($_POST['TopicDesc'], ENT_QUOTES, $Settings['charset']));
528 //$_POST['TopicDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicDesc']);
529 $_POST['TopicDesc'] = @remove_spaces($_POST['TopicDesc']);
530 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
531 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
532 $_POST['GuestName'] = @remove_spaces($_POST['GuestName']);
533 $_POST['TopicPost'] = stripcslashes(htmlspecialchars($_POST['TopicPost'], ENT_QUOTES, $Settings['charset']));
534 //$_POST['TopicPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicPost']);
535 $_POST['TopicPost'] = remove_bad_entities($_POST['TopicPost']);
536 //$_POST['TopicPost'] = @remove_spaces($_POST['TopicPost']);
537 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
538 if(isset($_POST['GuestName'])&&$_POST['GuestName']!=null) {
539 @setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir);
540 $_SESSION['GuestName']=$_POST['GuestName']; } }
541 /*    <_<  iWordFilter  >_>      
542    by Kazuki Przyborowski - Cool Dude 2k */
543 $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
544 $katarzynart=mysql_query($katarzynaqy);
545 $katarzynanm=mysql_num_rows($katarzynart);
546 $katarzynas=0;
547 while ($katarzynas < $katarzynanm) {
548 $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
549 $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
550 $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
551 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
552 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
553 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
554 $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
555 if($WholeWord=="on") { $WholeWord = "yes"; }
556 if($WholeWord=="off") { $WholeWord = "no"; }
557 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
558 $Filter = preg_quote($Filter, "/");
559 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
560 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicDesc']); 
561 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['TopicPost']); }
562 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
563 $_POST['TopicDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicDesc']); 
564 $_POST['TopicPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['TopicPost']); }
565 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
566 $_POST['TopicDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicDesc']); 
567 $_POST['TopicPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['TopicPost']); }
568 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
569 $_POST['TopicDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicDesc']); 
570 $_POST['TopicPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['TopicPost']); }
571 ++$katarzynas; } @mysql_free_result($katarzynart);
572 $lonewolfqy=query("SELECT * FROM `".$Settings['sqltable']."restrictedwords` WHERE `RestrictedTopicName`='yes' or `RestrictedUserName`='yes'", array(null));
573 $lonewolfrt=mysql_query($lonewolfqy);
574 $lonewolfnm=mysql_num_rows($lonewolfrt);
575 $lonewolfs=0; $RMatches = null; $RGMatches = null;
576 while ($lonewolfs < $lonewolfnm) {
577 $RWord=mysql_result($lonewolfrt,$lonewolfs,"Word");
578 $RCaseInsensitive=mysql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
579 if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
580 if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
581 if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
582 $RWholeWord=mysql_result($lonewolfrt,$lonewolfs,"WholeWord");
583 if($RWholeWord=="on") { $RWholeWord = "yes"; }
584 if($RWholeWord=="off") { $RWholeWord = "no"; }
585 if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
586 $RestrictedTopicName=mysql_result($lonewolfrt,$lonewolfs,"RestrictedTopicName");
587 if($RestrictedTopicName=="on") { $RestrictedTopicName = "yes"; }
588 if($RestrictedTopicName=="off") { $RestrictedTopicName = "no"; }
589 if($RestrictedTopicName!="yes"||$RestrictedTopicName!="no") { $RestrictedTopicName = "no"; }
590 $RestrictedUserName=mysql_result($lonewolfrt,$lonewolfs,"RestrictedUserName");
591 if($RestrictedUserName=="on") { $RestrictedUserName = "yes"; }
592 if($RestrictedUserName=="off") { $RestrictedUserName = "no"; }
593 if($RestrictedUserName!="yes"||$RestrictedUserName!="no") { $RestrictedUserName = "no"; }
594 $RWord = preg_quote($RWord, "/");
595 if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
596 if($RestrictedTopicName=="yes") {
597 $RMatches = preg_match("/\b(".$RWord.")\b/", $_POST['TopicName']);
598         if($RMatches==true) { break 1; } }
599 if($RestrictedUserName=="yes") {
600 $RGMatches = preg_match("/\b(".$RWord.")\b/", $_POST['GuestName']);
601         if($RGMatches==true) { break 1; } } }
602 if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
603 if($RestrictedTopicName=="yes") {
604 $RMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['TopicName']);
605         if($RMatches==true) { break 1; } }
606 if($RestrictedUserName=="yes") {
607 $RGMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['GuestName']);
608         if($RGMatches==true) { break 1; } } }
609 if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
610 if($RestrictedTopicName=="yes") {
611 $RMatches = preg_match("/".$RWord."/", $_POST['TopicName']);
612         if($RMatches==true) { break 1; } }
613 if($RestrictedUserName=="yes") {
614 $RGMatches = preg_match("/".$RWord."/", $_POST['GuestName']);
615         if($RGMatches==true) { break 1; } } }
616 if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
617 if($RestrictedTopicName=="yes") {
618 $RMatches = preg_match("/".$RWord."/i", $_POST['TopicName']);
619         if($RMatches==true) { break 1; } }
620 if($RestrictedUserName=="yes") {
621 $RGMatches = preg_match("/".$RWord."/i", $_POST['GuestName']);
622         if($RGMatches==true) { break 1; } } }
623 ++$lonewolfs; } @mysql_free_result($lonewolfrt);
624 if ($_POST['TopicName']==null) { $Error="Yes"; ?>
625 <tr>
626         <td><span class="TableMessage">
627         <br />You need to enter a Topic Name.<br />
628         </span>&nbsp;</td>
629 </tr>
630 <?php } if ($_POST['TopicDesc']==null) { $Error="Yes"; ?>
631 <tr>
632         <td><span class="TableMessage">
633         <br />You need to enter a Topic Description.<br />
634         </span>&nbsp;</td>
635 </tr>
636 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
637         $_POST['GuestName']==null) { $Error="Yes"; ?>
638 <tr>
639         <td><span class="TableMessage">
640         <br />You need to enter a Guest Name.<br />
641         </span>&nbsp;</td>
642 </tr>
643 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
644         $RGMatches==true) { $Error="Yes"; ?>
645 <tr>
646         <td><span class="TableMessage">
647         <br />This Guest Name is restricted to use.<br />
648         </span>&nbsp;</td>
649 </tr>
650 <?php } if($PermissionInfo['CanMakeTopics'][$ForumID]=="no"||$CanHaveTopics=="no") { $Error="Yes"; ?>
651 <tr>
652         <td><span class="TableMessage">
653         <br />You do not have permission to make a topic here.<br />
654         </span>&nbsp;</td>
655 </tr>
656 <?php } if ($_POST['TopicPost']==null) { $Error="Yes"; ?>
657 <tr>
658         <td><span class="TableMessage">
659         <br />You need to enter a Topic Post.<br />
660         </span>&nbsp;</td>
661 </tr>
662 <?php } if($RMatches==true) { $Error="Yes"; ?>
663 <tr>
664         <td><span class="TableMessage">
665         <br />This Topic Name is restricted to use.<br />
666         </span>&nbsp;</td>
667 </tr>
668 <?php } if ($Error=="Yes") {
669 @redirect("refresh",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"4"); ?>
670 <tr>
671         <td><span class="TableMessage">
672         <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;
673         </span><br /></td>
674 </tr>
675 <?php } if ($Error!="Yes") { $LastActive = GMTimeStamp();
676 $topicid = getnextid($Settings['sqltable'],"topics");
677 $postid = getnextid($Settings['sqltable'],"posts");
678 $requery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($MyUserID));
679 $reresult=mysql_query($requery);
680 $renum=mysql_num_rows($reresult);
681 $rei=0;
682 while ($rei < $renum) {
683 $User1ID=$MyUserID;
684 $User1Name=mysql_result($reresult,$rei,"Name");
685 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
686 $User1Email=mysql_result($reresult,$rei,"Email");
687 $User1Title=mysql_result($reresult,$rei,"Title");
688 $User1GroupID=mysql_result($reresult,$rei,"GroupID");
689 $PostCount=mysql_result($reresult,$rei,"PostCount");
690 if($PostCountAdd=="on") { $NewPostCount = $PostCount + 1; }
691 if(!isset($NewPostCount)) { $NewPostCount = $PostCount; }
692 $gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($User1GroupID));
693 $gresult=mysql_query($gquery);
694 $User1Group=mysql_result($gresult,0,"Name");
695 @mysql_free_result($gresult);
696 $User1IP=$_SERVER['REMOTE_ADDR'];
697 ++$rei; } @mysql_free_result($reresult);
698 $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']));
699 mysql_query($query);
700 $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));
701 mysql_query($query);
702 if($User1ID!=0&&$User1ID!=-1) {
703 $queryupd = query("UPDATE `".$Settings['sqltable']."members` SET `LastActive`=%i,`IP`='%s',`PostCount`=%i WHERE `id`=%i", array($LastActive,$User1IP,$NewPostCount,$User1ID));
704 mysql_query($queryupd); }
705 $NewNumPosts = $NumberPosts + 1; $NewNumTopics = $NumberTopics + 1;
706 $queryupd = query("UPDATE `".$Settings['sqltable']."forums` SET `NumPosts`=%i,`NumTopics`=%i WHERE `id`=%i", array($NewNumPosts,$NewNumTopics,$ForumID));
707 mysql_query($queryupd);
708 @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");
709 ?><tr>
710         <td><span class="TableMessage"><br />
711         Topic <?php echo $_POST['TopicName']; ?> was started.<br />
712         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;
713         </span><br /></td>
714 </tr>
715 <?php } ?>
716 </table>
717 </td></tr>
718 <tr class="TableRow4">
719 <td class="TableColumn4">&nbsp;</td>
720 </tr>
721 </table></div>
722 <div class="DivMkTopics">&nbsp;</div>
723 <?php }
724 if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
725 <table class="Table2" style="width: 100%;">
726 <tr>
727  <td style="width: 0%; text-align: left;">&nbsp;</td>
728  <td style="width: 100%; text-align: right;">
729  <?php if($PermissionInfo['CanMakeTopics'][$ForumID]=="yes"&&$CanHaveTopics=="yes") { ?>
730  <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>
731  <?php } ?></td>
732 </tr>
733 </table>
734 <div class="DivTable2">&nbsp;</div>
735 <?php } } } ?>