ubbcode函数

2018-09-06 11:28

阅读:471

  复制代码 代码如下:
<%
PublicFunctionUbbCode(strContent)
Dimre
Setre=NewRegExp
re.IgnoreCase=True
re.Global=True
过滤危险脚本
re.Pattern=(</script>)
strContent=re.Replace(strContent,</script>)
re.Pattern=(script:)
strContent=re.Replace(strContent,script:)
re.Pattern=(script)
strContent=re.Replace(strContent,script)
re.Pattern=(js:)
strContent=re.Replace(strContent,js:)
re.Pattern=(value)
strContent=re.Replace(strContent,value)
re.Pattern=(about:)
strContent=re.Replace(strContent,about:)
re.Pattern=(file:)
strContent=re.Replace(strContent,file:)
strContent=re.Replace(strContent,documents.cookie)
re.Pattern=(vbs:)
strContent=re.Replace(strContent,vbs:)
re.Pattern=(on(mouseexiterrorclickkey))
strContent=re.Replace(strContent,on$2)

re.Pattern=<IMG.[^>]*SRC(=)(.[^>]*)>
strContent=re.replace(strContent,<IMGSRC=$2onclick=javascript:window.open(this.src);style=CURSOR:pointerborder=0>)
strContent=re.replace(strContent,<IMGSRC=$2border=0>)

re.Pattern=<img(.[^>]*)>
strContent=re.replace(strContent,<img$1onload=returnimgzoom(this,550)>)

re.Pattern=(\[i\])(.[^\[]*)(\[\/i\])
strContent=re.Replace(strContent,<i>$2</i>)
re.Pattern=(\[u\])(.[^\[]*)(\[\/u\])
strContent=re.Replace(strContent,<u>$2</u>)
re.Pattern=(\[b\])(.[^\[]*)(\[\/b\])
strContent=re.Replace(strContent,<b>$2</b>)
re.Pattern=(\[fly\])(.*)(\[\/fly\])
strContent=re.Replace(strContent,<marquee>$2</marquee>)

re.Pattern=\[size=([1-9])\](.[^\[]*)\[\/size\]
strContent=re.Replace(strContent,<fontsize=$1>$2</font>)
re.Pattern=(\[center\])(.[^\[]*)(\[\/center\])
strContent=re.Replace(strContent,<center>$2</center>)

re.Pattern=\[DIR=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/DIR]
strContent=re.Replace(strContent,<embedsrc=$3pluginspage=
re.Pattern=\[QT=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/QT]
strContent=re.Replace(strContent,<embedsrc=$3width=$1height=$2autoplay=trueloop=falsecontroller=trueplayeveryframe=falsecache=falsescale=TOFITbgcolor=#000000kioskmode=falsetargetcache=falsepluginspage=
re.Pattern=\[MP=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/MP]
strContent=re.Replace(strContent,<embedtype=application/x-oleobjectcodebase=
re.Pattern=\[RM=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/RM]
strContent=re.Replace(strContent,<OBJECTclassid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFAclass=OBJECTid=RAOCXwidth=$1height=$2><PARAMNAME=SRCVALUE=$3><PARAMNAME=CONSOLEVALUE=Clip1><PARAMNAME=CONTROLSVALUE=imagewindow><PARAMNAME=AUTOSTARTVALUE=true></OBJECT><br><OBJECTclassid=CLSID:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFAheight=32id=video2width=$1><PARAMNAME=SRCVALUE=$3><PARAMNAME=AUTOSTARTVALUE=-1><PARAMNAME=CONTROLSVALUE=controlpanel><PARAMNAME=CONSOLEVALUE=Clip1></OBJECT>)

re.Pattern=(\[FLASH\])(.[^\[]*)(\[\/FLASH\])
strContent=re.Replace(strContent,<embedsrc=$2quality=highpluginspage=
strContent=re.Replace(strContent,)
re.Pattern=(\[FLASH=*([0-9]*),*([0-9]*)\])(.[^\[]*)(\[\/FLASH\])
strContent=re.Replace(strContent,<embedsrc=$4quality=highpluginspage=
strContent=re.Replace(strContent,)
re.Pattern=\[UPLOAD=(gifjpgjpegbmppng)\](.[^\[]*)(gifjpgjpegbmppng)\[\/UPLOAD\]
strContent=re.Replace(strContent,<br><AHREF=$2$1TARGET=_blank><IMGSRC=$2$1border=0alt=按此在新窗口浏览图片onload=javascript:if(this.width>screen.width-333)this.width=screen.width-333></A>)

re.Pattern=(\[UPLOAD=(.[^\[]*)\])(.[^\[]*)(\[\/UPLOAD\])
strContent=re.Replace(strContent,<br><ahref=$3>点击浏览该文件</a>)

re.Pattern=(\[URL\])(.[^\[]*)(\[\/URL\])
strContent=re.Replace(strContent,<AHREF=$2TARGET=_blank>$2</A>)
re.Pattern=(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])
strContent=re.Replace(strContent,<AHREF=$2TARGET=_blank>$3</A>)

re.Pattern=(\[EMAIL\])(.[^\[]*)(\[\/EMAIL\])
strContent=re.Replace(strContent,<AHREF=mailto:$2>$2</A>)
re.Pattern=(\[EMAIL=(.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])
strContent=re.Replace(strContent,<AHREF=mailto:$2TARGET=_blank>$3</A>)

re.Pattern=(\[HTML\])(.[^\[]*)(\[\/HTML\])
strContent=re.Replace(strContent,<tablewidth=100%border=0cellspacing=0cellpadding=6bgcolor=#F6F6F6><td><b>以下内容为程序代码:</b><br>$2</td></table>)
re.Pattern=(\[code\])(.[^\[]*)(\[\/code\])
strContent=re.Replace(strContent,<tablewidth=100%border=0cellspacing=0cellpadding=6bgcolor=#F6F6F6><td><b>以下内容为程序代码:</b><br>$2</td></table>)

re.Pattern=(\[color=(.[^\[]*)\])(.[^\[]*)(\[\/color\])
strContent=re.Replace(strContent,<fontcolor=$2>$3</font>)
re.Pattern=(\[face=(.[^\[]*)\])(.[^\[]*)(\[\/face\])
strContent=re.Replace(strContent,<fontface=$2>$3</font>)
re.Pattern=\[align=(centerleftright)\](.*)\[\/align\]
strContent=re.Replace(strContent,<divalign=$1>$2</div>)

re.Pattern=(\[QUOTE\])(.*)(\[\/QUOTE\])
strContent=re.Replace(strContent,<tablecellpadding=0cellspacing=0border=1WIDTH=94%bordercolor=#000000bgcolor=#F2F8FFalign=center><tr><td><tablewidth=100%cellpadding=5cellspacing=1border=0><TR><TDBGCOLOR=#F6F6F6>$2</table></table><br>)
re.Pattern=(\[move\])(.*)(\[\/move\])
strContent=re.Replace(strContent,<MARQUEEscrollamount=3>$2</marquee>)
re.Pattern=\[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/GLOW]
strContent=re.Replace(strContent,<tablewidth=$1style=filter:glow(color=$2,strength=$3)>$4</table>)
re.Pattern=\[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/SHADOW]
strContent=re.Replace(strContent,<tablewidth=$1style=filter:shadow(color=$2,strength=$3)>$4</table>)
Setre=Nothing
strContent=Replace(strContent,{,{)
strContent=Replace(strContent,},})
strContent=Replace(strContent,$,$)
UbbCode=strContent
EndFunction
%>


评论


亲,登录后才可以留言!