OSDN Git Service

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