📄 ubb_cls.asp
字号:
<%Const MaxLoopcount=100%>
<script language=vbscript runat=server>
Class YxBBsubb_Cls
Public UbbString,Re
Private Sub Class_Initialize()
End Sub
Rem 入口(内容,1=帖子|2=留言公告等)
Public Function Ubb(Str,PostType)
If isNull(Str) or Str="" then
Ubb=""
Exit function
End if
If UbbString="" Or IsNull(UbbString) Then
UbbString=YxBBs.Fun.UbbString(Str)
End If
If instr(UbbString,",41,")>0 And PostType=1 Then
Str=YxBBs_Code(Str,PostType)
Else
Str=YxBBs_UBB(str,postType)
End If
UBB=Str
End Function
Private Function YxBBs_UBB(Str,PostType)
If isNull(Str) or Str="" then
YxBBs_UBB=""
Exit function
End if
Str=Html_Code(Str)
Set re=new RegExp
re.IgnoreCase =True
re.Global=True
If InStr(UbbString,",0,")>0 Then
re.pattern="((javascript:)|(jscript:)|(object)|(js:)|(location.)|(vbscript:)|(vbs:)|(\.value)|(about:)|(file:)|(document.cookie)|(on(mouse|exit|error|click|key|load)))"
str=re.replace(str,"<font color=#000000>$1</font>")
End If
If InStr(UbbString,",35,")>0 Then Str=YxBBs_Ubb_Login(Str,PostType)
If InStr(UbbString,",36,")>0 Then Str=YxBBs_Ubb_Sex(Str,PostType)
If InStr(UbbString,",37,")>0 Then Str=YxBBs_Ubb_Name(Str,PostType)
If InStr(UbbString,",38,")>0 Then Str=YxBBs_Ubb_Date(Str,PostType)
If InStr(UbbString,",16,")>0 Then re.pattern="\[em*([0-9]*)]":str=re.replace(str,"<img src=Images/Em/$1.gif>")
If InStr(UbbString,",24,")>0 Then Str=YxBBs_Ubb2(Str,"\[img\]","\[\/img\]","<img src=$1>","<a href=$1 target=_blank>$1</a>",YxBBs.BBSSetting(22))
If InStr(UbbString,",25,")>0 Then
If Not YxBBs.FoundUser and YxBBs.BBSSetting(55)="0" Then
Str=YxBBs_Ubb3(Str,"\[upload=(txt|zip|rar|mdb|swf),*(#*[0-9\.]*),*(#*[0-9\.]*),*(#*[0-9\.]*),*(#*[0-9\.]*)\]","\[\/upload\]","<fieldset><legend>上传的附件</legend><br> <font color=gray>抱歉,您所在的组无权下载附件,请<a href=register.asp>注册</a>或<a href=login.asp>登陆</a>.</font><br><br></fieldset>")
Str=YxBBs_Ubb2(Str,"\[upload=(gif|jpg|jpeg|bmp|png),*(#*[0-9\.]*),([0-9]{1,3}),*(#*[0-9\.]*),*(#*[0-9\.]*)\]","\[\/upload\]","<fieldset><legend>上传的图片</legend><br> <font color=gray>抱歉,您所在的组无权下载附件,请<a href=register.asp>注册</a>或<a href=login.asp>登陆</a></font></fieldset>","",YxBBs.BBSSetting(22))
Else
Str=YxBBs_Ubb3(Str,"\[upload=(txt|zip|rar|mdb|swf),*(#*[0-9\.]*),*(#*[0-9\.]*),*(#*[0-9\.]*),*(#*[0-9\.]*)\]","\[\/upload\]","<fieldset><legend>上传的附件</legend><br> <IMG SRC=Images/edit/common.gif align=absmiddle> <a href=""ViewFile.Asp?FileName=$6"" TARGET=_blank>$6</a> [ <font color=blue>$2</font> KB ]<br><br></fieldset>")
Str=YxBBs_Ubb2(Str,"\[upload=(gif|jpg|jpeg|bmp|png),*(#*[0-9\.]*),([0-9]{1,3}),*(#*[0-9\.]*),*(#*[0-9\.]*)\]","\[\/upload\]","<fieldset><legend>上传的图片</legend><br> <img src=Images/edit/img.gif align=absmiddle> <A HREF=""ViewFile.Asp?FileName=$6"" TARGET=_blank>$6</a> [ <font color=blue>$2</font> KB <font color=blue>$4</font>×<font color=blue>$5</font> ] <font color=#999999>(缩略时请点击查看原图)</font><br><br> <IMG SRC=""ViewFile.Asp?FileName=$6"" border=0><br><br></fieldset>","<A HREF=""ViewFile.Asp?FileName=$6"" TARGET=_blank>$6</a>",YxBBs.BBSSetting(22))
End If
End If
If InStr(UbbString,",27,")>0 Then Str=YxBBs_Ubb2(Str,"\[flash=*([0-9]*),*([0-9]*)\]","\[\/flash\]","<a href=""$3"" TARGET=_blank><IMG SRC=Images/edit/common.gif border=0 alt='点击开新窗口欣赏该FLASH动画!'>[全屏欣赏]</a><br><OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=$1 height=$2><PARAM NAME=movie VALUE=""$3""><PARAM NAME=quality VALUE=high><embed src=""$3"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=$1 height=$2>$4</embed></OBJECT>","<A HREF=""$3"" TARGET=_blank><font color=red><b>[安全提示:</font>此FLASH已屏蔽,如确定安全,可点击链接可观看!]</A></b>",YxBBs.BBSSetting(20))
If InStr(UbbString,",28,")>0 Then Str=YxBBs_Ubb1(Str,"\[mp=*([0-9]{1,3}),([0-9]{1,3})\]","\[\/mp\]","<br><b>此主题相关媒体如下:<a href=""$3"" TARGET=_blank>(点这里下载)</a></b><br><object align=middle classid=CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95 class=OBJECT id=MediaPlayer width=$1 height=$2 >" & vbcrlf & "<PARAM NAME=AUTOSTART VALUE=false><param name=ShowStatusBar value=-1>" & vbcrlf & "<param name=Filename value=$3>" & vbcrlf & "<embed type=application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename=mp src=$3 width=$1 height=$2>" & vbcrlf & "</embed>" & vbcrlf & "</object>")
If InStr(UbbString,",29,")>0 Then Str=YxBBs_Ubb1(Str,"\[rm=([0-9]{1,3}),([0-9]{1,3})\]","\[\/rm\]","<b>此主题相关媒体如下:<a href=""$3"" TARGET=_blank>(点这里下载)</a></b><br><OBJECT classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class=OBJECT id=RAOCX width=$1 height=$2>" & vbcrlf & "<PARAM NAME=SRC VALUE=$3>" & vbcrlf & "<PARAM NAME=CONSOLE VALUE=Clip1>" & vbcrlf & "<PARAM NAME=CONTROLS VALUE=imagewindow>" & vbcrlf & "<PARAM NAME=AUTOSTART VALUE=false>" & vbcrlf & "</OBJECT>" & vbcrlf & "<br>" & vbcrlf & "<OBJECT classid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA height=32 id=video2 width=$1>" & vbcrlf & "<PARAM NAME=SRC VALUE=$3>" & vbcrlf & "<PARAM NAME=AUTOSTART VALUE=0>" & vbcrlf & "<PARAM NAME=CONTROLS VALUE=controlpanel>" & vbcrlf & "<PARAM NAME=CONSOLE VALUE=Clip1>" & vbcrlf & "</OBJECT>")
If InStr(UbbString,",31,")>0 Then Str=UbbCode_Q(Str)
If InStr(UbbString,",32,")>0 Then Str=YxBBs_GetUBB(Str,"\[coin=*([0-9]*)\]","\[\/coin\]","$1<hr noshade size=1><font color=gray>以下内容需要金钱数达到<B>$3</B>才可以浏览</font><BR>$4<hr noshade size=1>$6","$1<hr noshade size=1><font color=Red>以下内容需要金钱数达到<B>$3</B>才可以浏览</font><hr noshade size=1>$6",PostType,YxBBs.MyCoin)
If InStr(UbbString,",33,")>0 Then Str=YxBBs_GetUBB(Str,"\[mark=*([0-9]*)\]","\[\/mark\]","$1<hr noshade size=1><font color=gray>以下内容需要积分数达到<B>$3</B>才可以浏览</font><BR>$4<hr noshade size=1>$6","$1<hr noshade size=1><font color=Red>以下内容需要积分数达到<B>$3</B>才可以浏览</font><hr noshade size=1>$6",PostType,YxBBs.MyMark)
If InStr(UbbString,",34,")>0 Then Str=YxBBs_GetUBB(Str,"\[grade=*([0-9]*)\]","\[\/grade\]","$1<hr noshade size=1><font color=gray>以下内容需要等级为 <b>$3</b> 或更高的等级以及作者才能浏览</font><BR>$4<hr noshade size=1>$6","$1<hr noshade size=1><font color=Red>以下内容需要等级为<B>$3</B>或更高的等级以及作者才可以浏览</font><hr noshade size=1>$6",PostType,YxBBs.MyGradeNum)
If InStr(UbbString,",35,")>0 Then Str=YxBBs_Ubb_Login(Str,PostType)
If InStr(UbbString,",36,")>0 Then Str=YxBBs_Ubb_Sex(Str,PostType)
If InStr(UbbString,",37,")>0 Then Str=YxBBs_Ubb_Name(Str,PostType)
If InStr(UbbString,",38,")>0 Then Str=YxBBs_Ubb_Date(Str,PostType)
If InStr(UbbString,",39,")>0 Then Str=YxBBs_Ubb_Reply(Str,PostType)
If InStr(UbbString,",40,")>0 Then Str=YxBBs_Ubb_Buy(Str,PostType)
re.Pattern="\[cc\](.*?)\[\/cc\]"
str= re.Replace(str,"<embed src=""http://union.bokecc.com/$1"" width=""438"" height=""387"" type=""application/x-shockwave-flash""></embed>")
re.Pattern="<img(.[^>]*)>"
str=re.replace(str,"<img$1 onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-500) this.style.width=screen.width-500;"" border=0 onclick=""javascript:window.open(this.src);"" style=""CURSOR: pointer"">")
Set re=Nothing
YxBBs_UBB=Str
End function
Private Function Html_Code(byval Str)
If IsNull(Str) then
Html_code=""
Else
Str=replace(Str,chr(39),"'")
Str=replace(Str,chr(36),"$")
str = Replace(str, "SCRIPT", "script")
Str = Replace(Str, chr(10) &chr(10), "<br><br> ")
Html_Code = Replace(Str, chr(10), "<p></p>")
End if
End Function
Public Function Sign_Code(byval Str)
If IsNull(Str) or Str="" Then
Sign_Code=""
Exit Function
End If
Str=Html_Code(Str)
Set re=new regExp
re.IgnoreCase=true
re.Global=true
re.pattern="((javascript:)|(jscript:)|(object)|(js:)|(location.)|(vbscript:)|(vbs:)|(\.value)|(about:)|(file:)|(document.cookie)|(on(mouse|exit|error|click|key|load)))"
str=re.replace(str,"<font color=#000000>$1</font>")
If InStr(Lcase(Str),"[/b]")>0 Then Str=YxBBs_Ubb1(Str,"\[b\]","\[\/b\]","<b>$1</b>")
If InStr(Lcase(Str),"[/i]")>0 Then Str=YxBBs_Ubb1(Str,"\[i\]","\[\/i\]","<i>$1</i>")
If InStr(Lcase(Str),"[/u]")>0 Then Str=YxBBs_Ubb1(Str,"\[u\]","\[\/u\]","<u>$1</u>")
If InStr(Lcase(Str),"[/fly]")>0 Then Str=YxBBs_Ubb1(Str,"\[fly\]","\[\/fly\]","<marquee width=90% behavior=alternate scrollamount=3>$1</marquee>")
If InStr(Lcase(Str),"[/url]")>0 Then Str=YxBBs_Ubb1(Str,"\[url=(.{5,}?)\]","\[\/url\]","<a href=""$1"" target='_blank'>$2</a>")
If InStr(Lcase(Str),"[/color]")>0 Then Str=YxBBs_Ubb1(Str,"\[color=((#.{6})|.{3,6})\]","\[\/color\]","<font color=#$1>$3</font>")
If InStr(Lcase(Str),"[/img]")>0 Then Str=YxBBs_Ubb2(Str,"\[img\]","\[\/img\]","<img src=$1 border=0 style='cursor:hand' onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333"" onclick=""window.open(this.src,null,'')"">","<a href=$1 target=_blank>$1</a>",YxBBs.BBSSetting(22))
Set re=nothing
Sign_Code=Str
End Function
Private Function UbbCode_Q(strText)
Dim s
Dim Test
Dim LoopCount
LoopCount=0
s=strText
re.Pattern="\[QUOTE\]"
Test=re.Test(s)
If Test Then
re.Pattern="\[\/QUOTE\]"
Test=re.Test(s)
If Test Then
re.Pattern="\[QUOTE\]"
s=re.replace(s, chr(1) & "QUOTE" & chr(2))
re.Pattern="\[\/QUOTE\]"
s=re.replace(s, chr(1) & "/QUOTE" & chr(2))
Do
re.Pattern="\x01QUOTE\x02\x01\/QUOTE\x02"
s=re.Replace(s,"")
re.Pattern="\x01QUOTE\x02(.[^\x01]*)\x01\/QUOTE\x02"
s=re.Replace(s,"<table cellpadding=0 cellspacing=0 border=1 WIDTH='90%' style='border-collapse: collapse' bordercolor=#CCCCCC align=center><tr><td bgcolor='#f2f8ff'><p style='margin:15'>$1</p></td></tr></table><br>")
Test=re.Test(s)
LoopCount=LoopCount+1
If LoopCount>MaxLoopCount Then Exit Do
Loop While(Test)
re.Pattern="\x02"
s=re.replace(s, "]")
re.Pattern="\x01"
s=re.replace(s, "[")
End If
End If
UbbCode_Q=s
End Function
Private Function text_encode(byval str)
If isnull(str) then
text_encode=""
Else
str=replace(Str,"|","|")
str=replace(Str,"'",chr(39))
str=replace(str,"&","&")
str=replace(str,"<","<")
text_encode=replace(str,">",">")
End if
End function
Private Function YxBBs_Ubb1(Str,uCodeL,uCodeR,tCode)
Dim s
s=str
re.Pattern=uCodeL&uCodeR
s=re.Replace(s,"")
re.Pattern=uCodeL&"(.+?)"&uCodeR
s=re.Replace(s,tCode)
re.Pattern=uCodeL
s=re.Replace(s,"")
re.Pattern=uCodeR
s=re.Replace(s,"")
YxBBs_Ubb1=s
End Function
Private Function YxBBs_Ubb3(Str,uCodeL,uCodeR,tCode)
Dim s
s=str
re.Pattern=uCodeL&uCodeR
s=re.Replace(s,"")
re.Pattern=uCodeL&"(.+?)"&uCodeR
s=re.Replace(s,tCode)
YxBBs_Ubb3=s
End Function
Private Function YxBBs_Ubb2(Str,uCodeL,uCodeR,tCode1,tCode2,BBSCheck)
Dim s
s=str
re.Pattern=uCodeL&uCodeR
s=re.Replace(s,"")
re.Pattern=uCodeL&"(.+?)"&uCodeR
If BBScheck="0" Then
s=re.Replace(s,tCode1)
Else
s=re.Replace(s,tCode2)
End If
re.Pattern=uCodeL
s=re.Replace(s,"")
re.Pattern=uCodeR
s=re.Replace(s,"")
YxBBs_Ubb2=s
End Function
Private Function YxBBs_Code(Str,PostType)
dim ary_String,i,n,n_pos
ary_String=split(Str,"[code]")
n=ubound(ary_String)
If n<1 then
YxBBs_Code=YxBBs_UBB(Str,PostType)
Exit function
End If
ary_String(0)=YxBBs_UBB(ary_String(0),postType)
for i=1 to n
n_pos=inStr(ary_String(i),"[/code]")
If n_pos>0 then
ary_String(i)="<table cellpadding=0 cellspacing=0 border=1 WIDTH='98%' style='border-collapse: collapse' bordercolor=#CCCCCC align=center><tr><td bgcolor='#f2f8ff'><p style='margin:15'><b>本贴相关代码:</b><br>" & left(ary_String(i),n_pos-1) & "</p></td></tr></table><br>" & YXBBS_UBB(right(ary_String(i),len(ary_String(i))-n_pos-6),PostType)
Else
ary_String(i)="[code]" & YxBBs_UBB(ary_String(i),PostType)
End if
next
YxBBs_Code=join(ary_String,"")
End Function
Rem 入口(内容,开始的UBB,结束的UBB,显示允许,显示不允许,标记:1=帖子/2=留言公告,用户的信息)
Rem (Str,"\[grade=*([0-9]*)\]","\[\/grade\]","$1<hr noshade size=1><font color=gray>以下内容需要等级为 <b>$3</b> 或更高的等级以及作者才能浏览</font><BR>$4<hr noshade size=1>$6","$1<hr noshade size=1><font color=Red>以下内容需要等级为<B>$3</B>或更高的等级以及作者才可以浏览</font><hr noshade size=1>$6",PostType,YxBBs.MyGrade)
Private Function YxBBs_GetUBB(Str,uCodeL,uCodeR,tCode1,tCode2,postType,MyInfo)
Dim Test
Dim po,ii
Dim LoopCount
LoopCount=0
Do While True
re.Pattern=uCodeL
Test=re.Test(Str)
If Test Then
re.Pattern=uCodeR
Test=re.Test(Str)
If Test Then
If PostType=1 Then
re.Pattern="(^.*)("&uCodeL&")(.+?)("&uCodeR&")(.*)"
po=re.Replace(Str,"$3")
If IsNumeric(po) Then
ii=int(po)
Else
ii=0
End If
If YxBBs.Founduser and (Lcase(YxBBs.MyName)=Lcase(UserName) or int(MyInfo)>=int(ii) or YxBBs.ClassID<=2 or YxBBs.IsBoardAdmin) Then
Str=re.Replace(str,tCode1)
Else
Str=re.Replace(str,tCode2)
End If
Else
re.Pattern="("&uCodeL&")(.+?)("&uCodeR&")"
s=re.Replace(s,"$3")
End If
Else
Exit Do
End If
Else
Exit Do
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -