<% Dim finalKeysToHighLite:finalKeysToHighLite = replace(CheckDelimitedFormat(replace(replace(key&"",",","|"),"\","\\"),"|"),"|","|\b") Dim hPGDEscape,hPGDEs hPGDEscape = Array("+","?","*","{","}",":","^","$","=",".","<",">","/") for each hPGDEs in hPGDEscape finalKeysToHighLite = replace(finalKeysToHighLite,hPGDEs,"\"&hPGDEs) next hPGDEscape = Array("[","]","(",")") for each hPGDEs in hPGDEscape finalKeysToHighLite = replace(finalKeysToHighLite,hPGDEs,"") next Dim finalBadWordToBan:finalBadWordToBan = replace(CheckDelimitedFormat(replace(Application(dbName&"wordFilter")&"","/",""),"|"),"|","|\b") Dim NoSmile:NoSmile = request.cookies(dbName&"ASPplayground_forum_Speed")("NoSmile") Dim ImagePrefInCookies:ImagePrefInCookies = request.cookies(dbName&"ASPplayground_forum_Speed")("NoImage") Dim NoImage:NoImage = ImagePrefInCookies Dim NoImageRes Dim NoSigImage:NoSigImage = iff(ImagePrefInCookies&"" = "1" or Application(dbName&"NoIMGinSigs")&"" = "1","1","0") function vbPGDCode2(objRegExp, byVal sbody,NoImage,NoSmile,finalKeysToHighLite,finalBadWordToBan,regexpForumDir) objRegExp.ignorecase = true ' highlight code' if not(len(finalKeysToHighLite)=0) then objRegExp.pattern = "(\b"&finalKeysToHighLite&")" 'response.write objRegExp.pattern:response.end sbody = objRegExp.Replace(sbody,"$1") End if 'Remove Bad Words' if len(finalBadWordToBan)<>0 then objRegExp.pattern = "(?:\b"&finalBadWordToBan&")" sbody = objRegExp.Replace(sbody,"****") end if objRegExp.ignorecase = false 'grab code matches and submatches' Dim matchg(), oSubMatch, oMatches, iMatch, im, proceedWithCodeTagTransformation proceedWithCodeTagTransformation = false if instr(sbody,"[code]") then proceedWithCodeTagTransformation = true iMatch = 0 objRegExp.pattern = "\[(code)\].+?\[\/\1\]" Set oMatches = objRegExp.Execute (sbody) iMatch = oMatches.Count-1 Redim matchg(iMatch) For im = 0 to iMatch oSubMatch = oMatches(im) matchg(im) = oSubMatch sbody = replace(sbody,oSubMatch,chr(1)&im&chr(1),1,1,vbBinaryCompare) next Set oMatches = nothing end if 'General Replacing Mechnism' objRegExp.pattern = "\[(\/?(?:b|i|u|s|ol|ul|hr))\]" sbody = objRegExp.replace (sbody,"<$1>") 'align if instr(sbody,"[right]") or instr(sbody,"[center]") or instr(sbody,"[left]") then objRegExp.pattern = "\[(right|center|left)\]" sbody = objRegExp.replace (sbody,"
") objRegExp.pattern = "\[\/(?:right|center|left)\]" sbody = objRegExp.replace (sbody,"
") end if 'Li and HR if instr(sbody,"[*]") then sbody = replace(sbody,"[*]","
  • ") 'quote tag if instr(sbody,"[quote]") then sbody = replace(sbody,"[quote]","
    quote:

    ") sbody = replace(sbody,"[/quote]","
    ") end if 'Font Tags Replace' Dim fontTagExists:fontTagExists = false if instr(sbody,"[size=") or instr(sbody,"[color=") then objRegExp.pattern = "\[(size|color)\=(.+?)\]" sbody = objRegExp.Replace(sbody,"") fontTagExists = true end if if instr(sbody,"[font=") then objRegExp.pattern = "\[font\=(\"\;|\')(.+?)\1\]" sbody = objRegExp.Replace(sbody,"") fontTagExists = true end if if fontTagExists then objRegExp.pattern = "\[\/(?:font|size|color)\]" sbody = objRegExp.Replace(sbody,"") end if Dim validURIChars:validURIChars = "\w\%\;\/\?\:\@\&\=\+\$\,\-\.\!\~\*\'\(\)\#" Dim validURIPrefix:validURIPrefix = "(?:ftp|https?)\:\/\/" 'Auto Linking' objRegExp.pattern = "\s(\w+\@\w+\.[a-zA-Z]{2,4})" sbody = objRegExp.Replace(sbody," $1") objRegExp.pattern = "\s("&validURIPrefix&"["&validURIChars&"]+)" sbody = objRegExp.Replace(sbody," $1") objRegExp.pattern = "\s([wW]{3}\.["&validURIChars&"]+)" sbody = objRegExp.Replace(sbody," $1") 'Link w/ w/o Name' if instr(sbody,"[link") or instr(sbody,"[url") then objRegExp.pattern = "\[(url|link)\=(\"\;|\')?("&validURIPrefix&".+?)\2\](.+?)\[\/\1\]" sbody = objRegExp.Replace(sbody,"$4") objRegExp.pattern = "\[(url|link)\=?\]("&validURIPrefix&".+?)\[\/\1\]" sbody = objRegExp.Replace(sbody,"$2") end if Dim imgStart, imgEnd : imgStart = " " 'Image Tags Replace' if instr(sbody,"[image]") or instr(sbody,"[img]") and (NoImage<>"1") then objRegExp.pattern = "\[(im(?:g|age))\]((?:https?\:\/\/).+?)\[\/\1\]" sbody = objRegExp.Replace(sbody,imgStart&"$2"&""""&imgEnd) if instr(sbody,"]local://") then objRegExp.pattern = "\[(im(?:g|age))\](?:local\:\/\/)(.+?)\[\/\1\]" sbody = objRegExp.Replace(sbody,imgStart®expForumDir&"$2"""&imgEnd) end if end if 'Smiley Faces' imgStart = imgStart®expForumDir if NoSmile <> "1" then Dim arrSmile, iSmile: arrSmile = Array("","[:)]","[:D]","[8D]","[;)]","[&:]","[:@]","[:(]","[:'(]","[>:]","[:o]","[X(]","[:-]","[8|]","[&o]") if instr(sbody,"[sm=") then objRegExp.pattern = "\[sm\=(.+?)\]" sbody = objRegExp.Replace(sbody,imgStart&"upfiles/smiley/$1"""&imgEnd) end if for iSmile = 1 to ubound(arrSmile) if instr(sbody,arrSmile(iSmile)) then sbody = replace(sbody,arrSmile(iSmile),imgStart&"image/s"&iSmile&".gif"""&imgEnd) next end if 'Finish Code Pre Tag' if proceedWithCodeTagTransformation then for im=0 to imatch sbody = replace(sbody,chr(1)&im&chr(1),replace(replace(replace(matchg(im),"[/code]",""),"[code]","
    ")," 
    ",vbcrlf),1,1,vbBinaryCompare) next Erase matchg end if vbPGDCode2 = sbody end function function PGDCodeResolution(byVal objPGDCode, byVal Body, enablePGDCode) 'generally input the SQLOuted string here' body = replace(space(1)&body, vbcrlf, "
    ") if enablePGDCode = 1 then PGDCodeResolution = vbPGDCode2(objPGDCode,body,NoImage,NoSmile,finalKeysToHighLite,finalBadWordToBan,forumdir) else PGDCodeResolution = body end if end function %>