📄 showpost.pl
字号:
###############################################################################
# ShowPost.pl #
###############################################################################
# UltraBoard Ver. 1.61 by UltraScripts.com #
# Scripts written by Jacky W.W. Yung, WebMaster@UltraScripts.com #
# Available from http://www.UltraScripts.com/UltraBoard/ #
# --------------------------------------------------------------------------- #
# PROGRAM NAME : UltraBoard #
# VERSION : 1.61 #
# LAST MODIFIED : 30/06/1999 #
# =========================================================================== #
# COPYRIGHT NOTICE : #
# #
# Copyright (c) 1999 Jacky Yung. All Rights Reserved. #
# #
# This program is free software; you can change or modify it as you see fit. #
# However, modified versions cannot be sold or distributed. You cannot alter #
# the copyright and "powered by" notices throughout the scripts. These #
# notices must be clearly visible to the end users. #
# #
# WARRANTY DISCLAIMER: #
# #
# THIS PROGRAM IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT #
# ANY WARRANTY; WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR #
# FITNESS FOR A PARTICULAR PURPOSE. #
###############################################################################
###############################################################################
# ShowPost #
###############################################################################
sub ShowPost {
my ($HTML);
unless (-e "$DBPath/$in{'Board'}/board.list") {
&ShowError("ACCESS DENIED","The board that you want is not found.<br>Please contact the webmaster (".&Link("mailto:$EmailAddress","","").$EmailAddress."</a>".") for more information.");
}
unless (-e "$DBPath/$in{'Board'}/$in{'Post'}.post") {
&ShowError("ACCESS DENIED","The topic that you want to read is not found.<br>Please contact the webmaster (".&Link("mailto:$EmailAddress","","").$EmailAddress."</a>".") for more information.");
}
open(BOARD,"$DBPath/$in{'Board'}/board.list")||&CGIError("Couldn't open/read the board.list file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
flock(BOARD,1) if ($FLock);
$BOARD_DATA=<BOARD>;
close(BOARD);
@BoardInfo=&DecodeDBOutput($BOARD_DATA);
if ($Group ne "administrator") {
if ($BoardInfo[5] ne "Active") {
&ShowError("ACCESS DENIED","The \"$BoardInfo[1]\" board is currently inactive.<br>Please contact the webmaster (".&Link("mailto:$EmailAddress","","").$EmailAddress."</a>".") for more information.");
}
if (($BoardInfo[6] eq "Private")&&($Group eq "Guest")) {
print "Location: UltraBoard.$Ext?Action=SignIn&Ref=ShowPost&Board=$in{'Board'}&Post=$in{'Post'}&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}\n\n";
}elsif ($BoardInfo[6] eq "Private") {
require "$DBPath/$in{'Board'}/Access.db";
if (!exists ($Access{$MemberData[3]})) {
print "Location: UltraBoard.$Ext?Action=SignIn&Ref=ShowPost&Board=$in{'Board'}&Post=$in{'Post'}&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}\n\n";
}else{
$MemberStatus=$Access{$MemberData[3]};
}
}
}
###############################################################################
open(POST,"$DBPath/$in{'Board'}/$in{'Post'}.post")||&CGIError("Couldn't open/read the $in{'Post'}.post file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
flock(POST,1) if ($FLock);
@POST_DATA=<POST>;
close(POST);
@PostInfo=&DecodeDBOutput($POST_DATA[0]);
$Topic=$PostInfo[0];
$Closed=$PostInfo[8];
$TopicDes=$PostInfo[9];
if ($PostInfo[2]) {
@MemberInfo=&GetMemberData($PostInfo[2]);
#add line showpost L:1
$FirstMember=$MemberInfo[1];
$FirstLevel=$MemberInfo[3];
}
if (($ENV{'REMOTE_HOST'})&&($TrackIP=~/Host/)) {
$IP=$ENV{'REMOTE_HOST'};
}elsif ($TrackIP=~/IP/){
$IP=$ENV{'REMOTE_ADDR'};
}
$mark=0;
open(VIEWIP,"$DBPath/$in{'Board'}/$in{'Post'}.viewip")||&CGIError("Couldn't read the $in{'Post'}.viewip file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
flock(VIEWIP,1) if ($FLock);
@VIEWIP_DATA=<VIEWIP>;
close(VIEWIP);
$Return_key="\n";
for($i=0;$i<=11;$i++) {
if($VIEWIP_DATA[$i] eq $IP){
$mark=1;
last;
}
if($i == 11) {
for($j=0;$j<10;$j++) {
$VIEWIP_DATA[$j]=$VIEWIP_DATA[$j+1]
}
$VIEWIP_DATA[10]=$Return_key.$IP;
}
else {
if (!($VIEWIP_DATA[$i])){
$VIEWIP_DATA[$i]=$Return_key.$IP;
last;
}
}
}
open(VIEWIP,">$DBPath/$in{'Board'}/$in{'Post'}.viewip")||&CGIError("Couldn't create/write the $in{'Post'}.viewip file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
flock(VIEWIP,2) if ($FLock);
print VIEWIP @VIEWIP_DATA;
flock(VIEWIP,8) if ($FLock);
close(VIEWIP);
if($IP eq $PostInfo[6]){
$mark=1;
}
else{
for (my ($i)=2;$i<=$#POST_DATA;$i++) {
@PostInfo1=&DecodeDBOutput($POST_DATA[$i]);
if($IP eq $PostInfo1[6]){
$mark=1;
}
}
}
@PostStat=&DecodeDBOutput($POST_DATA[1]);
if($mark==0){
$PostStat[1]++;
if ($PostInfo[2]) {
$MemberInfo[18]++;
&SaveMemberData($PostInfo[2],@MemberInfo);
}
}
# add line showpost
$TotalShow=$PostStat[1];
# end line showpost
$POST_DATA[1]=&EncodeDBInput(@PostStat);
open(POST,">$DBPath/$in{'Board'}/$in{'Post'}.post")||&CGIError("Couldn't create/write the $in{'Post'}.post file<br>\nPath: $DBPath/$in{'Board'}<br>\nReason : $!");
flock(POST,2) if ($FLock);
print POST @POST_DATA;
flock(POST,8) if ($FLock);
close(POST);
if ($UBMessageIcon) {
open(ICON,"$VarsPath/mIcons.txt");
flock(ICON,2) if ($FLock);
my (@Icons)=<ICON>;
close(ICON);
if ($#Icons>=0) {
%TopicIcon=();
for ($c=0;$c<=$#Icons;$c++) {
@IconData=split (/\|\^\|/, $Icons[$c]);
$TopicIcon{$IconData[0]}=$IconData[2];
}
}
}
if ($Cookies{"B_".$in{'Board'}."_TIME"}<$PostStat[2]) {
$NewIcon=&Image("$URLImages/New.gif","","","","","0","");
}else{
$NewIcon="";
}
$MessageIcon=&Image("$URLImages/Message.gif","","","","","0",$PostInfo[8]);
if ($Closed ne ""){
$MessageIcon=&Image("$URLImages/LockedMessage.gif","","","","","0",$PostInfo[8]);
}elsif ($PostInfo[11]) {
$MessageIcon=&Image($TopicIcon{$PostInfo[11]},"","","","","0",$PostInfo[8]);
}
###############################################################################
# open(GROUP,"$MembersPath/Groups.db")||&CGIError("Couldn't open/read the Groups.db file<br>\nPath: $MembersPath<br>\nReason : $!");
# flock(GROUP,1) if ($FLock);
# while (<GROUP>) {
# @Group=&DecodeDBOutput($_);
# if ($MemberData[3] eq $Group[0]) {
# $StatusUser=$Group[1];
# last;
# }
# }
# close(GROUP);
open(GROUP,"$MembersPath/Groups.db")||&CGIError("Couldn't open/read the Groups.db file<br>\nPath: $MembersPath<br>\nReason : $!");
flock(GROUP,1) if ($FLock);
while (<GROUP>) {
@Group=&DecodeDBOutput($_);
if ($FirstLevel eq $Group[0]) {
$Status=$Group[1];
last;
}
}
close(GROUP);
$Rank="";
($MemberInfo23[0], $MemberInfo23[1]) = split(/\|\^\|/, $MemberInfo[23]);
open(GROUP,"$MembersPath/$MemberInfo[3].rank")||&CGIError("Couldn't open/read the $MemberInfo[0] $MemberInfo[3].rank file<br>\nPath: $MembersPath<br>\nReason : $!");
flock(GROUP,1) if ($FLock);
while (<GROUP>) {
@Group=&DecodeDBOutput($_);
if ($MemberInfo23[0] eq $Group[0]) {
$Rank=$Group[1];
last;
}
}
close(GROUP);
$OnlineMessage="<font color=purple> 断线中!</font>";
open(ONLINE,"$Online_DIRECTORY/Online.Data")||&CGIError("Couldn't open/read the $Online_DIRECTORY/Online.Data file<br>\nPath: $DBPath/UserData<br>\nReason : $!");
flock(ONLINE,1) if ($ONLINE);
while (<ONLINE>){
@Online=&DecodeDBOutput($_);
if ($MemberInfo[0] eq $Online[0]){
$OnlineMessage="<font color=blue> 在线中!</font>";
last;
}
}
close(ONLINE);
if ($Cookies{"B_".$in{'Board'}."_TIME"}<$PostInfo[5]) {
$MNewIcon=&Image("$URLImages/SmallNew.gif","","","","","0","新内容");
}else{
$MNewIcon=&Image("$URLImages/SmallMessage.gif","","","","","0",$PostInfo[0]);
}
$Post.= &BTable($TableWidth,$TableAlign,"0","0",$TableCellSpacing,$TableCellPadding,$TableBorderColor,"","").
&Tr("","",$HeaderBGColor).
&Td("","","","","","","","","").
&Table("100%","CENTER","0","0","","").
&Tr("","","").
&Td("10","","","","","","","","").
$MNewIcon.
"</td>".
&Td("50%","","","","","","","","").
&Font($FontFace,$HeaderTextSize,$HeaderTextColor).
"<b>".$PostInfo[0]." (编辑了 ".$PostInfo[10]." 次)</b> ".
"</font>".
"</td>".
&Td("50%","","","","RIGHT","","","","").
&Font($FontFace,$MenuTextSize,$MenuTextColor).
&GetDate($PostInfo[5],$MenuTextColor,$MenuTextColor,$MenuTextSize,$MenuTextSize).
"</font>".
"</td>".
"</tr>".
"</table>".
"</td>".
"</tr>";
if (($PostInfo[2])||($Group eq "administrator")||($Group eq $BoardInfo[4])) {
$Post.= &Tr("","",$MenuBGColor).
&Td("","","","","","","","","").
&Table("100%","CENTER","0","0","","").
&Tr("","","").
&Td("","","","","","","","","");
if ($PostInfo[2]) {
$Post.= &Link("UltraBoard.$Ext?Action=ShowProfile&ID=$PostInfo[2]&Board=$in{'Board'}&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}&Session=$SessionID","Profile","",
"显示 $MemberInfo[1] ($MemberInfo[0]) 的个人信息").
$imgProfile.
"</a>";
$Post.= $imgSperater.&Link("UltraBoard.pl?Action=SendMessage&ReName=$MemberInfo[0]&Ref=$in{'Action'}&Category=$in{'Category'}&Board=$in{'Board'}&Post=$in{'Post'}&ID=$in{'ID'}&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}&Session=$SessionID","","",
"即刻在线传呼 $MemberInfo[1] ").
$imgICQ."<font color=7E7E03>“".$MemberInfo[1]."”</font>".
"</a>";
}
if ($MemberInfo[17] ne "") {
$Post.= $imgSperater.&Link("mailto:$MemberInfo[4]","","",
"给 $MemberInfo[1] 发送电子邮件").
$imgEmail.
"</a>";
}
if ((($Group ne "administrator")&&($Group ne $BoardInfo[4]))&&($UserName eq $PostInfo[2])&&($PostInfo[2] ne "")&&(!$Closed)) {
$Post.= $imgSperater.&Link("UltraBoard.$Ext?Action=ModifyPost&Post=$in{'Post'}&Board=$in{'Board'}&ID=0&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}&Session=$SessionID","","",
"编辑 ($PostInfo[0])").
$imgModify.
"</a>";
}
$Post.= "</td>".
&Td("","","","","RIGHT","","","","");
if (($Group eq "administrator")||($Group eq $BoardInfo[4])) {
$Post.= &Link("UltraBoard.$Ext?Action=ModifyPost&Post=$in{'Post'}&Board=$in{'Board'}&ID=0&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}&Session=$SessionID","","",
"编辑 ($PostInfo[0])").
$imgModify;
# "</a>".$imgSperater;
}
# if (($Group eq "administrator")||($Group eq $BoardInfo[4])) {
# $Post.= &Link("UltraBoard.$Ext?Action=DoRemoveMessages&Post=$in{'Post'}&Board=$in{'Board'}&Idle=$in{'Idle'}&Sort=$in{'Sort'}&Order=$in{'Order'}&Page=$in{'Page'}&Session=$SessionID","","",
# "删除 ($PostInfo[0])").
# $imgRemoveThread.
# "</a>";
# }
$Post.= "</td>".
"</tr>".
"</table>".
"</td>".
"</tr>";
}
$Post.= &Tr("","",$RowOddBGColor).
&Td("","","","","","","","","").
&Table("100%","CENTER","5","5","","").
&Tr("","","").
# &Td("","","","","","MIDDLE","","","").
"<td height=60 valign=MIDDLE>".
&Font($FontFace,$TextSize,$TextColor).
"<span style=\"letter-spacing: 2\">".
$PostInfo[7].
"</span>";
if ($UseSignatures and $PostInfo[4] and $MemberInfo[15]) {
$Post.= "<hr>".
$MemberInfo[15];
}
$Post.= "</font>".
"</td>".
"</tr>".
"</table>".
"</td>".
"</tr>".
&Tr("","",$MenuBGColor).
&Td("","","","","","","","","").
&Table("100%","CENTER","0","0","","").
&Tr("","","").
&Td("","","","","","","","","").
&Font($FontFace,$HeaderTextSize,$TextColor2);
if ($PostInfo[2]) {
$Post.= "发言人:<font color=800000>[ ";
if ($MemberInfo[22] eq "male"){
$Post.= "</font><font color=navy>".$Status.$Rank."</font><font color=red>*</font><font color=smalt>".$MemberInfo[1]."</font><font color=800000> ]</font>";
}
elsif ($MemberInfo[22] eq "female"){
$Post.= "</font><font color=navy>".$Status.$Rank."</font><font color=red>*</font><font color=claret>".$MemberInfo[1]."</font><font color=800000> ]</font>";
}
elsif (!($MemberInfo[22])){
$Post.= "</font><font color=navy>".$Status.$Rank."</font><font color=red>*</font><font color=blue>".$MemberInfo[1]."</font><font color=800000> ]</font>";
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -