<%
FunctionHTMLEncode(ByValstrValue)
'忽略错误
OnErrorResumeNext
'定义变量
DimstrNewValue
IfstrValue<>""Then
strNewValue=Replace(strValue,"<","<")
strNewValue=Replace(strNewValue,">",">")
strNewValue=Replace(strNewValue,"'","")
strNewValue=Replace(strNewValue,"""",""")
strNewValue=Replace(strNewValue,vbCrLf,"<br>")
strNewValue=Replace(strNewValue,"","")
EndIf
HTMLEncode=strNewValue
'输出错误
IfErr.Number>0Then
Response.WriteErr.Description
Response.End
EndIf
EndFunction
FunctionUBBCode(strValue)
DimRegExp
'strValue=HTMLEncode(strValue)
SetRegExp=NewRegExp
RegExp.IgnoreCase=True
RegExp.Global=True
IfstrValue<>""Then
RegExp.Pattern="([IMG])(.[^[]*)([/IMG])"
strValue=RegExp.Replace(strValue,"<ahref=""$2""target=_blank><IMGSRC=""$2""border=0alt=按此在新窗口浏览图片onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></a>")
RegExp.Pattern="([FLASH])(.[^[]*)([/FLASH])"
strValue=RegExp.Replace(strValue,"<OBJECTcodebase=""http://download.macromedia.com/pub/sho ... h/swflash.cab#version=4,0,2,0""classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000width=500height=400id=ShockwaveFlash1><PARAMNAME=movieVALUE=""$2""><PARAMNAME=qualityVALUE=high><embedsrc=""$2""quality=highpluginspage=""http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash""type=""appl ... 00height=400></embed></OBJECT>")
RegExp.Pattern="([ZIP])(.[^[]*)([/ZIP])"
strValue=RegExp.Replace(strValue,"<br><ahref=""$2"">点击下载该文件</a>")
RegExp.Pattern="([RAR])(.[^[]*)([/RAR])"
strValue=RegExp.Replace(strValue,"<br><ahref=""$2"">点击下载该文件</a>")
'RegExp.Pattern="([UPLOAD=(.[^[]*)])(.[^[]*)([/UPLOAD])"
'strValue=RegExp.Replace(strValue,"<br><IMGSRC=""$2.gif""border=0><AHREF=""$3""TARGET=_blank>点击查看或下载该文件</A>")
'strValue=RegExp.Replace(strValue,"<br><IMGSRC=""$2.gif""border=0>此主题相关图片如下:<br><AHREF=""$3""TARGET=_blank><IMGSRC=""$3""border=0alt=按此在新窗口浏览图片onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333""></A>")
RegExp.Pattern="([URL])(http://.[^[]*)([/URL])"
strValue=RegExp.Replace(strValue,"<AHREF=""$2""TARGET=_blank>$2</A>")
RegExp.Pattern="([URL])(.[^[]*)([/URL])"
strValue=RegExp.Replace(strValue,"<AHREF=""http://$2""TARGET= ... t;/A>")
RegExp.Pattern="(*)])(.[^[]*)([/URL])"
strValue=RegExp.Replace(strValue,"<AHREF=""$2""TARGET=_blank>$3</A>")
RegExp.Pattern="([URL=(.[^[]*)])(.[^[]*)([/URL])"
strValue=RegExp.Replace(strValue,"<AHREF=""[url]http://$2""TARGET=_blank>$3</A>")
RegExp.Pattern="([EMAIL])(S+@.[^[]*)([/EMAIL])"
strValue=RegExp.Replace(strValue,"<AHREF=""mailto:$2"">$2</A>")
RegExp.Pattern="([EMAIL=(S+@.[^[]*)])(.[^[]*)([/EMAIL])"
strValue=RegExp.Replace(strValue,"<AHREF=""mailto:$2""TARGET=_blank>$3</A>")
RegExp.Pattern="^(http://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="(http://[A-Za-z0-9./=?%-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="[^>=""](http://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="^(ftp://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="(ftp://[A-Za-z0-9./=?%-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="[^>=""](ftp://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="^(rtsp://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="(rtsp://[A-Za-z0-9./=?%-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="[^>=""](rtsp://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="^(mms://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="(mms://[A-Za-z0-9./=?%-&_~`@':+!]+)$"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="[^>=""](mms://[A-Za-z0-9./=?%-&_~`@':+!]+)"
strValue=RegExp.Replace(strValue,"<atarget=_blankhref=$1>$1</a>")
RegExp.Pattern="([HTML])(.[^[]*)([/HTML])"
strValue=RegExp.Replace(strValue,"<tablewidth='100%'border='0'cellspacing='0'cellpadding='6'bgcolor='#FFFFFF'><td><b>以下内容为程序代码:</b><br>$2</td></table>")
RegExp.Pattern="([code])(.[^[]*)([/code])"
strValue=RegExp.Replace(strValue,"<tablewidth='100%'border='0'cellspacing='0'cellpadding='6'bgcolor='#FFFFFF'><td><b>以下内容为程序代码:</b><br>$2</td></table>")
RegExp.Pattern="([color=(.[^[]*)])(.[^[]*)([/color])"
strValue=RegExp.Replace(strValue,"<fontcolor=$2>$3</font>")
RegExp.Pattern="([face=(.[^[]*)])(.[^[]*)([/face])"
strValue=RegExp.Replace(strValue,"<fontface=$2>$3</font>")
RegExp.Pattern="([align=(.[^[]*)])(.*)([/align])"
strValue=RegExp.Replace(strValue,"<divalign=$2>$3</div>")
RegExp.Pattern="([QUOTE])(.*)([/QUOTE])"
strValue=RegExp.Replace(strValue,"<tablecellpadding=0cellspacing=0border=0WIDTH=94%bgcolor=#000000align=center><tr><td><tablewidth=100%cellpadding=5cellspacing=1border=0><TR><TDBGCOLOR='#FFFFFF'>$2</table></table><br>")
RegExp.Pattern="([fly])(.*)([/fly])"
strValue=RegExp.Replace(strValue,"<marqueewidth=90%behavior=alternatescrollamount=3>$2</marquee>")
RegExp.Pattern="([move])(.*)([/move])"
strValue=RegExp.Replace(strValue,"<MARQUEEscrollamount=3>$2</marquee>")
RegExp.Pattern="[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/GLOW]"
strValue=RegExp.Replace(strValue,"<tablewidth=$1filter:glow(color=$2,strength=$3)"">$4</table>")
RegExp.Pattern="[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)](.[^[]*)[/SHADOW]"
strValue=RegExp.Replace(strValue,"<tablewidth=$1filter:shadow(color=$2,strength=$3)"">$4</table>")
RegExp.Pattern="([i])(.[^[]*)([/i])"
strValue=RegExp.Replace(strValue,"<i>$2</i>")
RegExp.Pattern="([u])(.[^[]*)([/u])"
strValue=RegExp.Replace(strValue,"<u>$2</u>")
RegExp.Pattern="([b])(.[^[]*)([/b])"
strValue=RegExp.Replace(strValue,"<b>$2</b>")
RegExp.Pattern="([fly])(.[^[]*)([/fly])"
strValue=RegExp.Replace(strValue,"<marquee>$2</marquee>")
RegExp.Pattern="([size=1])(.[^[]*)([/size])"
strValue=RegExp.Replace(strValue,"<fontsize=1>$2</font>")
RegExp.Pattern="([size=2])(.[^[]*)([/size])"
strValue=RegExp.Replace(strValue,"<fontsize=2>$2</font>")
RegExp.Pattern="([size=3])(.[^[]*)([/size])"
strValue=RegExp.Replace(strValue,"<fontsize=3>$2</font>")
RegExp.Pattern="([size=4])(.[^[]*)([/size])"
strValue=RegExp.Replace(strValue,"<fontsize=4>$2</font>")
RegExp.Pattern="([center])(.[^[]*)([/center])"
strValue=RegExp.Replace(strValue,"<center>$2</center>")
EndIf
SetRegExp=Nothing
UBBCode=strValue
'输出错误
IfErr.Number>0Then
Response.WriteErr.Description
Response.End
EndIf
EndFunction
%>
调用:<%=UBBCode(Content)%>