Another small update
[iDB.git] / inc / replies.php.bak
blob924492480b7d7892a84e0c3405976871cdc620f7
1 <?php
2 /*
3     This program is free software; you can redistribute it and/or modify
4     it under the terms of the Revised BSD License.
6     This program is distributed in the hope that it will be useful,
7     but WITHOUT ANY WARRANTY; without even the implied warranty of
8     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9     Revised BSD License for more details.
11     Copyright 2004-2015 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2015 Game Maker 2k - http://gamemaker2k.org/
14     $FileInfo: replies.php - Last Update: 01/26/2017 SVN 810 - Author: cooldude2k $
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="replies.php"||$File3Name=="/replies.php") {
18         require('index.php');
19         exit(); }
20 $pstring = null; $pagenum = null;
21 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
22 if(!is_numeric($_GET['post'])) { $_GET['post'] = null; }
23 if(!is_numeric($_GET['page'])) { $_GET['page'] = 1; }
24 if(!isset($_GET['st'])) { $_GET['st'] = 0; }
25 if(!is_numeric($_GET['st'])) { $_GET['st'] = 0; }
26 if(!isset($_GET['modact'])) { $_GET['modact'] = null; }
27 if(!isset($_GET['link'])) { $_GET['link'] = "no"; } 
28 if(!isset($_GET['level'])) { $_GET['level'] = 1; } 
29 if(!is_numeric($_GET['level'])) { $_GET['level'] = 1; }
30 if($_GET['link']!="yes"&&$_GET['link']!="no") { $_GET['link'] = "no"; }
31 if($_GET['modact']=="pin"||$_GET['modact']=="unpin"||$_GET['modact']=="open"||
32         $_GET['modact']=="move"||$_GET['modact']=="close"||$_GET['modact']=="edit"||
33         $_GET['modact']=="delete"||$_GET['modact']=="announce")
34                 { $_GET['act'] = $_GET['modact']; }
35 if($_GET['act']=="announce") { $_GET['act'] = "pin"; $_GET['level'] = 2; }
36 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i".$ForumIgnoreList4." LIMIT 1", array($_GET['id']));
37 $preresult=sql_query($prequery,$SQLStat);
38 $prenum=sql_num_rows($preresult);
39 if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
40 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
41 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
42 if($prenum>=1) {
43 $TopicName=sql_result($preresult,0,"TopicName");
44 $TopicID=sql_result($preresult,0,"id");
45 $TopicForumID=sql_result($preresult,0,"ForumID");
46 $TopicCatID=sql_result($preresult,0,"CategoryID");
47 $TopicClosed=sql_result($preresult,0,"Closed");
48 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$TopicForumID]=="no") { 
49 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
50 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
51 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
52 if(!isset($_GET['post'])||$_GET['post']!==null) {
53 $NumberReplies=sql_result($preresult,0,"NumReply"); }
54 if(isset($_GET['post'])&&$_GET['post']!==null) {
55 $NumberReplies=1; }
56 $ViewTimes=sql_result($preresult,0,"NumViews");
57 sql_free_result($preresult);
58 $forumcheckx = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2."  LIMIT 1", array($TopicForumID));
59 $fmckresult=sql_query($forumcheckx,$SQLStat);
60 $fmcknum=sql_num_rows($fmckresult);
61 if($fmcknum==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
62 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
63 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
64 $ForumID=sql_result($fmckresult,0,"id");
65 $ForumName=sql_result($fmckresult,0,"Name");
66 $ForumType=sql_result($fmckresult,0,"ForumType");
67 $ForumShow=sql_result($fmckresult,0,"ShowForum");
68 $InSubForum=sql_result($fmckresult,0,"InSubForum");
69 if($InSubForum!=0) {
70 $subforumcheckx = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2."  LIMIT 1", array($InSubForum));
71 $subfmckresult=sql_query($subforumcheckx,$SQLStat);
72 $subfmcknum=sql_num_rows($subfmckresult);
73 $SubForumName=sql_result($subfmckresult,0,"Name");
74 $SubForumType=sql_result($subfmckresult,0,"ForumType");
75 $SubForumShow=sql_result($subfmckresult,0,"ShowForum");
76 sql_free_result($subfmckresult); }
77 if($ForumShow=="no") { $_SESSION['ShowActHidden'] = "yes"; }
78 $CanHaveTopics=sql_result($fmckresult,0,"CanHaveTopics");
79 $ForumPostCountView=sql_result($fmckresult,0,"PostCountView");
80 $ForumKarmaCountView=sql_result($fmckresult,0,"KarmaCountView");
81 sql_free_result($fmckresult);
82 $catcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2."  LIMIT 1", array($TopicCatID));
83 $catresult=sql_query($catcheck,$SQLStat);
84 $CategoryID=sql_result($catresult,0,"id");
85 $CategoryName=sql_result($catresult,0,"Name");
86 $CategoryShow=sql_result($catresult,0,"ShowCategory");
87 if($CategoryShow=="no") { $_SESSION['ShowActHidden'] = "yes"; }
88 $CategoryType=sql_result($catresult,0,"CategoryType");
89 $InSubCategory=sql_result($catresult,0,"InSubCategory");
90 $CategoryPostCountView=sql_result($catresult,0,"PostCountView");
91 $CategoryKarmaCountView=sql_result($catresult,0,"KarmaCountView");
92 sql_free_result($catresult);
93 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
94 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
95 if($MyKarmaCount==null) { $MyKarmaCount = 0; }
96 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
97 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
98 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
99 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
100 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
101 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
102 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
103 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
104 if($ForumCheck!="skip") {
106 <div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>"><?php echo $Settings['board_name']; ?></a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$CategoryType],$Settings['file_ext'],"act=view&id=".$TopicCatID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php echo $CategoryName; ?></a><?php echo $ThemeSet['NavLinkDivider']; if($InSubForum!=0 && $subfmcknum>0) { ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$InSubForum."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"><?php echo $SubForumName; ?></a><?php echo $ThemeSet['NavLinkDivider']; } ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$TopicForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"><?php echo $ForumName; ?></a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></div>
107 <div class="DivNavLinks">&nbsp;</div>
108 <?php }
109 if(!isset($CatPermissionInfo['CanViewCategory'][$TopicCatID])) {
110         $CatPermissionInfo['CanViewCategory'][$TopicCatID] = "no"; }
111 if($CatPermissionInfo['CanViewCategory'][$TopicCatID]=="no"||
112         $CatPermissionInfo['CanViewCategory'][$TopicCatID]!="yes") {
113 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
114 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
115 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
116 if(!isset($PermissionInfo['CanViewForum'][$TopicForumID])) {
117         $PermissionInfo['CanViewForum'][$TopicForumID] = "no"; }
118 if($PermissionInfo['CanViewForum'][$TopicForumID]=="no"||
119         $PermissionInfo['CanViewForum'][$TopicForumID]!="yes") {
120 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
121 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
122 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
123 if($_GET['act']!="view") { 
124 $CanMakeReply = "no"; $CanMakeTopic = "no";
125 if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes"&&$CanHaveTopics=="yes") { 
126         $CanMakeTopic = "yes"; }
127 if($TopicClosed==0&&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
128         $CanMakeReply = "yes"; }
129 if($TopicClosed==1&&$PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="yes"
130         &&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
131                 $CanMakeReply = "yes"; } ?>
132 <table style="width: 100%;" class="Table2">
133 <tr>
134  <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
135  <td style="width: 70%; text-align: right;">
136  <?php if($CatPermissionInfo['CanViewCategory'][$TopicCatID]=="yes"&&$PermissionInfo['CanViewForum'][$TopicForumID]=="yes") {
137  if($CanMakeReply=="yes") { ?>
138  <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=create&id=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $ThemeSet['AddReply']; ?></a>
139  <?php } if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") {
140         if($CanMakeTopic=="yes"&&$CanMakeReply=="yes") { ?>
141  <?php echo $ThemeSet['ButtonDivider']; } ?>
142  <a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=create&id=".$TopicForumID,$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ThemeSet['NewTopic']; ?></a>
143  <?php } ?></td>
144 </tr>
145 </table>
146 <div class="DivTable2">&nbsp;</div>
147 <?php } } if($_GET['act']=="view") {
148 if($ForumCheck!="skip") {
149 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=view&id=".$_GET['id']."&page=".$_GET['page'],"&","=",$prexqstr['topic'],$exqstr['topic']);
150 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
151 $_SESSION['ViewingFile'] = $exfile['topic'].$Settings['file_ext']; }
152 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
153 $_SESSION['ViewingFile'] = $exfile['topic']; }
154 $_SESSION['PreViewingTitle'] = "Viewing Topic:";
155 $_SESSION['ViewingTitle'] = $TopicName; 
156 $_SESSION['ExtraData'] = "currentact:".$_GET['act']."; currentcategoryid:".$InSubCategory.",".$CategoryID."; currentforumid:".$InSubForum.",".$ForumID."; currenttopicid:".$TopicID."; currentmessageid:0; currenteventid:0; currentmemberid:0;"; }
157 if($NumberReplies==null) { 
158         $NumberReplies = 0; }
159 $num=$NumberReplies+1;
160 //Start Reply Page Code
161 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
162 if($_GET['page']==null) { $_GET['page'] = 1; } 
163 if($_GET['page']<=0) { $_GET['page'] = 1; }
164 if($_GET['st']<=0||!isset($_GET['st'])) {
165 $nums = $_GET['page'] * $Settings['max_posts']; }
166 if($_GET['st']>0&&isset($_GET['st'])) {
167 $nums = $_GET['st']; }
168 if($nums>$num) { $nums = $num; }
169 $numz = $nums - $Settings['max_posts'];
170 if($numz<=0) { $numz = 0; }
171 //$i=$numz;
172 if($nums<$num) { $nextpage = $_GET['page'] + 1; }
173 if($nums>=$num) { $nextpage = $_GET['page']; }
174 if($numz>=$Settings['max_posts']) { $backpage = $_GET['page'] - 1; }
175 if($_GET['page']<=1) { $backpage = 1; }
176 $pnum = $num; $l = 1; $Pages = null;
177 while ($pnum>0) {
178 if($pnum>=$Settings['max_posts']) { 
179         $pnum = $pnum - $Settings['max_posts']; 
180         $Pages[$l] = $l; ++$l; }
181 if($pnum<$Settings['max_posts']&&$pnum>0) { 
182         $pnum = $pnum - $pnum; 
183         $Pages[$l] = $l; ++$l; } }
184 $snumber = $_GET['page'] - 1;
185 if($_GET['st']<=0||!isset($_GET['st'])) {
186 $PageLimit = $Settings['max_posts'] * $snumber; }
187 if($_GET['st']>0&&isset($_GET['st'])) {
188 $PageLimit = $_GET['st']; }
189 if($PageLimit<0) { $PageLimit = 0; }
190 //End Reply Page Code
191 $i=0;
192 if(!isset($_GET['post'])||$_GET['post']!==null) {
193 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC ".$SQLimit, array($_GET['id'],$PageLimit,$Settings['max_posts'])); }
194 if(isset($_GET['post'])&&$_GET['post']!==null) {
195 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i AND \"id\"=%i ORDER BY \"TimeStamp\" ASC ".$SQLimit, array($_GET['id'],$_GET['post'],$PageLimit,$Settings['max_posts'])); }
196 $result=sql_query($query,$SQLStat);
197 $num=sql_num_rows($result);
198 if($num==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
199 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
200 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
201 if($num!=0) { 
202 if($ViewTimes==0||$ViewTimes==null) { $NewViewTimes = 1; }
203 if($ViewTimes!=0&&$ViewTimes!=null) { $NewViewTimes = $ViewTimes + 1; }
204 $viewsup = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"NumViews\"='%s' WHERE \"id\"=%i", array($NewViewTimes,$_GET['id']));
205 sql_query($viewsup,$SQLStat); }
206 //List Page Number Code Start
207 $pagenum=count($Pages);
208 if($_GET['page']>$pagenum) {
209         $_GET['page'] = $pagenum; }
210 $pagei=0; $pstring = null;
211 if($pagenum>1) {
212 $pstring = "<div class=\"PageList\"><span class=\"pagelink\">".$pagenum." Pages:</span> "; }
213 if($_GET['page']<4) { $Pagez[0] = null; }
214 if($_GET['page']>=4) { $Pagez[0] = "First"; }
215 if($_GET['page']>=3) {
216 $Pagez[1] = $_GET['page'] - 2; }
217 if($_GET['page']<3) {
218 $Pagez[1] = null; }
219 if($_GET['page']>=2) {
220 $Pagez[2] = $_GET['page'] - 1; }
221 if($_GET['page']<2) {
222 $Pagez[2] = null; }
223 $Pagez[3] = $_GET['page'];
224 if($_GET['page']<$pagenum) {
225 $Pagez[4] = $_GET['page'] + 1; }
226 if($_GET['page']>=$pagenum) {
227 $Pagez[4] = null; }
228 $pagenext = $_GET['page'] + 1;
229 if($pagenext<$pagenum) {
230 $Pagez[5] = $_GET['page'] + 2; }
231 if($pagenext>=$pagenum) {
232 $Pagez[5] = null; }
233 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
234 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
235 $pagenumi=count($Pagez);
236 if($num==0) {
237 $pagenumi = 0;
238 $pstring = null; }
239 if($pagenum>1) {
240 while ($pagei < $pagenumi) {
241 if($_GET['page']!=1&&$pagei==1) {
242 $Pback = $_GET['page'] - 1;
243 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pback,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&lt;</a></span> "; }
244 if($Pagez[$pagei]!=null&&
245    $Pagez[$pagei]!="First"&&
246    $Pagez[$pagei]!="Last") {
247 if($pagei!=3) { 
248 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">".$Pagez[$pagei]."</a></span> "; }
249 if($pagei==3) { 
250 $pstring = $pstring."<span class=\"pagecurrent\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">".$Pagez[$pagei]."</a></span> "; } }
251 if($Pagez[$pagei]=="First") {
252 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&laquo;</a></span> "; }
253 if($Pagez[$pagei]=="Last") {
254 $ptestnext = $pagenext + 1;
255 $paget = $pagei - 1;
256 $Pnext = $_GET['page'] + 1;
257 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$Pnext,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&gt;</a></span> ";
258 if($ptestnext<$pagenum) {
259 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$pagenum,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&raquo;</a></span> "; } }
260         ++$pagei; } $pstring = $pstring."</div>"; }
261 //List Page Number Code end
262 $CanMakeReply = "no"; $CanMakeTopic = "no";
263 if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes"&&$CanHaveTopics=="yes") { 
264         $CanMakeTopic = "yes"; }
265 if($TopicClosed==0&&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
266         $CanMakeReply = "yes"; }
267 if($TopicClosed==1&&$PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="yes"
268         &&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
269                 $CanMakeReply = "yes"; }
270 if($pstring!=null||$CanMakeReply=="yes"||$CanMakeTopic=="yes") {
272 <table style="width: 100%;" class="Table2">
273 <tr>
274  <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
275  <td style="width: 70%; text-align: right;">
276  <?php if($CatPermissionInfo['CanViewCategory'][$TopicCatID]=="yes"&&$PermissionInfo['CanViewForum'][$TopicForumID]=="yes") {
277  if($CanMakeReply=="yes") { ?>
278  <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=create&id=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $ThemeSet['AddReply']; ?></a>
279  <?php } if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") {
280         if($CanMakeTopic=="yes"&&$CanMakeReply=="yes") { ?>
281  <?php echo $ThemeSet['ButtonDivider']; } ?>
282  <a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=create&id=".$TopicForumID,$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ThemeSet['NewTopic']; ?></a>
283  <?php } ?></td>
284 </tr>
285 </table>
286 <?php }
287 /* <div class="DivPageLinks">&nbsp;</div> */
289 <div class="DivTable2">&nbsp;</div>
290 <?php }
291 while ($i < $num) {
292 $MyPostID=sql_result($result,$i,"id");
293 $MyTopicID=sql_result($result,$i,"TopicID");
294 $MyPostIP=sql_result($result,$i,"IP");
295 $MyForumID=sql_result($result,$i,"ForumID");
296 $MyCategoryID=sql_result($result,$i,"CategoryID");
297 $MyUserID=sql_result($result,$i,"UserID");
298 $MyGuestName=sql_result($result,$i,"GuestName");
299 $MyTimeStamp=sql_result($result,$i,"TimeStamp");
300 $MyEditTime=sql_result($result,$i,"LastUpdate");
301 $MyEditUserID=sql_result($result,$i,"EditUser");
302 $MyEditUserName=sql_result($result,$i,"EditUserName");
303 $tmpusrcurtime = new DateTime();
304 $tmpusrcurtime->setTimestamp($MyTimeStamp);
305 $tmpusrcurtime->setTimezone($usertz);
306 $MyTimeStamp=$tmpusrcurtime->format($_SESSION['iDBDateFormat'].", ".$_SESSION['iDBTimeFormat']);
307 $MyPost=sql_result($result,$i,"Post");
308 $MyDescription=sql_result($result,$i,"Description");
309 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
310 $reresult=sql_query($requery,$SQLStat);
311 $renum=sql_num_rows($reresult);
312 if($renum<1) { $MyUserID = -1;
313 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
314 $reresult=sql_query($requery,$SQLStat);
315 $renum=sql_num_rows($reresult); }
316 $memrequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."mempermissions\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
317 $memreresult=sql_query($memrequery,$SQLStat);
318 $memrenum=sql_num_rows($memreresult);
319 $rei=0; $ipshow = "two";
320 $User1ID=$MyUserID; $GuestsName = $MyGuestName;
321 $User1Name=sql_result($reresult,$rei,"Name");
322 $User1IP=sql_result($reresult,$rei,"IP");
323 if($User1IP==$MyPostIP) { $ipshow = "one"; }
324 $User1Email=sql_result($reresult,$rei,"Email");
325 $User1Title=sql_result($reresult,$rei,"Title");
326 $PreUserCanExecPHP=sql_result($memreresult,$rei,"CanExecPHP");
327 if($PreUserCanExecPHP!="yes"&&$PreUserCanExecPHP!="no"&&$PreUserCanExecPHP!="group") {
328         $PreUserCanExecPHP = "no"; }
329 $PreUserCanDoHTML=sql_result($memreresult,$rei,"CanDoHTML");
330 if($PreUserCanDoHTML!="yes"&&$PreUserCanDoHTML!="no"&&$PreUserCanDoHTML!="group") {
331         $PreUserCanDoHTML = "no"; }
332 $PreUserCanUseBBTags=sql_result($memreresult,$rei,"CanUseBBTags");
333 if($PreUserCanUseBBTags!="yes"&&$PreUserCanUseBBTags!="no"&&$PreUserCanUseBBTags!="group") {
334         $PreUserCanUseBBTags = "no"; }
335 sql_free_result($memreresult);
336 $User1Joined=sql_result($reresult,$rei,"Joined");
337 $tmpusrcurtime = new DateTime();
338 $tmpusrcurtime->setTimestamp($User1Joined);
339 $tmpusrcurtime->setTimezone($usertz);
340 $User1Joined=$tmpusrcurtime->format($_SESSION['iDBDateFormat']);
341 $User1Hidden=sql_result($reresult,$rei,"HiddenMember");
342 $User1LevelID=sql_result($reresult,$rei,"LevelID");
343 $lquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."levels\" WHERE \"id\"=%i LIMIT 1", array($User1LevelID));
344 $lresult=sql_query($lquery,$SQLStat);
345 $User1Level=sql_result($lresult,0,"Name");
346 $User1GroupID=sql_result($reresult,$rei,"GroupID");
347 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($User1GroupID));
348 $gresult=sql_query($gquery,$SQLStat);
349 $User1Group=sql_result($gresult,0,"Name");
350 $User1CanExecPHP = $PreUserCanExecPHP;
351 if($PreUserCanExecPHP=="group") {
352 $User1CanExecPHP=sql_result($gresult,0,"CanExecPHP"); }
353 if($User1CanExecPHP!="yes"&&$User1CanExecPHP!="no") {
354         $User1CanExecPHP = "no"; }
355 $User1CanDoHTML = $PreUserCanDoHTML;
356 if($PreUserCanDoHTML=="group") {
357 $User1CanDoHTML=sql_result($gresult,0,"CanDoHTML"); }
358 if($User1CanDoHTML!="yes"&&$User1CanDoHTML!="no") {
359         $User1CanDoHTML = "no"; }
360 $User1CanUseBBTags = $PreUserCanUseBBTags;
361 if($User1CanUseBBTags=="group") {
362 $User1CanUseBBTags=sql_result($gresult,0,"CanUseBBTags"); }
363 if($User1CanUseBBTags!="yes"&&$User1CanUseBBTags!="no") {
364         $User1CanUseBBTags = "no"; }
365 $GroupNamePrefix=sql_result($gresult,0,"NamePrefix");
366 $GroupNameSuffix=sql_result($gresult,0,"NameSuffix");
367 $User1PermissionID=sql_result($gresult,0,"PermissionID");
368 sql_free_result($gresult); sql_free_result($lresult);
369 $per1query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."permissions\" WHERE \"PermissionID\"=%i LIMIT 1", array($User1PermissionID));
370 $per1esult=sql_query($per1query,$SQLStat);
371 $per1num=sql_num_rows($per1esult);
372 $User1CanDoHTML1=sql_result($per1esult,0,"CanDoHTML");
373 if($User1CanDoHTML1!="yes"&&$User1CanDoHTML1!="no") {
374         $User1CanDoHTML1 = "no"; }
375 $User1CanUseBBTags1=sql_result($per1esult,0,"CanUseBBTags");
376 if($User1CanUseBBTags1!="yes"&&$User1CanUseBBTags1!="no") {
377         $User1CanUseBBTags1 = "no"; }
378 sql_free_result($per1esult);
379 if($User1Title=="") { $User1Title = $User1Group; }
380 $User1Signature=sql_result($reresult,$rei,"Signature");
381 $User1Avatar=sql_result($reresult,$rei,"Avatar");
382 $User1AvatarSize=sql_result($reresult,$rei,"AvatarSize");
383 if ($User1Avatar=="http://"||$User1Avatar==null||
384         strtolower($User1Avatar)=="noavatar") {
385 $User1Avatar=$ThemeSet['NoAvatar'];
386 $User1AvatarSize=$ThemeSet['NoAvatarSize']; }
387 $AvatarSize1=explode("x", $User1AvatarSize);
388 $AvatarSize1W=$AvatarSize1[0]; $AvatarSize1H=$AvatarSize1[1];
389 $User1Website=sql_result($reresult,$rei,"Website");
390 if($User1Website=="http://") { 
391         $User1Website = $Settings['idburl']; }
392 $User1Website = urlcheck($User1Website);
393 $BoardWWWChCk = parse_url($Settings['idburl']);
394 $User1WWWChCk = parse_url($User1Website);
395 $opennew = " onclick=\"window.open(this.href);return false;\"";
396 if($BoardWWWChCk['host']==$User1WWWChCk['host']) {
397         $opennew = null; }
398 $User1PostCount=sql_result($reresult,$rei,"PostCount");
399 $User1Karma=sql_result($reresult,$rei,"Karma");
400 $User1IP=sql_result($reresult,$rei,"IP");
401 sql_free_result($reresult);
402 if($User1Name=="Guest") { $User1Name=$GuestsName;
403 if($User1Name==null) { $User1Name="Guest"; } }
404 if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
405         $User1Name = $GroupNamePrefix.$User1Name; }
406 if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
407         $User1Name = $User1Name.$GroupNameSuffix; }
408 $MySubPost = null;
409 if($MyEditTime!=$MyTimeStamp&&$MyEditUserID!=0) {
410 if($MyEditUserID!=$MyUserID) {
411 $euquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyEditUserID));
412 $euresult = sql_query($euquery,$SQLStat);
413 $eunum = sql_num_rows($euresult);
414 if($eunum<1) { $MyEditUserID = -1;
415 $euquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyEditUserID));
416 $euresult = sql_query($euquery,$SQLStat);
417 $eunum = sql_num_rows($euresult); }
418         $EditUserID = $MyEditUserID;
419         $EditUserGroupID = sql_result($euresult,0,"GroupID");
420         $EditUserHidden=sql_result($euresult,0,"HiddenMember");
421         $EditUserName = sql_result($euresult,0,"Name");
422         sql_free_result($euresult);
423         $eugquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($EditUserGroupID));
424         $eugresult=sql_query($eugquery,$SQLStat);
425         $EditUserGroup=sql_result($eugresult,0,"Name");
426         $EditUserNamePrefix=sql_result($eugresult,0,"NamePrefix");
427         $EditUserNameSuffix=sql_result($eugresult,0,"NameSuffix");
428         sql_free_result($eugresult);    }
429         if($MyEditUserID==$MyUserID) {
430         $EditUserID = $User1ID;
431         $EditUserGroupID = $User1GroupID;
432         $EditUserHidden=$User1Hidden;
433         $EditUserName = $User1Name;
434         $EditUserGroup=$User1Group;
435         $EditUserNamePrefix=null;
436         $EditUserNameSuffix=null; }
437         if($EditUserName=="Guest") { $EditUserName=$MyEditUserName;
438         if($EditUserName==null) { $EditUserName="Guest"; } }
439         if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
440                 $EditUserName = $EditUserNamePrefix.$EditUserName; }
441         if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
442                 $EditUserName = $EditUserName.$EditUserNameSuffix; }
443         $tmpusrcurtime = new DateTime();
444         $tmpusrcurtime->setTimestamp($MyEditTime);
445         $tmpusrcurtime->setTimezone($usertz);
446         $MyEditTime = $tmpusrcurtime->format($_SESSION['iDBDateFormat'].", ".$_SESSION['iDBTimeFormat']);
447         $MySubPost = "<div class=\"EditReply\"><br />This post has been edited by <b>".$EditUserName."</b> on ".$MyEditTime."</div>"; }
448 if($User1CanUseBBTags1=="yes") { $MyPost = bbcode_parser($MyPost); }
449 if($User1CanExecPHP=="no") {
450 $MyPost = preg_replace("/\[ExecPHP\](.*?)\[\/ExecPHP\]/is","<span style=\"color: red; font-weight: bold;\">ERROR:</span> cannot execute php code.",$MyPost); }
451 if($User1CanExecPHP=="yes") { $MyPost = php_execute($MyPost); }
452 if($User1CanDoHTML1=="no") {
453 $MyPost = preg_replace("/\[DoHTML\](.*?)\[\/DoHTML\]/is","<span style=\"color: red; font-weight: bold;\">ERROR:</span> cannot execute html.",$MyPost); }
454 if($User1CanDoHTML1=="yes") { $MyPost = do_html_bbcode($MyPost); }
455 $MyPost = text2icons($MyPost,$Settings['sqltable'],$SQLStat);
456 $MyPost = preg_replace("/\<br\>/", "<br />", nl2br($MyPost));
457 $MyPost = url2link($MyPost);
458 if($MySubPost!=null) { $MyPost = $MyPost."\n".$MySubPost; }
459 if($User1CanUseBBTags=="yes") { $User1Signature = bbcode_parser($User1Signature); }
460 if($User1CanExecPHP=="no") {
461 $User1Signature = preg_replace("/\[ExecPHP\](.*?)\[\/ExecPHP\]/is","<span style=\"color: red; font-weight: bold;\">ERROR:</span> cannot execute php code.",$User1Signature); }
462 if($User1CanExecPHP=="yes") { $User1Signature = php_execute($User1Signature); }
463 if($User1CanDoHTML1=="no") {
464 $User1Signature = preg_replace("/\[DoHTML\](.*?)\[\/DoHTML\]/is","<span style=\"color: red; font-weight: bold;\">ERROR:</span> cannot execute html.",$User1Signature); }
465 if($User1CanDoHTML=="yes") { $User1Signature = do_html_bbcode($User1Signature); }
466 $User1Signature = text2icons($User1Signature,$Settings['sqltable'],$SQLStat);
467 $User1Signature = preg_replace("/\<br\>/", "<br />", nl2br($User1Signature));
468 $User1Signature = url2link($User1Signature);
469 $CanEditReply = false; $CanDeleteReply = false;
470 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
471 if($PermissionInfo['CanEditReplys'][$MyForumID]=="yes"&&
472         $_SESSION['UserID']==$MyUserID) { $CanEditReply = true; }
473 if($PermissionInfo['CanDeleteReplys'][$MyForumID]=="yes"&&
474         $_SESSION['UserID']==$MyUserID) { $CanDeleteReply = true; }
475 if($PermissionInfo['CanModForum'][$MyForumID]=="yes") { 
476         $CanEditReply = true; $CanDeleteReply = true; } }
477 if($_SESSION['UserID']==0) { 
478         $CanEditReply = false; $CanDeleteReply = false; }
479 $ReplyNum = $i + $PageLimit + 1;
481 <div class="TableInfo1Border" id="reply<?php echo $ReplyNum; ?>">
482 <?php if($ThemeSet['TableStyle']=="div") { ?>
483 <div class="TableInfoRow1">
484 <span style="font-weight: bold; text-align: left;"><?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."&#35;reply".$ReplyNum; ?>"><?php echo $TopicName; ?></a> ( <?php echo $MyDescription; ?> )</span>
485 </div>
486 <?php } ?>
487 <table class="TableInfo1" id="post<?php echo $MyPostID; ?>">
488 <?php if($ThemeSet['TableStyle']=="table") { ?>
489 <tr class="TableInfoRow1">
490 <td class="TableInfoColumn1" colspan="2"><span style="font-weight: bold; text-align: left;"><?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."&#35;reply".$ReplyNum; ?>"><?php echo $TopicName; ?></a> ( <?php echo $MyDescription; ?> )</span>
491 </td>
492 </tr><?php } ?>
493 <tr class="TableInfoRow2">
494 <td class="TableInfoColumn2" style="vertical-align: middle; width: 160px;">
495 &nbsp;<?php
496 if($User1ID>0&&$User1Hidden=="no") {
497 echo "<a href=\"";
498 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$User1ID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
499 echo "\">".$User1Name."</a>"; }
500 if($User1ID<=0||$User1Hidden=="yes") {
501 echo "<span>".$User1Name."</span>"; }
502 ?></td>
503 <td class="TableInfoColumn2" style="vertical-align: middle;">
504 <div style="float: left; text-align: left;">
505 <span style="font-weight: bold; vertical-align: middle;">Time Posted: </span><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&post=".$MyPostID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>" style="vertical-align: middle;"><?php echo $MyTimeStamp; ?></a>
506 </div>
507 <div style="float: right;">
508 <?php if(isset($ThemeSet['Report'])&&$ThemeSet['Report']!=null) { ?>
509 <a href="#Act/Report"><?php echo $ThemeSet['Report']; ?></a>
510 <?php } if($CanEditReply===true&&isset($ThemeSet['EditReply'])&&$ThemeSet['EditReply']!=null) {
511 echo $ThemeSet['LineDividerTopic']; echo "<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=edit&id=".$MyTopicID."&post=".$MyPostID."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">".$ThemeSet['EditReply']; ?></a>
512 <?php } if($CanDeleteReply===true&&isset($ThemeSet['DeleteReply'])&&$ThemeSet['DeleteReply']!=null) { 
513 echo $ThemeSet['LineDividerTopic']; echo "<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=delete&id=".$MyTopicID."&post=".$MyPostID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">".$ThemeSet['DeleteReply']; ?></a>
514 <?php } if($CanMakeReply=="yes"&&isset($ThemeSet['QuoteReply'])&&$ThemeSet['QuoteReply']!=null) { 
515 echo $ThemeSet['LineDividerTopic']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=create&id=".$TopicID."&post=".$MyPostID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $ThemeSet['QuoteReply']; ?></a>
516 <?php } ?>&nbsp;</div>
517 </td>
518 </tr>
519 <tr class="TableInfoRow3">
520 <td class="TableInfoColumn3" style="vertical-align: top; width: 180px;">
521 <?php  // Avatar Table Thanks For SeanJ's Help at http://seanj.jcink.com/  
522  ?>
523  <table class="AvatarTable" style="width: 100px; height: 100px; text-align: center;">
524         <tr class="AvatarRow" style="width: 100%; height: 100%;">
525                 <td class="AvatarRow" style="width: 100%; height: 100%; text-align: center; vertical-align: middle;">
526                 <img src="<?php echo $User1Avatar; ?>" alt="<?php echo $User1Name; ?>'s Avatar" title="<?php echo $User1Name; ?>'s Avatar" style="border: 0px; width: <?php echo $AvatarSize1W; ?>px; height: <?php echo $AvatarSize1H; ?>px;" />
527                 </td>
528         </tr>
529  </table><br />
530 <?php echo $User1Title; ?><br />
531 Group: <?php echo $User1Group; ?><br />
532 Level: <?php echo $User1Level; ?><br />
533 Member: <?php 
534 if($User1ID>0&&$User1Hidden=="no") { echo $User1ID; }
535 if($User1ID<=0||$User1Hidden=="yes") { echo 0; }
536 ?><br />
537 Posts: <?php echo $User1PostCount; ?><br />
538 Karma: <?php echo $User1Karma; ?><br />
539 Joined: <?php echo $User1Joined; ?><br />
540 <?php if($GroupInfo['CanViewIPAddress']=="yes") { ?>
541 User IP: <a onclick="window.open(this.href);return false;" href="<?php echo sprintf($IPCheckURL,$User1IP); ?>">
542 <?php echo $User1IP; ?></a><br />
543 <?php if($ipshow=="two") { ?>
544 Post IP: <a onclick="window.open(this.href);return false;" href="<?php echo sprintf($IPCheckURL,$MyPostIP); ?>">
545 <?php echo $MyPostIP; ?></a><br />
546 <?php } } ?><br />
547 </td>
548 <td class="TableInfoColumn3" style="vertical-align: middle;">
549 <div class="replypost"><?php echo $MyPost; ?></div>
550 <?php if(isset($User1Signature)&&$User1Signature!="") { ?> <br />--------------------
551 <div class="signature"><?php echo $User1Signature; ?></div><?php } ?>
552 </td>
553 </tr>
554 <tr class="TableInfoRow4">
555 <td class="TableInfoColumn4" colspan="2">
556 <span style="text-align: left; float: left;">&nbsp;<a href="<?php
557 if($User1ID>0&&$User1Hidden=="no"&&isset($ThemeSet['Profile'])&&$ThemeSet['Profile']!=null) {
558 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$User1ID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); }
559 if(($User1ID<=0||$User1Hidden=="yes")&&isset($ThemeSet['Profile'])&&$ThemeSet['Profile']!=null) {
560 echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); }
561 ?>"><?php echo $ThemeSet['Profile']; ?></a>
562 <?php if(isset($ThemeSet['WWW'])&&$ThemeSet['WWW']!=null) {
563 echo $ThemeSet['LineDividerTopic']; ?><a href="<?php echo $User1Website; ?>"<?php echo $opennew; ?>><?php echo $ThemeSet['WWW']; ?></a><?php } echo $ThemeSet['LineDividerTopic']; ?><a href="<?php
564 if($User1ID>0&&$User1Hidden=="no"&&isset($ThemeSet['PM'])&&$ThemeSet['PM']!=null) {
565 echo url_maker($exfile['messenger'],$Settings['file_ext'],"act=create&id=".$User1ID,$Settings['qstr'],$Settings['qsep'],$prexqstr['messenger'],$exqstr['messenger']); }
566 if(($User1ID<=0||$User1Hidden=="yes")&&isset($ThemeSet['PM'])&&$ThemeSet['PM']!=null) {
567 echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); }
568 ?>"><?php echo $ThemeSet['PM']; ?></a></span>
569 <span style="text-align: right; float: right; font-weight: bold;"><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&post=".$MyPostID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>" title="Link to post #<?php echo $ReplyNum; ?>" style="vertical-align: middle; font-weight: bold;">
570 #<?php echo $ReplyNum; ?></a>&nbsp;</span>
571 </td>
572 </tr>
573 </table></div>
574 <div class="DivReplies">&nbsp;</div>
575 <?php ++$i; } sql_free_result($result); } 
576 if(($utccurtime->getTimestamp()<$_SESSION['LastPostTime']&&$_SESSION['LastPostTime']!=0)&&
577 ($_GET['act']=="create"||$_GET['act']=="edit"||$_GET['act']=="makereply"||$_GET['act']=="editreply")) { 
578 $_GET['act'] = "view"; $_POST['act'] = null; 
579 redirect("refresh",$rbasedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],FALSE),"3"); ?>
580 <div class="Table1Border">
581 <?php if($ThemeSet['TableStyle']=="div") { ?>
582 <div class="TableRow1">
583 <span style="text-align: left;">
584 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span></div>
585 <?php } ?>
586 <table class="Table1">
587 <?php if($ThemeSet['TableStyle']=="table") { ?>
588 <tr class="TableRow1">
589 <td class="TableColumn1"><span style="text-align: left;">
590 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span>
591 </td>
592 </tr><?php } ?>
593 <tr class="TableRow2">
594 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Make Reply Message: </th>
595 </tr>
596 <tr class="TableRow3">
597 <td class="TableColumn3">
598 <table style="width: 100%; height: 25%; text-align: center;">
599 <tr>
600         <td><span class="TableMessage"><br />
601         You have to wait before making/editing another post.<br />
602         Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">here</a> to view your reply.<br />&nbsp;
603         </span><br /></td>
604 </tr>
605 </table>
606 </td></tr>
607 <tr class="TableRow4">
608 <td class="TableColumn4">&nbsp;</td>
609 </tr>
610 </table></div>
611 <div class="DivMkReply">&nbsp;</div>
612 <?php } if($_GET['act']=="create") {
613 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
614 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
615 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
616 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
617 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
618 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
619 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
620 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
621 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
622 if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="no") { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
623 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
624 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
625 if($PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
626 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
627 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
628 $QuoteReply = null; $QuoteDescription = null;
629 if($_GET['post']==null) {
630 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC  LIMIT 1", array($_GET['id']));
631 $result=sql_query($query,$SQLStat);
632 $num=sql_num_rows($result);
633 $QuoteDescription=sql_result($result,0,"Description"); 
634 $QuoteDescription = str_replace("Re: ","",$QuoteDescription);
635 $QuoteDescription = "Re: ".$QuoteDescription;
636 sql_free_result($result); }
637 if($_GET['post']!=null) {
638 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"id\"=%i LIMIT 1", array($_GET['post']));
639 $result=sql_query($query,$SQLStat);
640 $num=sql_num_rows($result);
641 if($num>=1) {
642 $QuoteReplyID=sql_result($result,0,"id");
643 $QuoteReplyFID=sql_result($result,0,"ForumID");
644 $QuoteReplyCID=sql_result($result,0,"CategoryID");
645 $QuoteUserID=sql_result($result,0,"UserID");
646 $QuoteReply=sql_result($result,0,"Post");
647 $QuoteReply = preg_replace("/\[ExecPHP\](.*?)\[\/ExecPHP\]/is","",$QuoteReply);
648 $QuoteDescription=sql_result($result,0,"Description");
649 $QuoteGuestName=sql_result($result,0,"GuestName");
650 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($QuoteUserID));
651 $reresult=sql_query($requery,$SQLStat);
652 $renum=sql_num_rows($reresult);
653 if($renum<1) { $QuoteUserID = -1;
654 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($QuoteUserID));
655 $reresult=sql_query($requery,$SQLStat);
656 $renum=sql_num_rows($reresult); }
657 $QuoteUserName=sql_result($reresult,0,"Name");
658 if($QuoteUserName=="Guest") { $QuoteUserName=$QuoteGuestName;
659 if($QuoteUserName==null) { $QuoteUserName="Guest"; } }
660 $QuoteUserName = stripcslashes(htmlspecialchars($QuoteUserName, ENT_QUOTES, $Settings['charset']));
661 //$QuoteUserName = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $QuoteUserName);
662 $QuoteUserName = remove_spaces($QuoteUserName);
663 /*$QuoteReply = stripcslashes(htmlspecialchars($QuoteReply, ENT_QUOTES, $Settings['charset']));
664 $QuoteReply = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $QuoteReply);
665 //$QuoteReply = remove_spaces($QuoteReply);*/
666 $QuoteReply = remove_bad_entities($QuoteReply);
667 $QuoteDescription = str_replace("Re: ","",$QuoteDescription);
668 $QuoteDescription = "Re: ".$QuoteDescription;
669 $QuoteReply = $QuoteUserName.":\n(&quot;".$QuoteReply."&quot;)";
670 if(!isset($PermissionInfo['CanViewForum'][$QuoteReplyFID])) {
671         $PermissionInfo['CanViewForum'][$QuoteReplyFID] = "no"; }
672 if($PermissionInfo['CanViewForum'][$QuoteReplyFID]=="no") {
673         $QuoteReply = null; $QuoteDescription = null; }
674 if(!isset($CatPermissionInfo['CanViewCategory'][$QuoteReplyCID])) {
675         $CatPermissionInfo['CanViewCategory'][$QuoteReplyCID] = "no"; }
676 if($CatPermissionInfo['CanViewCategory'][$QuoteReplyCID]=="no") {
677         $QuoteReply = null; $QuoteDescription = null; } } }
678 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
679 if($_GET['post']!=null&&$num>=1) {
680 $rforumcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2."  LIMIT 1", array($QuoteReplyFID));
681 $rfmckresult=sql_query($rforumcheck,$SQLStat);
682 $rForumPostCountView=sql_result($rfmckresult,0,"PostCountView");
683 $rForumKarmaCountView=sql_result($rfmckresult,0,"KarmaCountView");
684 sql_free_result($rfmckresult);
685 $rcatcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2."  LIMIT 1", array($QuoteReplyCID));
686 $rcatresult=sql_query($rcatcheck,$SQLStat);
687 $rCategoryPostCountView=sql_result($rcatresult,0,"PostCountView");
688 $rCategoryKarmaCountView=sql_result($rcatresult,0,"KarmaCountView");
689 sql_free_result($rcatresult);
690 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
691 if($rForumPostCountView!=0&&$MyPostCountChk<$rForumPostCountView) {
692 $QuoteReply = null; $QuoteDescription = null; }
693 if($rCategoryPostCountView!=0&&$MyPostCountChk<$rCategoryPostCountView) {
694 $QuoteReply = null; $QuoteDescription = null; }
695 if($rForumKarmaCountView!=0&&$MyKarmaCount<$rForumKarmaCountView) {
696 $QuoteReply = null; $QuoteDescription = null; }
697 if($rCategoryKarmaCountView!=0&&$MyKarmaCount<$rCategoryKarmaCountView) {
698 $QuoteReply = null; $QuoteDescription = null; } } }
699 if($_GET['post']==null||$num<1) { $QuoteReply = null; /*$QuoteDescription = null;*/ }
700 $UFID = rand_uuid("rand");
701 $_SESSION['UserFormID'] = $UFID;
703 <div class="Table1Border">
704 <?php if($ThemeSet['TableStyle']=="div") { ?>
705 <div class="TableRow1">
706 <span style="text-align: left;">
707 <?php echo $ThemeSet['TitleIcon']; ?><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 $TopicID; ?>"><?php echo $TopicName; ?></a></span></div>
708 <?php } ?>
709 <table class="Table1" id="MakeReply<?php echo $TopicForumID; ?>">
710 <?php if($ThemeSet['TableStyle']=="table") { ?>
711 <tr class="TableRow1" id="ReplyStart<?php echo $TopicForumID; ?>">
712 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
713 <?php echo $ThemeSet['TitleIcon']; ?><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 $TopicID; ?>"><?php echo $TopicName; ?></a></span>
714 </td>
715 </tr><?php } ?>
716 <tr id="MakeReplyRow<?php echo $TopicForumID; ?>" class="TableRow2">
717 <td class="TableColumn2" colspan="2" style="width: 100%;">Making a Reply in Topic <?php echo $TopicName; ?></td>
718 </tr>
719 <tr class="TableRow3" id="MkReply<?php echo $TopicForumID; ?>">
720 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
721 <div style="width: 100%; height: 160px; overflow: auto;">
722 <table style="width: 100%; text-align: center;"><?php
723 $renee_query=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."smileys\" WHERE \"Display\"='yes'", array(null));
724 $renee_result=sql_query($renee_query,$SQLStat);
725 $renee_num=sql_num_rows($renee_result);
726 $renee_s=0; $rose_a=0; $SmileRow=0; $SmileCRow=0;
727 while ($renee_s < $renee_num) { ++$SmileRow;
728 $FileName=sql_result($renee_result,$renee_s,"FileName");
729 $SmileName=sql_result($renee_result,$renee_s,"SmileName");
730 $SmileText=sql_result($renee_result,$renee_s,"SmileText");
731 $SmileDirectory=sql_result($renee_result,$renee_s,"Directory");
732 $ShowSmile=sql_result($renee_result,$renee_s,"Display");
733 $ReplaceType=sql_result($renee_result,$renee_s,"ReplaceCI");
734 if($SmileRow==1) { ?><tr>
735         <?php } if($SmileRow<5) { ++$SmileCRow; ?>
736         <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('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" /></td>
737         <?php ++$rose_a; } if($SmileRow==5) { ++$SmileCRow; $rose_a = 0; ?>
738         <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('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" /></td></tr>
739         <?php $SmileCRow=0; $SmileRow=0; }
740 ++$renee_s; }
741 if($SmileCRow<5&&$SmileCRow!=0) {
742 $SmileCRowL = 5 - $SmileCRow;
743 echo "<td colspan=\"".$SmileCRowL."\">&nbsp;</td></tr>"; }
744 echo "</table>";
745 sql_free_result($renee_result);
746 ?></div></td>
747 <td class="TableColumn3" style="width: 85%;">
748 <form style="display: inline;" method="post" id="MkReplyForm" action="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=makereply&id=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">
749 <table style="text-align: left;">
750 <tr style="text-align: left;">
751         <td style="width: 50%;"><label class="TextBoxLabel" for="ReplyDesc">Insert Reply Description:</label></td>
752         <td style="width: 50%;"><input maxlength="45" type="text" name="ReplyDesc" class="TextBox" id="ReplyDesc" size="20" value="<?php echo $QuoteDescription; ?>" /></td>
753 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
754         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
755         <?php if(!isset($_SESSION['GuestName'])) { ?>
756         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
757         <?php } if(isset($_SESSION['GuestName'])) { ?>
758         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
759 <?php } ?></tr><?php } ?>
760 </table>
761 <table style="text-align: left;">
762 <tr style="text-align: left;">
763 <td style="width: 100%;">
764 <label class="TextBoxLabel" for="ReplyPost">Insert Your Reply:</label><br />
765 <textarea rows="10" name="ReplyPost" id="ReplyPost" cols="40" class="TextBox"><?php echo $QuoteReply; ?></textarea><br />
766 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
767 <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 />
768 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
769 <?php } ?>
770 <input type="hidden" name="act" value="makereplies" style="display: none;" />
771 <input type="hidden" style="display: none;" name="fid" value="<?php echo $UFID; ?>" />
772 <input type="hidden" style="display: none;" name="ubid" value="<?php echo $Settings['BoardUUID']; ?>" />
773 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
774 <input type="hidden" name="GuestName" value="null" style="display: none;" />
775 <?php } ?>
776 <input type="submit" class="Button" value="Make Reply" name="make_reply" />
777 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
778 </td></tr></table>
779 </form></td></tr>
780 <tr id="MkReplyEnd<?php echo $TopicForumID; ?>" class="TableRow4">
781 <td class="TableColumn4" colspan="2">&nbsp;</td>
782 </tr>
783 </table></div>
784 <div class="DivMkReply">&nbsp;</div>
785 <?php } if($_GET['act']=="makereply"&&$_POST['act']=="makereplies") {
786 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
787 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
788 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
789 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
790 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
791 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
792 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
793 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
794 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
795 if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="no") { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
796 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
797 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
798 if($PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
799 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
800 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
801 $MyUsersID = $_SESSION['UserID']; if($MyUsersID=="0"||$MyUsersID==null) { $MyUsersID = -1; }
802 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
803 $URL['REFERER'] = $REFERERurl['host'];
804 $URL['HOST'] = $_SERVER["SERVER_NAME"];
805 $REFERERurl = null;
806 if(!isset($_POST['ReplyDesc'])) { $_POST['ReplyDesc'] = null; }
807 if(!isset($_POST['ReplyPost'])) { $_POST['ReplyPost'] = null; }
808 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
809 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
810         $Settings['captcha_guest']=="on") {
811 require($SettDir['inc']."captcha.php"); }
813 <div class="Table1Border">
814 <?php if($ThemeSet['TableStyle']=="div") { ?>
815 <div class="TableRow1">
816 <span style="text-align: left;">
817 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>#<?php echo $TopicID; ?>"><?php echo $TopicName; ?></a></span></div>
818 <?php } ?>
819 <table class="Table1">
820 <?php if($ThemeSet['TableStyle']=="table") { ?>
821 <tr class="TableRow1">
822 <td class="TableColumn1"><span style="text-align: left;">
823 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>#<?php echo $TopicID; ?>"><?php echo $TopicName; ?></a></span>
824 </td>
825 </tr><?php } ?>
826 <tr class="TableRow2">
827 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Make Reply Message: </th>
828 </tr>
829 <tr class="TableRow3">
830 <td class="TableColumn3">
831 <table style="width: 100%; height: 25%; text-align: center;">
832 <?php if (pre_strlen($_POST['ReplyDesc'])>"80") { $Error="Yes";  ?>
833 <tr>
834         <td><span class="TableMessage">
835         <br />Your Reply Description is too big.<br />
836         </span>&nbsp;</td>
837 </tr>
838 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
839         $Settings['captcha_guest']=="on") {
840 if (PhpCaptcha::Validate($_POST['signcode'])) {
841 //echo 'Valid code entered';
842 } else { $Error="Yes"; ?>
843 <tr>
844         <td><span class="TableMessage">
845         <br />Invalid code entered<br />
846         </span>&nbsp;</td>
847 </tr>
848 <?php } } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
849         pre_strlen($_POST['GuestName'])>"30") { $Error="Yes"; ?>
850 <tr>
851         <td><span class="TableMessage">
852         <br />You Guest Name is too big.<br />
853         </span>&nbsp;</td>
854 </tr>
855 <?php } if($_POST['fid']!=$_SESSION['UserFormID']) { $Error="Yes";  ?>
856 <tr>
857         <td><span class="TableMessage">
858         <br />Sorry the referering url dose not match our host name.<br />
859         </span>&nbsp;</td>
860 </tr>
861 <?php } if($_POST['ubid']!=$Settings['BoardUUID']) { $Error="Yes";  ?>
862 <tr>
863         <td><span class="TableMessage">
864         <br />Sorry the referering url dose not match our host name.<br />
865         </span>&nbsp;</td>
866 </tr>
867 <?php } if ($Settings['TestReferer']=="on") {
868         if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
869 <tr>
870         <td><span class="TableMessage">
871         <br />Sorry the referering url dose not match our host name.<br />
872         </span>&nbsp;</td>
873 </tr>
874 <?php } }
875 $_POST['ReplyDesc'] = stripcslashes(htmlspecialchars($_POST['ReplyDesc'], ENT_QUOTES, $Settings['charset']));
876 //$_POST['ReplyDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyDesc']);
877 $_POST['ReplyDesc'] = remove_spaces($_POST['ReplyDesc']);
878 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
879 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
880 $_POST['GuestName'] = remove_spaces($_POST['GuestName']);
881 $_POST['ReplyPost'] = stripcslashes(htmlspecialchars($_POST['ReplyPost'], ENT_QUOTES, $Settings['charset']));
882 //$_POST['ReplyPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyPost']);
883 //$_POST['ReplyPost'] = remove_spaces($_POST['ReplyPost']);
884 $_POST['ReplyPost'] = remove_bad_entities($_POST['ReplyPost']);
885 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
886 if(isset($_POST['GuestName'])&&$_POST['GuestName']!=null) {
887 if($cookieDomain==null) {
888 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir); }
889 if($cookieDomain!=null) {
890 if($cookieSecure===true) {
891 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain, 1); }
892 if($cookieSecure===false) {
893 setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir, $cookieDomain); } }
894 $_SESSION['GuestName']=$_POST['GuestName']; } }
895 /*    <_<  iWordFilter  >_>      
896    by Kazuki Przyborowski - Cool Dude 2k */
897 $katarzynaqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."wordfilter\"", array(null));
898 $katarzynart=sql_query($katarzynaqy,$SQLStat);
899 $katarzynanm=sql_num_rows($katarzynart);
900 $katarzynas=0;
901 while ($katarzynas < $katarzynanm) {
902 $Filter=sql_result($katarzynart,$katarzynas,"FilterWord");
903 $Replace=sql_result($katarzynart,$katarzynas,"Replacement");
904 $CaseInsensitive=sql_result($katarzynart,$katarzynas,"CaseInsensitive");
905 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
906 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
907 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
908 $WholeWord=sql_result($katarzynart,$katarzynas,"WholeWord");
909 if($WholeWord=="on") { $WholeWord = "yes"; }
910 if($WholeWord=="off") { $WholeWord = "no"; }
911 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
912 $Filter = preg_quote($Filter, "/");
913 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
914 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyDesc']); 
915 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyPost']); }
916 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
917 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyDesc']); 
918 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyPost']); }
919 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
920 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyDesc']); 
921 $_POST['ReplyPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyPost']); }
922 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
923 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyDesc']); 
924 $_POST['ReplyPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyPost']); }
925 ++$katarzynas; } sql_free_result($katarzynart);
926 if ($_POST['ReplyDesc']==null) { $Error="Yes"; ?>
927 <tr>
928         <td><span class="TableMessage">
929         <br />You need to enter a Reply Description.<br />
930         </span>&nbsp;</td>
931 </tr>
932 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
933         $_POST['GuestName']==null) { $Error="Yes"; ?>
934 <tr>
935         <td><span class="TableMessage">
936         <br />You need to enter a Guest Name.<br />
937         </span>&nbsp;</td>
938 </tr>
939 <?php } if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="no") { $Error="Yes"; ?>
940 <tr>
941         <td><span class="TableMessage">
942         <br />You do not have permission to make a reply here.<br />
943         </span>&nbsp;</td>
944 </tr>
945 <?php } if($PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="no"&&
946         $TopicClosed==1) { $Error="Yes"; ?>
947 <tr>
948         <td><span class="TableMessage">
949         <br />You do not have permission to make a reply here.<br />
950         </span>&nbsp;</td>
951 </tr>
952 <?php } if ($_POST['ReplyPost']==null) { $Error="Yes"; ?>
953 <tr>
954         <td><span class="TableMessage">
955         <br />You need to enter a Reply.<br />
956         </span>&nbsp;</td>
957 </tr>
958 <?php } if ($Error=="Yes") {
959 redirect("refresh",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"4"); ?>
960 <tr>
961         <td><span class="TableMessage">
962         <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;
963         </span><br /></td>
964 </tr>
965 <?php } if ($Error!="Yes") { $LastActive = $utccurtime->getTimestamp();
966 $gnrquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($TopicForumID));
967 $gnrresult=sql_query($gnrquery,$SQLStat); $gnrnum=sql_num_rows($gnrresult);
968 $NumberPosts=sql_result($gnrresult,0,"NumPosts"); 
969 $PostCountAdd=sql_result($gnrresult,0,"PostCountAdd"); 
970 sql_free_result($gnrresult);
971 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUsersID));
972 $reresult=sql_query($requery,$SQLStat);
973 $renum=sql_num_rows($reresult);
974 $rei=0;
975 while ($rei < $renum) {
976 $User1ID=$MyUsersID;
977 $User1Name=sql_result($reresult,$rei,"Name");
978 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
979 $User1Email=sql_result($reresult,$rei,"Email");
980 $User1Title=sql_result($reresult,$rei,"Title");
981 $User1GroupID=sql_result($reresult,$rei,"GroupID");
982 $PostCount=sql_result($reresult,$rei,"PostCount");
983 $NewPostCount = null;
984 if($PostCountAdd=="on") { $NewPostCount = $PostCount + 1; }
985 if(!isset($NewPostCount)) { $NewPostCount = $PostCount; }
986 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($User1GroupID));
987 $gresult=sql_query($gquery,$SQLStat);
988 $User1Group=sql_result($gresult,0,"Name");
989 sql_free_result($gresult);
990 $User1IP=$_SERVER['REMOTE_ADDR'];
991 ++$rei; } sql_free_result($reresult);
992 $query = sql_pre_query("INSERT INTO \"".$Settings['sqltable']."posts\" (\"TopicID\", \"ForumID\", \"CategoryID\", \"UserID\", \"GuestName\", \"TimeStamp\", \"LastUpdate\", \"EditUser\", \"EditUserName\", \"Post\", \"Description\", \"IP\", \"EditIP\") VALUES\n".
993 "(%i, %i, %i, %i, '%s', %i, %i, 0, '', '%s', '%s', '%s', '0')", array($TopicID,$TopicForumID,$TopicCatID,$User1ID,$User1Name,$LastActive,$LastActive,$_POST['ReplyPost'],$_POST['ReplyDesc'],$User1IP));
994 sql_query($query,$SQLStat);
995 $postid = sql_get_next_id($Settings['sqltable'],"posts",$SQLStat);
996 $_SESSION['LastPostTime'] = $utccurtime->getTimestamp() + $GroupInfo['FloodControl'];
997 if($User1ID!=0&&$User1ID!=-1) {
998 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"LastActive\"=%i,\"IP\"='%s',\"PostCount\"=%i,\"LastPostTime\"=%i WHERE \"id\"=%i", array($LastActive,$User1IP,$NewPostCount,$_SESSION['LastPostTime'],$User1ID));
999 sql_query($queryupd,$SQLStat); }
1000 $NewNumPosts = $NumberPosts + 1; $NewNumReplies = $NumberReplies + 1;
1001 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i WHERE \"id\"=%i", array($NewNumPosts,$TopicForumID));
1002 sql_query($queryupd,$SQLStat);
1003 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"NumReply\"=%i,LastUpdate=%i WHERE \"id\"=%i", array($NewNumReplies,$LastActive,$TopicID));
1004 sql_query($queryupd,$SQLStat);
1005 $MyPostNum = $NewNumReplies + 1; $NumPages = null;
1006 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
1007 if($MyPostNum>$Settings['max_posts']) {
1008 $NumPages = ceil($MyPostNum/$Settings['max_posts']); }
1009 if($MyPostNum<=$Settings['max_posts']) {
1010 $NumPages = 1; }
1011 redirect("refresh",$rbasedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],FALSE).$Settings['qstr']."#reply".$MyPostNum,"3");
1012 ?><tr>
1013         <td><span class="TableMessage"><br />
1014         Reply to Topic <?php echo $TopicName; ?> was posted.<br />
1015         Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>&amp;&#35;reply<?php echo $MyPostNum; ?>">here</a> to view your reply.<br />&nbsp;
1016         </span><br /></td>
1017 </tr>
1018 <?php } ?>
1019 </table>
1020 </td></tr>
1021 <tr class="TableRow4">
1022 <td class="TableColumn4">&nbsp;</td>
1023 </tr>
1024 </table></div>
1025 <div class="DivMkReply">&nbsp;</div>
1026 <?php } if($_GET['act']=="pin"||$_GET['act']=="unpin") {
1027 $gtsquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i LIMIT 1", array($_GET['id']));
1028 $gtsresult=sql_query($gtsquery,$SQLStat);
1029 $gtsnum=sql_num_rows($gtsresult);
1030 $TTopicID=sql_result($gtsresult,0,"id");
1031 $TForumID=sql_result($gtsresult,0,"ForumID");
1032 $TUsersID=sql_result($gtsresult,0,"UserID");
1033 $TPinned=sql_result($gtsresult,0,"Pinned");
1034 $TClosed=sql_result($gtsresult,0,"Closed");
1035 if($TopicClosed==2&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1036 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1037 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1038 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1039 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1040 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1041 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1042 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1043 if ($TPinned>2) { $TPinned = 1; } 
1044 if ($TPinned<0) { $TPinned = 0; }
1045 $CanPinTopics = false;
1046 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
1047 if($PermissionInfo['CanPinTopics'][$TForumID]=="yes"&&
1048         $_SESSION['UserID']==$TUsersID) { $CanPinTopics = true; }
1049 if($PermissionInfo['CanPinTopics'][$TForumID]=="yes"&&
1050         $PermissionInfo['CanModForum'][$TForumID]=="yes") { 
1051         $CanPinTopics = true; }
1052         if($PermissionInfo['CanPinTopics'][$TForumID]=="no"&&
1053                 $TopicClosed==1) { $CanPinTopics = false; } }
1054 if($_SESSION['UserID']==0) { $CanPinTopics = false; }
1055 if($_GET['level']<1) { $_GET['level'] = 1; }
1056 if($_GET['level']>2) { $_GET['level'] = 1; }
1057 if($PermissionInfo['CanModForum'][$UseThisFonum]=="no") {
1058 if($_GET['level']>1) { $_GET['level'] = 1; } }
1059 if($CanPinTopics===false) {
1060 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($gtsresult);
1061 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1062 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1063 sql_free_result($gtsresult);
1064 if($CanPinTopics===true) {
1065         if($_GET['act']=="pin") {
1066 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"Pinned\"=%i WHERE \"id\"=%i", array($_GET['level'],$TTopicID)); }
1067         if($_GET['act']=="unpin") {
1068 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"Pinned\"=0 WHERE \"id\"=%i", array($TTopicID)); } 
1069 sql_query($queryupd,$SQLStat); 
1070 redirect("refresh",$rbasedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],false).$Settings['qstr']."#post".$_GET['post'],"4");
1072 <div class="Table1Border">
1073 <?php if($ThemeSet['TableStyle']=="div") { ?>
1074 <div class="TableRow1">
1075 <span style="text-align: left;">
1076 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span></div>
1077 <?php } ?>
1078 <table class="Table1">
1079 <?php if($ThemeSet['TableStyle']=="table") { ?>
1080 <tr class="TableRow1">
1081 <td class="TableColumn1"><span style="text-align: left;">
1082 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span>
1083 </td>
1084 </tr><?php } ?>
1085 <tr class="TableRow2">
1086 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Pin/Unpin Topic Message: </th>
1087 </tr>
1088 <tr class="TableRow3" style="text-align: center;">
1089         <td class="TableColumn3" style="text-align: center;"><span class="TableMessage"><br />
1090         Topic was successfully unpinned/pinned.<br />
1091         Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">here</a> to go back to topic.<br />&nbsp;
1092         </span><br /></td>
1093 </tr>
1094 <tr class="TableRow4">
1095 <td class="TableColumn4">&nbsp;</td>
1096 </tr>
1097 </table></div>
1098 <?php } } if($_GET['act']=="open"||$_GET['act']=="close") {
1099 $gtsquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i LIMIT 1", array($_GET['id']));
1100 $gtsresult=sql_query($gtsquery,$SQLStat);
1101 $gtsnum=sql_num_rows($gtsresult);
1102 $TTopicID=sql_result($gtsresult,0,"id");
1103 $TForumID=sql_result($gtsresult,0,"ForumID");
1104 $TUsersID=sql_result($gtsresult,0,"UserID");
1105 $TClosed=sql_result($gtsresult,0,"Closed");
1106 if($TopicClosed==2&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1107 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1108 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1109 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1110 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1111 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1112 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1113 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1114 if ($TClosed>3) { $TClosed = 3; } 
1115 if ($TClosed<0) { $TClosed = 0; }
1116 $CanCloseTopics = false;
1117 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
1118 if($PermissionInfo['CanCloseTopics'][$TForumID]=="yes"&&
1119         $_SESSION['UserID']==$TUsersID) { $CanCloseTopics = true; }
1120 if($PermissionInfo['CanCloseTopics'][$TForumID]=="yes"&&
1121         $PermissionInfo['CanModForum'][$TForumID]=="yes") { 
1122         $CanCloseTopics = true; } }
1123 if($_GET['level']<1) { $_GET['level'] = 1; }
1124 if($_GET['level']>3) { $_GET['level'] = 1; }
1125 if($PermissionInfo['CanModForum'][$TForumID]=="no") {
1126 if($_GET['level']>1) { $_GET['level'] = 1; } }
1127 if($_SESSION['UserID']==0) { $CanCloseTopics = false; }
1128 if($CanCloseTopics===false) {
1129 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($gtsresult);
1130 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1131 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1132 sql_free_result($gtsresult);
1133 if($CanCloseTopics===true) {
1134         if($_GET['act']=="close") {
1135 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"Closed\"=%i WHERE \"id\"=%i", array($_GET['level'],$TTopicID)); }
1136         if($_GET['act']=="open") {
1137 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"Closed\"=0 WHERE \"id\"=%i", array($TTopicID)); } 
1138 sql_query($queryupd,$SQLStat); 
1139 redirect("refresh",$rbasedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],false).$Settings['qstr']."#post".$_GET['post'],"4");
1141 <div class="Table1Border">
1142 <?php if($ThemeSet['TableStyle']=="div") { ?>
1143 <div class="TableRow1">
1144 <span style="text-align: left;">
1145 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span></div>
1146 <?php } ?>
1147 <table class="Table1">
1148 <?php if($ThemeSet['TableStyle']=="table") { ?>
1149 <tr class="TableRow1">
1150 <td class="TableColumn1"><span style="text-align: left;">
1151 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span>
1152 </td>
1153 </tr><?php } ?>
1154 <tr class="TableRow2">
1155 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Open/Close Topic Message: </th>
1156 </tr>
1157 <tr class="TableRow3" style="text-align: center;">
1158         <td class="TableColumn3" style="text-align: center;"><span class="TableMessage"><br />
1159         Topic was successfully opened/closed.<br />
1160         Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">here</a> to go back to topic.<br />&nbsp;
1161         </span><br /></td>
1162 </tr>
1163 <tr class="TableRow4">
1164 <td class="TableColumn4">&nbsp;</td>
1165 </tr>
1166 </table></div>
1167 <?php } } if($_GET['act']=="move") {
1168 if(!isset($_GET['newid'])) {
1169 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($gtsresult);
1170 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1171 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1172 if(!is_numeric($_GET['newid'])) {
1173 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($gtsresult);
1174 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1175 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1176 $gtsquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i LIMIT 1", array($_GET['id']));
1177 $gtsresult=sql_query($gtsquery,$SQLStat);
1178 $gtsnum=sql_num_rows($gtsresult);
1179 $TTopicID=sql_result($gtsresult,0,"id");
1180 $OldForumID=sql_result($gtsresult,0,"ForumID");
1181 $OldCatID=sql_result($gtsresult,0,"CategoryID");
1182 $TClosed=sql_result($gtsresult,0,"Closed");
1183 if($TopicClosed==2&&$PermissionInfo['CanModForum'][$OldForumID]=="no") { 
1184 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1185 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1186 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1187 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$OldForumID]=="no") { 
1188 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1189 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1190 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1191 $CanMoveTopics = false;
1192 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
1193 if($PermissionInfo['CanCloseTopics'][$OldForumID]=="yes"&&
1194         $PermissionInfo['CanModForum'][$OldForumID]=="yes") { 
1195         $CanMoveTopics = true; }
1196 if($PermissionInfo['CanCloseTopics'][$_GET['newid']]=="yes"&&
1197         $PermissionInfo['CanModForum'][$_GET['newid']]=="yes") { 
1198         $CanMoveTopics = true; } }
1199 if($_SESSION['UserID']==0) { $CanMoveTopics = false; }
1200 //if($CanMoveTopics===false||$_GET['newid']==$OldForumID) {
1201 if($CanMoveTopics===false) {
1202 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($gtsresult);
1203 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1204 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1205 sql_free_result($gtsresult);
1206 if($CanMoveTopics===true) {
1207 $TNumberPosts = $NumberReplies + 1;
1208 $mvquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($_GET['newid']));
1209 $mvresult=sql_query($mvquery,$SQLStat);
1210 $mvnum=sql_num_rows($mvresult);
1211 if($mvnum<1) {
1212 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($gtsresult); $urlstatus = 302;
1213 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); sql_free_result($mvresult);
1214 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1215 $NumberPosts=sql_result($mvresult,0,"NumPosts");
1216 $NumberPosts = $NumberPosts + $TNumberPosts;
1217 $NumberTopics=sql_result($mvresult,0,"NumTopics");
1218 $NumberTopics = $NumberTopics + 1;
1219 $NewCatID=sql_result($mvresult,0,"CategoryID");
1220 sql_free_result($mvresult);
1221 $recountq = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($NumberPosts,$NumberTopics,$_GET['newid']));
1222 sql_query($recountq,$SQLStat);
1223 $mvquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($OldForumID));
1224 $mvresult=sql_query($mvquery,$SQLStat);
1225 $mvnum=sql_num_rows($mvresult);
1226 $NumberPosts=sql_result($mvresult,0,"NumPosts");
1227 $NumberPosts = $NumberPosts - $TNumberPosts;
1228 $NumberTopics=sql_result($mvresult,0,"NumTopics");
1229 $NumberTopics = $NumberTopics - 1;
1230 sql_free_result($mvresult);
1231 $recountq = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($NumberPosts,$NumberTopics,$OldForumID));
1232 sql_query($recountq,$SQLStat);
1233 if($_GET['link']=="no") {
1234 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"ForumID\"=%i,\"CategoryID\"=%i,\"OldForumID\"=%i,\"OldCategoryID\"=%i WHERE \"id\"=%i", array($_GET['newid'],$NewCatID,$_GET['newid'],$NewCatID,$TTopicID)); }
1235 if($_GET['link']=="yes") {
1236 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"ForumID\"=%i,\"CategoryID\"=%i,\"OldForumID\"=%i,\"OldCategoryID\"=%i WHERE \"id\"=%i", array($_GET['newid'],$NewCatID,$OldForumID,$OldCatID,$TTopicID)); }
1237 sql_query($queryupd,$SQLStat);
1238 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"ForumID\"=%i,\"CategoryID\"=%i WHERE \"TopicID\"=%i", array($_GET['newid'],$NewCatID,$TTopicID)); 
1239 sql_query($queryupd,$SQLStat);
1241 redirect("refresh",$rbasedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],false),"4");
1243 <div class="Table1Border">
1244 <?php if($ThemeSet['TableStyle']=="div") { ?>
1245 <div class="TableRow1">
1246 <span style="text-align: left;">
1247 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span></div>
1248 <?php } ?>
1249 <table class="Table1">
1250 <?php if($ThemeSet['TableStyle']=="table") { ?>
1251 <tr class="TableRow1">
1252 <td class="TableColumn1"><span style="text-align: left;">
1253 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $TopicName; ?></a></span>
1254 </td>
1255 </tr><?php } ?>
1256 <tr class="TableRow2">
1257 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Move Topic Message: </th>
1258 </tr>
1259 <tr class="TableRow3" style="text-align: center;">
1260         <td class="TableColumn3" style="text-align: center;"><span class="TableMessage"><br />
1261         Topic was successfully moved.<br />
1262         Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">here</a> to go back to topic.<br />&nbsp;
1263         </span><br /></td>
1264 </tr>
1265 <tr class="TableRow4">
1266 <td class="TableColumn4">&nbsp;</td>
1267 </tr>
1268 </table></div>
1269 <?php } if($_GET['act']=="delete") {
1270 $predquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"id\"=%i LIMIT 1", array($_GET['post']));
1271 $predresult=sql_query($predquery,$SQLStat);
1272 $prednum=sql_num_rows($predresult);
1273 $ReplyID=sql_result($predresult,0,"id");
1274 $ReplyTopicID=sql_result($predresult,0,"TopicID");
1275 $ReplyForumID=sql_result($predresult,0,"ForumID");
1276 $ReplyUserID=sql_result($predresult,0,"UserID");
1277 sql_free_result($predresult);
1278 $CanDeleteReply = false;
1279 if($_SESSION['UserID']!=0) {
1280 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
1281 if($PermissionInfo['CanDeleteReplys'][$ReplyForumID]=="yes"&&
1282         $_SESSION['UserID']==$ReplyUserID) { $CanDeleteReply = true; } 
1283 if($PermissionInfo['CanDeleteReplys'][$ReplyForumID]=="yes"&&
1284         $PermissionInfo['CanModForum'][$ReplyForumID]=="yes") { 
1285         $CanDeleteReply = true; } } 
1286         if($PermissionInfo['CanDeleteReplysClose'][$TopicForumID]=="no"&&
1287                 $TopicClosed==1) { $CanDeleteReply = false; } }
1288 if($_SESSION['UserID']==0) { $CanDeleteReply = false; }
1289 if($CanDeleteReply===false) {
1290 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1291 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1292 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1293 $delquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC", array($_GET['id']));
1294 $delresult=sql_query($delquery,$SQLStat);
1295 $delnum=sql_num_rows($delresult);
1296 $DelTopic = false;
1297 $gnrquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList2." LIMIT 1", array($ReplyForumID));
1298 $gnrresult=sql_query($gnrquery,$SQLStat); $gnrnum=sql_num_rows($gnrresult);
1299 $NumberPosts=sql_result($gnrresult,0,"NumPosts"); $NumberTopics=sql_result($gnrresult,0,"NumTopics"); 
1300 sql_free_result($gnrresult);
1301 $FReplyID=sql_result($delresult,0,"id");
1302 if($ReplyID==$FReplyID) { $DelTopic = true;
1303 $gtsquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i LIMIT 1", array($ReplyTopicID));
1304 $gtsresult=sql_query($gtsquery,$SQLStat);
1305 $gtsnum=sql_num_rows($gtsresult);
1306 $TUsersID=sql_result($gtsresult,0,"UserID");
1307 $TForumID=sql_result($gtsresult,0,"ForumID");
1308 $TClosed=sql_result($gtsresult,0,"Closed");
1309 if($TopicClosed==2&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1310 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1311 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1312 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1313 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1314 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1315 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1316 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1317 $CanDeleteTopics = false;
1318 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
1319 if($PermissionInfo['CanDeleteTopics'][$ReplyForumID]=="yes"&&
1320         $_SESSION['UserID']==$TUsersID) { $CanDeleteTopics = true; }
1321 if($PermissionInfo['CanDeleteTopics'][$ReplyForumID]=="yes"&&
1322         $PermissionInfo['CanModForum'][$ReplyForumID]=="yes") { 
1323         $CanDeleteTopics = true; }
1324         if($PermissionInfo['CanDeleteTopicsClose'][$TopicForumID]=="no"&&
1325                 $TopicClosed==1) { $CanDeleteTopics = false; } }
1326 if($_SESSION['UserID']==0) { $CanDeleteTopics = false; }
1327 if($CanDeleteTopics===false) {
1328 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($delresult);
1329 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1330 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1331 if($CanDeleteTopics===true) { $NewNumTopics = $NumberTopics - 1; $NewNumPosts = $NumberPosts - $delnum;
1332 $drquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i", array($ReplyTopicID));
1333 sql_query($drquery,$SQLStat); 
1334 $dtquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i", array($ReplyTopicID));
1335 sql_query($dtquery,$SQLStat);
1336 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i,\"NumTopics\"=%i WHERE \"id\"=%i", array($NewNumPosts,$NewNumTopics,$ReplyForumID));
1337 sql_query($queryupd,$SQLStat); } }
1338 if($ReplyID!=$FReplyID) {
1339 $LReplyID=sql_result($delresult,$delnum-1,"id");
1340 $SLReplyID=sql_result($delresult,$delnum-2,"id");
1341 $NewLastUpdate=sql_result($delresult,$delnum-2,"TimeStamp");
1342 if($ReplyID==$LReplyID) { $NewNumReplies = $NumberReplies - 1; $NewNumPosts = $NumberPosts - 1;
1343 $drquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"id\"=%i", array($ReplyID));
1344 sql_query($drquery,$SQLStat); 
1345 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i WHERE \"id\"=%i", array($NewNumPosts,$ReplyForumID));
1346 sql_query($queryupd,$SQLStat);
1347 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"LastUpdate\"=%i,\"NumReply\"=%i WHERE \"id\"=%i", array($NewLastUpdate,$NewNumReplies,$ReplyTopicID));
1348 sql_query($queryupd,$SQLStat); } }
1349 if($ReplyID!=$FReplyID&&$ReplyID!=$LReplyID) { $NewNumReplies = $NumberReplies - 1; $NewNumPosts = $NumberPosts - 1;
1350 $drquery = sql_pre_query("DELETE FROM \"".$Settings['sqltable']."posts\" WHERE \"id\"=%i", array($ReplyID));
1351 sql_query($drquery,$SQLStat);
1352 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."forums\" SET \"NumPosts\"=%i WHERE \"id\"=%i", array($NewNumPosts,$ReplyForumID));
1353 sql_query($queryupd,$SQLStat);
1354 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"NumReply\"=%i WHERE \"id\"=%i", array($NewNumReplies,$ReplyTopicID));
1355 sql_query($queryupd,$SQLStat); }
1356 redirect("refresh",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],FALSE),"3");
1357 sql_free_result($delresult);
1359 <div class="Table1Border">
1360 <?php if($ThemeSet['TableStyle']=="div") { ?>
1361 <div class="TableRow1">
1362 <span style="text-align: left;">
1363 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>"><?php echo $TopicName; ?></a></span></div>
1364 <?php } ?>
1365 <table class="Table1">
1366 <?php if($ThemeSet['TableStyle']=="table") { ?>
1367 <tr class="TableRow1">
1368 <td class="TableColumn1"><span style="text-align: left;">
1369 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>"><?php echo $TopicName; ?></a></span>
1370 </td>
1371 </tr><?php } ?>
1372 <tr class="TableRow2">
1373 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Delete Reply Message: </th>
1374 </tr>
1375 <tr class="TableRow3" style="text-align: center;">
1376         <td class="TableColumn3" style="text-align: center;"><span class="TableMessage"><br />
1377         Reply was deleted successfully.<br />
1378         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 go back to index.<br />&nbsp;
1379         </span><br /></td>
1380 </tr>
1381 <tr class="TableRow4">
1382 <td class="TableColumn4">&nbsp;</td>
1383 </tr>
1384 </table></div>
1385 <?php } if($_GET['act']=="edit") {
1386 if($PermissionInfo['CanEditReplys'][$TopicForumID]=="no"||$_SESSION['UserID']==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1387 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1388 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1389 if($PermissionInfo['CanEditReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1390 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1391 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1392 $ShowEditTopic = null;
1393 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") {
1394 $editquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC", array($TopicID));
1395 $editresult=sql_query($editquery,$SQLStat);
1396 $editnum=sql_num_rows($editresult);
1397 $FReplyID=sql_result($editresult,0,"id");
1398 sql_free_result($editresult);
1399 if($_GET['post']==$FReplyID) { $ShowEditTopic = true; } }
1400 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="no") { $ShowEditTopic = null; }
1401 $ersquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"id\"=%i LIMIT 1", array($_GET['post']));
1402 $ersresult=sql_query($ersquery,$SQLStat);
1403 $ersnum=sql_num_rows($ersresult);
1404 if($ersnum==0) { sql_free_result($ersresult);
1405 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1406 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1407 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1408 $ReplyPost=sql_result($ersresult,0,"Post");
1409 /*$ReplyPost = stripcslashes(htmlspecialchars($ReplyPost, ENT_QUOTES, $Settings['charset']));
1410 $ReplyPost = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $ReplyPost);
1411 //$ReplyPost = remove_spaces($ReplyPost);*/
1412 $ReplyPost = remove_bad_entities($ReplyPost);
1413 $ReplyDescription=sql_result($ersresult,0,"Description");
1414 /*$ReplyDescription = stripcslashes(htmlspecialchars($ReplyDescription, ENT_QUOTES, $Settings['charset']));
1415 $ReplyDescription = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $ReplyDescription);
1416 //$ReplyDescription = remove_spaces($ReplyDescription);*/
1417 $ReplyGuestName=sql_result($ersresult,0,"GuestName");
1418 //$ReplyGuestName = stripcslashes(htmlspecialchars($ReplyGuestName, ENT_QUOTES, $Settings['charset']));
1419 //$ReplyGuestName = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $ReplyGuestName);
1420 $ReplyGuestName = remove_spaces($ReplyGuestName);
1421 $ReplyUser=sql_result($ersresult,0,"UserID");
1422 if($_SESSION['UserID']!=$ReplyUser&&$PermissionInfo['CanModForum'][$TopicForumID]=="no") {
1423 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1424 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1425 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1426 sql_free_result($ersresult);
1427 if($ShowEditTopic===true) {
1428 $gtsquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i LIMIT 1", array($TopicID));
1429 $gtsresult=sql_query($gtsquery,$SQLStat);
1430 $gtsnum=sql_num_rows($gtsresult);
1431 $TUsersID=sql_result($gtsresult,0,"UserID");
1432 $TForumID=sql_result($gtsresult,0,"ForumID");
1433 $TClosed=sql_result($gtsresult,0,"Closed");
1434 if($TopicClosed==2&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1435 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1436 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1437 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1438 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1439 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1440 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1441 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1442 if($_SESSION['UserID']!=$TUsersID) { $ShowEditTopic = null; }
1443 if($PermissionInfo['CanModForum'][$TopicForumID]=="yes"&&
1444         $PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") { 
1445         $ShowEditTopic = true; } 
1446 if($PermissionInfo['CanEditTopicsClose'][$TopicForumID]=="no"&&$TopicClosed==1) {
1447         $ShowEditTopic = null; } }
1448 //$TopicName = stripcslashes(htmlspecialchars($TopicName, ENT_QUOTES, $Settings['charset']));
1449 //$TopicName = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $TopicName);
1450 $TopicName = remove_spaces($TopicName);
1451 if($ShowEditTopic===true) {
1452 sql_free_result($gtsresult); }
1453 $UFID = rand_uuid("rand");
1454 $_SESSION['UserFormID'] = $UFID;
1456 <div class="Table1Border">
1457 <?php if($ThemeSet['TableStyle']=="div") { ?>
1458 <div class="TableRow1">
1459 <span style="text-align: left;">
1460 <?php echo $ThemeSet['TitleIcon']; ?><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></span></div>
1461 <?php } ?>
1462 <table class="Table1" id="EditReply<?php echo $_GET['post']; ?>">
1463 <?php if($ThemeSet['TableStyle']=="table") { ?>
1464 <tr class="TableRow1" id="ReplyEdit<?php echo $_GET['post']; ?>">
1465 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
1466 <?php echo $ThemeSet['TitleIcon']; ?><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></span>
1467 </td>
1468 </tr><?php } ?>
1469 <tr id="EditReplyRow<?php echo $_GET['post']; ?>" class="TableRow2">
1470 <td class="TableColumn2" colspan="2" style="width: 100%;">Editing a Reply in Topic <?php echo $TopicName; ?></td>
1471 </tr>
1472 <tr class="TableRow3" id="EditReplies<?php echo $_GET['post']; ?>">
1473 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
1474 <div style="width: 100%; height: 160px; overflow: auto;"><?php
1475 $renee_query=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."smileys\" WHERE \"Display\"='yes'", array(null));
1476 $renee_result=sql_query($renee_query,$SQLStat);
1477 $renee_num=sql_num_rows($renee_result);
1478 $renee_s=0; $SmileRow=1;
1479 while ($renee_s < $renee_num) {
1480 $FileName=sql_result($renee_result,$renee_s,"FileName");
1481 $SmileName=sql_result($renee_result,$renee_s,"SmileName");
1482 $SmileText=sql_result($renee_result,$renee_s,"SmileText");
1483 $SmileDirectory=sql_result($renee_result,$renee_s,"Directory");
1484 $ShowSmile=sql_result($renee_result,$renee_s,"Display");
1485 $ReplaceType=sql_result($renee_result,$renee_s,"ReplaceCI");
1486 if($SmileRow<5) { ?>
1487         <img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" />&nbsp;&nbsp;
1488         <?php } if($SmileRow==5) { ?>
1489         <img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" /><br />
1490         <?php $SmileRow=1; }
1491 ++$renee_s; ++$SmileRow; }
1492 sql_free_result($renee_result);
1493 ?></div></td>
1494 <td class="TableColumn3" style="width: 85%;">
1495 <form style="display: inline;" method="post" id="EditReplyForm" action="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=editreply&id=".$TopicID."&post=".$_GET['post'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">
1496 <table style="text-align: left;">
1497 <tr style="text-align: left;">
1498 <?php if($ShowEditTopic===true) { ?>
1499         <td style="width: 50%;"><label class="TextBoxLabel" for="TopicName">Insert Topic Name:</label></td>
1500         <td style="width: 50%;"><input maxlength="30" type="text" name="TopicName" class="TextBox" id="TopicName" size="20" value="<?php echo $TopicName; ?>" /></td>
1501 </tr><tr style="text-align: left;"><?php } ?>
1502         <td style="width: 50%;"><label class="TextBoxLabel" for="ReplyDesc">Insert Reply Description:</label></td>
1503         <td style="width: 50%;"><input maxlength="45" type="text" name="ReplyDesc" class="TextBox" id="ReplyDesc" size="20" value="<?php echo $ReplyDescription; ?>" /></td>
1504 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
1505         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
1506         <?php if(!isset($_SESSION['GuestName'])) { ?>
1507         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
1508         <?php } if(isset($_SESSION['GuestName'])) { ?>
1509         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
1510 <?php } ?></tr><?php } ?>
1511 </table>
1512 <table style="text-align: left;">
1513 <tr style="text-align: left;">
1514 <td style="width: 100%;">
1515 <label class="TextBoxLabel" for="ReplyPost">Insert Your Reply:</label><br />
1516 <textarea rows="10" name="ReplyPost" id="ReplyPost" cols="40" class="TextBox"><?php echo $ReplyPost; ?></textarea><br />
1517 <input type="hidden" name="act" value="editreplies" style="display: none;" />
1518 <input type="hidden" style="display: none;" name="fid" value="<?php echo $UFID; ?>" />
1519 <input type="hidden" style="display: none;" name="ubid" value="<?php echo $Settings['BoardUUID']; ?>" />
1520 <?php if(isset($_GET['page'])&&is_numeric($_GET['page'])) { ?>
1521 <input type="hidden" style="display: none;" name="page" value="<?php echo $_GET['page']; ?>" />
1522 <?php } if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
1523 <input type="hidden" name="GuestName" value="null" style="display: none;" />
1524 <?php } ?>
1525 <input type="submit" class="Button" value="Edit Reply" name="edit_reply" />
1526 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1527 </td></tr></table>
1528 </form></td></tr>
1529 <tr id="EditReplyEnd<?php echo $_GET['post']; ?>" class="TableRow4">
1530 <td class="TableColumn4" colspan="2">&nbsp;</td>
1531 </tr>
1532 </table></div>
1533 <div class="DivMkReply">&nbsp;</div>
1534 <?php } if($_GET['act']=="editreply"&&$_POST['act']=="editreplies") {
1535 if($PermissionInfo['CanEditReplys'][$TopicForumID]=="no"||$_SESSION['UserID']==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1536 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1537 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1538 if($PermissionInfo['CanEditReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1539 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1540 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1541 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
1542 $URL['REFERER'] = $REFERERurl['host'];
1543 $URL['HOST'] = $_SERVER["SERVER_NAME"];
1544 $REFERERurl = null;
1545 if(!isset($_POST['ReplyDesc'])) { $_POST['ReplyDesc'] = null; }
1546 if(!isset($_POST['ReplyPost'])) { $_POST['ReplyPost'] = null; }
1547 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
1548 if(!isset($_POST['TopicName'])) { $_POST['TopicName'] = null; }
1549 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1550         $Settings['captcha_guest']=="on") {
1551 require($SettDir['inc']."captcha.php"); }
1552 $ShowEditTopic = null;
1553 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") {
1554 $editquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC", array($TopicID));
1555 $editresult=sql_query($editquery,$SQLStat);
1556 $editnum=sql_num_rows($editresult);
1557 $FReplyID=sql_result($editresult,0,"id");
1558 sql_free_result($editresult);
1559 if($_GET['post']==$FReplyID) { $ShowEditTopic = true; } }
1560 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="no") { $ShowEditTopic = null; }
1561 $ersquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"id\"=%i LIMIT 1", array($_GET['post']));
1562 $ersresult=sql_query($ersquery,$SQLStat);
1563 $ersnum=sql_num_rows($ersresult);
1564 if($ersnum==0) { sql_free_result($ersresult);
1565 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1566 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1567 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1568 $ReplyUser=sql_result($ersresult,0,"UserID");
1569 if($_SESSION['UserID']!=$ReplyUser&&$PermissionInfo['CanModForum'][$TopicForumID]=="no") {
1570 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1571 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1572 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1573 sql_free_result($ersresult); 
1574 if($ShowEditTopic===true) {
1575 $gtsquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i LIMIT 1", array($TopicID));
1576 $gtsresult=sql_query($gtsquery,$SQLStat);
1577 $gtsnum=sql_num_rows($gtsresult);
1578 $TUsersID=sql_result($gtsresult,0,"UserID");
1579 $TForumID=sql_result($gtsresult,0,"ForumID");
1580 $TClosed=sql_result($gtsresult,0,"Closed");
1581 if($_SESSION['UserID']!=$TUsersID) { $ShowEditTopic = null; }
1582 if($PermissionInfo['CanModForum'][$TopicForumID]=="yes"&&
1583         $PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") { 
1584         $ShowEditTopic = true; } 
1585 if($PermissionInfo['CanEditTopicsClose'][$TopicForumID]=="no"&&$TopicClosed==1) {
1586         $ShowEditTopic = null; } }
1587 if($TopicClosed==2&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1588 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1589 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1590 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1591 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$TForumID]=="no") { 
1592 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
1593 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']); $urlstatus = 302;
1594 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
1596 <div class="Table1Border">
1597 <?php if($ThemeSet['TableStyle']=="div") { ?>
1598 <div class="TableRow1">
1599 <span style="text-align: left;">
1600 <?php echo $ThemeSet['TitleIcon']; ?><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></span></div>
1601 <?php } ?>
1602 <table class="Table1">
1603 <?php if($ThemeSet['TableStyle']=="table") { ?>
1604 <tr class="TableRow1">
1605 <td class="TableColumn1"><span style="text-align: left;">
1606 <?php echo $ThemeSet['TitleIcon']; ?><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></span>
1607 </td>
1608 </tr><?php } ?>
1609 <tr class="TableRow2">
1610 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Edit Reply Message: </th>
1611 </tr>
1612 <tr class="TableRow3">
1613 <td class="TableColumn3">
1614 <table style="width: 100%; height: 25%; text-align: center;">
1615 <?php if (pre_strlen($_POST['ReplyDesc'])>"80") { $Error="Yes";  ?>
1616 <tr>
1617         <td><span class="TableMessage">
1618         <br />Your Reply Description is too big.<br />
1619         </span>&nbsp;</td>
1620 </tr>
1621 <?php } if($_POST['fid']!=$_SESSION['UserFormID']) { $Error="Yes";  ?>
1622 <tr>
1623         <td><span class="TableMessage">
1624         <br />Sorry the referering url dose not match our host name.<br />
1625         </span>&nbsp;</td>
1626 </tr>
1627 <?php } if($_POST['ubid']!=$Settings['BoardUUID']) { $Error="Yes";  ?>
1628 <tr>
1629         <td><span class="TableMessage">
1630         <br />Sorry the referering url dose not match our host name.<br />
1631         </span>&nbsp;</td>
1632 </tr>
1633 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1634         $Settings['captcha_guest']=="on") {
1635 if (PhpCaptcha::Validate($_POST['signcode'])) {
1636 //echo 'Valid code entered';
1637 } else { $Error="Yes"; ?>
1638 <tr>
1639         <td><span class="TableMessage">
1640         <br />Invalid code entered<br />
1641         </span>&nbsp;</td>
1642 </tr>
1643 <?php } } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1644         pre_strlen($_POST['GuestName'])>"30") { $Error="Yes"; ?>
1645 <tr>
1646         <td><span class="TableMessage">
1647         <br />You Guest Name is too big.<br />
1648         </span>&nbsp;</td>
1649 </tr>
1650 <?php } if($ShowEditTopic===true&&
1651         pre_strlen($_POST['TopicName'])>"50") { $Error="Yes"; ?>
1652 <tr>
1653         <td><span class="TableMessage">
1654         <br />You Topic Name is too big.<br />
1655         </span>&nbsp;</td>
1656 </tr>
1657 <?php } if ($Settings['TestReferer']=="on") {
1658         if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
1659 <tr>
1660         <td><span class="TableMessage">
1661         <br />Sorry the referering url dose not match our host name.<br />
1662         </span>&nbsp;</td>
1663 </tr>
1664 <?php } }
1665 $_POST['ReplyDesc'] = stripcslashes(htmlspecialchars($_POST['ReplyDesc'], ENT_QUOTES, $Settings['charset']));
1666 //$_POST['ReplyDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyDesc']);
1667 $_POST['ReplyDesc'] = remove_spaces($_POST['ReplyDesc']);
1668 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
1669 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
1670 $_POST['GuestName'] = remove_spaces($_POST['GuestName']);
1671 $_POST['ReplyPost'] = stripcslashes(htmlspecialchars($_POST['ReplyPost'], ENT_QUOTES, $Settings['charset']));
1672 //$_POST['ReplyPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyPost']);
1673 $_POST['ReplyPost'] = remove_bad_entities($_POST['ReplyPost']);
1674 if($ShowEditTopic===true) {
1675 $_POST['TopicName'] = stripcslashes(htmlspecialchars($_POST['TopicName'], ENT_QUOTES, $Settings['charset']));
1676 //$_POST['TopicName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicName']);
1677 $_POST['TopicName'] = remove_spaces($_POST['TopicName']); }
1678 /*    <_<  iWordFilter  >_>      
1679    by Kazuki Przyborowski - Cool Dude 2k */
1680 $katarzynaqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."wordfilter\"", array(null));
1681 $katarzynart=sql_query($katarzynaqy,$SQLStat);
1682 $katarzynanm=sql_num_rows($katarzynart);
1683 $katarzynas=0;
1684 while ($katarzynas < $katarzynanm) {
1685 $Filter=sql_result($katarzynart,$katarzynas,"FilterWord");
1686 $Replace=sql_result($katarzynart,$katarzynas,"Replacement");
1687 $CaseInsensitive=sql_result($katarzynart,$katarzynas,"CaseInsensitive");
1688 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
1689 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
1690 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
1691 $WholeWord=sql_result($katarzynart,$katarzynas,"WholeWord");
1692 if($WholeWord=="on") { $WholeWord = "yes"; }
1693 if($WholeWord=="off") { $WholeWord = "no"; }
1694 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
1695 $Filter = preg_quote($Filter, "/");
1696 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
1697 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyDesc']); 
1698 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyPost']); }
1699 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
1700 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyDesc']); 
1701 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyPost']); }
1702 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
1703 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyDesc']); 
1704 $_POST['ReplyPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyPost']); }
1705 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
1706 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyDesc']); 
1707 $_POST['ReplyPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyPost']); }
1708 ++$katarzynas; } sql_free_result($katarzynart);
1709 $lonewolfqy=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."restrictedwords\" WHERE \"RestrictedTopicName\"='yes' or \"RestrictedUserName\"='yes'", array(null));
1710 $lonewolfrt=sql_query($lonewolfqy,$SQLStat);
1711 $lonewolfnm=sql_num_rows($lonewolfrt);
1712 $lonewolfs=0; $RMatches = null; $RGMatches = null;
1713 while ($lonewolfs < $lonewolfnm) {
1714 $RWord=sql_result($lonewolfrt,$lonewolfs,"Word");
1715 $RCaseInsensitive=sql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
1716 if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
1717 if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
1718 if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
1719 $RWholeWord=sql_result($lonewolfrt,$lonewolfs,"WholeWord");
1720 if($RWholeWord=="on") { $RWholeWord = "yes"; }
1721 if($RWholeWord=="off") { $RWholeWord = "no"; }
1722 if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
1723 $RestrictedTopicName=sql_result($lonewolfrt,$lonewolfs,"RestrictedTopicName");
1724 if($RestrictedTopicName=="on") { $RestrictedTopicName = "yes"; }
1725 if($RestrictedTopicName=="off") { $RestrictedTopicName = "no"; }
1726 if($RestrictedTopicName!="yes"||$RestrictedTopicName!="no") { $RestrictedTopicName = "no"; }
1727 $RestrictedUserName=sql_result($lonewolfrt,$lonewolfs,"RestrictedUserName");
1728 if($RestrictedUserName=="on") { $RestrictedUserName = "yes"; }
1729 if($RestrictedUserName=="off") { $RestrictedUserName = "no"; }
1730 if($RestrictedUserName!="yes"||$RestrictedUserName!="no") { $RestrictedUserName = "no"; }
1731 $RWord = preg_quote($RWord, "/");
1732 if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
1733 if($RestrictedTopicName=="yes") {
1734 $RMatches = preg_match("/\b(".$RWord.")\b/", $_POST['TopicName']);
1735         if($RMatches==true) { break 1; } }
1736 if($RestrictedUserName=="yes") {
1737 $RGMatches = preg_match("/\b(".$RWord.")\b/", $_POST['GuestName']);
1738         if($RGMatches==true) { break 1; } } }
1739 if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
1740 if($RestrictedTopicName=="yes") {
1741 $RMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['TopicName']);
1742         if($RMatches==true) { break 1; } }
1743 if($RestrictedUserName=="yes") {
1744 $RGMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['GuestName']);
1745         if($RGMatches==true) { break 1; } } }
1746 if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
1747 if($RestrictedTopicName=="yes") {
1748 $RMatches = preg_match("/".$RWord."/", $_POST['TopicName']);
1749         if($RMatches==true) { break 1; } }
1750 if($RestrictedUserName=="yes") {
1751 $RGMatches = preg_match("/".$RWord."/", $_POST['GuestName']);
1752         if($RGMatches==true) { break 1; } } }
1753 if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
1754 if($RestrictedTopicName=="yes") {
1755 $RMatches = preg_match("/".$RWord."/i", $_POST['TopicName']);
1756         if($RMatches==true) { break 1; } }
1757 if($RestrictedUserName=="yes") {
1758 $RGMatches = preg_match("/".$RWord."/i", $_POST['GuestName']);
1759         if($RGMatches==true) { break 1; } } }
1760 ++$lonewolfs; } sql_free_result($lonewolfrt);
1761 if ($_POST['ReplyDesc']==null) { $Error="Yes"; ?>
1762 <tr>
1763         <td><span class="TableMessage">
1764         <br />You need to enter a Reply Description.<br />
1765         </span>&nbsp;</td>
1766 </tr>
1767 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1768         $_POST['GuestName']==null) { $Error="Yes"; ?>
1769 <tr>
1770         <td><span class="TableMessage">
1771         <br />You need to enter a Guest Name.<br />
1772         </span>&nbsp;</td>
1773 </tr>
1774 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1775         $RGMatches==true) { $Error="Yes"; ?>
1776 <tr>
1777         <td><span class="TableMessage">
1778         <br />This Guest Name is restricted to use.<br />
1779         </span>&nbsp;</td>
1780 </tr>
1781 <?php } if($PermissionInfo['CanEditReplys'][$TopicForumID]=="no") { $Error="Yes"; ?>
1782 <tr>
1783         <td><span class="TableMessage">
1784         <br />You do not have permission to edit a reply here.<br />
1785         </span>&nbsp;</td>
1786 </tr>
1787 <?php } if($PermissionInfo['CanEditReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { $Error="Yes"; ?>
1788 <tr>
1789         <td><span class="TableMessage">
1790         <br />You do not have permission to edit a reply here.<br />
1791         </span>&nbsp;</td>
1792 </tr>
1793 <?php } if($ShowEditTopic===true&&$_POST['TopicName']==null) { $Error="Yes"; ?>
1794 <tr>
1795         <td><span class="TableMessage">
1796         <br />You need to enter a Topic Name.<br />
1797         </span>&nbsp;</td>
1798 </tr>
1799 <?php } if ($_POST['ReplyPost']==null) { $Error="Yes"; ?>
1800 <tr>
1801         <td><span class="TableMessage">
1802         <br />You need to enter a Reply.<br />
1803         </span>&nbsp;</td>
1804 </tr>
1805 <?php } if($RMatches==true) { $Error="Yes"; ?>
1806 <tr>
1807         <td><span class="TableMessage">
1808         <br />This Topic Name is restricted to use.<br />
1809         </span>&nbsp;</td>
1810 </tr>
1811 <?php } if ($Error=="Yes") {
1812 redirect("refresh",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']),"3"); ?>
1813 <tr>
1814         <td><span class="TableMessage">
1815         <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;
1816         </span><br /></td>
1817 </tr>
1818 <?php } if ($Error!="Yes") { $LastActive = $utccurtime->getTimestamp();
1819 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($_SESSION['UserID']));
1820 $reresult=sql_query($requery,$SQLStat);
1821 $renum=sql_num_rows($reresult);
1822 $rei=0;
1823 while ($rei < $renum) {
1824 $User1ID=$_SESSION['UserID'];
1825 $User1Name=sql_result($reresult,$rei,"Name");
1826 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
1827 ++$rei; }
1828 sql_free_result($reresult);
1829 $EditUserIP=$_SERVER['REMOTE_ADDR'];
1830 $_SESSION['LastPostTime'] = $utccurtime->getTimestamp() + $GroupInfo['FloodControl'];
1831 if($_SESSION['UserID']!=0&&$_SESSION['UserID']!=-1) {
1832 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."members\" SET \"LastActive\"=%i,\"IP\"='%s',\"LastPostTime\"=%i WHERE \"id\"=%i", array($LastActive,$EditUserIP,$_SESSION['LastPostTime'],$_SESSION['UserID']));
1833 sql_query($queryupd,$SQLStat); }
1834 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."posts\" SET \"LastUpdate\"=%i,\"EditUser\"=%i,\"EditUserName\"='%s',\"Post\"='%s',\"Description\"='%s',\"EditIP\"='%s' WHERE \"id\"=%i", array($LastActive,$User1ID,$User1Name,$_POST['ReplyPost'],$_POST['ReplyDesc'],$EditUserIP,$_GET['post']));
1835 sql_query($queryupd,$SQLStat);
1836 if($ShowEditTopic===true) {
1837 $queryupd = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"TopicName\"='%s',\"Description\"='%s' WHERE \"id\"=%i", array($_POST['TopicName'],$_POST['ReplyDesc'],$TopicID));
1838 sql_query($queryupd,$SQLStat); } } 
1839 redirect(url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],FALSE).$Settings['qstr']."#post".$_GET['post'],"3");
1840 $erpage = "&page=1";
1841 if(isset($_POST['page'])&&is_numeric($_POST['page'])) {
1842         $erpage = "&page=".$_POST['page']; }
1844 <tr>
1845         <td><span class="TableMessage"><br />
1846         Reply to Topic <?php echo $TopicName; ?> was edited.<br />
1847         Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID.$erpage,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$qstrhtml."&#35;post".$_GET['post']; ?>">here</a> to view topic.<br />&nbsp;
1848         </span><br /></td>
1849 </tr>
1850 </table>
1851 </td></tr>
1852 <tr class="TableRow4">
1853 <td class="TableColumn4">&nbsp;</td>
1854 </tr>
1855 </table></div>
1856 <?php } $frnext = "off";
1857 if(!isset($_GET['fastreply'])) {
1858         $_GET['fastreply'] = "off"; }
1859 if($_GET['fastreply']=="on") {
1860         $frnext = "off"; $extrafe = null; }
1861 if($_GET['fastreply']!="on") {
1862         $frnext = "on"; $extrafe = "&#35;FastReply"; }
1863 if($pstring!=null||$CanMakeReply=="yes"||$CanMakeTopic=="yes") {
1865 <table class="Table2" style="width: 100%;">
1866 <tr>
1867  <td style="width: 30%; text-align: left;"><?php echo $pstring; ?></td>
1868  <td style="width: 70%; text-align: right;">
1869  <?php if($CanMakeReply=="yes") { ?>
1870  <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=create&id=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>"><?php echo $ThemeSet['AddReply']; ?></a>
1871  <?php if(isset($ThemeSet['FastReply'])&&$ThemeSet['FastReply']!=null) { ?>
1872  <?php echo $ThemeSet['ButtonDivider']; ?>
1873  <a onclick="toggletag('FastReply'); toggletag('MkFastReply'); return false;" href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=".$_GET['page']."&fastreply=".$frnext,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']).$extrafe; ?>"><?php echo $ThemeSet['FastReply']; ?></a>
1874  <?php } } if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") {
1875         if($CanMakeTopic=="yes"&&$CanMakeReply=="yes") { ?>
1876  <?php echo $ThemeSet['ButtonDivider']; } ?>
1877  <a href="<?php echo url_maker($exfile['forum'],$Settings['file_ext'],"act=create&id=".$TopicForumID,$Settings['qstr'],$Settings['qsep'],$prexqstr['forum'],$exqstr['forum']); ?>"><?php echo $ThemeSet['NewTopic']; ?></a>
1878  <?php } ?></td>
1879 </tr>
1880 </table>
1881 <div class="DivTable2">&nbsp;</div>
1882 <?php } }
1883 if($_GET['act']=="view"&&$CanMakeReply=="yes") {  
1884 if(!isset($_GET['fastreply'])) { $_GET['fastreply'] = false; }
1885 if($_GET['fastreply']===true||
1886         $_GET['fastreply']=="on") { $fps = " "; }
1887 if($_GET['fastreply']!==true&&
1888         $_GET['fastreply']!="on") { $fps = " style=\"display: none;\" "; }
1889 $QuoteReply = null; $QuoteDescription = null;
1890 $queryra = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC LIMIT 1", array($_GET['id']));
1891 $resultra=sql_query($queryra,$SQLStat);
1892 $numrose=sql_num_rows($resultra);
1893 $QuoteDescription=sql_result($resultra,0,"Description"); 
1894 $QuoteDescription = str_replace("Re: ","",$QuoteDescription);
1895 $QuoteDescription = "Re: ".$QuoteDescription;
1896 sql_free_result($resultra);
1897 $UFID = rand_uuid("rand");
1898 $_SESSION['UserFormID'] = $UFID;
1900 <div class="Table1Border"<?php echo $fps; ?>id="FastReply">
1901 <?php if($ThemeSet['TableStyle']=="div") { ?>
1902 <div class="TableRow1">
1903 <span style="text-align: left;">
1904 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>#<?php echo $TopicID; ?>"><?php echo $TopicName; ?></a></span></div>
1905 <?php } ?>
1906 <table class="Table1" id="MakeReply<?php echo $TopicForumID; ?>">
1907 <?php if($ThemeSet['TableStyle']=="table") { ?>
1908 <tr class="TableRow1" id="ReplyStart<?php echo $TopicForumID; ?>">
1909 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
1910 <?php echo $ThemeSet['TitleIcon']; ?><a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$_GET['page'],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>#<?php echo $TopicID; ?>"><?php echo $TopicName; ?></a></span>
1911 </td>
1912 </tr><?php } ?>
1913 <tr id="MakeReplyRow<?php echo $TopicForumID; ?>" class="TableRow2">
1914 <td class="TableColumn2" colspan="2" style="width: 100%;">Making a Reply in Topic <?php echo $TopicName; ?></td>
1915 </tr>
1916 <tr class="TableRow3" id="MkReply<?php echo $TopicForumID; ?>">
1917 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
1918 <div style="width: 100%; height: 160px; overflow: auto;">
1919 <table style="width: 100%; text-align: center;"><?php
1920 $renee_query=sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."smileys\" WHERE \"Display\"='yes'", array(null));
1921 $renee_result=sql_query($renee_query,$SQLStat);
1922 $renee_num=sql_num_rows($renee_result);
1923 $renee_s=0; $SmileRow=0; $SmileCRow=0;
1924 while ($renee_s < $renee_num) { ++$SmileRow;
1925 $FileName=sql_result($renee_result,$renee_s,"FileName");
1926 $SmileName=sql_result($renee_result,$renee_s,"SmileName");
1927 $SmileText=sql_result($renee_result,$renee_s,"SmileText");
1928 $SmileDirectory=sql_result($renee_result,$renee_s,"Directory");
1929 $ShowSmile=sql_result($renee_result,$renee_s,"Display");
1930 $ReplaceType=sql_result($renee_result,$renee_s,"ReplaceCI");
1931 if($SmileRow==1) { ?><tr>
1932         <?php } if($SmileRow<5) { ++$SmileCRow; ?>
1933         <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('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" /></td>
1934         <?php } if($SmileRow==5) { ++$SmileCRow; ?>
1935         <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('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" /></td></tr>
1936         <?php $SmileCRow=0; $SmileRow=0; }
1937 ++$renee_s; }
1938 if($SmileCRow<5&&$SmileCRow!=0) {
1939 $SmileCRowL = 5 - $SmileCRow;
1940 echo "<td colspan=\"".$SmileCRowL."\">&nbsp;</td></tr>"; }
1941 echo "</table>";
1942 sql_free_result($renee_result);
1943 ?></div></td>
1944 <td class="TableColumn3" style="width: 85%;">
1945 <form style="display: inline;" method="post" id="MkReplyForm" action="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=makereply&id=".$TopicID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic']); ?>">
1946 <table style="text-align: left;">
1947 <tr style="text-align: left;">
1948         <td style="width: 50%;"><label class="TextBoxLabel" for="ReplyDesc">Insert Reply Description:</label></td>
1949         <td style="width: 50%;"><input maxlength="45" type="text" name="ReplyDesc" class="TextBox" id="ReplyDesc" size="20" value="<?php echo $QuoteDescription; ?>" /></td>
1950 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
1951         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
1952         <?php if(!isset($_SESSION['GuestName'])) { ?>
1953         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
1954         <?php } if(isset($_SESSION['GuestName'])) { ?>
1955         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
1956 <?php } ?></tr><?php } ?>
1957 </table>
1958 <table style="text-align: left;">
1959 <tr style="text-align: left;">
1960 <td style="width: 100%;">
1961 <label class="TextBoxLabel" for="ReplyPost">Insert Your Reply:</label><br />
1962 <textarea rows="10" name="ReplyPost" id="ReplyPost" cols="40" class="TextBox"><?php echo $QuoteReply; ?></textarea><br />
1963 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
1964 <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 />
1965 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
1966 <?php } ?>
1967 <input type="hidden" name="act" value="makereplies" style="display: none;" />
1968 <input type="hidden" style="display: none;" name="fid" value="<?php echo $UFID; ?>" />
1969 <input type="hidden" style="display: none;" name="ubid" value="<?php echo $Settings['BoardUUID']; ?>" />
1970 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
1971 <input type="hidden" name="GuestName" value="null" style="display: none;" />
1972 <?php } ?>
1973 <input type="hidden" name="act" value="makereplies" style="display: none;" />
1974 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
1975 <input type="hidden" name="GuestName" value="null" style="display: none;" />
1976 <?php } ?>
1977 <input type="submit" class="Button" value="Make Reply" name="make_reply" />
1978 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1979 </td></tr></table>
1980 </form></td></tr>
1981 <tr id="MkReplyEnd<?php echo $TopicForumID; ?>" class="TableRow4">
1982 <td class="TableColumn4" colspan="2">&nbsp;</td>
1983 </tr>
1984 </table></div>
1985 <div<?php echo $fps; ?>id="MkFastReply" class="MkFastReply">&nbsp;</div>
1986 <?php }
1987 $uviewlcuttime = $utccurtime->getTimestamp();
1988 $uviewltime = $uviewlcuttime - ini_get("session.gc_maxlifetime");
1989 $uviewlquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."sessions\" WHERE \"expires\" >= %i AND \"session_id\"<>'%s' AND \"serialized_data\" LIKE '%s' ORDER BY \"expires\" DESC", array($uviewltime, session_id(), "%currenttopicid:".$TopicID.";%"));
1990 $uviewlresult=sql_query($uviewlquery,$SQLStat);
1991 $uviewlnum=sql_num_rows($uviewlresult);
1992 $uviewli=0; $uviewlmn = 0; $uviewlgn = 0; $uviewlan = 0; $uviewlmbn = 0;
1993 $MembersViewList = null; $GuestsOnline = null;
1994 while ($uviewli < $uviewlnum) {
1995 $session_data=sql_result($uviewlresult,$uviewli,"session_data"); 
1996 $serialized_data=sql_result($uviewlresult,$uviewli,"serialized_data");
1997 $session_user_agent=sql_result($uviewlresult,$uviewli,"user_agent"); 
1998 $session_ip_address=sql_result($uviewlresult,$uviewli,"ip_address");
1999 //$UserSessInfo = unserialize_session($session_data);
2000 $UserSessInfo = unserialize($serialized_data);
2001 if(!isset($UserSessInfo['UserGroup'])) { $UserSessInfo['UserGroup'] = $Settings['GuestGroup']; }
2002 $AmIHiddenUser = "no";
2003 $user_agent_check = false;
2004 if(user_agent_check($session_user_agent)) {
2005         $user_agent_check = user_agent_check($session_user_agent); }
2006 if($UserSessInfo['UserGroup']!=$Settings['GuestGroup']||$user_agent_check!==false) {
2007 $PreAmIHiddenUser = GetUserName($UserSessInfo['UserID'],$Settings['sqltable'],$SQLStat);
2008 $AmIHiddenUser = $PreAmIHiddenUser['Hidden'];
2009 if(($AmIHiddenUser=="no"&&$UserSessInfo['UserID']>0)||$user_agent_check!==false) {
2010 if($uviewlmbn>0) { $MembersViewList .= ", "; }
2011 if($user_agent_check===false) {
2012 $uatitleadd = null;
2013 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($session_user_agent, ENT_QUOTES, $Settings['charset'])."\""; }
2014 $MembersViewList .= "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$UserSessInfo['UserID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$UserSessInfo['MemberName']."</a>"; 
2015 if($GroupInfo['CanViewIPAddress']=="yes") {
2016 $MembersViewList .= " (<a title=\"".$session_ip_address."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$session_ip_address)."\">".$session_ip_address."</a>)"; }
2017 ++$uviewlmn; ++$uviewlmbn; }
2018 if($user_agent_check!==false) {
2019 $uatitleadd = null;
2020 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($session_user_agent, ENT_QUOTES, $Settings['charset'])."\""; }
2021 $MembersViewList .= "<span".$uatitleadd.">".$user_agent_check."</span>"; 
2022 if($GroupInfo['CanViewIPAddress']=="yes") {
2023 $MembersViewList .= " (<a title=\"".$session_ip_address."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$session_ip_address)."\">".$session_ip_address."</a>)"; }
2024 ++$uviewlmbn; } }
2025 if($UserSessInfo['UserID']<=0||$AmIHiddenUser=="yes") {
2026 if($user_agent_check===false) {
2027 ++$uviewlan; } } }
2028 if($UserSessInfo['UserGroup']==$Settings['GuestGroup']) {
2029 /*$uatitleadd = null;
2030 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($session_user_agent, ENT_QUOTES, $Settings['charset'])."\""; }
2031 $GuestsViewList .= "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$MemList['ID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$MemList['Name']."</a>";
2032 if($GroupInfo['CanViewIPAddress']=="yes") {
2033 $GuestsViewList .= " (<a title=\"".$session_ip_address."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$session_ip_address)."\">".$session_ip_address."</a>)"; } */
2034 ++$uviewlgn; }
2035 ++$uviewli; }
2036 if(!isset($_SESSION['UserGroup'])) { $_SESSION['UserGroup'] = $Settings['GuestGroup']; }
2037 $AmIHiddenUser = "no";
2038 $user_agent_check = false;
2039 if(user_agent_check($_SERVER['HTTP_USER_AGENT'])) {
2040         $user_agent_check = user_agent_check($_SERVER['HTTP_USER_AGENT']); }
2041 if($_SESSION['UserGroup']!=$Settings['GuestGroup']||$user_agent_check!==false) {
2042 $PreAmIHiddenUser = GetUserName($_SESSION['UserID'],$Settings['sqltable'],$SQLStat);
2043 $AmIHiddenUser = $PreAmIHiddenUser['Hidden'];
2044 if(($AmIHiddenUser=="no"&&$_SESSION['UserID']>0)||$user_agent_check!==false) {
2045 if($uviewlmbn>0) { $MembersViewList = ", ".$MembersViewList; }
2046 if($user_agent_check===false) {
2047 $uatitleadd = null;
2048 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $Settings['charset'])."\""; }
2049 if($GroupInfo['CanViewIPAddress']=="yes") {
2050 $MembersViewList = " (<a title=\"".$_SERVER['REMOTE_ADDR']."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$_SERVER['REMOTE_ADDR'])."\">".$_SERVER['REMOTE_ADDR']."</a>)".$MembersViewList; }
2051 $MembersViewList = "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$_SESSION['UserID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$_SESSION['MemberName']."</a>".$MembersViewList; 
2052 ++$uviewlmn; ++$uviewlmbn; }
2053 if($user_agent_check!==false) {
2054 $uatitleadd = null;
2055 if($GroupInfo['CanViewIPAddress']=="yes") {
2056 $MembersViewList = " (<a title=\"".$_SERVER['REMOTE_ADDR']."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$_SERVER['REMOTE_ADDR'])."\">".$_SERVER['REMOTE_ADDR']."</a>)".$MembersViewList; }
2057 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $Settings['charset'])."\""; }
2058 $MembersViewList = "<span".$uatitleadd.">".$user_agent_check."</span>".$MembersViewList; 
2059 ++$uviewlmbn; } }
2060 if($_SESSION['UserID']<=0||$AmIHiddenUser=="yes") {
2061 if($user_agent_check===false) {
2062 ++$uviewlan; } } }
2063 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
2064 /*$uatitleadd = null;
2065 if($GroupInfo['CanViewUserAgent']=="yes") { $uatitleadd = " title=\"".htmlentities($_SERVER['HTTP_USER_AGENT'], ENT_QUOTES, $Settings['charset'])."\""; }
2066 if($GroupInfo['CanViewIPAddress']=="yes") {
2067 $GuestsViewList = " (<a title=\"".$_SERVER['REMOTE_ADDR']."\" onclick=\"window.open(this.href);return false;\" href=\"".sprintf($IPCheckURL,$_SERVER['REMOTE_ADDR'])."\">".$_SERVER['REMOTE_ADDR']."</a>)".$GuestsViewList; }
2068 $GuestsViewList = "<a".$uatitleadd." href=\"".url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$MemList['ID'],$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member'])."\">".$MemList['Name']."</a>".$GuestsViewList; */
2069 ++$uviewlgn; }
2070 ++$uviewlnum;
2072 <div class="StatsBorder">
2073 <?php if($ThemeSet['TableStyle']=="div") { ?>
2074 <div class="TableStatsRow1">
2075 <span style="text-align: left;">
2076 <?php echo $ThemeSet['TitleIcon']; ?><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]); ?>">Topic Statistics</a></span></div>
2077 <?php } ?>
2078 <table id="BoardStats" class="TableStats1">
2079 <?php if($ThemeSet['TableStyle']=="table") { ?>
2080 <tr class="TableStatsRow1">
2081 <td class="TableStatsColumn1" colspan="2"><span style="text-align: left;">
2082 <?php echo $ThemeSet['TitleIcon']; ?><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]); ?>">Topic Statistics</a></span>
2083 </td>
2084 </tr><?php } ?>
2085 <tr id="Stats1" class="TableStatsRow2">
2086 <td class="TableStatsColumn2" colspan="2" style="width: 100%; font-weight: bold;"><?php echo $uviewlnum; ?> users viewing topic</td>
2087 </tr>
2088 <tr class="TableStatsRow3" id="Stats2">
2089 <td style="width: 4%;" class="TableStatsColumn3"><div class="statsicon">
2090 <?php echo $ThemeSet['StatsIcon']; ?></div></td>
2091 <td style="width: 96%;" class="TableStatsColumn3"><div class="statsinfo">
2092 &nbsp;<span style="font-weight: bold;"><?php echo $uviewlgn; ?></span> guests, <span style="font-weight: bold;"><?php echo $uviewlmn; ?></span> members, <span style="font-weight: bold;"><?php echo $uviewlan; ?></span> anonymous members <br />
2093 <?php if($MembersViewList!=null) { ?>&nbsp;<?php echo $MembersViewList."\n<br />"; } ?>
2094 </div></td>
2095 </tr>
2096 <tr id="Stats7" class="TableStatsRow4">
2097 <td class="TableStatsColumn4" colspan="2">&nbsp;</td>
2098 </tr>
2099 </table></div>
2100 <div class="DivStats">&nbsp;</div>