ASP General UBB Code conversion Program

Source: Internet
Author: User
Tags chr ftp


<%
Const imagepath= "images/"
function Ubbcode (strcontent)
strcontent= filterjs (strcontent)
Dim Re
Dim Po,ii
Dim Recontent
Set Re=new RegExp
Re. IgnoreCase =true
Re. Global=true
po=0
ii=0
 
Re. Pattern= "[IMG] (HTTP|HTTPS|FTP):///(. [ ^[]*) [/img] '
Strcontent=re. Replace (strcontent, "<a Onfocus=this.blur () href=" "$1://$2" "Target=_blank>screen.width-333) this.width=screen.width-333 "></a>")
Re. Pattern= "[Upload= (Gif|jpg|jpeg|bmp|png)] (. [ ^[]*) (gif|jpg|jpeg|bmp|png) [/upload] "
strcontent= re. Replace (strcontent, "<br> this topic related to the following pictures: <br><a href= "" $2$1 "" Target=_blank> screen.width-333) this.width=screen.width-333 "></A>")

Re. Pattern= "[Upload= (. [ ^[]*)](. [^[]*) [/upload] "
Strcontent= Re. Replace (strcontent, "<br> <a href= "" $ "> Click to browse the file </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=* ([0-9]*), * ([0-9]*)] (. [ ^[]*) [/MP] "
Strcontent=re. Replace (strcontent, "<object align=middle classid=clsid:22d6f312-b0f6-11d0-94ab-0080c74c7e95 Class=OBJECT id= MediaPlayer width=$1 height=$2 ><param name=showstatusbar value=-1><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 width=$1 height=$2></embed></object> ")
Re. Pattern= "[Rm=* ([0-9]*), * ([0-9]*)] (. [ ^[]*) [/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 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 AUTOSTART value=-1><param name=controls Value=controlpanel><param name=console VALUE=Clip1></ Object> ")

Re. Pattern= "([FLASH]) (. [ ^[]*) ([/flash]) "
Strcontent= re. Replace (strcontent, "<a href=" "$" "Target=_blank>[Full Screen appreciation]</a><br><object codebase=http://download.macromedia.com/pub/shockwave /cabs/flash/swflash.cab#version=5,0,0,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=500 height=400 ><param Name=movie value= "" $ "" ><param name=quality value=high><embed src= "" $ "" Quality=high Pluginspage= ' http://www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash ' type= ' Application/x-shockwave-flash ' width=500 height=400>$2</embed>< /object> ")

Re. Pattern= "([flash=* ([0-9]*), * ([0-9]*)]) (. [ ^[]*) ([/flash]) "
Strcontent= re. Replace (strcontent, "<a href=" "$" "Target=_blank>[Full Screen appreciation]</a><br><object codebase=http://download.macromedia.com/pub/shockwave /cabs/flash/swflash.cab#version=5,0,0,0 classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000 width=$2 height=$3> <param Name=movie value= "" $ "" ><param name=quality value=high><embed src= "" $ "" Quality=high Pluginspage= ' http://www.macromedia.com/shockwave/download/index.cgi? P1_prod_version=shockwaveflash ' type= ' Application/x-shockwave-flash ' width=$2 height=$3>$4</embed></ Object> ")

Re. Pattern= "([URL]) (. [ ^[]*) ([/url]) "
Strcontent= Re. Replace (strcontent, "<a href=" "$" "target=_blank>$2</a>")
Re. Pattern= "([Url= (. [ ^[]*)])(. [^[]*) ([/URL]) "
Strcontent= Re. Replace (strcontent, "<a href=" "$" "target=_blank>$3</a>")

Re. Pattern= "([EMAIL]) (s+@.[ ^[]*) ([/email]) "
Strcontent= Re. Replace (strcontent, "<a href=" "mailto:$2" ">$2" </A> ")
Re. Pattern= "([Email= (s+@.[ ^[]*)])(. [^[]*) ([/email]) "
Strcontent= Re. Replace (strcontent, "<a href=" "Mailto:$2" "TARGET =_blank>$3</a> ")

Automatically identify URLs
' re. Pattern = "^ ((http|https|ftp|rtsp|mms):(//|\\) [a-za-z0-9./=?%-&_~ ' @ ': +!] +) "
' strcontent = Re. Replace (strcontent, "<a Target=_blank ")
' re. Pattern = "((HTTP|HTTPS|FTP|RTSP|MMS):(//|\\) [a-za-z0-9./=?%-&_~ ' @ ': +!] +) $ "
' strcontent = Re." Replace (strcontent, "<a Target=_blank ")
' re. Pattern = "([^>="]) ((HTTP|HTTPS|FTP|RTSP|MMS):(//|\\) [a-za-z0-9./=?%-&_~ ' @ ': +!] +) "
' strcontent = Re. Replace (strcontent, "$1<a Target=_blank > ")

' Automatic identification of Web sites at the beginning of www
' Re. Pattern = "([^ (http://|http:\)])" (WWW|CN) [.] (w) +[.] {1,} (NET|COM|CN|ORG|CC) (((/[~]*|\[~]*) (w) +) | [.] (w) +) * (([?] (w) +) {1}[=]*)) * ((W) +) {1} ([+] (W) +[=] (w) +) *) *) "
' Strcontent = Re. Replace (strcontent, "<a Target=_blank </a> ")

' Automatic identification of email addresses, such as opening this feature in the browsing content of a lot of posts will cause the server to pause
' Re. Pattern = "([^ (=)]) ((w) +[@]{1} ((W) +[.]) {1,3} (w) +) "
' Strcontent = Re. Replace (strcontent, "<a target=_blank href=" "Mailto:$2" ">$ 2</a> ")

Re. Pattern= "[Em (. [ ^[]*)]"
Strcontent=re. Replace (strcontent, "

Re. Pattern= "[HTML] (. [ ^[]*) [/html] "
Strcontent=re. Replace (strcontent, "<table width= ' 100% ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 6 ' class=tableborder1><td ><b> below for program code:</b><br>$1</td></table> ")
Re. Pattern= "[Code] (. [ ^[]*) [/code] "
Strcontent=re. Replace (strcontent, "<table width= ' 100% ' border= ' 0 ' cellspacing= ' 0 ' cellpadding= ' 6 ' class=tableborder1><td ><b> below for program code:</b><br>$1</td></table> ")

Re. Pattern= "[Color= (. [ ^[]*)](. [^[]*) [/color] "
Strcontent=re. Replace (strcontent, "<font color=$1>$2</font>")
Re. Pattern= "[Face= (. [ ^[]*)](. [^[]*) [/face] "
Strcontent=re. Replace (strcontent, "<font face=$1>$2</font>")
Re. Pattern= "[Align= (Center|left|right)] (. *) [/align]"
Strcontent=re. Replace (strcontent, "<div align=$1>$2</div>")

Re. Pattern= "[QUOTE] (. *) [/quote]"
Strcontent=re. Replace (strcontent, "<table style=" "width:80%" "Cellpadding=5 cellspacing=1 class=tableborder1><tr>< TD class=tableborder1>$1</td></tr></table><br> ")
Re. Pattern= "[Fly] (. *) [/fly]"
Strcontent=re. Replace (strcontent, "<marquee width=90% behavior=alternate scrollamount=3>$1</marquee>")
Re. Pattern= "[Move] (. *) [/move]"
Strcontent=re. Replace (strcontent, "<marquee scrollamount=3>$1</marquee>")  
Re. Pattern= "[Glow=* ([0-9]*), * (#*[a-z0-9]*), * ([0-9]*)] (. [ ^[]*) [/glow] '
Strcontent=re. Replace (strcontent, "<table width=$1 style=" "Filter:glow (color=$2, strength=$3)" ">$4</table>")
Re. Pattern= "[Shadow=* ([0-9]*), * (#*[a-z0-9]*), * ([0-9]*)] (. [ ^[]*) [/shadow] '
Strcontent=re. Replace (strcontent, "<table width=$1 style=" "Filter:shadow (color=$2, strength=$3)" ">$4</table>")

Re. Pattern= "[i] (. [ ^[]*) [/i] '
Strcontent=re. Replace (strcontent, "<i>$1</i>")
Re. Pattern= "[u] (. [ ^[]*) ([/u])
Strcontent=re. Replace (strcontent, "<u>$1</u>")
Re. Pattern= "[b] (. [ ^[]*) ([/b]) "
Strcontent=re. Replace (strcontent, "<b>$1</b>")
Re. Pattern= "[Size= ([1-4])]] (. [ ^[]*) [/size] '
Strcontent=re. Replace (strcontent, "<font size=$1>$2</font>")
Strcontent=replace (strcontent, "<I></I> "," ")
Set re=nothing
ubbcode=strcontent
End Function

Function Filterjs (v)
If not IsNull (v) then
Dim T
Dim Re
Dim recontent
Set Re=new RegExp
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "(JavaScript)"
T=re. Replace (V, "& #106avascript")
Re. pattern= "(JScript:)"
T=re. Replace (t, "& #106script:")
Re. Pattern= "(js:)"
T=re. Replace (t, "& #106s:")
Re. Pattern= "(value)"
T=re. Replace (t, "& #118alue")
Re. Pattern= "(about:)"
T=re. Replace (t, "about& #58")
Re. Pattern= "(File:)"
T=re. Replace (t, "file& #58")
Re. Pattern= "(document.cookie)"
T=re. Replace (t, "documents& #46cookie")
Re. Pattern= "(VBScript:)"
T=re. Replace (t, "& #118bscript:")
Re. Pattern= "(VBS:)"
T=re. Replace (t, "& #118bs:")
Re. Pattern= "(On (Mouse|exit|error|click|key))"
T=re. Replace (t, "& #111n $")
Re. Pattern= "(&#)"
T=re. Replace (T, "&#")
filterjs=t
Set re=nothing
End If
End Function

function Dvhtmlencode (fstring)
If not IsNull (fstring) Then
fstring = replace (fstring, ">", "&gt;")
fstring = replace (fstring, "<", "&lt;")

fstring = Replace (fstring, CHR (), "&nbsp;")
fstring = Replace (fstring, CHR (9), "&nbsp;")
fstring = Replace (fstring, CHR (), "&quot;")
fstring = Replace (fstring, CHR (), "& #39;")
fstring = Replace (fstring, CHR (13), "")
fstring = Replace (fstring, CHR (a) & CHR (a), "</P><P>")
fstring = Replace (fstring, CHR (), "<BR>")

Dvhtmlencode = fstring
End If
End Function

function nohtml (str)
Dim re
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "(<.[ ^<]*>) "
Str=re.replace (str, "")
Re. Pattern= "(</[^<]*>)"
Str=re.replace (str, "")
Nohtml=str
Set re=nothing
End Function

%>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.