OSDN Git Service

Small change. :P
[idb/iDB.git.git] / inc / replies.php
1 <?php
2 /*
3     This program is free software; you can redistribute it and/or modify
4     it under the terms of the Revised BSD License.
5
6     This program is distributed in the hope that it will be useful,
7     but WITHOUT ANY WARRANTY; without even the implied warranty of
8     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9     Revised BSD License for more details.
10
11     Copyright 2004-2008 Cool Dude 2k - http://idb.berlios.de/
12     Copyright 2004-2008 Game Maker 2k - http://intdb.sourceforge.net/
13
14     $FileInfo: replies.php - Last Update: 12/09/2008 SVN 207 - Author: cooldude2k $
15 */
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="replies.php"||$File3Name=="/replies.php") {
18         require('index.php');
19         exit(); }
20 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
21 if(!is_numeric($_GET['post'])) { $_GET['post'] = null; }
22 if(!is_numeric($_GET['page'])) { $_GET['page'] = null; }
23 if(!isset($_GET['modact'])) { $_GET['modact'] = null; }
24 if($_GET['modact']=="pin"||$_GET['modact']=="unpin"||$_GET['modact']=="open"||
25         $_GET['modact']=="close"||$_GET['modact']=="edit"||$_GET['modact']=="delete")
26                 { $_GET['act'] = $_GET['modact']; }
27 if(!isset($ForumCheck)) { $ForumCheck = null; }
28 $prequery = query("SELECT * FROM `".$Settings['sqltable']."topics` WHERE `id`=%i LIMIT 1", array($_GET['id']));
29 $preresult=mysql_query($prequery);
30 $prenum=mysql_num_rows($preresult);
31 if($prenum==0) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); @mysql_free_result($preresult);
32 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
33 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
34 if($prenum>=1) {
35 $TopicName=mysql_result($preresult,0,"TopicName");
36 $TopicID=mysql_result($preresult,0,"id");
37 $TopicForumID=mysql_result($preresult,0,"ForumID");
38 $TopicCatID=mysql_result($preresult,0,"CategoryID");
39 $TopicClosed=mysql_result($preresult,0,"Closed");
40 $NumberReplies=mysql_result($preresult,0,"NumReply");
41 $ViewTimes=mysql_result($preresult,0,"NumViews");
42 @mysql_free_result($preresult);
43 $forumcheckx = query("SELECT * FROM `".$Settings['sqltable']."forums` WHERE `id`=%i  LIMIT 1", array($TopicForumID));
44 $fmckresult=mysql_query($forumcheckx);
45 $ForumName=mysql_result($fmckresult,0,"Name");
46 $ForumType=mysql_result($fmckresult,0,"ForumType");
47 $ForumPostCountView=mysql_result($fmckresult,0,"PostCountView");
48 $ForumKarmaCountView=mysql_result($fmckresult,0,"KarmaCountView");
49 @mysql_free_result($fmckresult);
50 $catcheck = query("SELECT * FROM `".$Settings['sqltable']."categories` WHERE `id`=%i  LIMIT 1", array($TopicCatID));
51 $catresult=mysql_query($catcheck);
52 $CategoryName=mysql_result($catresult,0,"Name");
53 $CategoryType=mysql_result($catresult,0,"CategoryType");
54 $CategoryPostCountView=mysql_result($catresult,0,"PostCountView");
55 $CategoryKarmaCountView=mysql_result($catresult,0,"KarmaCountView");
56 @mysql_free_result($catresult);
57 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
58 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
59 if($MyKarmaCount==null) { $MyKarmaCount = 0; }
60 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
61 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
62 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
63 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
64 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
65 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
66 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
67 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
68 if($ForumCheck!="skip") {
69 ?>
70 <div class="NavLinks"><?php echo $ThemeSet['NavLinkIcon']; ?><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); ?>">Board index</a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$CategoryType],$Settings['file_ext'],"act=view&id=".$TopicCatID,$Settings['qstr'],$Settings['qsep'],$prexqstr[$CategoryType],$exqstr[$CategoryType]); ?>"><?php echo $CategoryName; ?></a><?php echo $ThemeSet['NavLinkDivider']; ?><a href="<?php echo url_maker($exfile[$ForumType],$Settings['file_ext'],"act=view&id=".$TopicForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"><?php echo $ForumName; ?></a></div>
71 <div class="DivNavLinks">&nbsp;</div>
72 <?php }
73 if(!isset($CatPermissionInfo['CanViewCategory'][$TopicCatID])) {
74         $CatPermissionInfo['CanViewCategory'][$TopicCatID] = "no"; }
75 if($CatPermissionInfo['CanViewCategory'][$TopicCatID]=="no"||
76         $CatPermissionInfo['CanViewCategory'][$TopicCatID]!="yes") {
77 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
78 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
79 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
80 if(!isset($PermissionInfo['CanViewForum'][$TopicForumID])) {
81         $PermissionInfo['CanViewForum'][$TopicForumID] = "no"; }
82 if($PermissionInfo['CanViewForum'][$TopicForumID]=="no"||
83         $PermissionInfo['CanViewForum'][$TopicForumID]!="yes") {
84 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
85 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
86 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
87 $CanMakeReply = null;
88 if($CatPermissionInfo['CanViewCategory'][$TopicCatID]=="yes"&&
89         $PermissionInfo['CanViewForum'][$TopicForumID]=="yes") {
90 if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes"||$PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") {
91 $CanMakeReply = "no";
92 if($TopicClosed==0&&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
93         $CanMakeReply = "yes"; }
94 if($TopicClosed==1&&$PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="yes"
95         &&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
96                 $CanMakeReply = "yes"; }
97 if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes"||$PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") {
98 ?>
99 <table style="width: 100%;" class="Table2">
100 <tr>
101  <td style="width: 0%; text-align: left;">&nbsp;</td>
102  <td style="width: 100%; text-align: right;">
103  <?php if($CanMakeReply=="yes") { ?>
104  <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>
105  <?php } if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") {
106         if($CanMakeReply=="yes") { ?>
107  <?php echo $ThemeSet['ButtonDivider']; } ?>
108  <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>
109  <?php } ?></td>
110 </tr>
111 </table>
112 <div class="DivTable2">&nbsp;</div>
113 <?php } } if($_GET['act']=="view") {
114 if($NumberReplies==null) { 
115         $NumberReplies = 0; }
116 $num=$NumberReplies+1;
117 //Start Reply Page Code
118 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
119 if($_GET['page']==null) { $_GET['page'] = 1; } 
120 if($_GET['page']<=0) { $_GET['page'] = 1; }
121 $nums = $_GET['page'] * $Settings['max_posts'];
122 if($nums>$num) { $nums = $num; }
123 $numz = $nums - $Settings['max_posts'];
124 if($numz<=0) { $numz = 0; }
125 //$i=$numz;
126 if($nums<$num) { $nextpage = $_GET['page'] + 1; }
127 if($nums>=$num) { $nextpage = $_GET['page']; }
128 if($numz>=$Settings['max_posts']) { $backpage = $_GET['page'] - 1; }
129 if($_GET['page']<=1) { $backpage = 1; }
130 $pnum = $num; $l = 1; $Pages = null;
131 while ($pnum>0) {
132 if($pnum>=$Settings['max_posts']) { 
133         $pnum = $pnum - $Settings['max_posts']; 
134         $Pages[$l] = $l; ++$l; }
135 if($pnum<$Settings['max_posts']&&$pnum>0) { 
136         $pnum = $pnum - $pnum; 
137         $Pages[$l] = $l; ++$l; } }
138 $PageLimit = $nums - $Settings['max_posts'];
139 if($PageLimit<0) { $PageLimit = 0; }
140 //End Reply Page Code
141 $i=0;
142 $query = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `TopicID`=%i ORDER BY `TimeStamp` ASC LIMIT %i,%i", array($_GET['id'],$PageLimit,$Settings['max_posts']));
143 $result=mysql_query($query);
144 $num=mysql_num_rows($result);
145 if($num==0) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
146 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
147 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
148 if($num!=0) { 
149 if($ViewTimes==0||$ViewTimes==null) { $NewViewTimes = 1; }
150 if($ViewTimes!=0&&$ViewTimes!=null) { $NewViewTimes = $ViewTimes + 1; }
151 $viewsup = query("UPDATE `".$Settings['sqltable']."topics` SET `NumViews`='%s' WHERE `id`=%i", array($NewViewTimes,$_GET['id']));
152 mysql_query($viewsup); }
153 //List Page Number Code Start
154 $pagenum=count($Pages);
155 if($_GET['page']>$pagenum) {
156         $_GET['page'] = $pagenum; }
157 $pagei=0; $pstring = "<div class=\"PageList\"><span class=\"pagelink\">Pages:</span> ";
158 if($_GET['page']<4) { $Pagez[0] = null; }
159 if($_GET['page']>=4) { $Pagez[0] = "First"; }
160 if($_GET['page']>=3) {
161 $Pagez[1] = $_GET['page'] - 2; }
162 if($_GET['page']<3) {
163 $Pagez[1] = null; }
164 if($_GET['page']>=2) {
165 $Pagez[2] = $_GET['page'] - 1; }
166 if($_GET['page']<2) {
167 $Pagez[2] = null; }
168 $Pagez[3] = $_GET['page'];
169 if($_GET['page']<$pagenum) {
170 $Pagez[4] = $_GET['page'] + 1; }
171 if($_GET['page']>=$pagenum) {
172 $Pagez[4] = null; }
173 $pagenext = $_GET['page'] + 1;
174 if($pagenext<$pagenum) {
175 $Pagez[5] = $_GET['page'] + 2; }
176 if($pagenext>=$pagenum) {
177 $Pagez[5] = null; }
178 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
179 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
180 $pagenumi=count($Pagez);
181 if($num==0) {
182 $pagenumi = 0;
183 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$_GET['id']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">1</a></span> "; }
184 while ($pagei < $pagenumi) {
185 if($Pagez[$pagei]!=null&&
186    $Pagez[$pagei]!="First"&&
187    $Pagez[$pagei]!="Last") {
188 if($pagei==1&$Pagez[$pagei]!=null&&$Pagez[$pagei]>=2) {
189 $Pback = $Pagez[$pagei] - 1;
190 $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> "; }
191 if($pagei!=3) { 
192 $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> "; }
193 if($pagei==3) { 
194 $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> "; } }
195 if($Pagez[$pagei]=="First") {
196 $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> "; }
197 if($Pagez[$pagei]=="Last") {
198 $ptestnext = $pagenext + 1;
199 if($ptestnext<$pagenum) {
200 $paget = $pagei - 1;
201 $Pnext = $Pagez[$paget] + 1;
202 $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> "; }
203 $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> "; }
204         ++$pagei; } $pstring = $pstring."</div>";
205 echo $pstring;
206 //List Page Number Code end
207 ?>
208 <div class="DivPageLinks">&nbsp;</div>
209 <?php
210 while ($i < $num) {
211 $MyPostID=mysql_result($result,$i,"id");
212 $MyTopicID=mysql_result($result,$i,"TopicID");
213 $MyPostIP=mysql_result($result,$i,"IP");
214 $MyForumID=mysql_result($result,$i,"ForumID");
215 $MyCategoryID=mysql_result($result,$i,"CategoryID");
216 $MyUserID=mysql_result($result,$i,"UserID");
217 $MyGuestName=mysql_result($result,$i,"GuestName");
218 $MyTimeStamp=mysql_result($result,$i,"TimeStamp");
219 $MyEditTime=mysql_result($result,$i,"LastUpdate");
220 $MyEditUserID=mysql_result($result,$i,"EditUser");
221 $MyTimeStamp=GMTimeChange("M j, Y, g:i a",$MyTimeStamp,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
222 $MyPost=mysql_result($result,$i,"Post");
223 $MyPost = preg_replace("/\<br\>/", "<br />\n", nl2br($MyPost));
224 $MyDescription=mysql_result($result,$i,"Description");
225 $requery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($MyUserID));
226 $reresult=mysql_query($requery);
227 $renum=mysql_num_rows($reresult);
228 $rei=0; $ipshow = "two";
229 $User1ID=$MyUserID; $GuestName = $MyGuestName;
230 $User1Name=mysql_result($reresult,$rei,"Name");
231 $User1IP=mysql_result($reresult,$rei,"IP");
232 if($User1IP==$MyPostIP) { $ipshow = "one"; }
233 $User1Email=mysql_result($reresult,$rei,"Email");
234 $User1Title=mysql_result($reresult,$rei,"Title");
235 $User1Joined=mysql_result($reresult,$rei,"Joined");
236 $User1Joined=GMTimeChange("M j Y",$User1Joined,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
237 $User1GroupID=mysql_result($reresult,$rei,"GroupID");
238 $gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($User1GroupID));
239 $gresult=mysql_query($gquery);
240 $User1Group=mysql_result($gresult,0,"Name");
241 $GroupNamePrefix=mysql_result($gresult,0,"NamePrefix");
242 $GroupNameSuffix=mysql_result($gresult,0,"NameSuffix");
243 @mysql_free_result($gresult);
244 $User1Signature=mysql_result($reresult,$rei,"Signature");
245 $User1Avatar=mysql_result($reresult,$rei,"Avatar");
246 $User1AvatarSize=mysql_result($reresult,$rei,"AvatarSize");
247 if ($User1Avatar=="http://"||$User1Avatar==null||
248         strtolower($User1Avatar)=="noavatar") {
249 $User1Avatar=$ThemeSet['NoAvatar'];
250 $User1AvatarSize=$ThemeSet['NoAvatarSize']; }
251 $AvatarSize1=explode("x", $User1AvatarSize);
252 $AvatarSize1W=$AvatarSize1[0]; $AvatarSize1H=$AvatarSize1[1];
253 $User1Website=mysql_result($reresult,$rei,"Website");
254 $User1PostCount=mysql_result($reresult,$rei,"PostCount");
255 $User1Karma=mysql_result($reresult,$rei,"Karma");
256 $User1IP=mysql_result($reresult,$rei,"IP");
257 @mysql_free_result($reresult);
258 if($User1Name=="Guest") { $User1Name=$GuestName;
259 if($User1Name==null) { $User1Name="Guest"; } }
260 if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
261         $User1Name = $GroupNamePrefix.$User1Name; }
262 if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
263         $User1Name = $User1Name.$GroupNameSuffix; }
264 $MySubPost = null;
265 if($MyEditTime!=$MyTimeStamp&&$MyEditUserID!=0) {
266 $euquery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($MyEditUserID));
267 $euresult = mysql_query($euquery);
268 $eunum = mysql_num_rows($euresult);
269 $eui=0; while ($eui < $eunum) {
270         $EditUserID = $MyEditUserID;
271         $EditUserName = mysql_result($euresult,$eui,"Name");
272         ++$eui; }
273         $MyEditTime = GMTimeChange("M j, Y, g:i a",$MyEditTime,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
274         $MySubPost = "<div class=\"EditReply\"><br />This post has been edited by <b>".$EditUserName."</b> on ".$MyEditTime."</div>"; }
275 $MyPost = text2icons($MyPost,$Settings['sqltable']);
276 if($MySubPost!=null) { $MyPost = $MyPost."\n".$MySubPost; }
277 $User1Signature = preg_replace("/\<br\>/", "<br />\n", nl2br($User1Signature));
278 $User1Signature = text2icons($User1Signature,$Settings['sqltable']);
279 $CanEditReply = false; $CanDeleteReply = false;
280 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
281 if($PermissionInfo['CanEditReplys'][$MyForumID]=="yes"&&
282         $_SESSION['UserID']==$MyUserID) { $CanEditReply = true; }
283 if($PermissionInfo['CanDeleteReplys'][$MyForumID]=="yes"&&
284         $_SESSION['UserID']==$MyUserID) { $CanDeleteReply = true; }
285 if($PermissionInfo['CanModForum'][$MyForumID]=="yes") { 
286         $CanEditReply = true; $CanDeleteReply = true; } }
287 if($_SESSION['UserID']==0) { 
288         $CanEditReply = false; $CanDeleteReply = false; }
289 $ReplyNum = $i + $PageLimit + 1;
290 ?>
291 <div class="TableInfo1Border">
292 <?php if($ThemeSet['TableStyle']=="div") { ?>
293 <div class="TableInfoRow1">
294 <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'])."&#35;reply".$ReplyNum; ?>"><?php echo $TopicName; ?></a> ( <?php echo $MyDescription; ?> )</span>
295 </div>
296 <?php } ?>
297 <table class="TableInfo1">
298 <?php if($ThemeSet['TableStyle']=="table") { ?>
299 <tr class="TableInfoRow1">
300 <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'])."&#35;reply".$ReplyNum; ?>"><?php echo $TopicName; ?></a> ( <?php echo $MyDescription; ?> )</span>
301 </td>
302 </tr><?php } ?>
303 <tr class="TableInfoRow2">
304 <td class="TableInfoColumn2" style="vertical-align: middle; width: 160px;">
305 &nbsp;<?php
306 if($User1ID!="-1") {
307 echo "<a href=\"";
308 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$User1ID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']);
309 echo "\">".$User1Name."</a>"; }
310 if($User1ID=="-1") {
311 echo "<span>".$User1Name."</span>"; }
312 ?></td>
313 <td class="TableInfoColumn2" style="vertical-align: middle;">
314 <div style="float: left; text-align: left;" id="post<?php echo $MyPostID; ?>">
315 <a style="vertical-align: middle;" id="reply<?php echo $ReplyNum; ?>">
316 <span style="font-weight: bold;">Time Posted: </span><?php echo $MyTimeStamp; ?></a>
317 </div>
318 <div style="float: right;">
319 <?php if(isset($ThemeSet['Report'])&&$ThemeSet['Report']!=null) { ?>
320 <a href="#Act/Report"><?php echo $ThemeSet['Report']; ?></a>
321 <?php } if($CanEditReply===true&&isset($ThemeSet['EditReply'])&&$ThemeSet['EditReply']!=null) {
322 echo $ThemeSet['LineDividerTopic']; echo "<a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=edit&id=".$MyTopicID."&post=".$MyPostID,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">".$ThemeSet['EditReply']; ?></a>
323 <?php } if($CanDeleteReply===true&&isset($ThemeSet['DeleteReply'])&&$ThemeSet['DeleteReply']!=null) { 
324 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>
325 <?php } if($CanMakeReply=="yes"&&isset($ThemeSet['QuoteReply'])&&$ThemeSet['QuoteReply']!=null) { 
326 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>
327 <?php } ?>&nbsp;</div>
328 </td>
329 </tr>
330 <tr class="TableInfoRow3">
331 <td class="TableInfoColumn3" style="vertical-align: top; width: 180px;">
332  <?php  /* Avatar Table Thanks For SeanJ's Help at http://seanj.jcink.com/ */  ?>
333  <table class="AvatarTable" style="width: 100px; height: 100px; text-align: center;">
334         <tr class="AvatarRow" style="width: 100%; height: 100%;">
335                 <td class="AvatarRow" style="width: 100%; height: 100%; text-align: center; vertical-align: middle;">
336                 <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;" />
337                 </td>
338         </tr>
339  </table><br />
340 <?php echo $User1Title; ?><br />
341 Group: <?php echo $User1Group; ?><br />
342 Member: <?php 
343 if($User1ID!="-1") { echo $User1ID; }
344 if($User1ID=="-1") { echo 0; }
345 ?><br />
346 Posts: <?php echo $User1PostCount; ?><br />
347 Karma: <?php echo $User1Karma; ?><br />
348 Joined: <?php echo $User1Joined; ?><br />
349 <?php if($GroupInfo['HasAdminCP']=="yes") { ?>
350 User IP: <a onclick="window.open(this.href);return false;" href="http://ip-lookup.net/?<?php echo $User1IP; ?>">
351 <?php echo $User1IP; ?></a><br />
352 <?php if($ipshow=="two") { ?>
353 Post IP: <a onclick="window.open(this.href);return false;" href="http://ip-lookup.net/?<?php echo $MyPostIP; ?>">
354 <?php echo $MyPostIP; ?></a><br />
355 <?php } } ?><br />
356 </td>
357 <td class="TableInfoColumn3" style="vertical-align: middle;">
358 <div class="replypost"><?php echo $MyPost; ?></div>
359 <?php if(isset($User1Signature)) { ?> <br />--------------------
360 <div class="signature"><?php echo $User1Signature; ?></div><?php } ?>
361 </td>
362 </tr>
363 <tr class="TableInfoRow4">
364 <td class="TableInfoColumn4" colspan="2">
365 <span style="text-align: left;">&nbsp;<a href="<?php
366 if($User1ID!="-1") {
367 echo url_maker($exfile['member'],$Settings['file_ext'],"act=view&id=".$User1ID,$Settings['qstr'],$Settings['qsep'],$prexqstr['member'],$exqstr['member']); }
368 if($User1ID=="-1"&&isset($ThemeSet['Profile'])&&$ThemeSet['Profile']!=null) {
369 echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); }
370 ?>"><?php echo $ThemeSet['Profile']; ?></a>
371 <?php if(isset($ThemeSet['WWW'])&&$ThemeSet['WWW']!=null) {
372 echo $ThemeSet['LineDividerTopic']; ?><a href="<?php echo $User1Website; ?>" onclick="window.open(this.href);return false;"><?php echo $ThemeSet['WWW']; ?></a><?php } echo $ThemeSet['LineDividerTopic']; ?><a href="<?php
373 if($User1ID!="-1"&&isset($ThemeSet['Profile'])&&$ThemeSet['Profile']!=null) {
374 echo url_maker($exfile['messenger'],$Settings['file_ext'],"act=create&id=".$User1ID,$Settings['qstr'],$Settings['qsep'],$prexqstr['messenger'],$exqstr['messenger']); }
375 if($User1ID=="-1"&&isset($ThemeSet['PM'])&&$ThemeSet['PM']!=null) {
376 echo url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index']); }
377 ?>"><?php echo $ThemeSet['PM']; ?></a></span>
378 </td>
379 </tr>
380 </table></div>
381 <div class="DivReplies">&nbsp;</div>
382 <?php ++$i; } @mysql_free_result($result); 
383 if($CanMakeReply=="yes") {  
384 if(!isset($_GET['fastreply'])) { $_GET['fastreply'] = false; }
385 if($_GET['fastreply']===true||
386         $_GET['fastreply']=="on") { $fps = " "; }
387 if($_GET['fastreply']!==true&&
388         $_GET['fastreply']!="on") { $fps = " style=\"display: none;\" "; }
389 $QuoteReply = null; $QuoteDescription = null;
390 ?>
391 <div class="Table1Border"<?php echo $fps; ?>id="FastReply">
392 <?php if($ThemeSet['TableStyle']=="div") { ?>
393 <div class="TableRow1">
394 <span style="text-align: left;">
395 <?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>
396 <?php } ?>
397 <table class="Table1" id="MakeReply<?php echo $TopicForumID; ?>">
398 <?php if($ThemeSet['TableStyle']=="table") { ?>
399 <tr class="TableRow1" id="ReplyStart<?php echo $TopicForumID; ?>">
400 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
401 <?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>
402 </td>
403 </tr><?php } ?>
404 <tr id="MakeReplyRow<?php echo $TopicForumID; ?>" class="TableRow2">
405 <td class="TableColumn2" colspan="2" style="width: 100%;">Making a Reply in Topic <?php echo $TopicName; ?></td>
406 </tr>
407 <tr class="TableRow3" id="MkReply<?php echo $TopicForumID; ?>">
408 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
409 <div style="width: 100%; height: 160px; overflow: auto;">
410 <table style="width: 100%; text-align: center;"><?php
411 $renee_query=query("SELECT * FROM `".$Settings['sqltable']."smileys` WHERE `Show`='yes'", array(null));
412 $renee_result=mysql_query($renee_query);
413 $renee_num=mysql_num_rows($renee_result);
414 $renee_s=0; $SmileRow=0; $SmileCRow=0;
415 while ($renee_s < $renee_num) { ++$SmileRow;
416 $FileName=mysql_result($renee_result,$renee_s,"FileName");
417 $SmileName=mysql_result($renee_result,$renee_s,"SmileName");
418 $SmileText=mysql_result($renee_result,$renee_s,"SmileText");
419 $SmileDirectory=mysql_result($renee_result,$renee_s,"Directory");
420 $ShowSmile=mysql_result($renee_result,$renee_s,"Show");
421 $ReplaceType=mysql_result($renee_result,$renee_s,"ReplaceCI");
422 if($SmileRow==1) { ?><tr>
423         <?php } if($SmileRow<5) { ++$SmileCRow; ?>
424         <td>&nbsp;<img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" />&nbsp;</td>
425         <?php } if($SmileRow==5) { ++$SmileCRow; ?>
426         <td>&nbsp;<img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" />&nbsp;</td></tr>
427         <?php $SmileCRow=0; $SmileRow=0; }
428 ++$renee_s; }
429 if($SmileCRow<5&&$SmileCRow!=0) {
430 $SmileCRowL = 5 - $SmileCRow;
431 echo "<td colspan=\"".$SmileCRowL."\">&nbsp;</td></tr>"; }
432 echo "</table>";
433 @mysql_free_result($renee_result);
434 ?></div></td>
435 <td class="TableColumn3" style="width: 85%;">
436 <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']); ?>">
437 <table style="text-align: left;">
438 <tr style="text-align: left;">
439         <td style="width: 50%;"><label class="TextBoxLabel" for="ReplyDesc">Insert Reply Description:</label></td>
440         <td style="width: 50%;"><input maxlength="45" type="text" name="ReplyDesc" class="TextBox" id="ReplyDesc" size="20" value="<?php echo $QuoteDescription; ?>" /></td>
441 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
442         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
443         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
444 </tr><?php } ?>
445 </table>
446 <table style="text-align: left;">
447 <tr style="text-align: left;">
448 <td style="width: 100%;">
449 <label class="TextBoxLabel" for="ReplyPost">Insert Your Reply:</label><br />
450 <textarea rows="10" name="ReplyPost" id="ReplyPost" cols="40" class="TextBox"><?php echo $QuoteReply; ?></textarea><br />
451 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
452 <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 />
453 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
454 <?php } ?>
455 <input type="hidden" name="act" value="makereplies" style="display: none;" />
456 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
457 <input type="hidden" name="GuestName" value="null" style="display: none;" />
458 <?php } ?>
459 <input type="hidden" name="act" value="makereplies" style="display: none;" />
460 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
461 <input type="hidden" name="GuestName" value="null" style="display: none;" />
462 <?php } ?>
463 <input type="submit" class="Button" value="Make Reply" name="make_reply" />
464 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
465 </td></tr></table>
466 </form></td></tr>
467 <tr id="MkReplyEnd<?php echo $TopicForumID; ?>" class="TableRow4">
468 <td class="TableColumn4" colspan="2">&nbsp;</td>
469 </tr>
470 </table></div>
471 <div class="MkFastReply">&nbsp;</div>
472 <?php } } if($_GET['act']=="create") {
473 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
474 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
475 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
476 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
477 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
478 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
479 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
480 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
481 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
482 if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="no") { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
483 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
484 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
485 if($PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
486 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
487 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
488 $QuoteReply = null; $QuoteDescription = null;
489 if($_GET['post']!=null) {
490 $query = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `id`=%i LIMIT 1", array($_GET['post']));
491 $result=mysql_query($query);
492 $num=mysql_num_rows($result);
493 $QuoteReplyID=mysql_result($result,0,"id");
494 $QuoteReplyFID=mysql_result($result,0,"ForumID");
495 $QuoteReplyCID=mysql_result($result,0,"CategoryID");
496 $QuoteUserID=mysql_result($result,0,"UserID");
497 $QuoteReply=mysql_result($result,0,"Post");
498 $QuoteDescription=mysql_result($result,0,"Description");
499 $QuoteGuestName=mysql_result($result,0,"GuestName");
500 $requery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($QuoteUserID));
501 $reresult=mysql_query($requery);
502 $renum=mysql_num_rows($reresult);
503 $QuoteUserName=mysql_result($reresult,0,"Name");
504 if($QuoteUserName=="Guest") { $QuoteUserName=$QuoteGuestName;
505 if($QuoteUserName==null) { $QuoteUserName="Guest"; } }
506 $QuoteUserName = stripcslashes(htmlspecialchars($QuoteUserName, ENT_QUOTES, $Settings['charset']));
507 //$QuoteUserName = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $QuoteUserName);
508 $QuoteUserName = @remove_spaces($QuoteUserName);
509 /*$QuoteReply = stripcslashes(htmlspecialchars($QuoteReply, ENT_QUOTES, $Settings['charset']));
510 $QuoteReply = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $QuoteReply);
511 //$QuoteReply = @remove_spaces($QuoteReply);*/
512 $QuoteReply = remove_bad_entities($QuoteReply);
513 $QuoteDescription = str_replace("Re: ","",$QuoteDescription);
514 $QuoteDescription = "Re: ".$QuoteDescription;
515 $QuoteReply = $QuoteUserName.":\n(&quot;".$QuoteReply."&quot;)"; 
516 if(!isset($PermissionInfo['CanViewForum'][$QuoteReplyFID])) {
517         $PermissionInfo['CanViewForum'][$QuoteReplyFID] = "no"; }
518 if($PermissionInfo['CanViewForum'][$QuoteReplyFID]=="no") {
519         $QuoteReply = null; $QuoteDescription = null; }
520 if(!isset($CatPermissionInfo['CanViewCategory'][$QuoteReplyCID])) {
521         $CatPermissionInfo['CanViewCategory'][$QuoteReplyCID] = "no"; }
522 if($CatPermissionInfo['CanViewCategory'][$QuoteReplyCID]=="no") {
523         $QuoteReply = null; $QuoteDescription = null; } }
524 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
525 if($_GET['post']!=null) {
526 $rforumcheck = query("SELECT * FROM `".$Settings['sqltable']."forums` WHERE `id`=%i  LIMIT 1", array($QuoteReplyFID));
527 $rfmckresult=mysql_query($rforumcheck);
528 $rForumPostCountView=mysql_result($rfmckresult,0,"PostCountView");
529 $rForumKarmaCountView=mysql_result($rfmckresult,0,"KarmaCountView");
530 @mysql_free_result($rfmckresult);
531 $rcatcheck = query("SELECT * FROM `".$Settings['sqltable']."categories` WHERE `id`=%i  LIMIT 1", array($QuoteReplyCID));
532 $rcatresult=mysql_query($rcatcheck);
533 $rCategoryPostCountView=mysql_result($rcatresult,0,"PostCountView");
534 $rCategoryKarmaCountView=mysql_result($rcatresult,0,"KarmaCountView");
535 @mysql_free_result($rcatresult);
536 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
537 if($rForumPostCountView!=0&&$MyPostCountChk<$rForumPostCountView) {
538 $QuoteReply = null; $QuoteDescription = null; }
539 if($rCategoryPostCountView!=0&&$MyPostCountChk<$rCategoryPostCountView) {
540 $QuoteReply = null; $QuoteDescription = null; }
541 if($rForumKarmaCountView!=0&&$MyKarmaCount<$rForumKarmaCountView) {
542 $QuoteReply = null; $QuoteDescription = null; }
543 if($rCategoryKarmaCountView!=0&&$MyKarmaCount<$rCategoryKarmaCountView) {
544 $QuoteReply = null; $QuoteDescription = null; } } }
545 if($_GET['post']==null) { $QuoteReply = null; $QuoteDescription = null; }
546 ?>
547 <div class="Table1Border">
548 <?php if($ThemeSet['TableStyle']=="div") { ?>
549 <div class="TableRow1">
550 <span style="text-align: left;">
551 <?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>
552 <?php } ?>
553 <table class="Table1" id="MakeReply<?php echo $TopicForumID; ?>">
554 <?php if($ThemeSet['TableStyle']=="table") { ?>
555 <tr class="TableRow1" id="ReplyStart<?php echo $TopicForumID; ?>">
556 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
557 <?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>
558 </td>
559 </tr><?php } ?>
560 <tr id="MakeReplyRow<?php echo $TopicForumID; ?>" class="TableRow2">
561 <td class="TableColumn2" colspan="2" style="width: 100%;">Making a Reply in Topic <?php echo $TopicName; ?></td>
562 </tr>
563 <tr class="TableRow3" id="MkReply<?php echo $TopicForumID; ?>">
564 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
565 <div style="width: 100%; height: 160px; overflow: auto;">
566 <table style="width: 100%; text-align: center;"><?php
567 $renee_query=query("SELECT * FROM `".$Settings['sqltable']."smileys` WHERE `Show`='yes'", array(null));
568 $renee_result=mysql_query($renee_query);
569 $renee_num=mysql_num_rows($renee_result);
570 $renee_s=0; $SmileRow=0; $SmileCRow=0;
571 while ($renee_s < $renee_num) { ++$SmileRow;
572 $FileName=mysql_result($renee_result,$renee_s,"FileName");
573 $SmileName=mysql_result($renee_result,$renee_s,"SmileName");
574 $SmileText=mysql_result($renee_result,$renee_s,"SmileText");
575 $SmileDirectory=mysql_result($renee_result,$renee_s,"Directory");
576 $ShowSmile=mysql_result($renee_result,$renee_s,"Show");
577 $ReplaceType=mysql_result($renee_result,$renee_s,"ReplaceCI");
578 if($SmileRow==1) { ?><tr>
579         <?php } if($SmileRow<5) { ++$SmileCRow; ?>
580         <td>&nbsp;<img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" />&nbsp;</td>
581         <?php } if($SmileRow==5) { ++$SmileCRow; ?>
582         <td>&nbsp;<img src="<?php echo $SmileDirectory."".$FileName; ?>" style="vertical-align: middle; border: 0px; cursor: pointer;" title="<?php echo $SmileName; ?>" alt="<?php echo $SmileName; ?>" onclick="addsmiley('ReplyPost','&nbsp;<?php echo htmlspecialchars($SmileText, ENT_QUOTES, $Settings['charset']); ?>&nbsp;')" />&nbsp;</td></tr>
583         <?php $SmileCRow=0; $SmileRow=0; }
584 ++$renee_s; }
585 if($SmileCRow<5&&$SmileCRow!=0) {
586 $SmileCRowL = 5 - $SmileCRow;
587 echo "<td colspan=\"".$SmileCRowL."\">&nbsp;</td></tr>"; }
588 echo "</table>";
589 @mysql_free_result($renee_result);
590 ?></div></td>
591 <td class="TableColumn3" style="width: 85%;">
592 <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']); ?>">
593 <table style="text-align: left;">
594 <tr style="text-align: left;">
595         <td style="width: 50%;"><label class="TextBoxLabel" for="ReplyDesc">Insert Reply Description:</label></td>
596         <td style="width: 50%;"><input maxlength="45" type="text" name="ReplyDesc" class="TextBox" id="ReplyDesc" size="20" value="<?php echo $QuoteDescription; ?>" /></td>
597 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
598         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
599         <?php if(!isset($_SESSION['GuestName'])) { ?>
600         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
601         <?php } if(isset($_SESSION['GuestName'])) { ?>
602         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
603 <?php } ?></tr><?php } ?>
604 </table>
605 <table style="text-align: left;">
606 <tr style="text-align: left;">
607 <td style="width: 100%;">
608 <label class="TextBoxLabel" for="ReplyPost">Insert Your Reply:</label><br />
609 <textarea rows="10" name="ReplyPost" id="ReplyPost" cols="40" class="TextBox"><?php echo $QuoteReply; ?></textarea><br />
610 <?php if($_SESSION['UserGroup']==$Settings['GuestGroup']&&$Settings['captcha_guest']=="on") { ?>
611 <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 />
612 <input maxlength="25" type="text" class="TextBox" name="signcode" size="20" id="signcode" value="Enter SignCode" /><br />
613 <?php } ?>
614 <input type="hidden" name="act" value="makereplies" style="display: none;" />
615 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
616 <input type="hidden" name="GuestName" value="null" style="display: none;" />
617 <?php } ?>
618 <input type="submit" class="Button" value="Make Reply" name="make_reply" />
619 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
620 </td></tr></table>
621 </form></td></tr>
622 <tr id="MkReplyEnd<?php echo $TopicForumID; ?>" class="TableRow4">
623 <td class="TableColumn4" colspan="2">&nbsp;</td>
624 </tr>
625 </table></div>
626 <div class="DivMkReply">&nbsp;</div>
627 <?php } if($_GET['act']=="makereply"&&$_POST['act']=="makereplies") {
628 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
629 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
630 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
631 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
632 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
633 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
634 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
635 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
636 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
637 if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="no") { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
638 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
639 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
640 if($PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
641 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
642 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
643 $MyUsersID = $_SESSION['UserID']; if($MyUsersID=="0"||$MyUsersID==null) { $MyUsersID = -1; }
644 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
645 $URL['REFERER'] = $REFERERurl['host'];
646 $URL['HOST'] = $_SERVER["SERVER_NAME"];
647 $REFERERurl = null;
648 if(!isset($_POST['ReplyDesc'])) { $_POST['ReplyDesc'] = null; }
649 if(!isset($_POST['ReplyPost'])) { $_POST['ReplyPost'] = null; }
650 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
651 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
652         $Settings['captcha_guest']=="on") {
653 require($SettDir['inc']."captcha.php"); }
654 ?>
655 <div class="Table1Border">
656 <?php if($ThemeSet['TableStyle']=="div") { ?>
657 <div class="TableRow1">
658 <span style="text-align: left;">
659 <?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>
660 <?php } ?>
661 <table class="Table1">
662 <?php if($ThemeSet['TableStyle']=="table") { ?>
663 <tr class="TableRow1">
664 <td class="TableColumn1"><span style="text-align: left;">
665 <?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>
666 </td>
667 </tr><?php } ?>
668 <tr class="TableRow2">
669 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Make Reply Message: </th>
670 </tr>
671 <tr class="TableRow3">
672 <td class="TableColumn3">
673 <table style="width: 100%; height: 25%; text-align: center;">
674 <?php if (pre_strlen($_POST['ReplyDesc'])>="45") { $Error="Yes";  ?>
675 <tr>
676         <td><span class="TableMessage">
677         <br />Your Reply Description is too big.<br />
678         </span>&nbsp;</td>
679 </tr>
680 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
681         $Settings['captcha_guest']=="on") {
682 if (PhpCaptcha::Validate($_POST['signcode'])) {
683 //echo 'Valid code entered';
684 } else { $Error="Yes"; ?>
685 <tr>
686         <td><span class="TableMessage">
687         <br />Invalid code entered<br />
688         </span>&nbsp;</td>
689 </tr>
690 <?php } } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
691         pre_strlen($_POST['GuestName'])>="25") { $Error="Yes"; ?>
692 <tr>
693         <td><span class="TableMessage">
694         <br />You Guest Name is too big.<br />
695         </span>&nbsp;</td>
696 </tr>
697 <?php } if ($Settings['TestReferer']=="on") {
698         if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
699 <tr>
700         <td><span class="TableMessage">
701         <br />Sorry the referering url dose not match our host name.<br />
702         </span>&nbsp;</td>
703 </tr>
704 <?php } }
705 $_POST['ReplyDesc'] = stripcslashes(htmlspecialchars($_POST['ReplyDesc'], ENT_QUOTES, $Settings['charset']));
706 //$_POST['ReplyDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyDesc']);
707 $_POST['ReplyDesc'] = @remove_spaces($_POST['ReplyDesc']);
708 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
709 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
710 $_POST['GuestName'] = @remove_spaces($_POST['GuestName']);
711 $_POST['ReplyPost'] = stripcslashes(htmlspecialchars($_POST['ReplyPost'], ENT_QUOTES, $Settings['charset']));
712 //$_POST['ReplyPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyPost']);
713 //$_POST['ReplyPost'] = @remove_spaces($_POST['ReplyPost']);
714 $_POST['ReplyPost'] = remove_bad_entities($_POST['ReplyPost']);
715 if($_SESSION['UserGroup']==$Settings['GuestGroup']) {
716 if(isset($_POST['GuestName'])&&$_POST['GuestName']!=null) {
717 @setcookie("GuestName", $_POST['GuestName'], time() + (7 * 86400), $cbasedir);
718 $_SESSION['GuestName']=$_POST['GuestName']; } }
719 /*    <_<  iWordFilter  >_>      
720    by Kazuki Przyborowski - Cool Dude 2k */
721 $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
722 $katarzynart=mysql_query($katarzynaqy);
723 $katarzynanm=mysql_num_rows($katarzynart);
724 $katarzynas=0;
725 while ($katarzynas < $katarzynanm) {
726 $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
727 $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
728 $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
729 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
730 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
731 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
732 $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
733 if($WholeWord=="on") { $WholeWord = "yes"; }
734 if($WholeWord=="off") { $WholeWord = "no"; }
735 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
736 $Filter = preg_quote($Filter, "/");
737 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
738 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyDesc']); 
739 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyPost']); }
740 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
741 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyDesc']); 
742 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyPost']); }
743 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
744 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyDesc']); 
745 $_POST['ReplyPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyPost']); }
746 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
747 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyDesc']); 
748 $_POST['ReplyPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyPost']); }
749 ++$katarzynas; } @mysql_free_result($katarzynart);
750 if ($_POST['ReplyDesc']==null) { $Error="Yes"; ?>
751 <tr>
752         <td><span class="TableMessage">
753         <br />You need to enter a Reply Description.<br />
754         </span>&nbsp;</td>
755 </tr>
756 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
757         $_POST['GuestName']==null) { $Error="Yes"; ?>
758 <tr>
759         <td><span class="TableMessage">
760         <br />You need to enter a Guest Name.<br />
761         </span>&nbsp;</td>
762 </tr>
763 <?php } if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="no") { $Error="Yes"; ?>
764 <tr>
765         <td><span class="TableMessage">
766         <br />You do not have permission to make a reply here.<br />
767         </span>&nbsp;</td>
768 </tr>
769 <?php } if($PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="no"&&
770         $TopicClosed==1) { $Error="Yes"; ?>
771 <tr>
772         <td><span class="TableMessage">
773         <br />You do not have permission to make a reply here.<br />
774         </span>&nbsp;</td>
775 </tr>
776 <?php } if ($_POST['ReplyPost']==null) { $Error="Yes"; ?>
777 <tr>
778         <td><span class="TableMessage">
779         <br />You need to enter a Reply.<br />
780         </span>&nbsp;</td>
781 </tr>
782 <?php } if ($Error=="Yes") {
783 @redirect("refresh",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false),"4"); ?>
784 <tr>
785         <td><span class="TableMessage">
786         <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;
787         </span><br /></td>
788 </tr>
789 <?php } if ($Error!="Yes") { $LastActive = GMTimeStamp();
790 $gnrquery = query("SELECT * FROM `".$Settings['sqltable']."forums` WHERE `id`=%i LIMIT 1", array($TopicForumID));
791 $gnrresult=mysql_query($gnrquery); $gnrnum=mysql_num_rows($gnrresult);
792 $NumberPosts=mysql_result($gnrresult,0,"NumPosts"); 
793 $PostCountAdd=mysql_result($gnrresult,0,"PostCountAdd"); 
794 @mysql_free_result($gnrresult);
795 $postid = getnextid($Settings['sqltable'],"posts");
796 $requery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($MyUsersID));
797 $reresult=mysql_query($requery);
798 $renum=mysql_num_rows($reresult);
799 $rei=0;
800 while ($rei < $renum) {
801 $User1ID=$MyUsersID;
802 $User1Name=mysql_result($reresult,$rei,"Name");
803 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
804 $User1Email=mysql_result($reresult,$rei,"Email");
805 $User1Title=mysql_result($reresult,$rei,"Title");
806 $User1GroupID=mysql_result($reresult,$rei,"GroupID");
807 $PostCount=mysql_result($reresult,$rei,"PostCount");
808 $NewPostCount = null;
809 if($PostCountAdd=="on") { $NewPostCount = $PostCount + 1; }
810 if(!isset($NewPostCount)) { $NewPostCount = $PostCount; }
811 $gquery = query("SELECT * FROM `".$Settings['sqltable']."groups` WHERE `id`=%i LIMIT 1", array($User1GroupID));
812 $gresult=mysql_query($gquery);
813 $User1Group=mysql_result($gresult,0,"Name");
814 @mysql_free_result($gresult);
815 $User1IP=$_SERVER['REMOTE_ADDR'];
816 ++$rei; } @mysql_free_result($reresult);
817 $query = query("INSERT INTO `".$Settings['sqltable']."posts` VALUES (".$postid.",%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));
818 mysql_query($query);
819 if($User1ID!=0&&$User1ID!=-1) {
820 $queryupd = query("UPDATE `".$Settings['sqltable']."members` SET `LastActive`=%i,`IP`='%s',`PostCount`=%i WHERE `id`=%i", array($LastActive,$User1IP,$NewPostCount,$User1ID));
821 mysql_query($queryupd); }
822 $NewNumPosts = $NumberPosts + 1; $NewNumReplies = $NumberReplies + 1;
823 $queryupd = query("UPDATE `".$Settings['sqltable']."forums` SET `NumPosts`=%i WHERE `id`=%i", array($NewNumPosts,$TopicForumID));
824 mysql_query($queryupd);
825 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `NumReply`=%i,LastUpdate=%i WHERE `id`=%i", array($NewNumReplies,$LastActive,$TopicID));
826 mysql_query($queryupd);
827 $MyPostNum = $NewNumReplies + 1; $NumPages = null;
828 if(!isset($Settings['max_posts'])) { $Settings['max_posts'] = 10; }
829 if($MyPostNum>$Settings['max_posts']) {
830 $NumPages = ceil($MyPostNum/$Settings['max_posts']); }
831 if($MyPostNum<=$Settings['max_posts']) {
832 $NumPages = 1; }
833 @redirect("refresh",$basedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=".$NumPages,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],FALSE)."&#35;reply".$MyPostNum,"3");
834 ?><tr>
835         <td><span class="TableMessage"><br />
836         Reply to Topic <?php echo $TopicName; ?> was posted.<br />
837         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']); ?>&#35;reply<?php echo $MyPostNum; ?>">here</a> to view your reply.<br />&nbsp;
838         </span><br /></td>
839 </tr>
840 <?php } ?>
841 </table>
842 </td></tr>
843 <tr class="TableRow4">
844 <td class="TableColumn4">&nbsp;</td>
845 </tr>
846 </table></div>
847 <div class="DivMkReply">&nbsp;</div>
848 <?php } if($_GET['act']=="pin"||$_GET['act']=="unpin") {
849 $gtsquery = query("SELECT * FROM `".$Settings['sqltable']."topics` WHERE `id`=%i LIMIT 1", array($_GET['id']));
850 $gtsresult=mysql_query($gtsquery);
851 $gtsnum=mysql_num_rows($gtsresult);
852 $TTopicID=mysql_result($gtsresult,0,"id");
853 $TForumID=mysql_result($gtsresult,0,"ForumID");
854 $TUsersID=mysql_result($gtsresult,0,"UserID");
855 $TPinned=mysql_result($gtsresult,0,"Pinned");
856 if ($TPinned>1) { $TPinned = 1; } 
857 if ($TPinned<0) { $TPinned = 0; }
858 $CanPinTopics = false;
859 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
860 if($PermissionInfo['CanPinTopics'][$TForumID]=="yes"&&
861         $_SESSION['UserID']==$TUsersID) { $CanPinTopics = true; }
862 if($PermissionInfo['CanPinTopics'][$TForumID]=="yes"&&
863         $PermissionInfo['CanModForum'][$TForumID]=="yes") { 
864         $CanPinTopics = true; }
865         if($PermissionInfo['CanPinTopics'][$TForumID]=="no"&&
866                 $TopicClosed==1) { $CanPinTopics = false; } }
867 if($_SESSION['UserID']==0) { $CanPinTopics = false; }
868 if($CanPinTopics===false) {
869 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); @mysql_free_result($gtsresult);
870 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
871 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
872 @mysql_free_result($gtsresult);
873 if($CanPinTopics===true) {
874         if($_GET['act']=="pin") {
875 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `Pinned`=1 WHERE `id`=%i", array($TTopicID)); }
876         if($_GET['act']=="unpin") {
877 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `Pinned`=0 WHERE `id`=%i", array($TTopicID)); } 
878 mysql_query($queryupd); 
879 @redirect("refresh",$basedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],false)."&#35;post".$_GET['post'],"4");
880 ?>
881 <div class="Table1Border">
882 <?php if($ThemeSet['TableStyle']=="div") { ?>
883 <div class="TableRow1">
884 <span style="text-align: left;">
885 <?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>
886 <?php } ?>
887 <table class="Table1">
888 <?php if($ThemeSet['TableStyle']=="table") { ?>
889 <tr class="TableRow1">
890 <td class="TableColumn1"><span style="text-align: left;">
891 <?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>
892 </td>
893 </tr><?php } ?>
894 <tr class="TableRow2">
895 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Pin/Unpin Topic Message: </th>
896 </tr>
897 <tr class="TableRow3" style="text-align: center;">
898         <td class="TableColumn3" style="text-align: center;"><span class="TableMessage"><br />
899         Topic was successfully unpinned/pinned.<br />
900         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;
901         </span><br /></td>
902 </tr>
903 <tr class="TableRow4">
904 <td class="TableColumn4">&nbsp;</td>
905 </tr>
906 </table></div>
907 <?php } } if($_GET['act']=="open"||$_GET['act']=="close") {
908 $gtsquery = query("SELECT * FROM `".$Settings['sqltable']."topics` WHERE `id`=%i LIMIT 1", array($_GET['id']));
909 $gtsresult=mysql_query($gtsquery);
910 $gtsnum=mysql_num_rows($gtsresult);
911 $TTopicID=mysql_result($gtsresult,0,"id");
912 $TForumID=mysql_result($gtsresult,0,"ForumID");
913 $TUsersID=mysql_result($gtsresult,0,"UserID");
914 $TClosed=mysql_result($gtsresult,0,"Closed");
915 if ($TClosed>1) { $TClosed = 1; } 
916 if ($TClosed<0) { $TClosed = 0; }
917 $CanCloseTopics = false;
918 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
919 if($PermissionInfo['CanCloseTopics'][$TForumID]=="yes"&&
920         $_SESSION['UserID']==$TUsersID) { $CanCloseTopics = true; }
921 if($PermissionInfo['CanCloseTopics'][$TForumID]=="yes"&&
922         $PermissionInfo['CanModForum'][$TForumID]=="yes") { 
923         $CanCloseTopics = true; } }
924 if($_SESSION['UserID']==0) { $CanCloseTopics = false; }
925 if($CanCloseTopics===false) {
926 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); @mysql_free_result($gtsresult);
927 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
928 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
929 @mysql_free_result($gtsresult);
930 if($CanCloseTopics===true) {
931         if($_GET['act']=="close") {
932 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `Closed`=1 WHERE `id`=%i", array($TTopicID)); }
933         if($_GET['act']=="open") {
934 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `Closed`=0 WHERE `id`=%i", array($TTopicID)); } 
935 mysql_query($queryupd); 
936 @redirect("refresh",$basedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TTopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],false)."&#35;post".$_GET['post'],"4");
937 ?>
938 <div class="Table1Border">
939 <?php if($ThemeSet['TableStyle']=="div") { ?>
940 <div class="TableRow1">
941 <span style="text-align: left;">
942 <?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>
943 <?php } ?>
944 <table class="Table1">
945 <?php if($ThemeSet['TableStyle']=="table") { ?>
946 <tr class="TableRow1">
947 <td class="TableColumn1"><span style="text-align: left;">
948 <?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>
949 </td>
950 </tr><?php } ?>
951 <tr class="TableRow2">
952 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Open/Close Topic Message: </th>
953 </tr>
954 <tr class="TableRow3" style="text-align: center;">
955         <td class="TableColumn3" style="text-align: center;"><span class="TableMessage"><br />
956         Topic was successfully opened/closed.<br />
957         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;
958         </span><br /></td>
959 </tr>
960 <tr class="TableRow4">
961 <td class="TableColumn4">&nbsp;</td>
962 </tr>
963 </table></div>
964 <?php } } if($_GET['act']=="delete") {
965 $predquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `id`=%i LIMIT 1", array($_GET['post']));
966 $predresult=mysql_query($predquery);
967 $prednum=mysql_num_rows($predresult);
968 $ReplyID=mysql_result($predresult,0,"id");
969 $ReplyTopicID=mysql_result($predresult,0,"TopicID");
970 $ReplyForumID=mysql_result($predresult,0,"ForumID");
971 $ReplyUserID=mysql_result($predresult,0,"UserID");
972 @mysql_free_result($predresult);
973 $CanDeleteReply = false;
974 if($_SESSION['UserID']!=0) {
975 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
976 if($PermissionInfo['CanDeleteReplys'][$ReplyForumID]=="yes"&&
977         $_SESSION['UserID']==$ReplyUserID) { $CanDeleteReply = true; } 
978 if($PermissionInfo['CanDeleteReplys'][$ReplyForumID]=="yes"&&
979         $PermissionInfo['CanModForum'][$ReplyForumID]=="yes") { 
980         $CanDeleteReply = true; } } 
981         if($PermissionInfo['CanDeleteReplysClose'][$TopicForumID]=="no"&&
982                 $TopicClosed==1) { $CanDeleteReply = false; } }
983 if($_SESSION['UserID']==0) { $CanDeleteReply = false; }
984 if($CanDeleteReply===false) {
985 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
986 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
987 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
988 $delquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `TopicID`=%i ORDER BY `TimeStamp` ASC", array($_GET['id']));
989 $delresult=mysql_query($delquery);
990 $delnum=mysql_num_rows($delresult);
991 $DelTopic = false;
992 $gnrquery = query("SELECT * FROM `".$Settings['sqltable']."forums` WHERE `id`=%i LIMIT 1", array($ReplyForumID));
993 $gnrresult=mysql_query($gnrquery); $gnrnum=mysql_num_rows($gnrresult);
994 $NumberPosts=mysql_result($gnrresult,0,"NumPosts"); $NumberTopics=mysql_result($gnrresult,0,"NumTopics"); 
995 @mysql_free_result($gnrresult);
996 $FReplyID=mysql_result($delresult,0,"id");
997 if($ReplyID==$FReplyID) { $DelTopic = true;
998 $gtsquery = query("SELECT * FROM `".$Settings['sqltable']."topics` WHERE `id`=%i LIMIT 1", array($ReplyTopicID));
999 $gtsresult=mysql_query($gtsquery);
1000 $gtsnum=mysql_num_rows($gtsresult);
1001 $TUsersID=mysql_result($gtsresult,0,"UserID");
1002 $CanDeleteTopics = false;
1003 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
1004 if($PermissionInfo['CanDeleteTopics'][$ReplyForumID]=="yes"&&
1005         $_SESSION['UserID']==$TUsersID) { $CanDeleteTopics = true; }
1006 if($PermissionInfo['CanDeleteTopics'][$ReplyForumID]=="yes"&&
1007         $PermissionInfo['CanModForum'][$ReplyForumID]=="yes") { 
1008         $CanDeleteTopics = true; }
1009         if($PermissionInfo['CanDeleteTopicsClose'][$TopicForumID]=="no"&&
1010                 $TopicClosed==1) { $CanDeleteTopics = false; } }
1011 if($_SESSION['UserID']==0) { $CanDeleteTopics = false; }
1012 if($CanDeleteTopics===false) {
1013 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); @mysql_free_result($delresult);
1014 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1015 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1016 if($CanDeleteTopics===true) { $NewNumTopics = $NumberTopics - 1; $NewNumPosts = $NumberPosts - $delnum;
1017 $drquery = query("DELETE FROM `".$Settings['sqltable']."posts` WHERE `TopicID`=%i", array($ReplyTopicID));
1018 mysql_query($drquery); 
1019 $dtquery = query("DELETE FROM `".$Settings['sqltable']."topics` WHERE `id`=%i", array($ReplyTopicID));
1020 mysql_query($dtquery);
1021 $queryupd = query("UPDATE `".$Settings['sqltable']."forums` SET `NumPosts`=%i,`NumTopics`=%i WHERE `id`=%i", array($NewNumPosts,$NewNumTopics,$ReplyForumID));
1022 mysql_query($queryupd); } }
1023 if($ReplyID!=$FReplyID) {
1024 $LReplyID=mysql_result($delresult,$delnum-1,"id");
1025 $SLReplyID=mysql_result($delresult,$delnum-2,"id");
1026 $NewLastUpdate=mysql_result($delresult,$delnum-2,"TimeStamp");
1027 if($ReplyID==$LReplyID) { $NewNumReplies = $NumberReplies - 1; $NewNumPosts = $NumberPosts - 1;
1028 $drquery = query("DELETE FROM `".$Settings['sqltable']."posts` WHERE `id`=%i", array($ReplyID));
1029 mysql_query($drquery); 
1030 $queryupd = query("UPDATE `".$Settings['sqltable']."forums` SET `NumPosts`=%i WHERE `id`=%i", array($NewNumPosts,$ReplyForumID));
1031 mysql_query($queryupd);
1032 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `LastUpdate`=%i,`NumReply`=%i WHERE `id`=%i", array($NewLastUpdate,$NewNumReplies,$ReplyTopicID));
1033 mysql_query($queryupd); } }
1034 if($ReplyID!=$FReplyID&&$ReplyID!=$LReplyID) { $NewNumReplies = $NumberReplies - 1; $NewNumPosts = $NumberPosts - 1;
1035 $drquery = query("DELETE FROM `".$Settings['sqltable']."posts` WHERE `id`=%i", array($ReplyID));
1036 mysql_query($drquery);
1037 $queryupd = query("UPDATE `".$Settings['sqltable']."forums` SET `NumPosts`=%i WHERE `id`=%i", array($NewNumPosts,$ReplyForumID));
1038 mysql_query($queryupd);
1039 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `NumReply`=%i WHERE `id`=%i", array($NewNumReplies,$ReplyTopicID));
1040 mysql_query($queryupd); }
1041 @redirect("refresh",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],FALSE),"3");
1042 @mysql_free_result($delresult);
1043 ?>
1044 <div class="Table1Border">
1045 <?php if($ThemeSet['TableStyle']=="div") { ?>
1046 <div class="TableRow1">
1047 <span style="text-align: left;">
1048 <?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>
1049 <?php } ?>
1050 <table class="Table1">
1051 <?php if($ThemeSet['TableStyle']=="table") { ?>
1052 <tr class="TableRow1">
1053 <td class="TableColumn1"><span style="text-align: left;">
1054 <?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>
1055 </td>
1056 </tr><?php } ?>
1057 <tr class="TableRow2">
1058 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Delete Reply Message: </th>
1059 </tr>
1060 <tr class="TableRow3" style="text-align: center;">
1061         <td class="TableColumn3" style="text-align: center;"><span class="TableMessage"><br />
1062         Reply was deleted successfully.<br />
1063         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;
1064         </span><br /></td>
1065 </tr>
1066 <tr class="TableRow4">
1067 <td class="TableColumn4">&nbsp;</td>
1068 </tr>
1069 </table></div>
1070 <?php } if($_GET['act']=="edit") {
1071 if($PermissionInfo['CanEditReplys'][$TopicForumID]=="no"||$_SESSION['UserID']==0) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1072 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1073 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1074 if($PermissionInfo['CanEditReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1075 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1076 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1077 $ShowEditTopic = null;
1078 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") {
1079 $editquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `TopicID`=%i ORDER BY `TimeStamp` ASC", array($TopicID));
1080 $editresult=mysql_query($editquery);
1081 $editnum=mysql_num_rows($editresult);
1082 $FReplyID=mysql_result($editresult,0,"id");
1083 @mysql_free_result($editresult);
1084 if($_GET['post']==$FReplyID) { $ShowEditTopic = true; } }
1085 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="no") { $ShowEditTopic = null; }
1086 $ersquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `id`=%i LIMIT 1", array($_GET['post']));
1087 $ersresult=mysql_query($ersquery);
1088 $ersnum=mysql_num_rows($ersresult);
1089 if($ersnum==0) { @mysql_free_result($ersresult);
1090 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1091 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1092 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1093 $ReplyPost=mysql_result($ersresult,0,"Post");
1094 /*$ReplyPost = stripcslashes(htmlspecialchars($ReplyPost, ENT_QUOTES, $Settings['charset']));
1095 $ReplyPost = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $ReplyPost);
1096 //$ReplyPost = @remove_spaces($ReplyPost);*/
1097 $ReplyPost = remove_bad_entities($ReplyPost);
1098 $ReplyDescription=mysql_result($ersresult,0,"Description");
1099 /*$ReplyDescription = stripcslashes(htmlspecialchars($ReplyDescription, ENT_QUOTES, $Settings['charset']));
1100 $ReplyDescription = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $ReplyDescription);
1101 //$ReplyDescription = @remove_spaces($ReplyDescription);*/
1102 $ReplyGuestName=mysql_result($ersresult,0,"GuestName");
1103 $ReplyGuestName = stripcslashes(htmlspecialchars($ReplyGuestName, ENT_QUOTES, $Settings['charset']));
1104 //$ReplyGuestName = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $ReplyGuestName);
1105 $ReplyGuestName = @remove_spaces($ReplyGuestName);
1106 $ReplyUser=mysql_result($ersresult,0,"UserID");
1107 if($_SESSION['UserID']!=$ReplyUser&&$PermissionInfo['CanModForum'][$TopicForumID]=="no") {
1108 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1109 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1110 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1111 @mysql_free_result($ersresult);
1112 if($ShowEditTopic===true) {
1113 $gtsquery = query("SELECT * FROM `".$Settings['sqltable']."topics` WHERE `id`=%i LIMIT 1", array($TopicID));
1114 $gtsresult=mysql_query($gtsquery);
1115 $gtsnum=mysql_num_rows($gtsresult);
1116 $TUsersID=mysql_result($gtsresult,0,"UserID");
1117 if($_SESSION['UserID']!=$TUsersID) { $ShowEditTopic = null; }
1118 if($PermissionInfo['CanModForum'][$TopicForumID]=="yes"&&
1119         $PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") { 
1120         $ShowEditTopic = true; } 
1121 if($PermissionInfo['CanEditTopicsClose'][$TopicForumID]=="no"&&$TopicClosed==1) {
1122         $ShowEditTopic = null; } }
1123 $TopicName = stripcslashes(htmlspecialchars($TopicName, ENT_QUOTES, $Settings['charset']));
1124 //$TopicName = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $TopicName);
1125 $TopicName = @remove_spaces($TopicName);
1126 @mysql_free_result($gtsresult);
1127 ?>
1128 <div class="Table1Border">
1129 <?php if($ThemeSet['TableStyle']=="div") { ?>
1130 <div class="TableRow1">
1131 <span style="text-align: left;">
1132 <?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>
1133 <?php } ?>
1134 <table class="Table1" id="EditReply<?php echo $_GET['post']; ?>">
1135 <?php if($ThemeSet['TableStyle']=="table") { ?>
1136 <tr class="TableRow1" id="ReplyEdit<?php echo $_GET['post']; ?>">
1137 <td class="TableColumn1" colspan="2"><span style="text-align: left;">
1138 <?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>
1139 </td>
1140 </tr><?php } ?>
1141 <tr id="EditReplyRow<?php echo $_GET['post']; ?>" class="TableRow2">
1142 <td class="TableColumn2" colspan="2" style="width: 100%;">Editing a Reply in Topic <?php echo $TopicName; ?></td>
1143 </tr>
1144 <tr class="TableRow3" id="EditReplies<?php echo $_GET['post']; ?>">
1145 <td class="TableColumn3" style="width: 15%; vertical-align: middle; text-align: center;">
1146 <div style="width: 100%; height: 160px; overflow: auto;"><?php
1147 $renee_query=query("SELECT * FROM `".$Settings['sqltable']."smileys`", array(null));
1148 $renee_result=mysql_query($renee_query);
1149 $renee_num=mysql_num_rows($renee_result);
1150 $renee_s=0; $SmileRow=1;
1151 while ($renee_s < $renee_num) {
1152 $FileName=mysql_result($renee_result,$renee_s,"FileName");
1153 $SmileName=mysql_result($renee_result,$renee_s,"SmileName");
1154 $SmileText=mysql_result($renee_result,$renee_s,"SmileText");
1155 $SmileDirectory=mysql_result($renee_result,$renee_s,"Directory");
1156 $ShowSmile=mysql_result($renee_result,$renee_s,"Show");
1157 $ReplaceType=mysql_result($renee_result,$renee_s,"ReplaceCI");
1158 if($SmileRow<5) { ?>
1159         <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;
1160         <?php } if($SmileRow==5) { ?>
1161         <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 />
1162         <?php $SmileRow=1; }
1163 ++$renee_s; ++$SmileRow; }
1164 @mysql_free_result($renee_result);
1165 ?></div></td>
1166 <td class="TableColumn3" style="width: 85%;">
1167 <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']); ?>">
1168 <table style="text-align: left;">
1169 <tr style="text-align: left;">
1170 <?php if($ShowEditTopic===true) { ?>
1171         <td style="width: 50%;"><label class="TextBoxLabel" for="TopicName">Insert Topic Name:</label></td>
1172         <td style="width: 50%;"><input maxlength="30" type="text" name="TopicName" class="TextBox" id="TopicName" size="20" value="<?php echo $TopicName; ?>" /></td>
1173 </tr><tr style="text-align: left;"><?php } ?>
1174         <td style="width: 50%;"><label class="TextBoxLabel" for="ReplyDesc">Insert Reply Description:</label></td>
1175         <td style="width: 50%;"><input maxlength="45" type="text" name="ReplyDesc" class="TextBox" id="ReplyDesc" size="20" value="<?php echo $ReplyDescription; ?>" /></td>
1176 </tr><?php if($_SESSION['UserGroup']==$Settings['GuestGroup']) { ?><tr style="text-align: left;">
1177         <td style="width: 50%;"><label class="TextBoxLabel" for="GuestName">Insert Guest Name:</label></td>
1178         <?php if(!isset($_SESSION['GuestName'])) { ?>
1179         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" /></td>
1180         <?php } if(isset($_SESSION['GuestName'])) { ?>
1181         <td style="width: 50%;"><input maxlength="25" type="text" name="GuestName" class="TextBox" id="GuestName" size="20" value="<?php echo $_SESSION['GuestName']; ?>" /></td>
1182 <?php } ?></tr><?php } ?>
1183 </table>
1184 <table style="text-align: left;">
1185 <tr style="text-align: left;">
1186 <td style="width: 100%;">
1187 <label class="TextBoxLabel" for="ReplyPost">Insert Your Reply:</label><br />
1188 <textarea rows="10" name="ReplyPost" id="ReplyPost" cols="40" class="TextBox"><?php echo $ReplyPost; ?></textarea><br />
1189 <input type="hidden" name="act" value="editreplies" style="display: none;" />
1190 <?php if($_SESSION['UserGroup']!=$Settings['GuestGroup']) { ?>
1191 <input type="hidden" name="GuestName" value="null" style="display: none;" />
1192 <?php } ?>
1193 <input type="submit" class="Button" value="Edit Reply" name="edit_reply" />
1194 <input type="reset" value="Reset Form" class="Button" name="Reset_Form" />
1195 </td></tr></table>
1196 </form></td></tr>
1197 <tr id="EditReplyEnd<?php echo $_GET['post']; ?>" class="TableRow4">
1198 <td class="TableColumn4" colspan="2">&nbsp;</td>
1199 </tr>
1200 </table></div>
1201 <div class="DivMkReply">&nbsp;</div>
1202 <?php } if($_GET['act']=="editreply"&&$_POST['act']=="editreplies") {
1203 if($PermissionInfo['CanEditReplys'][$TopicForumID]=="no"||$_SESSION['UserID']==0) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1204 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1205 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1206 if($PermissionInfo['CanEditReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1207 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1208 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1209 $REFERERurl = parse_url($_SERVER['HTTP_REFERER']);
1210 $URL['REFERER'] = $REFERERurl['host'];
1211 $URL['HOST'] = $_SERVER["SERVER_NAME"];
1212 $REFERERurl = null;
1213 if(!isset($_POST['ReplyDesc'])) { $_POST['ReplyDesc'] = null; }
1214 if(!isset($_POST['ReplyPost'])) { $_POST['ReplyPost'] = null; }
1215 if(!isset($_POST['GuestName'])) { $_POST['GuestName'] = null; }
1216 if(!isset($_POST['TopicName'])) { $_POST['TopicName'] = null; }
1217 if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1218         $Settings['captcha_guest']=="on") {
1219 require($SettDir['inc']."captcha.php"); }
1220 $ShowEditTopic = null;
1221 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") {
1222 $editquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `TopicID`=%i ORDER BY `TimeStamp` ASC", array($TopicID));
1223 $editresult=mysql_query($editquery);
1224 $editnum=mysql_num_rows($editresult);
1225 $FReplyID=mysql_result($editresult,0,"id");
1226 @mysql_free_result($editresult);
1227 if($_GET['post']==$FReplyID) { $ShowEditTopic = true; } }
1228 if($PermissionInfo['CanEditTopics'][$TopicForumID]=="no") { $ShowEditTopic = null; }
1229 $ersquery = query("SELECT * FROM `".$Settings['sqltable']."posts` WHERE `id`=%i LIMIT 1", array($_GET['post']));
1230 $ersresult=mysql_query($ersquery);
1231 $ersnum=mysql_num_rows($ersresult);
1232 if($ersnum==0) { @mysql_free_result($ersresult);
1233 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1234 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1235 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1236 $ReplyUser=mysql_result($ersresult,0,"UserID");
1237 if($_SESSION['UserID']!=$ReplyUser&&$PermissionInfo['CanModForum'][$TopicForumID]=="no") {
1238 redirect("location",$basedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
1239 ob_clean(); @header("Content-Type: text/plain; charset=".$Settings['charset']);
1240 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); @mysql_close(); die(); }
1241 @mysql_free_result($ersresult); 
1242 if($ShowEditTopic===true) {
1243 $gtsquery = query("SELECT * FROM `".$Settings['sqltable']."topics` WHERE `id`=%i LIMIT 1", array($TopicID));
1244 $gtsresult=mysql_query($gtsquery);
1245 $gtsnum=mysql_num_rows($gtsresult);
1246 $TUsersID=mysql_result($gtsresult,0,"UserID");
1247 if($_SESSION['UserID']!=$TUsersID) { $ShowEditTopic = null; }
1248 if($PermissionInfo['CanModForum'][$TopicForumID]=="yes"&&
1249         $PermissionInfo['CanEditTopics'][$TopicForumID]=="yes") { 
1250         $ShowEditTopic = true; } 
1251 if($PermissionInfo['CanEditTopicsClose'][$TopicForumID]=="no"&&$TopicClosed==1) {
1252         $ShowEditTopic = null; } }
1253 ?>
1254 <div class="Table1Border">
1255 <?php if($ThemeSet['TableStyle']=="div") { ?>
1256 <div class="TableRow1">
1257 <span style="text-align: left;">
1258 <?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>
1259 <?php } ?>
1260 <table class="Table1">
1261 <?php if($ThemeSet['TableStyle']=="table") { ?>
1262 <tr class="TableRow1">
1263 <td class="TableColumn1"><span style="text-align: left;">
1264 <?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>
1265 </td>
1266 </tr><?php } ?>
1267 <tr class="TableRow2">
1268 <th class="TableColumn2" style="width: 100%; text-align: left;">&nbsp;Edit Reply Message: </th>
1269 </tr>
1270 <tr class="TableRow3">
1271 <td class="TableColumn3">
1272 <table style="width: 100%; height: 25%; text-align: center;">
1273 <?php if (pre_strlen($_POST['ReplyDesc'])>="45") { $Error="Yes";  ?>
1274 <tr>
1275         <td><span class="TableMessage">
1276         <br />Your Reply Description is too big.<br />
1277         </span>&nbsp;</td>
1278 </tr>
1279 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1280         $Settings['captcha_guest']=="on") {
1281 if (PhpCaptcha::Validate($_POST['signcode'])) {
1282 //echo 'Valid code entered';
1283 } else { $Error="Yes"; ?>
1284 <tr>
1285         <td><span class="TableMessage">
1286         <br />Invalid code entered<br />
1287         </span>&nbsp;</td>
1288 </tr>
1289 <?php } } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1290         pre_strlen($_POST['GuestName'])>="25") { $Error="Yes"; ?>
1291 <tr>
1292         <td><span class="TableMessage">
1293         <br />You Guest Name is too big.<br />
1294         </span>&nbsp;</td>
1295 </tr>
1296 <?php } if($ShowEditTopic===true&&
1297         pre_strlen($_POST['TopicName'])>="30") { $Error="Yes"; ?>
1298 <tr>
1299         <td><span class="TableMessage">
1300         <br />You Topic Name is too big.<br />
1301         </span>&nbsp;</td>
1302 </tr>
1303 <?php } if ($Settings['TestReferer']=="on") {
1304         if ($URL['HOST']!=$URL['REFERER']) { $Error="Yes";  ?>
1305 <tr>
1306         <td><span class="TableMessage">
1307         <br />Sorry the referering url dose not match our host name.<br />
1308         </span>&nbsp;</td>
1309 </tr>
1310 <?php } }
1311 $_POST['ReplyDesc'] = stripcslashes(htmlspecialchars($_POST['ReplyDesc'], ENT_QUOTES, $Settings['charset']));
1312 //$_POST['ReplyDesc'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyDesc']);
1313 $_POST['ReplyDesc'] = @remove_spaces($_POST['ReplyDesc']);
1314 $_POST['GuestName'] = stripcslashes(htmlspecialchars($_POST['GuestName'], ENT_QUOTES, $Settings['charset']));
1315 //$_POST['GuestName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['GuestName']);
1316 $_POST['GuestName'] = @remove_spaces($_POST['GuestName']);
1317 $_POST['ReplyPost'] = stripcslashes(htmlspecialchars($_POST['ReplyPost'], ENT_QUOTES, $Settings['charset']));
1318 //$_POST['ReplyPost'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['ReplyPost']);
1319 $_POST['ReplyPost'] = remove_bad_entities($_POST['ReplyPost']);
1320 if($ShowEditTopic===true) {
1321 $_POST['TopicName'] = stripcslashes(htmlspecialchars($_POST['TopicName'], ENT_QUOTES, $Settings['charset']));
1322 //$_POST['TopicName'] = preg_replace("/&amp;#(x[a-f0-9]+|[0-9]+);/i", "&#$1;", $_POST['TopicName']);
1323 $_POST['TopicName'] = @remove_spaces($_POST['TopicName']); }
1324 /*    <_<  iWordFilter  >_>      
1325    by Kazuki Przyborowski - Cool Dude 2k */
1326 $katarzynaqy=query("SELECT * FROM `".$Settings['sqltable']."wordfilter`", array(null));
1327 $katarzynart=mysql_query($katarzynaqy);
1328 $katarzynanm=mysql_num_rows($katarzynart);
1329 $katarzynas=0;
1330 while ($katarzynas < $katarzynanm) {
1331 $Filter=mysql_result($katarzynart,$katarzynas,"Filter");
1332 $Replace=mysql_result($katarzynart,$katarzynas,"Replace");
1333 $CaseInsensitive=mysql_result($katarzynart,$katarzynas,"CaseInsensitive");
1334 if($CaseInsensitive=="on") { $CaseInsensitive = "yes"; }
1335 if($CaseInsensitive=="off") { $CaseInsensitive = "no"; }
1336 if($CaseInsensitive!="yes"||$CaseInsensitive!="no") { $CaseInsensitive = "no"; }
1337 $WholeWord=mysql_result($katarzynart,$katarzynas,"WholeWord");
1338 if($WholeWord=="on") { $WholeWord = "yes"; }
1339 if($WholeWord=="off") { $WholeWord = "no"; }
1340 if($WholeWord!="yes"&&$WholeWord!="no") { $WholeWord = "no"; }
1341 $Filter = preg_quote($Filter, "/");
1342 if($CaseInsensitive!="yes"&&$WholeWord=="yes") {
1343 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyDesc']); 
1344 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/", $Replace, $_POST['ReplyPost']); }
1345 if($CaseInsensitive=="yes"&&$WholeWord=="yes") {
1346 $_POST['ReplyDesc'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyDesc']); 
1347 $_POST['ReplyPost'] = preg_replace("/\b(".$Filter.")\b/i", $Replace, $_POST['ReplyPost']); }
1348 if($CaseInsensitive!="yes"&&$WholeWord!="yes") {
1349 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyDesc']); 
1350 $_POST['ReplyPost'] = preg_replace("/".$Filter."/", $Replace, $_POST['ReplyPost']); }
1351 if($CaseInsensitive=="yes"&&$WholeWord!="yes") {
1352 $_POST['ReplyDesc'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyDesc']); 
1353 $_POST['ReplyPost'] = preg_replace("/".$Filter."/i", $Replace, $_POST['ReplyPost']); }
1354 ++$katarzynas; } @mysql_free_result($katarzynart);
1355 $lonewolfqy=query("SELECT * FROM `".$Settings['sqltable']."restrictedwords` WHERE `RestrictedTopicName`='yes' or `RestrictedUserName`='yes'", array(null));
1356 $lonewolfrt=mysql_query($lonewolfqy);
1357 $lonewolfnm=mysql_num_rows($lonewolfrt);
1358 $lonewolfs=0; $RMatches = null; $RGMatches = null;
1359 while ($lonewolfs < $lonewolfnm) {
1360 $RWord=mysql_result($lonewolfrt,$lonewolfs,"Word");
1361 $RCaseInsensitive=mysql_result($lonewolfrt,$lonewolfs,"CaseInsensitive");
1362 if($RCaseInsensitive=="on") { $RCaseInsensitive = "yes"; }
1363 if($RCaseInsensitive=="off") { $RCaseInsensitive = "no"; }
1364 if($RCaseInsensitive!="yes"||$RCaseInsensitive!="no") { $RCaseInsensitive = "no"; }
1365 $RWholeWord=mysql_result($lonewolfrt,$lonewolfs,"WholeWord");
1366 if($RWholeWord=="on") { $RWholeWord = "yes"; }
1367 if($RWholeWord=="off") { $RWholeWord = "no"; }
1368 if($RWholeWord!="yes"||$RWholeWord!="no") { $RWholeWord = "no"; }
1369 $RestrictedTopicName=mysql_result($lonewolfrt,$lonewolfs,"RestrictedTopicName");
1370 if($RestrictedTopicName=="on") { $RestrictedTopicName = "yes"; }
1371 if($RestrictedTopicName=="off") { $RestrictedTopicName = "no"; }
1372 if($RestrictedTopicName!="yes"||$RestrictedTopicName!="no") { $RestrictedTopicName = "no"; }
1373 $RestrictedUserName=mysql_result($lonewolfrt,$lonewolfs,"RestrictedUserName");
1374 if($RestrictedUserName=="on") { $RestrictedUserName = "yes"; }
1375 if($RestrictedUserName=="off") { $RestrictedUserName = "no"; }
1376 if($RestrictedUserName!="yes"||$RestrictedUserName!="no") { $RestrictedUserName = "no"; }
1377 $RWord = preg_quote($RWord, "/");
1378 if($RCaseInsensitive!="yes"&&$RWholeWord=="yes") {
1379 if($RestrictedTopicName=="yes") {
1380 $RMatches = preg_match("/\b(".$RWord.")\b/", $_POST['TopicName']);
1381         if($RMatches==true) { break 1; } }
1382 if($RestrictedUserName=="yes") {
1383 $RGMatches = preg_match("/\b(".$RWord.")\b/", $_POST['GuestName']);
1384         if($RGMatches==true) { break 1; } } }
1385 if($RCaseInsensitive=="yes"&&$RWholeWord=="yes") {
1386 if($RestrictedTopicName=="yes") {
1387 $RMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['TopicName']);
1388         if($RMatches==true) { break 1; } }
1389 if($RestrictedUserName=="yes") {
1390 $RGMatches = preg_match("/\b(".$RWord.")\b/i", $_POST['GuestName']);
1391         if($RGMatches==true) { break 1; } } }
1392 if($RCaseInsensitive!="yes"&&$RWholeWord!="yes") {
1393 if($RestrictedTopicName=="yes") {
1394 $RMatches = preg_match("/".$RWord."/", $_POST['TopicName']);
1395         if($RMatches==true) { break 1; } }
1396 if($RestrictedUserName=="yes") {
1397 $RGMatches = preg_match("/".$RWord."/", $_POST['GuestName']);
1398         if($RGMatches==true) { break 1; } } }
1399 if($RCaseInsensitive=="yes"&&$RWholeWord!="yes") {
1400 if($RestrictedTopicName=="yes") {
1401 $RMatches = preg_match("/".$RWord."/i", $_POST['TopicName']);
1402         if($RMatches==true) { break 1; } }
1403 if($RestrictedUserName=="yes") {
1404 $RGMatches = preg_match("/".$RWord."/i", $_POST['GuestName']);
1405         if($RGMatches==true) { break 1; } } }
1406 ++$lonewolfs; } @mysql_free_result($lonewolfrt);
1407 if ($_POST['ReplyDesc']==null) { $Error="Yes"; ?>
1408 <tr>
1409         <td><span class="TableMessage">
1410         <br />You need to enter a Reply Description.<br />
1411         </span>&nbsp;</td>
1412 </tr>
1413 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1414         $_POST['GuestName']==null) { $Error="Yes"; ?>
1415 <tr>
1416         <td><span class="TableMessage">
1417         <br />You need to enter a Guest Name.<br />
1418         </span>&nbsp;</td>
1419 </tr>
1420 <?php } if($_SESSION['UserGroup']==$Settings['GuestGroup']&&
1421         $RGMatches==true) { $Error="Yes"; ?>
1422 <tr>
1423         <td><span class="TableMessage">
1424         <br />This Guest Name is restricted to use.<br />
1425         </span>&nbsp;</td>
1426 </tr>
1427 <?php } if($PermissionInfo['CanEditReplys'][$TopicForumID]=="no") { $Error="Yes"; ?>
1428 <tr>
1429         <td><span class="TableMessage">
1430         <br />You do not have permission to edit a reply here.<br />
1431         </span>&nbsp;</td>
1432 </tr>
1433 <?php } if($PermissionInfo['CanEditReplysClose'][$TopicForumID]=="no"&&$TopicClosed==1) { $Error="Yes"; ?>
1434 <tr>
1435         <td><span class="TableMessage">
1436         <br />You do not have permission to edit a reply here.<br />
1437         </span>&nbsp;</td>
1438 </tr>
1439 <?php } if($ShowEditTopic===true&&$_POST['TopicName']==null) { $Error="Yes"; ?>
1440 <tr>
1441         <td><span class="TableMessage">
1442         <br />You need to enter a Topic Name.<br />
1443         </span>&nbsp;</td>
1444 </tr>
1445 <?php } if ($_POST['ReplyPost']==null) { $Error="Yes"; ?>
1446 <tr>
1447         <td><span class="TableMessage">
1448         <br />You need to enter a Reply.<br />
1449         </span>&nbsp;</td>
1450 </tr>
1451 <?php } if($RMatches==true) { $Error="Yes"; ?>
1452 <tr>
1453         <td><span class="TableMessage">
1454         <br />This Topic Name is restricted to use.<br />
1455         </span>&nbsp;</td>
1456 </tr>
1457 <?php } if ($Error=="Yes") {
1458 @redirect("refresh",$basedir.url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],false)."&#35;post".$_GET['post'],"4"); ?>
1459 <tr>
1460         <td><span class="TableMessage">
1461         <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;
1462         </span><br /></td>
1463 </tr>
1464 <?php } if ($Error!="Yes") { $LastActive = GMTimeStamp();
1465 $requery = query("SELECT * FROM `".$Settings['sqltable']."members` WHERE `id`=%i LIMIT 1", array($_SESSION['UserID']));
1466 $reresult=mysql_query($requery);
1467 $renum=mysql_num_rows($reresult);
1468 $rei=0;
1469 while ($rei < $renum) {
1470 $User1ID=$_SESSION['UserID'];
1471 $User1Name=mysql_result($reresult,$rei,"Name");
1472 if($_SESSION['UserGroup']==$Settings['GuestGroup']) { $User1Name = $_POST['GuestName']; }
1473 ++$rei; }
1474 @mysql_free_result($reresult);
1475 $EditUserIP=$_SERVER['REMOTE_ADDR'];
1476 $queryupd = query("UPDATE `".$Settings['sqltable']."posts` SET `LastUpdate`=%i,`EditUser`=%i,`Post`='%s',`Description`='%s',`EditIP`='%s' WHERE `id`=%i", array($LastActive,$_SESSION['UserID'],$_POST['ReplyPost'],$_POST['ReplyDesc'],$EditUserIP,$_GET['post']));
1477 mysql_query($queryupd);
1478 if($ShowEditTopic===true) {
1479 $queryupd = query("UPDATE `".$Settings['sqltable']."topics` SET `TopicName`='%s',`Description`='%s' WHERE `id`=%i", array($_POST['TopicName'],$_POST['ReplyDesc'],$TopicID));
1480 mysql_query($queryupd); } } 
1481 @redirect(url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'],FALSE)."&#35;post".$_GET['post'],"3");
1482 ?>
1483 <tr>
1484         <td><span class="TableMessage"><br />
1485         Reply to Topic <?php echo $TopicName; ?> was edited.<br />
1486         Click <a href="<?php echo url_maker($exfile['topic'],$Settings['file_ext'],"act=view&id=".$TopicID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."&#35;post".$_GET['post']; ?>">here</a> to view topic.<br />&nbsp;
1487         </span><br /></td>
1488 </tr>
1489 </table>
1490 </td></tr>
1491 <tr class="TableRow4">
1492 <td class="TableColumn4">&nbsp;</td>
1493 </tr>
1494 </table></div>
1495 <?php }
1496 if($PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes"||$PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") { ?>
1497 <table class="Table2" style="width: 100%;">
1498 <tr>
1499  <td style="width: 0%; text-align: left;">&nbsp;</td>
1500  <td style="width: 100%; text-align: right;">
1501  <?php if($CanMakeReply=="yes") { ?>
1502  <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>
1503  <?php if(isset($ThemeSet['FastReply'])&&$ThemeSet['FastReply']!=null) { ?>
1504  <?php echo $ThemeSet['ButtonDivider']; } ?>
1505  <a href="javascript:%20<?php echo urlencode("toggletag('FastReply');"); ?>"><?php echo $ThemeSet['FastReply']; ?></a>
1506  <?php } if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes") {
1507         if($CanMakeReply=="yes") { ?>
1508  <?php echo $ThemeSet['ButtonDivider']; } ?>
1509  <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>
1510  <?php } ?></td>
1511 </tr>
1512 </table>
1513 <div class="DivTable2">&nbsp;</div>
1514 <?php } } } ?>