📄 dv_ubbcode.asp
字号:
re.Pattern="<img(.[^>]*)/>"
s=re.replace(s,"<img$1 onload=""imgresize(this);""/>")
End If
bbimg=s
End Function
'签名UBB转换
Public Function Dv_SignUbbCode(s,PostUserGroup)
Dim ii
Dim po
isxhtml=True
If Dvbbs.forum_setting(66)="0" Then
s= server.htmlEncode(s)
re.Pattern="\[\/(img|dir|qt|mp|rm|sound|flash)\]"
If re.Test(s) Then
If Dv_FilterJS2(s)Then
re.Pattern="\[(br)\]"
s=re.Replace(s,"<$1>")
re.Pattern = "( )"
s = re.Replace(s,Chr(9))
re.Pattern = "(<br/>)"
s = re.Replace(s,vbNewLine)
re.Pattern = "(<br />)"
s = re.Replace(s,vbNewLine)
re.Pattern = "(<p>)"
s = re.Replace(s,"")
re.Pattern = "(<\/p>)"
s = re.Replace(s,vbNewLine)
s=server.htmlencode(s)
s="<form name=""scode"&replyid&""" method=""post"" action=""""><table class=""tableborder2"" cellspacing=""1"" cellpadding=""3"" width=""100%"" align=""center"" border=""0""><tr><th height=""22"">以下内容含脚本,或可能导致页面不正常的代码</th></tr><tr><td class=""tablebody1"" align=""middle"" width=""98%""><textarea id=""CodeText"" style=""BORDER-RIGHT: 1px dotted; BORDER-TOP: 1px dotted; OVERFLOW-Y: visible; OVERFLOW: visible; BORDER-LEFT: 1px dotted; WIDth: 98%; COLOR: #000000; BORDER-BOTTOM: 1px dotted"" rows=""20"" cols=""120"">"&s&"</textarea></td></tr><tr><td class=""tablebody2"" align=""middle"" width=""98%""><b>说明:</b>上面显示的是代码内容。您可以先检查过代码没问题,或修改之后再运行.</td></tr><tr><td class=""tablebody1"" align=""middle"" width=""98%""><input type=""button"" name=""run"" value=""运行代码"" onclick=""Dvbbs_ViewCode("&replyid&");""></td></tr></table></form>"
s = Replace(s, vbNewLine, "")
s = Replace(s, Chr(10), "")
s = Replace(s, Chr(13), "")
Dv_SignUbbCode=s
Exit Function
End If
End If
re.Pattern="([^"&Chr(13)&"])"& Chr(10)
s= re.Replace(s,"$1<br />")
re.Pattern=Chr(13)&Chr(10)&"(.*)"
s= re.Replace(s,"<p>$1</p>")
Else
If Dv_FilterJS(s) Then
re.Pattern="\[(br)\]"
s=re.Replace(s,"<$1>")
re.Pattern = "( )"
s = re.Replace(s,Chr(9))
re.Pattern = "(<br/>)"
s = re.Replace(s,vbNewLine)
re.Pattern = "(<br>)"
s = re.Replace(s,vbNewLine)
re.Pattern = "(<p>)"
s = re.Replace(s,"")
re.Pattern = "(<\/p>)"
s = re.Replace(s,vbNewLine)
s=server.htmlencode(s)
s="<form name=""scode"&replyid&""" method=""post"" action=""""><table class=""tableborder2"" cellspacing=""1"" cellpadding=""3"" width=""100%"" align=""center"" border=""0""><tr><th height=""22"">以下内容含脚本,或可能导致页面不正常的代码</th></tr><tr><td class=""tablebody1"" align=""middle"" width=""98%""><textarea id=""CodeText"" style=""BORDER-RIGHT: 1px dotted; BORDER-TOP: 1px dotted; OVERFLOW-Y: visible; OVERFLOW: visible; BORDER-LEFT: 1px dotted; WIDth: 98%; COLOR: #000000; BORDER-BOTTOM: 1px dotted"" rows=""20"" cols=""120"">"&s&"</textarea></td></tr><tr><td class=""tablebody2"" align=""middle"" width=""98%""><b>说明:</b>上面显示的是代码内容。您可以先检查过代码没问题,或修改之后再运行.</td></tr><tr><td class=""tablebody1"" align=""middle"" width=""98%""><input type=""button"" name=""run"" value=""运行代码"" onclick=""Dvbbs_ViewCode("&replyid&");""></td></tr></table></form>"
Dv_SignUbbCode=s
Exit Function
End If
re.Pattern="<((asp|\!|%))"
s=re.Replace(s,"<$1")
re.Pattern="(>)("&vbNewLine&")(<)"
s=re.Replace(s,"$1$3")
re.Pattern="(>)("&vbNewLine&vbNewLine&")(<)"
s=re.Replace(s,"$1$3")
End If
s = Replace(s, " ", " ")
s = Replace(s, vbNewLine, "<br/>")
s = Replace(s, Chr(13), "")
'常规设置不支持UBB代码,则退出
If Cint(Dvbbs.Forum_setting(65))=0 Then
Dv_SignUbbCode=s
Exit Function
End If
'img code
If InStr(Lcase(s),"[/img]")>0 Then s=Dv_UbbCode_iS2(s,"img","<img "& DV_UBB_TITLE &" src=""$1"" border=""0"" />","<img "& DV_UBB_TITLE &" src=""skins/default/filetype/gif.gif"" border=""0"" /><a href=""$1"" target=""_blank"">$1</a>",PostUserGroup,Cint(Dvbbs.forum_setting(67)),"")
'media code
If InStr(Lcase(s),"[/sound]")>0 Then s=Dv_UbbCode_iS2(s,"sound","<a href=""$1"" target=""_blank""><img "& DV_UBB_TITLE &" src=""skins/default/filetype/mid.gif"" border=""0"" alt=""背景音乐"" /></a><bgsound src=""$1"" loop=""-1"">","<a href=""$1"" target=""_blank"">$1</a>",PostUserGroup,Cint(Board_Setting(9) * mt),"")
'flash code
If InStr(Lcase(s),"[/flash]")>0 Then
s=Dv_UbbCode_iS2(s,"flash",_
"<a href=""$1"" target=""_blank""><img "& DV_UBB_TITLE &" src=""skins/default/filetype/swf.gif"" border=""0"" alt=""点击开新窗口欣赏该FLASH动画!"" height=""16"" width=""16"" />[全屏欣赏]</a><br/>"&_
"<object "& DV_UBB_TITLE &" codebase=""http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0"" classid=""clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"" width=""500"" height=""400"">"&_
"<param name=""movie"" value=""$1"" /><param name=""quality"" value=""high"" />"&_
"<embed "& DV_UBB_TITLE &" src=""$1"" quality=""high"" pluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"" type=""application/x-shockwave-flash"" width=""500"" height=""400"">$1</embed></object>",_
"<img "& DV_UBB_TITLE &" src=""skins/default/filetype/swf.gif"" border=""0"" alt=""""> <a href=""$1"" target=""_blank"">$1</a>(注意:Flash内容可能含有恶意代码)",_
PostUserGroup,Cint(Dvbbs.forum_setting(71)),"")
s=Dv_UbbCode_iS2(s,"flash",_
"<a href=""$3"" target=""_blank""><img "& DV_UBB_TITLE &" src=""skins/default/filetype/swf.gif"" border=""0"" alt=""点击开新窗口欣赏该FLASH动画!"" height=""16"" width=""16"" />[全屏欣赏]</a><br/>"&_
"<object "& DV_UBB_TITLE &" 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 "& DV_UBB_TITLE &" 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"">$3</embed></object>",_
"<a href=""$3"" target=""_blank"">$3</a>(注意:Flash内容可能含有恶意代码)",_
PostUserGroup,Cint(Dvbbs.forum_setting(71)),"=*([0-9]*),*([0-9]*)")
End If
'url code
If InStr(Lcase(s),"[/url]")>0 Then
s=Dv_UbbCode_S1(s,"url","<a href=""$1"" target=""_blank"">$1</a>")
s=Dv_UbbCode_UF(s,"url","<a href=""$1"" target=""_blank"">$2</a>","0")
End If
'email code
If InStr(Lcase(s),"[/email]")>0 Then
s=Dv_UbbCode_S1(s,"email","<img "& DV_UBB_TITLE &" src=""skins/default/email1.gif"" alt="""" /><a href=""mailto:$1"">$1</a>")
s=Dv_UbbCode_UF(s,"email","<img "& DV_UBB_TITLE &" src=""skins/default/email1.gif"" alt="""" /><a href=""mailto:$1"" target=""_blank"">$2</a>","0")
End If
If InStr(Lcase(s),"[/html]")>0 Then s=Dv_UbbCode_C(s,"html")
If InStr(Lcase(s),"[/color]")>0 Then s=Dv_UbbCode_UF(s,"color","<font color=""$1"">$2</font>","1")
If InStr(Lcase(s),"[/face]")>0 Then s=Dv_UbbCode_UF(s,"face","<font face=""$1"">$2</font>","1")
If InStr(Lcase(s),"[/align]")>0 Then s=Dv_UbbCode_Align(s)
If InStr(Lcase(s),"[/shadow]")>0 Then s=Dv_UbbCode_iS1(s,"shadow","<div style=""width:$1px;filter:shadow(color=$2, strength=$3)"">$4</div>")
If InStr(Lcase(s),"[/glow]")>0 Then s=Dv_UbbCode_iS1(s,"glow","<div style=""width:$1px;filter:glow(color=$2, strength=$3)"">$4</div>")
If InStr(Lcase(s),"[/i]")>0 Then s=Dv_UbbCode_S1(s,"i","<i>$1</i>")
If InStr(Lcase(s),"[/b]")>0 Then s=Dv_UbbCode_S1(s,"b","<b>$1</b>")
If InStr(Lcase(s),"[/u]")>0 Then s=Dv_UbbCode_S1(s,"u","<u>$1</u>")
If InStr(Lcase(s),"[/size]")>0 Then
s=Dv_UbbCode_UF(s,"size","<font size=""$1"">$2</font>","1-"&Maxsize&"")
End If
REM :签名移动(如需使用则把以下屏蔽去掉)
'If InStr(Lcase(s),"[/fly]")>0 Then s=Dv_UbbCode_S1(s,"fly","<marquee width=""90%"" behavior=""alternate"" scrollamount=""3"">$1</marquee>")
'If InStr(Lcase(s),"[/move]")>0 Then s=Dv_UbbCode_S1(s,"move","<marquee scrollamount=""3"">$1</marquee>")
'不开放HTML支持,不转换HREF
REM 加上签名是否开放HTML判断 2004-5-6 Dvbbs.YangZheng
If Board_Setting(5)="1" And Dvbbs.Forum_Setting(66) = "1" Then
'自动识别网址
If InStr(Lcase(s),"http://")>0 Then
re.Pattern = "(^|[^<=""])(http:(\/\/|\\\\)(([\w\/\\\+\-~`@:%])+\.)+([\w\/\\\.\=\?\+\-~`@\':!%#]|(&)|&)+)"
s = re.Replace(s,"$1<a target=""_blank"" href=$2>$2</a>")
End If
'自动识别www等开头的网址
If InStr(Lcase(s),"www.")>0 or InStr(Lcase(s),"bbs.")>0 Then
re.Pattern = "(^|[^\/\\\w\=])((www|bbs)\.(\w)+\.([\w\/\\\.\=\?\+\-~`@\'!%#]|(&))+)"
s = re.Replace(s,"$1<a target=""_blank"" href=http://$2>$2</a>")
End If
End If
If xml.loadxml("<div>" & xmlencode(s) &"</div>") Then
s=checkimg(s)
s=Rexmlencode(s)
If showisxhtml=1 and Dvbbs.master Then
s=s&"<p style=""color:green"" align=""right"">[符合XHML规范]</p>"
End If
Else
s=bbimg(s)
If showisxhtml=1 and Dvbbs.master Then
s=s&"<p style=""color:red"" align=""right"">[不符合XHML规范]</p>"
End If
End If
Dv_SignUbbCode=s
End Function
Private Function Dv_UbbCode_S1(strText,uCodeC,tCode)
Dim s
s=strText
re.Pattern="\["&uCodeC&"\][\s\n]*\[\/"&uCodeC&"\]"
s=re.Replace(s,"")
re.Pattern="\[\/"&uCodeC&"\]"
s=re.replace(s, Chr(1)&"/"&uCodeC&"]")
re.Pattern="\["&uCodeC&"\]([^\x01]*)\x01\/"&uCodeC&"\]"
s=re.Replace(s,tCode)
re.Pattern="\x01\/"&uCodeC&"\]"
s=re.replace(s,"[/"&uCodeC&"]")
If isxhtml Then
If xml.loadxml("<div>" & xmlencode(s) &"</div>") Then
Dv_UbbCode_S1=s
Else
Dv_UbbCode_S1=strText
End If
Else
Dv_UbbCode_S1=s
End If
End Function
Private Function Dv_UbbCode_UF(strText,uCodeC,tCode,Flag)
Dim s
Dim LoopCount
LoopCount=0
s=strText
re.Pattern="\["&uCodeC&"=([^\]]*)\][\s\n ]*\[\/"&uCodeC&"\]"
s=re.Replace(s,"")
re.Pattern="\[\/"&uCodeC&"\]"
s=re.replace(s, chr(1)&"/"&uCodeC&"]")
re.Pattern="\["&uCodeC&"=([^\]]*)\]([^\x01]*)\x01\/"&uCodeC&"\]"
If Flag="1" Then
Do While Re.Test(s)
s=re.Replace(s,tCode)
LoopCount=LoopCount+1
If LoopCount>MaxLoopCount Then Exit Do
Loop
ElseIf Flag="0" Then
s=re.Replace(s,tCode)
Else
re.Pattern="\["&uCodeC&"=(["&Flag&"]*)\]([^\x01]*)\x01\/"&uCodeC&"\]"
Do While Re.Test(s)
s=re.Replace(s,tCode)
LoopCount=LoopCount+1
If LoopCount>MaxLoopCount Then Exit Do
Loop
End If
re.Pattern="\x01\/"&uCodeC&"\]"
s=re.replace(s,"[/"&uCodeC&"]")
If isxhtml Then
If xml.loadxml("<div>" & xmlencode(s) &"</div>") Then
Dv_UbbCode_UF=s
Else
Dv_UbbCode_UF=strText
End If
Else
Dv_UbbCode_UF=s
End If
End Function
Private Function Dv_UbbCode_iS1(strText,uCodeC,tCode)
Dim s
s=strText
re.Pattern="\["&uCodeC&"=[^\]]*\][\s\n]\[\/"&uCodeC&"\]"
s=re.Replace(s,"")
re.Pattern="\[\/"&uCodeC&"\]"
s=re.replace(s, chr(1)&"/"&uCodeC&"]")
re.Pattern="\["&uCodeC&"=([0-9]+),(#?[\w]+),([0-9]+)\]([^\x01]*)\x01\/"&uCodeC&"\]"
s=re.Replace(s,tCode)
re.Pattern="\x01\/"&uCodeC&"\]"
s=re.replace(s, "[/"&uCodeC&"]")
If isxhtml Then
If xml.loadxml("<div>" & xmlencode(s) &"</div>") Then
Dv_UbbCode_iS1=s
Else
Dv_UbbCode_iS1=strText
End If
Else
Dv_UbbCode_iS1=s
End If
End Function
Private Function Dv_UbbCode_iS2(strText,uCodeC,tCode1,tCode2,PostUserGroup,Flag,iCode)
Dim s
s=strText
re.Pattern="\["&uCodeC&iCode&"\][\s\n]*\[\/"&uCodeC&"\]"
s=re.replace(s,"")
re.Pattern="\[\/"&uCodeC&"\]"
s=re.replace(s, chr(1)&"/"&uCodeC&"]")
If uCodeC<>"flash" Then
re.Pattern="\["&uCodeC&"[^\]]*\](([^\x01\n]*)(\.swf|\.swi)([^\x01\n]*))\x01\/"&uCodeC&"\]"
s=re.Replace(s,"非法"&uCodeC&"多媒体标签,文件地址:$1")
End If
If uCodeC="img" Then
re.Pattern="\["&uCodeC&iCode&"\]([^""\x01\n]*)\x01\/"&uCodeC&"\]"
Else
re.Pattern="\["&uCodeC&iCode&"\]([^\x01\n]*)\x01\/"&uCodeC&"\]"
End If
If Flag = 1 Then
s=re.Replace(s,tCode1)
Else
s=re.Replace(s,tCode2)
End If
re.Pattern="\x01\/"&uCodeC&"\]"
s=re.replace(s,"[/"&uCodeC&"]")
If isxhtml Then
If xml.loadxml("<div>" & xmlencode(s) &"</div>") Then
Dv_UbbCode_iS2=s
Else
Dv_UbbCode_iS2=strText
End If
Else
Dv_UbbCode_iS2=s
End If
End Function
Private Function Dv_UbbCode_Align(strText)
Dim s
s=strText
re.Pattern="\[align=(center|left|right)\][\s\n]*\[\/align\]"
s=re.Replace(s,"")
re.Pattern="\[\/align\]"
s=re.replace(s,chr(1)&"/align]")
re.Pattern="\[align=(center|left|right)\]([^\x01]*)\x01\/align\]"
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -