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