CopyCode The Code is as follows:
<%
Dim Param, smiles 'Param is the fully available mark of the UBB label. Param = Full is fully available. Otherwise, smiles, a label with a large footprint, is not supported.
Function ubbcode (content)
Dim N, I
'On error resume next
Set Re = new Regexp
Re. ignorecase = true
Re. Global = true
Re. pattern = "\ [Code \] (\ r \ n )? ([\ S] + ?) \ [\/Code \]"
Set matches = Re. Execute (content)
Dim code ()
N = 0
If Re. Test (content) Then codeb = true
If codeb then
For each match in matches
Redim preserve code (N)
Code (n) = match. Value
N = n + 1
Next
For I = 0 to ubound (CODE)
If code (I) = "" Then exit
Content = Replace (content, code (I), "{code" & I &"}")
Next
End if
If Param = "full" then
Re. pattern = "\ [HTML \] (\ r \ n )? ([\ S] + ?) \ [\/Html \]"
Set matches = Re. Execute (content)
Dim HTML ()
N = 0
If Re. Test (content) Then htmlb = true
If htmlb then
For each match in matches
Redim preserve HTML (N)
HTML (n) = match. Value
N = n + 1
Next
For I = 0 to ubound (HTML)
If HTML (I) = "" Then exit
Content = Replace (content, HTML (I), "{html" & I &"}")
Next
End if
End if
Content = GMT (content) 'ubb
If codeb then
For I = 0 to ubound (CODE)
If code (I) = "" Then exit
Tcode=server.html encode (Code (I ))
Content = Replace (content, "{code" & I & "}", tcode)
Next
End if
'----- Process [HTML] in [Code]
Re. pattern = "\ [HTML \] (\ r \ n )? ([\ S] + ?) \ [\/Html \]"
Set matches = Re. Execute (content) 'execute search.
Dim html2 ()
N = 0
If Re. Test (content) Then html2b = true
If html2b then
For each match in matches 'iterate matches collection.
Redim preserve html2 (N)
Html2 (n) = match. Value
N = n + 1
Next
For I = 0 to ubound (html2)
If html2 (I) = "" Then exit
Content = Replace (content, html2 (I), "{html2" & I &"}")
Next
End if
If Param = "full" then
If htmlb then
For I = 0 to ubound (HTML)
If HTML (I) = "" Then exit
Thtmlw.server.html encode (HTML (I ))
Content = Replace (content, "{html" & I & "}", thtml)
Next
End if
End if
Re. pattern = "(\ [Code \]) (\ r \ n )? ([\ S] + ?) (\ [\/Code \])"
Content = Re. Replace (content, "<PRE class = codesamp> $3 </PRE> ")
If Param = "full" then
Re. pattern = "(\ [HTML \]) (\ r \ n )? ([\ S] + ?) (\ [\/Html \])"
Content = Re. replace (content, "<span> <textarea Cols = 95 rows = 12> $3 </textarea> <br> <input onclick = runcode () type = button value = run code> <input onclick = copycode () type = button value = copy code> [Ctrl + A select all tips: you can modify some code first, then press run] </span> ")
End if
If html2b then
For I = 0 to ubound (html2)
If html2 (I) = "" Then exit
Thtml2 = html2 (I)
Content = Replace (content, "{html2" & I & "}", thtml2)
Next
End if
Ubbcode = content
End Function
Function GMT (strcontent)
Strcontent = htmlfilter (strcontent)
Dim re
Set Re = new Regexp
Re. ignorecase = true
Re. Global = true
If Param = "full" then
If not smiles then' smiley face Conversion
Re. pattern = "(\ [EM (\ D {1, 2}) \])"
Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ":\)"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ":\("
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": O"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": D"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ";\)"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": P"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": Cool :"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": rolleyes :"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": Mad :"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": Eek :"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": Confused :"
'Strcontent = Re. Replace (strcontent, " ")
'Re. pattern = ": cry :"
'Strcontent = Re. Replace (strcontent, " ")
End if
Re. pattern = "(\ [img \]) (. *?) (\ [\/IMG \])"
Strcontent = Re. replace (strcontent, "<a href = $2 target = _ blank> document. body. clientWidth-300) {This. height = (document. body. clientWidth-300) * This. height/This. width; this. width = document. body. clientWidth-300} "" galleryimg = NO> </a> ")
'Re. pattern = "\ [dir = * ([0-9] *), * ([0-9] *) \] (. *?) \ [\/DIR]"
'Strcontent = Re. replace (strcontent, "<object classid = CLSID: 166b1bca-3f9c-11cf-8075-444553540000 codebase = http://download.macromedia.com/pub/shockwave/cabs/director/sw.cab#version=7,0,2,0 width = $1 Height = $2> <Param name = SRC value = $3> <embed src = $3 pluginspage = http://www.macromedia.com/shockwave/download/ width = $1 Height = $2> </embed> </Object> ")
'Re. pattern = "\ [Qt = * ([0-9] *), * ([0-9] *) \] (. *?) \ [\/Qt]"
'Strcontent = Re. replace (strcontent, "<embed src = $3 width = $1 Height = $2 autoplay = true loop = false controller = true playeveryframe = false cache = false scale = tofit bgcolor = #000000 kioskmode = false targetcache = false pluginspage = http://www.apple.com/quicktime/> ")
Re. pattern = "\ [MP = (\ D +), (\ D +) \] (. *?) \ [\/MP]"
Strcontent = Re. replace (strcontent, "<object align = middle classid = CLSID: required class = Object ID = mediaplayer width = $1 Height = $2> <Param name = showstatusbar value =-1> <Param name = playcount value = 10> <Param name = filename value = "" $3 ""> <embed type = application/X-oleobject codebase = http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701 flename = Mp src = "" $3 "" playcount = 10 width = $1 height = $2> </embed> </Object> ")
'mp3
re. pattern = "\ [MP3] (. *?) \ [\/MP3] "
strcontent = Re. replace (strcontent, " ")
Re. pattern = "\ [Rm = (\ D +), (\ D +) \] (. *?) \ [\/RM]"
Strcontent = Re. replace (strcontent, "<object classid = CLSID: CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA class = Object ID = raocx width = $1 Height = $2> <Param name = SRC value = "" $3 ""> <Param name = console value = clip1> <param name = controls value = imagewindow> <Param name = autostart value = true> </Object> <br> <object classid = CLSID: CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA Height = 32 id = video2 width = $1> <Param name = SRC value = "" $3 ""> <Param name = autostart value =-1> <Param name = controls value = controlpanel> <Param name = console value = clip1> </Object> ")
Re. pattern = "(\ [Flash \]) (. *?) (\ [\/Flash \])"
Strcontent = Re. replace (strcontent, "<object codebase = http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid = CLSID: d27CDB6E-AE6D-11cf-96B8-444553540000 width = 500 Height = 400> <Param name = movie value = "" $2 ""> <Param name = Quality value = high> <embed src = "" $2" "Quality = high pluginspage = 'HTTP: // www.macromedia.com/go/getflashplayer' type = 'application/X-Shockwave-flash' width = 500 Height = 400> $2 </embed> </Object> ")
Re. pattern = "(\ [Flash = (\ D +), (\ D +) \]) (. *?) (\ [\/Flash \])"
Strcontent = Re. replace (strcontent, "<object codebase = http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0 classid = CLSID: d27CDB6E-AE6D-11cf-96B8-444553540000 width = $2 Height = $3> <Param name = movie value = "" $4 ""> <Param name = Quality value = high> <Param name = menu value = false> <embed src = "" $4 "" Quality = high menu = false pluginspage = 'HTTP: // www.macromedia.com/go/getflashplayer' type = 'application/X-Shockwave-flash' width = $2 Height = $3> $4 </embed> </Object> ")
'Cyclic conversion quote
Re. pattern = "(\ [quote \]) (. *?) (\ [\/Quote \])"
While re. Test (strcontent)
Strcontent = Re. replace (strcontent, "<BLOCKQUOTE> reference: <HR class = bordercolor> <span> $2 </span> <HR class = bordercolor> </BLOCKQUOTE> ")
Wend
Re. pattern = "(\ [w \]) (. *?) (\ [\/W \])"
Strcontent = Re. replace (strcontent, "<IFRAME frameborder = 1 align = center width = 100% Height = 400 scrolling = Yes src = $2> </iframe> <br> page: <a href = $2 target = _ blank> click here to visit </a> ")
End if 'large space tag
Re. pattern = "(\ [Attachment = (.*?) \]) (. *?) (\ [\/Attachment \])"
Strcontent = Re. replace (strcontent, "<p> <a href =" "$2" "target = _ blank Title =" "tip: "& CHR (13) &" you can right-click Save As to download the file to your local machine ""> $3 </a> <p> ")
Re. pattern = "(\ [url \]) (. *?) (\ [\/URL \])"
Strcontent = Re. Replace (strcontent, "<a href =" "$2" "target = _ blank> $2 </a> ")
Re. pattern = "(\ [url = (HTTP | HTTPS | FTP | RTSP | MMS )(:\/\/)(.*?) \]) (. *?) (\ [\/URL \])"
Strcontent = Re. Replace (strcontent, "<a href =" "$2 $3 $4" "target = _ blank >$ 5 </a> ")
Re. pattern = "(\ [email \]) (. *?) (\ [\/Email \])"
Strcontent = Re. Replace (strcontent, "<a href =" "mailto: $2" "> $2 </a> ")
Re. pattern = "(\ [email = (.*?) \]) (. *?) (\ [\/Email \])"
Strcontent = Re. Replace (strcontent, "<a href =" "mailto: $2" "target = _ blank> $3 </a> ")
Re. pattern = "(^ | \ s | <br> | <p>) (HTTP | HTTPS | FTP | RTSP | MMS) (: \/) (\ s +)"
Strcontent = Re. Replace (strcontent, "$1 <a target = _ blank href = $2 $3 $4 >4 4 </a> ")
Re. pattern = "(^ | \ s | <br> | <p>) (www.) (\ s + )"
Strcontent = Re. Replace (strcontent, "$1 <a target = _ blank href = http: // $2 $3> $2 $3 </a> ")
'Text Effect
Re. pattern = "(\ [list \]) (. + ?) (\ [\/List \])"
Strcontent = Re. Replace (strcontent, "<ul type = square> $2 </ul> ")
Re. pattern = "(\ [list =) (a | 1) (\]) (. + ?) (\ [\/List \])"
Strcontent = Re. Replace (strcontent, "<ol type = $2> $4 </OL> ")
Re. pattern = "(\ [\ * \])"
Strcontent = Re. Replace (strcontent, "<li> ")
Re. pattern = "(\ [color = (.*?) \]) (. *?) (\ [\/Color \])"
Strcontent = Re. Replace (strcontent, "<font color = $2> $3 </font> ")
Re. pattern = "(\ [# (. {6 }?) \]) (. *?) (\ [\/# \])"
Strcontent = Re. Replace (strcontent, "<font color = # $2> $3 </font> ")
Re. pattern = "(\ [font = (.*?) \]) (. *?) (\ [\/Font \])"
Strcontent = Re. Replace (strcontent, "<font face = $2> $3 </font> ")
Re. pattern = "(\ [align = (left | center | right) \]) (. *?) (\ [\/Align \])"
Strcontent = Re. Replace (strcontent, "<Div align = $2> $3 </div> ")
re. pattern = "(\ [fly \]) (. *?) (\ [\/Fly \]) "
strcontent = Re. replace (strcontent, " $2 ")
re. pattern = "(\ [move \]) (. *?) (\ [\/Move \]) "
strcontent = Re. replace (strcontent, " $2 ")
re. pattern = "\ [glow = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *) \] (. *?) \ [\/Glow] "
strcontent = Re. replace (strcontent, "
")
re. pattern = "\ [shadow = * ([0-9] *), * (# * [a-z0-9] *), * ([0-9] *) \] (. *?) \ [\/Shadow] "
strcontent = Re. replace (strcontent, "
")
Re. pattern = "(\ [I \]) (. *?) (\ [\/I \])"
Strcontent = Re. Replace (strcontent, "<I >2 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 = "(\ [sup \]) (. *?) (\ [\/Sup \])"
Strcontent = Re. Replace (strcontent, "<sup> $2 </sup> ")
Re. pattern = "(\ [sub \]) (. *?) (\ [\/SUB \])"
Strcontent = Re. Replace (strcontent, "<sub> $2 </sub> ")
Re. pattern = "\ [size = ([+ |-]? [0-7]) \] (. *?) (\ [\/Size \])"
Strcontent = Re. Replace (strcontent, "<font size = $1> $2 </font> ")
Re. pattern = "(\ [center \]) (. *?) (\ [\/Center \])"
Strcontent = Re. Replace (strcontent, "<center> $2 </center> ")
Set Re = nothing
GMT = strcontent
End Function
Rem filters HTML code
Function htmlfilter (fstring)
If not isnull (fstring) then
Fstring=server.html encode (fstring)
Fstring = Replace (fstring, CHR (9), "") 'tab
'Fstring = Replace (fstring, CHR (34 ),""")'"
'Fstring = Replace (fstring, CHR (39 ),"'")''
Fstring = Replace (fstring, CHR (13), "") 'Carriage return is a 13 + 10
Fstring = Replace (fstring, CHR (10) & CHR (10), "<p> ")'
Fstring = Replace (fstring, CHR (10), "<br> ")
'Fstring = Replace (fstring, CHR (32), "") 'space
Htmlfilter = fstring
End if
End Function
%>
<%
Function isemail (strng)
Isemail = false
Dim RegEx, match 'create variables.
Set RegEx = new Regexp 'create a regular expression object (stupid, huh ?)
RegEx. pattern = "^ \ W + (-\ W +) | (\. \ W +) * \ @ [A-Za-z0-9] + ((\. |-) [A-Za-z0-9] + )*\. [A-Za-z0-9] + $ "'sets pattern.
RegEx. ignorecase = true' set case insensiti.pdf.
Set match = RegEx. Execute (strng) 'execute search.
If match. Count then isemail = true
End Function
%>