📄 common.lib
字号:
my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($_[0]+($GMTOffset*3600)); my ($DateColor,$TimeColor,$DateSize,$TimeSize)=($_[1],$_[2],$_[3],$_[4]); my ($DateFont, $CDateFont, $TimeFont, $CTimeFont); if ($DateColor and $DateSize) { $DateFont .= &Font("",$DateSize,$DateColor); $CDateFont = "</font>"; } if ($TimeColor and $TimeSize) { $TimeFont = &Font("",$TimeSize,$TimeColor); $CTimeFont = "</font>"; } my ($Full); if ($year>80) { $year += 1900; }else{ $year += 2000; } $mon++; if ($mon < 10) { $mon = "0$mon"; } if ($mday < 10) { $mday = "0$mday"; } if ($DateFormat eq "US") { $Full = $DateFont."$mon-$mday-$year".$CDateFont; }elsif ($DateFormat eq "USE") { $Full = $DateFont.@Months[$mon-1]." $mday, $year".$CDateFont; }elsif ($DateFormat eq "EU") { $Full = $DateFont."$mday-$mon-$year".$CDateFont; }elsif ($DateFormat eq "EUE") { $Full = $DateFont."$mday ".@Months[$mon-1].", $year".$CDateFont; } if ($sec < 10) { $sec = "0$sec"; } if ($min < 10) { $min = "0$min"; } if ($TimeFormat eq "12") { if ($hour > 11) { if ($hour > 12) { $hour = $hour-12; } if ($hour < 10) { $hour = "0$hour"; } $Full .= $TimeFont." $hour\:$min\:$sec P.M.".$CTimeFont; }else{ if ($hour < 10) { $hour = "0$hour"; } $Full .= $TimeFont." $hour\:$min\:$sec A.M.".$CTimeFont; } }elsif ($TimeFormat eq "24") { if ($hour < 10) { $hour = "0$hour"; } $Full .= $TimeFont." $hour\:$min\:$sec".$CTimeFont; } return $Full;}################################################################################ PrintVersion ################################################################################sub PrintVersion { my ($TimeZone) = @_; if ($TimeZone) { return &Table("100%","","0","0","",""). &Tr("","",""). &Td("","","","","","","","",""). &Font($FontFace,$MenuTextSize,$MenuTextColor).$TimeZoneName."</font>". "</td>". &Td("","","","","RIGHT","","","",""). &Font($FontFace,$MenuTextSize,$MenuTextColor).# "This ".# &Link("http://www.UltraScripts.com/","_blank","Powered by UltraBoard v1.61").# "UltraBoard v1.61".# &CLink(). " <span style=\"letter-spacing: 2\">Copyright 1999-2000</span> ".# &Link("mailto:catoc\@163.net","_blank","Mail to catoc").# "catoc".# &CLink(). "</font>". "</td>". "</tr>". "</table>"; }else{ return &Table("100%","","0","0","",""). &Tr("","",""). &Td("","","","","RIGHT","","","",""). &Font($FontFace,$MenuTextSize,$MenuTextColor). "Copyright ". &Link("http://www.UltraScripts.com/","_blank","Powered by UltraBoard v1.61"). "UltraBoard v1.61". &CLink(). " 1999-2000 AddFaction: ". &Link("mailto:lastsun\@netease.com","_blank","龙追日"). "LastSun". &CLink(). "</font>". "</td>". "</tr>". "</table>"; }}################################################################################ PrintTheme ################################################################################sub PrintTheme { my ($Title, $HTML, $Second, $Redirect)=@_; print &HTMLHeader(); open(THEME,"/vrcdata/UltraBoard.html")||&CGIError("Couldn't open/read the UltraBoard.them file<br>\nPath: $VarsPath<br>\nReason : $!"); flock(THEME,1) if ($FLock); while (<THEME>) { if ($_ =~/\<:UltraBoardTitle:\>/i) { $_=~s/\<:UltraBoardTitle:\>/$Title/ig; } if ($_ =~/\<:UltraBoardRedirect:\>/i) { if ($Redirect) { $Redirect="<meta http-equiv=\"REFRESH\" content=\"$Second; url=$Redirect\">"; } $_=~s/\<:UltraBoardRedirect:\>/$Redirect/ig; } if ($_=~/\<:TableWidth:\>/i) { $_=~s/\<:TableWidth:\>/$TableWidth/ig; } if ($_=~/\<:TableBorderColor:\>/i) { $_=~s/\<:TableBorderColor:\>/$TableBorderColor/ig; } if ($_=~/\<:TableAlign:\>/i) { $_=~s/\<:TableAlign:\>/$TableAlign/ig; } if ($_=~/\<:TableCellSpacing:\>/i) { $_=~s/\<:TableCellSpacing:\>/$TableCellSpacing/ig; } if ($_=~/\<:TableCellPadding:\>/i) { $_=~s/\<:TableCellPadding:\>/$TableCellPadding/ig; } if ($_=~/\<:UltraBoardName:\>/i) { $_=~s/\<:UltraBoardName:\>/$UBName/ig; } if ($_=~/\<:UltraBoardDescription:\>/i) { $_=~s/\<:UltraBoardDescription:\>/$UBDes/ig; } if ($_=~/\<:MenuBGColor:\>/i) { $_=~s/\<:MenuBGColor:\>/$MenuBGColor/ig; } if ($_=~/\<:UltraBoardMenu:\>/i) { $Menu=&GetMenu(); $_=~s/\<:UltraBoardMenu:\>/$Menu/ig; } if ($_=~/\<:UltraBoardBody:\>/i) { $_=~s/\<:UltraBoardBody:\>/$HTML/ig; } print $_; } close(THEME);}################################################################################ ShowThank ################################################################################sub ShowThank { my ($Title,$Message,$Second,$Redirect)=@_; $HTML.= "<p>".&BTable($TableWidth,$TableAlign,"0","0",$TableCellSpacing,$TableCellPadding,$TableBorderColor,"",""). &Tr("","",$HeaderBGColor). &Td("","","2","","","","","",""). &Font($FontFace,$HeaderTextSize,$HeaderTextColor). "<b>$Title</b>". "</font>". "</td>". "</tr>". &Tr("","",$RowOddBGColor). &Td("","","2","","","","","",""). &Table("100%","CENTER","10","10","",""). &Tr("","",""). &Td("","","","","","","","",""). &Font($FontFace,$TextSize,$TextColor). $Message. "</font>". "</td>". "</tr>". "</table>". "</td>". "</tr>". &Tr("","",$MenuBGColor). &Td("","","2","","","","","",""). &PrintVersion(). "</td>". "</tr>". &CBTable(); &PrintTheme($Title,$HTML,$Second,$Redirect); exit;}################################################################################ ceil ################################################################################sub ceil { my ($number)=$_[0]; my ($int); $int=int($number); if ($number != $int) { return $int+1; }else{ return $int; }}################################################################################ CGIError ################################################################################sub CGIError { my ($Message)=@_; print &HTMLHeader(). &Head("Script Error"). &Body(). "<h1>Script Error</h1>". "<p>".$Message."</p>". &CBody(); exit; #die @Message;}################################################################################ ShowError ################################################################################sub ShowError { my ($Title,$Message)=@_; $HTML.= "<p>".&BTable($TableWidth,$TableAlign,"0","0",$TableCellSpacing,$TableCellPadding,$TableBorderColor,"",""). &Tr("","",$HeaderBGColor). &Td("","","2","","","","","",""). &Font($FontFace,$HeaderTextSize,$HeaderTextColor). "<b>$Title</b>". "</font>". "</td>". "</tr>". &Tr("","",$RowOddBGColor). &Td("","","2","","","","","",""). &Table("100%","CENTER","10","10","",""). &Tr("","",""). &Td("","","","","","","","",""). &Font($FontFace,$TextSize,$TextColor). $Message. "</font>". "</td>". "</tr>". "</table>". "</td>". "</tr>". &Tr("","",$CategoryBGColor). &Td("","","2","","","","","",""). "<center>".&Button("","< 返回","width:$IETextBoxSize","onclick=\"history.go(-1)\"")."</center>". "</td>". "</tr>". &Tr("","",$MenuBGColor). &Td("","","2","","","","","",""). &PrintVersion(). "</td>". "</tr>". &CBTable(); &PrintTheme("$Title",$HTML); exit;}################################################################################ HTTP Cookie Library Version 2.1 ## Copyright 1996 Matt Wright mattw@worldwidemart.com ## Created 07/14/96 Last Modified 12/23/96 ################################################################################my @Cookie_Encode_Chars = ('\%', '\+', '\;', '\,', '\=', '\&', '\:\:', '\s');my %Cookie_Encode_Chars = ('\%', '%25', '\+', '%2B', '\;', '%3B', '\,', '%2C', '\=', '%3D', '\&', '%26', '\:\:', '%3A%3A', '\s', '+');my @Cookie_Decode_Chars = ('\+', '\%3A\%3A', '\%26', '\%3D', '\%2C', '\%3B', '\%2B', '\%25');my %Cookie_Decode_Chars = ('\+', ' ', '\%3A\%3A', '::', '\%26', '&', '\%3D', '=', '\%2C', ',', '\%3B', ';', '\%2B', '+', '\%25', '%');################################################################################ GetCookies ################################################################################sub GetCookies { my ($CookieFlag) = 0; my ($Cookie,$Value,$Char); if ($ENV{'HTTP_COOKIE'}) { foreach (split(/; /,$ENV{'HTTP_COOKIE'})) { ($Cookie,$Value) = split(/=/); foreach $Char (@Cookie_Decode_Chars) { $Cookie =~ s/$Char/$Cookie_Decode_Chars{$Char}/g; $Value =~ s/$Char/$Cookie_Decode_Chars{$Char}/g; } $Cookies{$Cookie} = $Value; } $CookieFlag = 1; } return $CookieFlag;}################################################################################ CookiesHeader ################################################################################sub CookiesHeader { if ($HeaderDefine ne "TRUE") { my ($Expires, @Cookies) = @_; my ($Header); my ($Cookie,$Value,$Char); my (@Days) = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); my (@Months) = ("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"); my ($Sec,$Min,$Hour,$MDay,$Mon,$Year,$WDay); if ($Expires) { ($Sec,$Min,$Hour,$MDay,$Mon,$Year,$WDay) = gmtime($Expires); }else{ ($Sec,$Min,$Hour,$MDay,$Mon,$Year,$WDay) = ("00","00","23","31","11","50","4"); } if ($Year>50) { $Year+=1900; }else{ $Year+=2000; } $Header="Content-type: text/html\n"; while(($Cookie,$Value)=@Cookies) { foreach $Char (@Cookie_Encode_Chars) { $Cookie =~ s/$Char/$Cookie_Encode_Chars{$Char}/g; $Value =~ s/$Char/$Cookie_Encode_Chars{$Char}/g; } $Header.="Set-Cookie: ".$Cookie."=". $Value."; "; $Header.="expires=$Days[$WDay], $MDay-$Months[$Mon]-$Year $Hour:$Min:$Sec GMT;"; $Header.="\n"; shift(@Cookies); shift(@Cookies); } $Header.="\n"; $HeaderDefine = "TRUE"; return $Header; }}###############################################################################1;# End of Common.lib file###############################################################################
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -