OSDN Git Service

Yet another bug fix.
[idb/iDB.git.git] / inc / lowreplies.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-2010 iDB Support - http://idb.berlios.de/
12     Copyright 2004-2010 Game Maker 2k - http://gamemaker2k.org/
13
14     $FileInfo: lowreplies.php - Last Update: 09/05/2010 SVN 572 - Author: cooldude2k $
15 */
16 $File3Name = basename($_SERVER['SCRIPT_NAME']);
17 if ($File3Name=="replies.php"||$File3Name=="/replies.php") {
18         require('index.php');
19         exit(); }
20 $pstring = null; $pagenum = null;
21 if(!is_numeric($_GET['id'])) { $_GET['id'] = null; }
22 if(!is_numeric($_GET['post'])) { $_GET['post'] = null; }
23 if(!is_numeric($_GET['page'])) { $_GET['page'] = 1; }
24 if(!isset($_GET['modact'])) { $_GET['modact'] = null; }
25 if($_GET['modact']=="pin"||$_GET['modact']=="unpin"||$_GET['modact']=="open"||
26         $_GET['modact']=="close"||$_GET['modact']=="edit"||$_GET['modact']=="delete")
27                 { $_GET['act'] = $_GET['modact']; }
28 $prequery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."topics\" WHERE \"id\"=%i".$ForumIgnoreList4." LIMIT 1", array($_GET['id']));
29 $preresult=sql_query($prequery,$SQLStat);
30 $prenum=sql_num_rows($preresult);
31 if($prenum==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
32 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
33 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
34 if($prenum>=1) {
35 $TopicName=sql_result($preresult,0,"TopicName");
36 $TopicID=sql_result($preresult,0,"id");
37 $TopicForumID=sql_result($preresult,0,"ForumID");
38 $TopicCatID=sql_result($preresult,0,"CategoryID");
39 $TopicClosed=sql_result($preresult,0,"Closed");
40 if($TopicClosed==3&&$PermissionInfo['CanModForum'][$TopicForumID]=="no") { 
41 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
42 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
43 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
44 $NumberReplies=sql_result($preresult,0,"NumReply");
45 $ViewTimes=sql_result($preresult,0,"NumViews");
46 sql_free_result($preresult);
47 $forumcheckx = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."forums\" WHERE \"id\"=%i".$ForumIgnoreList1."  LIMIT 1", array($TopicForumID));
48 $fmckresult=sql_query($forumcheckx,$SQLStat);
49 $fmcknum=sql_num_rows($fmckresult);
50 if($fmcknum==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=view",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); sql_free_result($preresult);
51 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
52 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
53 $ForumName=sql_result($fmckresult,0,"Name");
54 $ForumType=sql_result($fmckresult,0,"ForumType");
55 $CanHaveTopics=sql_result($fmckresult,0,"CanHaveTopics");
56 $ForumPostCountView=sql_result($fmckresult,0,"PostCountView");
57 $ForumKarmaCountView=sql_result($fmckresult,0,"KarmaCountView");
58 sql_free_result($fmckresult);
59 $catcheck = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."categories\" WHERE \"id\"=%i".$CatIgnoreList2."  LIMIT 1", array($TopicCatID));
60 $catresult=sql_query($catcheck,$SQLStat);
61 $CategoryName=sql_result($catresult,0,"Name");
62 $CategoryType=sql_result($catresult,0,"CategoryType");
63 $CategoryPostCountView=sql_result($catresult,0,"PostCountView");
64 $CategoryKarmaCountView=sql_result($catresult,0,"KarmaCountView");
65 sql_free_result($catresult);
66 if($GroupInfo['HasAdminCP']!="yes"||$GroupInfo['HasModCP']!="yes") {
67 if($MyPostCountChk==null) { $MyPostCountChk = 0; }
68 if($MyKarmaCount==null) { $MyKarmaCount = 0; }
69 if($ForumPostCountView!=0&&$MyPostCountChk<$ForumPostCountView) {
70 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
71 if($CategoryPostCountView!=0&&$MyPostCountChk<$CategoryPostCountView) {
72 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
73 if($ForumKarmaCountView!=0&&$MyKarmaCount<$ForumKarmaCountView) {
74 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); }
75 if($CategoryKarmaCountView!=0&&$MyKarmaCount<$CategoryKarmaCountView) {
76 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false)); } }
77 if($ForumCheck!="skip") {
78 $_SESSION['ViewingPage'] = url_maker(null,"no+ext","act=view&id=".$_GET['id']."&page=".$_GET['page'],"&","=",$prexqstr['topic'],$exqstr['topic']);
79 if($Settings['file_ext']!="no+ext"&&$Settings['file_ext']!="no ext") {
80 $_SESSION['ViewingFile'] = $exfile['topic'].$Settings['file_ext']; }
81 if($Settings['file_ext']=="no+ext"||$Settings['file_ext']=="no ext") {
82 $_SESSION['ViewingFile'] = $exfile['topic']; }
83 $_SESSION['PreViewingTitle'] = "Viewing Topic:";
84 $_SESSION['ViewingTitle'] = $TopicName;
85 ?>
86 <div style="font-size: 1.0em; font-weight: bold; margin-bottom: 10px; padding-top: 3px; width: auto;">Full Version: <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 $TopicName; ?></a></div>
87 <div style="font-size: 11px; font-weight: bold; padding: 10px; border: 1px solid gray;"><a href="<?php echo url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$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=lowview&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=lowview&id=".$TopicForumID."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr[$ForumType],$exqstr[$ForumType]); ?>"><?php echo $ForumName; ?></a></div>
88 <div>&nbsp;</div>
89 <?php }
90 if(!isset($CatPermissionInfo['CanViewCategory'][$TopicCatID])) {
91         $CatPermissionInfo['CanViewCategory'][$TopicCatID] = "no"; }
92 if($CatPermissionInfo['CanViewCategory'][$TopicCatID]=="no"||
93         $CatPermissionInfo['CanViewCategory'][$TopicCatID]!="yes") {
94 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
95 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
96 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
97 if(!isset($PermissionInfo['CanViewForum'][$TopicForumID])) {
98         $PermissionInfo['CanViewForum'][$TopicForumID] = "no"; }
99 if($PermissionInfo['CanViewForum'][$TopicForumID]=="no"||
100         $PermissionInfo['CanViewForum'][$TopicForumID]!="yes") {
101 redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
102 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
103 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
104 if($_GET['act']!="view") { 
105 $CanMakeReply = "no"; $CanMakeTopic = "no";
106 if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes"&&$CanHaveTopics=="yes") { 
107         $CanMakeTopic = "yes"; }
108 if($TopicClosed==0&&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
109         $CanMakeReply = "yes"; }
110 if($TopicClosed==1&&$PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="yes"
111         &&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
112                 $CanMakeReply = "yes"; } } 
113 if($_GET['act']=="lowview") {
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 $snumber = $_GET['page'] - 1;
139 $PageLimit = $Settings['max_posts'] * $snumber;
140 if($PageLimit<0) { $PageLimit = 0; }
141 //End Reply Page Code
142 $i=0;
143 $query = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."posts\" WHERE \"TopicID\"=%i ORDER BY \"TimeStamp\" ASC ".$SQLimit, array($_GET['id'],$PageLimit,$Settings['max_posts']));
144 $result=sql_query($query,$SQLStat);
145 $num=sql_num_rows($result);
146 if($num==0) { redirect("location",$rbasedir.url_maker($exfile['index'],$Settings['file_ext'],"act=lowview",$Settings['qstr'],$Settings['qsep'],$prexqstr['index'],$exqstr['index'],false));
147 ob_clean(); header("Content-Type: text/plain; charset=".$Settings['charset']);
148 gzip_page($Settings['use_gzip'],$GZipEncode['Type']); session_write_close(); die(); }
149 if($num!=0) { 
150 if($ViewTimes==0||$ViewTimes==null) { $NewViewTimes = 1; }
151 if($ViewTimes!=0&&$ViewTimes!=null) { $NewViewTimes = $ViewTimes + 1; }
152 $viewsup = sql_pre_query("UPDATE \"".$Settings['sqltable']."topics\" SET \"NumViews\"='%s' WHERE \"id\"=%i", array($NewViewTimes,$_GET['id']));
153 sql_query($viewsup,$SQLStat); }
154 //List Page Number Code Start
155 $pagenum=count($Pages);
156 if($_GET['page']>$pagenum) {
157         $_GET['page'] = $pagenum; }
158 $pagei=0; $pstring = null;
159 if($pagenum>1) {
160 $pstring = "<div style=\"\" class=\"PageList\"><span class=\"pagelink\">".$pagenum." Pages:</span> "; }
161 if($_GET['page']<4) { $Pagez[0] = null; }
162 if($_GET['page']>=4) { $Pagez[0] = "First"; }
163 if($_GET['page']>=3) {
164 $Pagez[1] = $_GET['page'] - 2; }
165 if($_GET['page']<3) {
166 $Pagez[1] = null; }
167 if($_GET['page']>=2) {
168 $Pagez[2] = $_GET['page'] - 1; }
169 if($_GET['page']<2) {
170 $Pagez[2] = null; }
171 $Pagez[3] = $_GET['page'];
172 if($_GET['page']<$pagenum) {
173 $Pagez[4] = $_GET['page'] + 1; }
174 if($_GET['page']>=$pagenum) {
175 $Pagez[4] = null; }
176 $pagenext = $_GET['page'] + 1;
177 if($pagenext<$pagenum) {
178 $Pagez[5] = $_GET['page'] + 2; }
179 if($pagenext>=$pagenum) {
180 $Pagez[5] = null; }
181 if($_GET['page']<$pagenum) { $Pagez[6] = "Last"; }
182 if($_GET['page']>=$pagenum) { $Pagez[6] = null; }
183 $pagenumi=count($Pagez);
184 if($num==0) {
185 $pagenumi = 0;
186 $pstring = null; }
187 if($pagenum>1) {
188 while ($pagei < $pagenumi) {
189 if($_GET['page']!=1&&$pagei==1) {
190 $Pback = $_GET['page'] - 1;
191 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=lowview&id=".$_GET['id']."&page=".$Pback,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&lt;</a></span> "; }
192 if($Pagez[$pagei]!=null&&
193    $Pagez[$pagei]!="First"&&
194    $Pagez[$pagei]!="Last") {
195 if($pagei!=3) { 
196 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=lowview&id=".$_GET['id']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">".$Pagez[$pagei]."</a></span> "; }
197 if($pagei==3) { 
198 $pstring = $pstring."<span class=\"pagecurrent\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=lowview&id=".$_GET['id']."&page=".$Pagez[$pagei],$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">".$Pagez[$pagei]."</a></span> "; } }
199 if($Pagez[$pagei]=="First") {
200 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=lowview&id=".$_GET['id']."&page=1",$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&laquo;</a></span> "; }
201 if($Pagez[$pagei]=="Last") {
202 $ptestnext = $pagenext + 1;
203 $paget = $pagei - 1;
204 $Pnext = $_GET['page'] + 1;
205 $pstring = $pstring."<span class=\"pagelink\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=lowview&id=".$_GET['id']."&page=".$Pnext,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&gt;</a></span> ";
206 if($ptestnext<$pagenum) {
207 $pstring = $pstring."<span class=\"pagelinklast\"><a href=\"".url_maker($exfile['topic'],$Settings['file_ext'],"act=lowview&id=".$_GET['id']."&page=".$pagenum,$Settings['qstr'],$Settings['qsep'],$prexqstr['topic'],$exqstr['topic'])."\">&raquo;</a></span> "; } }
208         ++$pagei; } $pstring = $pstring."</div>"; }
209 //List Page Number Code end
210 $CanMakeReply = "no"; $CanMakeTopic = "no";
211 if($PermissionInfo['CanMakeTopics'][$TopicForumID]=="yes"&&$CanHaveTopics=="yes") { 
212         $CanMakeTopic = "yes"; }
213 if($TopicClosed==0&&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
214         $CanMakeReply = "yes"; }
215 if($TopicClosed==1&&$PermissionInfo['CanMakeReplysClose'][$TopicForumID]=="yes"
216         &&$PermissionInfo['CanMakeReplys'][$TopicForumID]=="yes") {
217                 $CanMakeReply = "yes"; }
218 ?>
219 <div style="font-size: 11px; font-weight: bold; padding: 10px; border: 1px solid gray;">
220 <?php echo $pstring; ?></div>
221 <div>&nbsp;</div>
222 <div style="padding: 10px; border: 1px solid gray;">
223 <?php while ($i < $num) {
224 $MyPostID=sql_result($result,$i,"id");
225 $MyTopicID=sql_result($result,$i,"TopicID");
226 $MyPostIP=sql_result($result,$i,"IP");
227 $MyForumID=sql_result($result,$i,"ForumID");
228 $MyCategoryID=sql_result($result,$i,"CategoryID");
229 $MyUserID=sql_result($result,$i,"UserID");
230 $MyGuestName=sql_result($result,$i,"GuestName");
231 $MyTimeStamp=sql_result($result,$i,"TimeStamp");
232 $MyEditTime=sql_result($result,$i,"LastUpdate");
233 $MyEditUserID=sql_result($result,$i,"EditUser");
234 $MyEditUserName=sql_result($result,$i,"EditUserName");
235 $MyTimeStamp=GMTimeChange("M j Y, g:i a",$MyTimeStamp,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
236 $MyPost=sql_result($result,$i,"Post");
237 $MyPost = preg_replace("/\<br\>/", "<br />", nl2br($MyPost));
238 $MyDescription=sql_result($result,$i,"Description");
239 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
240 $reresult=sql_query($requery,$SQLStat);
241 $renum=sql_num_rows($reresult);
242 if($renum<1) { $MyUserID = -1;
243 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
244 $reresult=sql_query($requery,$SQLStat);
245 $renum=sql_num_rows($reresult); }
246 $rei=0; $ipshow = "two";
247 $User1ID=$MyUserID; $GuestsName = $MyGuestName;
248 $User1Name=sql_result($reresult,$rei,"Name");
249 $User1IP=sql_result($reresult,$rei,"IP");
250 if($User1IP==$MyPostIP) { $ipshow = "one"; }
251 $User1Email=sql_result($reresult,$rei,"Email");
252 $User1Title=sql_result($reresult,$rei,"Title");
253 $User1Joined=sql_result($reresult,$rei,"Joined");
254 $User1Joined=GMTimeChange("M j Y",$User1Joined,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
255 $User1GroupID=sql_result($reresult,$rei,"GroupID");
256 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($User1GroupID));
257 $gresult=sql_query($gquery,$SQLStat);
258 $User1Group=sql_result($gresult,0,"Name");
259 $GroupNamePrefix=sql_result($gresult,0,"NamePrefix");
260 $GroupNameSuffix=sql_result($gresult,0,"NameSuffix");
261 sql_free_result($gresult);
262 $User1Signature=sql_result($reresult,$rei,"Signature");
263 $User1Avatar=sql_result($reresult,$rei,"Avatar");
264 $User1AvatarSize=sql_result($reresult,$rei,"AvatarSize");
265 if ($User1Avatar=="http://"||$User1Avatar==null||
266         strtolower($User1Avatar)=="noavatar") {
267 $User1Avatar=$ThemeSet['NoAvatar'];
268 $User1AvatarSize=$ThemeSet['NoAvatarSize']; }
269 $AvatarSize1=explode("x", $User1AvatarSize);
270 $AvatarSize1W=$AvatarSize1[0]; $AvatarSize1H=$AvatarSize1[1];
271 $User1Website=sql_result($reresult,$rei,"Website");
272 $BoardWWWChCk = parse_url($Settings['idburl']);
273 $User1WWWChCk = parse_url($User1Website);
274 $User1Website = urlcheck($User1Website);
275 $opennew = " onclick=\"window.open(this.href);return false;\"";
276 if($BoardWWWChCk['host']==$User1WWWChCk['host']) {
277         $opennew = null; }
278 $User1PostCount=sql_result($reresult,$rei,"PostCount");
279 $User1Karma=sql_result($reresult,$rei,"Karma");
280 $User1IP=sql_result($reresult,$rei,"IP");
281 sql_free_result($reresult);
282 if($User1Name=="Guest") { $User1Name=$GuestsName;
283 if($User1Name==null) { $User1Name="Guest"; } }
284 if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
285         $User1Name = $GroupNamePrefix.$User1Name; }
286 if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
287         $User1Name = $User1Name.$GroupNameSuffix; }
288 $MySubPost = null;
289 if($MyEditTime!=$MyTimeStamp&&$MyEditUserID!=0) {
290 if($MyEditUserID!=$MyUserID) {
291 $euquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyEditUserID));
292 $euresult = sql_query($euquery,$SQLStat);
293 $eunum = sql_num_rows($euresult);
294 if($eunum<1) { $MyEditUserID = -1;
295 $euquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyEditUserID));
296 $euresult = sql_query($euquery,$SQLStat);
297 $eunum = sql_num_rows($euresult); }
298         $EditUserID = $MyEditUserID;
299         $EditUserGroupID = sql_result($euresult,0,"GroupID");
300         $EditUserHidden=sql_result($euresult,0,"HiddenMember");
301         $EditUserName = sql_result($euresult,0,"Name");
302         sql_free_result($euresult);
303         $eugquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($EditUserGroupID));
304         $eugresult=sql_query($eugquery,$SQLStat);
305         $EditUserGroup=sql_result($eugresult,0,"Name");
306         $EditUserNamePrefix=sql_result($eugresult,0,"NamePrefix");
307         $EditUserNameSuffix=sql_result($eugresult,0,"NameSuffix");
308         sql_free_result($eugresult);    }
309         if($MyEditUserID==$MyUserID) {
310         $EditUserID = $User1ID;
311         $EditUserGroupID = $User1GroupID;
312         $EditUserHidden=$User1Hidden;
313         $EditUserName = $User1Name;
314         $EditUserGroup=$User1Group;
315         $EditUserNamePrefix=null;
316         $EditUserNameSuffix=null; }
317         if($EditUserName=="Guest") { $EditUserName=$MyEditUserName;
318         if($EditUserName==null) { $EditUserName="Guest"; } }
319         if(isset($GroupNamePrefix)&&$GroupNamePrefix!=null) {
320                 $EditUserName = $EditUserNamePrefix.$EditUserName; }
321         if(isset($GroupNameSuffix)&&$GroupNameSuffix!=null) {
322                 $EditUserName = $EditUserName.$EditUserNameSuffix; }
323         $MyEditTime = GMTimeChange("M j Y, g:i a",$MyEditTime,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
324         $MySubPost = "<div class=\"EditReply\"><br />This post has been edited by <b>".$EditUserName."</b> on ".$MyEditTime."</div>"; }
325 if($MyEditTime!=$MyTimeStamp&&$MyEditUserID!=0&&$MyEditUserID!=$MyUserID) {
326 $requery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."members\" WHERE \"id\"=%i LIMIT 1", array($MyUserID));
327 $reresult=sql_query($requery,$SQLStat);
328 $renum=sql_num_rows($reresult);
329 $rei=0; $ipshow = "two";
330 $User1ID=$MyUserID; $GuestsName = $MyGuestName;
331 $User1Name=sql_result($reresult,$rei,"Name");
332 $User1IP=sql_result($reresult,$rei,"IP");
333 if($User1IP==$MyPostIP) { $ipshow = "one"; }
334 $User1Email=sql_result($reresult,$rei,"Email");
335 $User1Title=sql_result($reresult,$rei,"Title");
336 $User1Joined=sql_result($reresult,$rei,"Joined");
337 $User1Joined=GMTimeChange("M j Y",$User1Joined,$_SESSION['UserTimeZone'],0,$_SESSION['UserDST']);
338 $User1Hidden=sql_result($reresult,$rei,"HiddenMember");
339 $User1GroupID=sql_result($reresult,$rei,"GroupID");
340 $gquery = sql_pre_query("SELECT * FROM \"".$Settings['sqltable']."groups\" WHERE \"id\"=%i LIMIT 1", array($User1GroupID));
341 $gresult=sql_query($gquery,$SQLStat);
342 $User1Group=sql_result($gresult,0,"Name");
343 $GroupNamePrefix=sql_result($gresult,0,"NamePrefix");
344 $GroupNameSuffix=sql_result($gresult,0,"NameSuffix");
345 sql_free_result($gresult); }
346 $MyPost = url2link($MyPost);
347 $MyPost = text2icons($MyPost,$Settings['sqltable'],$SQLStat);
348 if($MySubPost!=null) { $MyPost = $MyPost."\n".$MySubPost; }
349 $User1Signature = preg_replace("/\<br\>/", "<br />", nl2br($User1Signature));
350 $User1Signature = url2link($User1Signature);
351 $User1Signature = text2icons($User1Signature,$Settings['sqltable'],$SQLStat);
352 $CanEditReply = false; $CanDeleteReply = false;
353 if($_SESSION['UserGroup']!=$Settings['GuestGroup']) {
354 if($PermissionInfo['CanEditReplys'][$MyForumID]=="yes"&&
355         $_SESSION['UserID']==$MyUserID) { $CanEditReply = true; }
356 if($PermissionInfo['CanDeleteReplys'][$MyForumID]=="yes"&&
357         $_SESSION['UserID']==$MyUserID) { $CanDeleteReply = true; }
358 if($PermissionInfo['CanModForum'][$MyForumID]=="yes") { 
359         $CanEditReply = true; $CanDeleteReply = true; } }
360 if($_SESSION['UserID']==0) { 
361         $CanEditReply = false; $CanDeleteReply = false; }
362 $ReplyNum = $i + $PageLimit + 1;
363 ?>
364 <div style="border:1px solid #E6E3E4; padding:1px; margin-bottom: 15px;">
365 <div style="border: 1px solid #E6E3E4; padding:1px; margin-bottom: 15px; background-color: #E6E3E4; padding: 6px;">
366 <div style="font-weight: bold; font-size: 0.8em; width: auto; float: left;"><?php echo $User1Name; ?></div>
367 <div style="width:auto; font-size: 0.8em; color: gray; text-align:right;"><?php echo $MyTimeStamp; ?></div>
368 </div>
369 <div style="padding: 6px; font-size: 0.8em;"><?php echo $MyPost; ?></div></div>
370 <?php ++$i; } sql_free_result($result); 
371 ?></div><div>&nbsp;</div><?php } } ?>