UBB

类别:Asp 点击:0 评论:0 推荐:
function ubb(vstr as string) '替换HTML标记及换行处理 vstr = server.HTMLEncode(vstr) vstr = replace(vstr,"") vstr = replace(vstr, chr(13),"") vstr = Replace(vstr, chr(32), " ") vstr = replace(vstr, chr(10) & chr(10), "

") vstr = replace(vstr, chr(10),"
") vstr = Replace(vstr, vbCrlf, "
") dim xface as integer if xface=1 then '表情转换,数值型变量xface=1时,允许转换 vstr = replace(vstr,":)","") vstr = replace(vstr,":(","") vstr = replace(vstr,":o","") vstr = replace(vstr,":D","") vstr = replace(vstr,";)","") vstr = replace(vstr,":p","") vstr = replace(vstr,":cool:","") vstr = replace(vstr,":mad:","") vstr = replace(vstr,":eek:","") vstr = replace(vstr,":?:","") end if dim objregex as RegEx '屏蔽JS等等 objregex = new regex("javascript") vstr = objregex.replace(vstr,"javascript") objregex = new regex("jscript:") vstr = objregex.replace(vstr,"jscript:") objregex = new regex("js:") vstr = objregex.replace(vstr,"js:") objregex = new regex("value") vstr = objregex.replace(vstr,"value") objregex = new regex("about:") vstr = objregex.replace(vstr,"about:") objregex = new regex("file:") vstr = objregex.replace(vstr,"file:") objregex = new regex("document.cookie") vstr = objregex.replace(vstr,"documents.cookie") objregex = new regex("vbscript:") vstr = objregex.replace(vstr,"vbscript:") objregex = new regex("vbs:") vstr = objregex.replace(vstr,"vbs:") objregex = new regex("(on(mouse|exit|error|click|key))") vstr = objregex.replace(vstr,"on$2") objregex = new regex("script") vstr = objregex.replace(vstr,"script") 'UBB转换 'url objregex = new regex("\[url\](http|https|ftp):\/\/(.[^\[]*)\[\/url\]") vstr = objregex.replace(vstr,"$1://$2") 'EMAIL objregex = new regex("\[email\](.[^\[]*)\[\/email\]") vstr = objregex.replace(vstr,"$1") 'IMG objregex = new regex("\[img\](http|https|ftp):\/\/(.[^\[]*)\[\/img\]") vstr = objregex.replace(vstr,"
screen.width-333)this.width=screen.width-333"">") '自动识别URL objregex = new regex("\[url=(http:\/\/.[^\[]*)\](.[^\[]*)(\[\/url\])") vstr = objregex.replace(vstr,"$2") objregex = new regex("^(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)") vstr = objregex.replace(vstr,"$1") objregex = new regex("(http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)$") vstr = objregex.replace(vstr,"$1") objregex = new regex("[^>=""](http://[A-Za-z0-9\./=\?%\-&_~`@':+!]+)") vstr = objregex.replace(vstr,"$1") 'COLOR objregex = new regex("\[color=(.[^\[]*)\](.[^\[]*)\[\/color\]") vstr = objregex.replace(vstr,"$2") 'u objregex = new regex("\[u\](.*)\[\/u\]") vstr = objregex.replace(vstr,"$1") 'B objregex = new regex("\[b\](.*)\[\/b\]") vstr = objregex.replace(vstr,"$1") 'I objregex = new regex("\[i\](.*)\[\/i\]") vstr = objregex.replace(vstr,"$1") 'FLY objregex = new regex("\[fly\](.*)\[\/fly\]") vstr = objregex.replace(vstr,"$1") 'SHADOW objregex = new regex("\[shadow=*(#*[a-z0-9]*),*([0-9]*)\](.[^\[]*)\[\/shadow\]") vstr = objregex.replace(vstr,"$3

本文地址:http://com.8s8s.com/it/it8716.htm