<% function UBBCode(strContent) dim re,i strContent=encodestr(strContent) strContent=funkillWord(strContent) UbbCode=strContent if (instr(strContent,"[")=0 or instr(strContent,"]")=0) and instr(strContent,"http://")=0 then exit function end if Set re=new RegExp re.IgnoreCase =true re.Global=True '过滤script事件 if instr(1,strContent,"on",1)>0 then re.Pattern="on(\w+)=" strContent=re.Replace(strContent,"on_$1=") end if strContent=Replace(strContent,"file:","file :") strContent=Replace(strContent,"files:","files :") strContent=Replace(strContent,"script:","script :") strContent=Replace(strContent,"js:","js :") if instr(1,strContent,"[IMG]",1)>0 then re.Pattern="(\[IMG\])(.[^\[]*)(\[\/IMG\])" if imgUbb then strContent=re.Replace(strContent,"按此在新窗口浏览图片500)this.width=500""> ") else strContent=re.Replace(strContent,"$2 ") end if end if if instr( request.servervariables("url"),"show")>0 then if instr(1,strContent,"[/dir]",1)>0 then re.Pattern="\[DIR=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/DIR]" strContent=re.Replace(strContent,"") end if if instr(1,strContent,"[/qt]",1)>0 then re.Pattern="\[QT=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/QT]" strContent=re.Replace(strContent,"") end if if instr(1,strContent,"[/mp]",1)>0 then re.Pattern="\[MP=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/MP]" strContent=re.Replace(strContent,"") end if if instr(1,strContent,"[/rm]",1)>0 then re.Pattern="\[RM=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/RM]" strContent=re.Replace(strContent,"
") end if else if instr(1,strContent,"[/dir]",1)>0 then re.Pattern="\[DIR=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/DIR]" strContent=re.Replace(strContent,"$3") end if if instr(1,strContent,"[/qt]",1)>0 then re.Pattern="\[QT=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/QT]" strContent=re.Replace(strContent,"$3") end if if instr(1,strContent,"[/mp]",1)>0 then re.Pattern="\[MP=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/MP]" strContent=re.Replace(strContent,"$3") end if if instr(1,strContent,"[/rm]",1)>0 then re.Pattern="\[RM=*([0-9]*),*([0-9]*)\](.[^\[]*)\[\/RM]" strContent=re.Replace(strContent,"$3") end if end if if instr(1,strContent,"[flash]",1)>0 then re.Pattern="(\[FLASH\])(.[^\[]*)(\[\/FLASH\])" strContent= re.Replace(strContent,"$2") end if if instr(1,strContent,"[/url]",1)>0 then re.Pattern="(\[URL\])(.[^\[]*)(\[\/URL\])" strContent= re.Replace(strContent,"$2") re.Pattern="(\[URL=(.[^\]]*)\])(.[^\[]*)(\[\/URL\])" strContent= re.Replace(strContent,"$3") end if if instr(1,strContent,"[/email]",1)>0 then re.Pattern="(\[EMAIL\])(.[^\[]*)(\[\/EMAIL\])" strContent= re.Replace(strContent,"$2") re.Pattern="(\[EMAIL=(.[^\[]*)\])(.[^\[]*)(\[\/EMAIL\])" strContent= re.Replace(strContent,"$3") end if if instr(1,strContent,"http://",1)>0 then re.Pattern = "^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1") re.Pattern = "(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$" strContent = re.Replace(strContent,"$1") re.Pattern = "([^>=""])(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1$2") end if if instr(1,strContent,"ftp://",1)>0 then re.Pattern = "^(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1") re.Pattern = "(ftp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$" strContent = re.Replace(strContent,"$1") re.Pattern = "([^>=""])(ftp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1$2") end if if instr(1,strContent,"rtsp://",1)>0 then re.Pattern = "^(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1") re.Pattern = "(rtsp://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$" strContent = re.Replace(strContent,"$1") re.Pattern = "([^>=""])(rtsp://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1$2") end if if instr(1,strContent,"mms://",1)>0 then re.Pattern = "^(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1") re.Pattern = "(mms://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$" strContent = re.Replace(strContent,"$1") re.Pattern = "([^>=""])(mms://[A-Za-z0-9\.\/=\?%\-&_~`@':+!]+)" strContent = re.Replace(strContent,"$1$2") end if 're.Pattern="(\[HTML\])(.+?)(\[\/HTML\])" 'strContent=re.Replace(strContent,"
以下内容为程序代码:
$2
") if instr(1,strContent,"[/color]",1)>0 then re.Pattern="(\[color=(.[^\[]*)\])(.[^\[]*)(\[\/color\])" strContent=re.Replace(strContent,"$3") end if if instr(1,strContent,"[/face]",1)>0 then re.Pattern="(\[face=(.[^\[]*)\])(.[^\[]*)(\[\/face\])" strContent=re.Replace(strContent,"$3") end if if instr(1,strContent,"[/align]",1)>0 then re.Pattern="(\[align=(.[^\[]*)\])(.[^\[]*)(\[\/align\])" strContent=re.Replace(strContent,"
$3
") end if if instr(1,strContent,"[/quote]",1)>0 then re.Pattern="(\[QUOTE\])(.[^\[]*)(\[\/QUOTE\])" strContent=re.Replace(strContent,"
$2

") end if if instr(1,strContent,"[/fly]",1)>0 then re.Pattern="(\[fly\])(.[^\[]*)(\[\/fly\])" strContent=re.Replace(strContent,"$2") end if if instr(1,strContent,"[/move]",1)>0 then re.Pattern="(\[move\])(.[^\[]*)(\[\/move\])" strContent=re.Replace(strContent,"$2") end if if instr(1,strContent,"[/glow]",1)>0 then re.Pattern="\[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/GLOW]" strContent=re.Replace(strContent,"$4
") end if if instr(1,strContent,"[/shadow]",1)>0 then re.Pattern="\[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/SHADOW]" strContent=re.Replace(strContent,"$4
") end if if instr(1,strContent,"[/i]",1)>0 then re.Pattern="(\[i\])(.[^\[]*)(\[\/i\])" strContent=re.Replace(strContent,"$2") end if if instr(1,strContent,"[/u]",1)>0 then re.Pattern="(\[u\])(.[^\[]*)(\[\/u\])" strContent=re.Replace(strContent,"$2") end if if instr(1,strContent,"[/b]",1)>0 then re.Pattern="(\[b\])(.[^\[]*)(\[\/b\])" strContent=re.Replace(strContent,"$2") end if if instr(1,strContent,"[/size]",1)>0 then re.Pattern="(\[size=1\])(.[^\[]*)(\[\/size\])" strContent=re.Replace(strContent,"$2") re.Pattern="(\[size=2\])(.[^\[]*)(\[\/size\])" strContent=re.Replace(strContent,"$2") re.Pattern="(\[size=3\])(.[^\[]*)(\[\/size\])" strContent=re.Replace(strContent,"$2") re.Pattern="(\[size=4\])(.[^\[]*)(\[\/size\])" strContent=re.Replace(strContent,"$2") end if if instr(1,strContent,"[/center]",1)>0 then re.Pattern="(\[center\])(.[^\[]*)(\[\/center\])" strContent=re.Replace(strContent,"
$2
") end if if instr(1,strContent,"[/list]",1)>0 then strContent = doCode(strContent, "[list]", "[/list]", "") strContent = doCode(strContent, "[list=1]", "[/list]", "
    ", "
") strContent = doCode(strContent, "[list=a]", "[/list]", "
    ", "
") end if if instr(1,strContent,"[/*]",1)>0 then strContent = doCode(strContent, "[*]", "[/*]", "
  • ", "
  • ") end if if instr(1,strContent,"[/code]",1)>0 then strContent = doCode(strContent, "[code]", "[/code]", "
    ", "
    ") end if set re=Nothing UBBCode=strContent end function function doCode(fString, fOTag, fCTag, fROTag, fRCTag) dim fOTagPos, fCTagPos fOTagPos = Instr(1, fString, fOTag, 1) fCTagPos = Instr(1, fString, fCTag, 1) while (fCTagPos > 0 and fOTagPos > 0) fString = replace(fString, fOTag, fROTag, 1, 1, 1) fString = replace(fString, fCTag, fRCTag, 1,1, 1) fOTagPos = Instr(1, fString, fOTag, 1) fCTagPos = Instr(1, fString, fCTag, 1) wend doCode = fString end function function funKillword(str) for i=0 to ubound(killword) str=replace(str,killword(i),"***") next funKillword=str end function %>