OSDN Git Service

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