ubbcode函数

时间:2021-05-26

复制代码 代码如下:
<%
PublicFunctionUbbCode(strContent)
Dimre
Setre=NewRegExp
re.IgnoreCase=True
re.Global=True
'过滤危险脚本
re.Pattern="(</script>)"
strContent=re.Replace(strContent,"&lt;/script&gt;")
re.Pattern="(script:)"
strContent=re.Replace(strContent,"&#115cript&#58")
re.Pattern="(script)"
strContent=re.Replace(strContent,"&#115cript")
re.Pattern="(js:)"
strContent=re.Replace(strContent,"&#106s&#58")
re.Pattern="(value)"
strContent=re.Replace(strContent,"&#118alue")
re.Pattern="(about:)"
strContent=re.Replace(strContent,"about&#58")
re.Pattern="(file:)"
strContent=re.Replace(strContent,"file&#58")
re.Pattern="(document.cookie)"
strContent=re.Replace(strContent,"documents&#46cookie")
re.Pattern="(vbs:)"
strContent=re.Replace(strContent,"&#118bs&#58")
re.Pattern="(on(mouse|exit|error|click|key))"
strContent=re.Replace(strContent,"&#111n$2")

re.Pattern="<IMG.[^>]*SRC(=|)(.[^>]*)>"
'strContent=re.replace(strContent,"<IMGSRC=$2onclick=""javascript:window.open(this.src);""style=""CURSOR:pointer""border=""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=http:///shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash'type='application/x-shockwave-flash'width=$2height=$3>$4</embed>")
strContent=re.Replace(strContent,"")
re.Pattern="\[UPLOAD=(gif|jpg|jpeg|bmp|png)\](.[^\[]*)(gif|jpg|jpeg|bmp|png)\[\/UPLOAD\]"
strContent=re.Replace(strContent,"<br><AHREF=""$2$1""TARGET=_blank><IMGSRC=""$2$1""border=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=""$2""TARGET=_blank>$2</A>")
re.Pattern="(\[URL=(.[^\[]*)\])(.[^\[]*)(\[\/URL\])"
strContent=re.Replace(strContent,"<AHREF=""$2""TARGET=_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:$2""TARGET=_blank>$3</A>")

re.Pattern="(\[HTML\])(.[^\[]*)(\[\/HTML\])"
strContent=re.Replace(strContent,"<tablewidth='100%'border='0'cellspacing='0'cellpadding='6'bgcolor='#F6F6F6'><td><b>以下内容为程序代码:</b><br>$2</td></table>")
re.Pattern="(\[code\])(.[^\[]*)(\[\/code\])"
strContent=re.Replace(strContent,"<tablewidth='100%'border='0'cellspacing='0'cellpadding='6'bgcolor='#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=(center|left|right)\](.*)\[\/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,"{","&#123;")
strContent=Replace(strContent,"}","&#125;")
strContent=Replace(strContent,"$","&#36;")
UbbCode=strContent
EndFunction
%>

声明:本页内容来源网络,仅供用户参考;我单位不保证亦不表示资料全面及准确无误,也不保证亦不表示这些资料为最新信息,如因任何原因,本网内容或者用户因倚赖本网内容造成任何损失或损害,我单位将不会负任何法律责任。如涉及版权问题,请提交至online#300.cn邮箱联系删除。

相关文章