改进后的UBB套件(使用详解)

时间:2008-10-07 12:04:25  来源:第二电脑网上收集  作者:

  第二电脑网导读:/联接/加粗字体等功能,从而实现动态排版。还有一种在页面中使用UBB的目的就是屏蔽危险的HTML脚本,起到安全提交的作用。 下面这个UBB套件可以直接使用,在需要的页面引入即可。 特点:支持绝大多数页面TAG、支持重复嵌套、支持高级模式插入-自动文本识别、高级模式取色 内容:getubb.asp mycode.asp ubbpic 图片包 文件打包下载:
  正文:

UBB代码是HTML的一个变种,最初是Ultimate Bulletin Board (国外的一个BBS程序)采用的一种特殊的TAG。
您也许已经对它很熟悉了。UBB代码很简单,功能很少,但是由于其Tag语法检查实现非常容易,所以引入这种代码可以方便在文本中调用显示图片/联接/加粗字体等功能,从而实现动态排版。还有一种在页面中使用UBB的目的就是屏蔽危险的HTML脚本,起到安全提交的作用。

下面这个UBB套件可以直接使用,在需要的页面引入即可。

特点:支持绝大多数页面TAG、支持重复嵌套、支持高级模式插入-自动文本识别、高级模式取色

内容:getubb.ASP/ target=_blank class=infotextkey>asp
mycode.asp
ubbpic 图片包

文件打包下载:

上传的附件
文件类型: rar56ade0e938cc6d88d60f751316b6c764.rar (27.28 KB)



使用方法:

在添加记录的页面调用UBB/注意高亮部分
操作很简单,与表单配合使用,注意这里UBB标签是添加到名为Content的文本域中

1. 引入UBB套件
<%@LANGUAGE="vbSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
... ...
... ...
<form action="savenews.asp" method="POST" name="frmAnnounce" id="frmAnnounce"> <table>
<tr>
<td height="30">UBB 标签:</td>
<td height="30" colspan="2"><!--#include file="getubb.asp" --></td>
</tr>
<tr>
<td width="15%" rowspan="2">文章内容:</td>
<td colspan="2"><textarea name="Content" cols="63" rows="10" class="form" id="Content"></textarea></td>
</tr>
<tr>
<td width="42%" height="20" align="center" valign="top"> <input name="Submit" type="submit" class="myinput" value="提交">
<img src="../images/spacer.gif" width="8" height="8">
<input name="Reset" type="reset" class="myinput" id="Reset" value="重置">
<img src="../images/spacer.gif" width="8" height="8"> </td>
<td width="43%" align="center" valign="top"><table width="67%" height="17" border="0" cellpadding="0" cellspacing="1" class="12font">
<tr>
<td align="center"><a href=# onClick=history.go(-1)> <strong>返回</strong></a></td>
</tr>
</table></td>
</tr>
</table></form>



2. getubb.asp 内容 / 注意将图片路径改为你的实际情况

<SELECT onchange="if(this.options[this.selectedIndex].value!=''){showfont(this.options[this.selectedIndex].value);this.options[0].selected=true;}else {this.selectedIndex=0;}" name=font class="myinput">
<option value="宋体" selected>字体类型</option>
<OPTION>========</OPTION>
<option value="宋体">宋体</option>
<option value="楷体_GB2312">楷体</option>
<option value="新宋体">新宋体</option>
<option value="黑体">黑体</option>
<option value="隶书">隶书</option>
<OPTION value="Andale Mono">Andale Mono</OPTION>
<OPTION value=Arial>Arial</OPTION>
<OPTION value="Arial Black">Arial Black</OPTION>
<OPTION value="Book Antiqua">Book Antiqua</OPTION>
<OPTION value="Century Gothic">Century Gothic</OPTION>
<OPTION value="Comic Sans MS">Comic Sans MS</OPTION>
<OPTION value="Courier New">Courier New</OPTION>
<OPTION value=Georgia>Georgia</OPTION>
<OPTION value=Impact>Impact</OPTION>
<OPTION value=Tahoma>Tahoma</OPTION>
<OPTION value="Times New Roman" >Times New Roman</OPTION>
<OPTION value="Trebuchet MS">Trebuchet MS</OPTION>
<OPTION value="Script MT Bold">Script MT Bold</OPTION>
<OPTION value=Stencil>Stencil</OPTION>
<OPTION value=Verdana>Verdana</OPTION>
<OPTION value="Lucida Console">Lucida Console</OPTION>
</SELECT>
<select name="size" onChange="if(this.options[this.selectedIndex].value!=''){showsize(this.options[this.selectedIndex].value);this.options[0].selected=true;}else {this.selectedIndex=0;}" class="myinput">
<option value="3" selected>字体大小</option>
<OPTION>=====</OPTION>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
</select>
 <br>
<img onclick=Cbold() src="../dovia/ubbpic/icon_editor_bold.gif" width="22" height="22" alt="粗体" border="0">
<img onclick=Citalic() src="../dovia/ubbpic/icon_editor_italicize.gif" width="23" height="22" alt="斜体" border="0">
<img onclick=Cunder() src="../dovia/ubbpic/icon_editor_underline.gif" width="23" height="22" alt="下划线" border="0">
<img onclick=Ccenter() src="../dovia/ubbpic/icon_editor_center.gif" width="22" height="22" alt="居中" border="0">
<img onclick=Curl() src="../dovia/ubbpic/icon_editor_url.gif" width="22" height="22" alt="超级连接" border="0">
<img onclick=Cemail() src="../dovia/ubbpic/icon_editor_email.gif" width="23" height="22" alt="Email连接" border="0">
<img onclick=Cimage() src="../dovia/ubbpic/icon_editor_image.gif" width="23" height="22" alt="图片" border="0">
<img onclick=Cswf() src="../dovia/ubbpic/swf.gif" width="23" height="22" alt="Flash图片" border="0">
<img onclick=Cdir() src="../dovia/ubbpic/sk.gif" width="23" height="22" alt="Shockwave文件" border="0">
<img onclick=Crm() src="../dovia/ubbpic/rm.gif" width="23" height="22" alt="realplay视频文件" border="0">
<img onclick=Cwmv() src="../dovia/ubbpic/mp.gif" width="23" height="22" alt="Media Player视频文件" border="0">
<img onclick=Cmov() src="../dovia/ubbpic/qt.gif" width="23" height="22" alt="QuickTime视频文件" border="0">

<img onclick=Ccode() src="../dovia/ubbpic/icon_editor_quote.gif" width="23" height="22" alt="代码" border="0">
<IMG onclick=Cfly() height=22 alt=飞行字 src="../dovia/ubbpic/fly.gif" width=23 border=0>
<IMG onclick=Cmarquee() height=22 alt=移动字 src="../dovia/ubbpic/move.gif" width=23 border=0>
<IMG onclick=Cguang() height=22 alt=发光字 src="../dovia/ubbpic/glow.gif" width=23 border=0>
<IMG onclick=Cying() height=22 alt=阴影字 src="../dovia/ubbpic/shadow.gif" width=23 border=0>
<img onclick=Csound() src="../dovia/ubbpic/csound.gif" width="23" height="22" alt="背景音乐" border="0">
<br>
<SCRIPT language=JavaScript>
//Made by mat

function MM_findObj(n, d) {
 var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
  d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
 if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
 for(i=0;!x&&d.layers&&i>d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); return x;
}

function insertTag(MyString)
{
fontbegin='<font color="' + MyString + '">'
fontend='</font>'
fontchuli();
}

function fontchuli(){
if ((document.selection)&&(document.selection.type == "Text")) {
var range = document.selection.createRange();
var ch_text=range.text;
range.text = fontbegin + ch_text + fontend;
}
else {
document.frmAnnounce.Content.value=fontbegin+document.frmAnnounce.Content.value+fontend;
document.frmAnnounce.Content.focus();
}
}

var base_hexa = "0123456789ABCDEF";
function dec2Hexa(number)
{
 return base_hexa.charAt(Math.floor(number / 16)) + base_hexa.charAt(number % 16);
}

function RGB2Hexa(TR,TG,TB)
{
 return "#" + dec2Hexa(TR) + dec2Hexa(TG) + dec2Hexa(TB);
}
function lightCase(MyObject,objName)
{
 MM_findObj(objName).bgColor = MyObject.bgColor;
}

function lightCase1(MyObject,objName)
{
 MM_findObj(objName).value = MyObject.bgColor;
}

col = new Array;
col[0] = new Array(255,0,255,-1,255,-1);
col[1] = new Array(255,0,0,1,0,0);
col[2] = new Array(255,-1,255,0,0,0);
col[3] = new Array(0,0,255,0,0,1);
col[4] = new Array(0,0,255,-1,255,0);
col[5] = new Array(0,1,0,0,255,0);
col[6] = new Array(255,-1,0,0,255,-1);

function rgb(pas,w,h){
 for (j=0;j<6+1;j++){
  for (i=0;i<pas+1;i++){
   r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);
   g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);
   b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);
   codehex = r + '' + g + '' + b;
   document.write('<td bgColor="' + RGB2Hexa(r,g,b) + '" onClick="insertTag(this.bgColor);lightCase(this,/'ColorUsed/');" width="'+w+'" height="'+h+'"><IMG height='+h+' width='+w+' border=0 title="<FONT COLOR='+RGB2Hexa(r,g,b)+'>字体颜色:'+RGB2Hexa(r,g,b)+'</FONT>"></TD>/n');
  }
 }
}

function rgb1(pas,w,h){
for (j=0;j<6+1;j++){
  for (i=0;i<pas+1;i++)
 {
 r = Math.floor(col[j][0]+col[j][1]*i*(255)/pas);
 g = Math.floor(col[j][2]+col[j][3]*i*(255)/pas);
 b = Math.floor(col[j][4]+col[j][5]*i*(255)/pas);
 codehex = r + '' + g + '' + b;
 document.write('<td bgColor="' + RGB2Hexa(r,g,b) + '" onClick="lightCase(this,/'ColorHead/');lightCase1(this,/'ChenTopicColor/');" width="'+w+'" height="'+h+'"><IMG height='+h+' width='+w+' border=0 title="<FONT COLOR='+RGB2Hexa(r,g,b)+'>标题颜色:'+RGB2Hexa(r,g,b)+'</FONT>"></TD>/n');
 }}}

function search(text,caract)
{
 for(i=0;i<text.length;i++)
 {
  if (caract == text.substring(i,i+1))
  return i+1;
 }
}
</SCRIPT>
<SCRIPT language=JavaScript>
 var height1 = 10; // define the height of the color bar
 var pas = 36;   // define the number of color in the color bar
 var width1=2;
          //define the width of the color bar here (for forum with little width put 1)
</SCRIPT>
<TABLE id=ColorPanel cellSpacing=0 cellPadding=0 align=left border=0 >
 <TBODY>
 <TR><TD id=ColorUsed onclick="if(this.bgColor.length > 0) insertTag(this.bgColor)" vAlign=center align=middle><SCRIPT language=JavaScript>document.write('<IMG height='+height1+' width=20 border=1></TD>');</SCRIPT></TD><SCRIPT language=JavaScript>rgb(pas,width1,height1)</SCRIPT></TR>
 </TBODY>
</TABLE>

3. UBB套件引入后测试这个添加记录的页面,你应该看到以下类似的页面



接下来,我们要在显示(细节)页面调用UBB,使它格式化文本,起到我们需要的作用。

1. 在细节页面引入解释UBB标签的mycode.asp、并代用格式化函数,注意红色高亮部分
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!--#include file="Connections/conn.asp" -->
<!--#include file="mycode.asp" -->

... ...
... ...
<table>
<tr>
<td>
<%=DvBCode(rsnews.Fields.Item("ntColor").Value)%>
</table>
</tr>
</td>

2. mycode 内容

<%
function UBB_IMG(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[IMG]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "IMG" & chr(2))
  re.Pattern="[/IMG]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/IMG" & chr(2))
   re.Pattern="x01IMGx02(.[^x01]*)x01/IMGx02"
  
    strContent=re.Replace(strContent,"<a onfocus=this.blur() href=""$1"" target=_blank><IMG SRC=""$1"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-400)this.width=screen.width-400""></a>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_IMG=strContent
end function

function UBB_UPLOAD(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[UPLOAD=(gif|jpg|jpeg|bmp|png)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "UPLOAD=$1" & chr(2))
  re.Pattern="[/UPLOAD]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/UPLOAD" & chr(2))
   re.Pattern="x01UPLOAD=(gif|jpg|jpeg|bmp|png)x02(.[^x01]*)x01/UPLOADx02"
 
    strContent= re.Replace(strContent,"<br><IMG SRC=""../../../../images/pic/gift.gif"" border=0>此主题相关图片如下:<br><A HREF=""$2"" TARGET=_blank><IMG SRC=""$2"" border=0 alt=按此在新窗口浏览图片 onload=""javascript:if(this.width>screen.width-400)this.width=screen.width-400""></A>")
 
   re.Pattern="[UPLOAD=(.[^[]*)]"
   strContent=re.replace(strContent, chr(1) & "UPLOAD=$1" & chr(2))
   re.Pattern="x01UPLOAD=(.[^x01]*)x02(.[^x01]*)x01/UPLOADx02"
   strContent= re.Replace(strContent,"<br><IMG SRC=""../../../../images/pic/gift.gif"" border=0> <a href=""$2"">点击浏览该文件</a>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 re.Pattern="[UPLOAD=(.[^[]*)](.[^[]*)[/UPLOAD]"
    strContent= re.Replace(strContent,"<br><IMG SRC=""../../../../images/pic/gift.gif"" border=0> <a href=""$2"">点击浏览该文件</a>")
 set re=Nothing
 UBB_UPLOAD=strContent
end function

function UBB_DIR(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[DIR=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "DIR=$1,$2" & chr(2))
  re.Pattern="[/DIR]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/DIR" & chr(2))
  
    re.Pattern="x01DIR=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/DIRx02"
    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="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_DIR=strContent
end function

function UBB_QT(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[QT=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "QT=$1,$2" & chr(2))
  re.Pattern="[/QT]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/QT" & chr(2))
  
    re.Pattern="x01QT=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/QTx02"
    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="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_QT=strContent
end function

function UBB_MP(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[MP=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "MP=$1,$2" & chr(2))
  re.Pattern="[/MP]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/MP" & chr(2))
   
    re.Pattern="x01MP=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/MPx02"
    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="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_MP=strContent
end function

function UBB_RM(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[RM=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "RM=$1,$2" & chr(2))
  re.Pattern="[/RM]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/RM" & chr(2))
  
    re.Pattern="x01RM=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/RMx02"
    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="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_RM=strContent
end function

function UBB_FLASH(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[FLASH]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "FLASH" & chr(2))
  re.Pattern="[/FLASH]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FLASH" & chr(2))
  
    re.Pattern="x01FLASHx02(.[^x01]*)x01/FLASHx02"
    strContent=re.Replace(strContent,"<a href=""$1"" TARGET=_blank><IMG SRC=../../../../images/pic/music.gif border=0 alt=点击开新窗口欣赏该FLASH动画! height=16 width=16>[全屏欣赏]</a><br><OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=500 height=400><PARAM NAME=movie VALUE=""$1""><PARAM NAME=quality VALUE=high><embed src=""$1"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=500 height=400>$1</embed></OBJECT>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 re.Pattern="[FLASH=*([0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "FLASH=$1,$2" & chr(2))
  re.Pattern="[/FLASH]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FLASH" & chr(2))
 
    re.Pattern="x01FLASH=*([0-9]*),*([0-9]*)x02(.[^x01]*)x01/FLASHx02"
    strContent=re.Replace(strContent,"<a href=""$3"" TARGET=_blank><IMG SRC=../../../../images/pic/music.gif border=0 alt=点击开新窗口欣赏该FLASH动画! height=16 width=16>[全屏欣赏]</a><br><OBJECT codeBase=http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=4,0,2,0 classid=clsid:D27CDB6E-AE6D-11cf-96B8-444553540000 width=$1 height=$2><PARAM NAME=movie VALUE=""$3""><PARAM NAME=quality VALUE=high><embed src=""$3"" quality=high pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width=$1 height=$2>$3</embed></OBJECT>")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_FLASH=strContent
end function

function UBB_SOUND(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[SOUND]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "SOUND" & chr(2))
  re.Pattern="[/SOUND]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/SOUND" & chr(2))
  
    re.Pattern="x01SOUNDx02(.[^x01]*)x01/SOUNDx02"
    strContent=re.Replace(strContent,"<a href=""$1"" target=_blank><IMG SRC=../../../../images/pic/music.gif border=0 alt='背景音乐'></a><bgsound src=""$1"" loop=""-1"">")
  
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_SOUND=strContent
end function

function UBB_URL(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="<a href=""
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "URL" & chr(2))
  re.Pattern="" target=_blank>"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "URL" & chr(2))
  re.Pattern="</a>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/URL" & chr(2))
   re.Pattern="x01URLx02(.[^x01]*)x01/URLx02"
   strContent=re.Replace(strContent,"<A HREF=""$1"" TARGET=_blank>$1</A>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 re.Pattern="[URL=(.[^[]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "URL=$1" & chr(2))
  re.Pattern="[/URL]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/URL" & chr(2))
   re.Pattern="x01URL=(.[^x01]*)x02(.[^x01]*)x01/URLx02"
   strContent=re.Replace(strContent,"<A HREF=""$1"" TARGET=_blank>$2</A>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_URL=strContent
end function

function UBB_EMAIL(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="<a href="mailto:"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "EMAIL" & chr(2))
  re.Pattern="">"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "EMAIL" & chr(2))
  re.Pattern="</a>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/EMAIL" & chr(2))
   re.Pattern="x01EMAILx02(S+@.[^x01]*)x01/EMAILx02"
   strContent=re.Replace(strContent,"<img align=absmiddle src=../../../../images/pic/coffee.gif><A HREF=""mailto:$1"">$1</A>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 re.Pattern="[EMAIL=(S+@.[^[]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "EMAIL=$1" & chr(2))
  re.Pattern="[/EMAIL]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/EMAIL" & chr(2))
   re.Pattern="x01EMAIL=(S+@.[^x01]*)x02(.[^x01]*)x01/EMAILx02"
   strContent=re.Replace(strContent,"<img align=absmiddle src=../../../../images/pic/clock.gif><A HREF=""mailto:$1"" TARGET=_blank>$2</A>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_EMAIL=strContent
end function

function UBB_HTML(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[HTML]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "HTML" & chr(2))
  re.Pattern="[/HTML]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/HTML" & chr(2))
   re.Pattern="x01HTMLx02(.[^x01]*)x01/HTMLx02"
   strContent=re.Replace(strContent,"<table width='100%' border='0' cellspacing='0' cellpadding='6' class='"&abgcolor&"'><td><b>以下内容为程序代码:</b><br>$1</td></table>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_HTML=strContent
end function

function UBB_CODE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[CODE]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "CODE" & chr(2))
  re.Pattern="[/CODE]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/CODE" & chr(2))
   re.Pattern="x01CODEx02(.[^x01]*)x01/CODEx02"
   strContent=re.Replace(strContent,"<table width='95%' border='0' cellspacing='0' cellpadding='6' ><td><FIELDSET><LEGEND align=left><b><font face='Verdana, Arial, Helvetica, sans-serif'>C2club代码:</font></b></LEGEND><br><font color=#CC0000>$1</font><br><br></FIELDSET></td></table>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_CODE=strContent
end function

function UBB_COLOR(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[COLOR=(.[^[]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "COLOR=$1" & chr(2))
  re.Pattern="</font>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/COLOR" & chr(2))
   re.Pattern="x01COLOR=(.[^x01]*)x02(.[^x01]*)x01/COLORx02"
   strContent=re.Replace(strContent,"<font color=$1>$2</font>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_COLOR=strContent
end function

function UBB_FACE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[FACE=(.[^[]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "FACE=$1" & chr(2))
  re.Pattern="[/FACE]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FACE" & chr(2))
   re.Pattern="x01FACE=(.[^x01]*)x02(.[^x01]*)x01/FACEx02"
   strContent=re.Replace(strContent,"<font face=$1>$2</font>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_FACE=strContent
end function

function UBB_ALIGN(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[ALIGN=(center|left|right)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "ALIGN=$1" & chr(2))
  re.Pattern="[/ALIGN]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/ALIGN" & chr(2))
   re.Pattern="x01ALIGN=(center|left|right)x02(.[^x01]*)x01/ALIGNx02"
   strContent=re.Replace(strContent,"<div align=$1>$2</div>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_ALIGN=strContent
end function

function UBB_FLY(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[FLY]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "FLY" & chr(2))
  re.Pattern="[/FLY]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FLY" & chr(2))
   re.Pattern="x01FLYx02(.[^x01]*)x01/FLYx02"
   strContent=re.Replace(strContent,"<marquee width=90% behavior=alternate scrollamount=3>$1</marquee>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_FLY=strContent
end function

function UBB_MOVE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[MOVE]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "MOVE" & chr(2))
  re.Pattern="[/MOVE]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/MOVE" & chr(2))
   re.Pattern="x01MOVEx02(.[^x01]*)x01/MOVEx02"
   strContent=re.Replace(strContent,"<MARQUEE scrollamount=3>$1</marquee>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_MOVE=strContent
end function

function UBB_CENTER(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[CENTER]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "CENTER" & chr(2))
  re.Pattern="[/CENTER]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/CENTER" & chr(2))
   re.Pattern="x01CENTERx02(.[^x01]*)x01/CENTERx02"
   strContent=re.Replace(strContent,"<div align=center>$1</div>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_CENTER=strContent
end function

function UBB_SHADOW(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "SHADOW=$1,$2,$3" & chr(2))
  re.Pattern="[/SHADOW]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/SHADOW" & chr(2))
   re.Pattern="x01SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)x02(.[^x01]*)x01/SHADOWx02"
   strContent=re.Replace(strContent,"<table width=$1><tr><td style=""filter:shadow(color=$2, strength=$3)"">$4</td></tr></table>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_SHADOW=strContent
end function

function UBB_GLOW(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "GLOW=$1,$2,$3" & chr(2))
  re.Pattern="[/GLOW]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/GLOW" & chr(2))
   re.Pattern="x01GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)x02(.[^x01]*)x01/GLOWx02"
   strContent=re.Replace(strContent,"<table width=$1><tr><td style=""filter:glow(color=$2, strength=$3)"">$4</td></tr></table>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_GLOW=strContent
end function

function UBB_I(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[I]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "I" & chr(2))
  re.Pattern="[/I]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/I" & chr(2))
   re.Pattern="x01Ix02(.[^x01]*)x01/Ix02"
   strContent=re.Replace(strContent,"<i>$1</i>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_I=strContent
end function

function UBB_U(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[U]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "U" & chr(2))
  re.Pattern="[/U]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/U" & chr(2))
   re.Pattern="x01Ux02(.[^x01]*)x01/Ux02"
   strContent=re.Replace(strContent,"<u>$1</u>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_U=strContent
end function

function UBB_B(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[B]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "B" & chr(2))
  re.Pattern="[/B]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/B" & chr(2))
   re.Pattern="x01Bx02(.[^x01]*)x01/Bx02"
   strContent=re.Replace(strContent,"<b>$1</b>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_B=strContent
end function

function UBB_SIZE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[SIZE=([1-7])]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "SIZE=$1" & chr(2))
  re.Pattern="</font>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/SIZE" & chr(2))
   re.Pattern="x01SIZE=([1-7])x02(.[^x01]*)x01/SIZEx02"
   strContent=re.Replace(strContent,"<font size=$1>$2</font>")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_SIZE=strContent
end function

function UBB_QUOTE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[QUOTE]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "QUOTE" & chr(2))
  re.Pattern="[/QUOTE]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/QUOTE" & chr(2))
   do
    re.Pattern="x01QUOTEx02(.[^x01]*)x01/QUOTEx02"
    strContent=re.Replace(strContent,"<table style=""width:100%"" cellpadding=5 cellspacing=1 class=tableborder1><TR><TD width=""100%"">$1</td></tr></table><br>")
    Test=re.Test(strContent)
   loop while(Test)
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 UBB_QUOTE=strContent
end function

 

 

 


function REUBB_COLOR(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[COLOR=(.[^[]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "COLOR=$1" & chr(2))
  re.Pattern="</font>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/COLOR" & chr(2))
   re.Pattern="x01COLOR=(.[^x01]*)x02(.[^x01]*)x01/COLORx02"
   strContent=re.Replace(strContent,"$2")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_COLOR=strContent
end function

function REUBB_FACE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[FACE=(.[^[]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "FACE=$1" & chr(2))
  re.Pattern="[/FACE]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FACE" & chr(2))
   re.Pattern="x01FACE=(.[^x01]*)x02(.[^x01]*)x01/FACEx02"
   strContent=re.Replace(strContent,"$2")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_FACE=strContent
end function

function REUBB_ALIGN(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[ALIGN=(center|left|right)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "ALIGN=$1" & chr(2))
  re.Pattern="[/ALIGN]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/ALIGN" & chr(2))
   re.Pattern="x01ALIGN=(center|left|right)x02(.[^x01]*)x01/ALIGNx02"
   strContent=re.Replace(strContent,"$2")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_ALIGN=strContent
end function

function REUBB_FLY(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[FLY]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "FLY" & chr(2))
  re.Pattern="[/FLY]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/FLY" & chr(2))
   re.Pattern="x01FLYx02(.[^x01]*)x01/FLYx02"
   strContent=re.Replace(strContent,"$1")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_FLY=strContent
end function

function REUBB_MOVE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[MOVE]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "MOVE" & chr(2))
  re.Pattern="[/MOVE]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/MOVE" & chr(2))
   re.Pattern="x01MOVEx02(.[^x01]*)x01/MOVEx02"
   strContent=re.Replace(strContent,"$1")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_MOVE=strContent
end function

function REUBB_CENTER(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[CENTER]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "CENTER" & chr(2))
  re.Pattern="[/CENTER]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/CENTER" & chr(2))
   re.Pattern="x01CENTERx02(.[^x01]*)x01/CENTERx02"
   strContent=re.Replace(strContent,"$1")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_CENTER=strContent
end function

function REUBB_SHADOW(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "SHADOW=$1,$2,$3" & chr(2))
  re.Pattern="[/SHADOW]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/SHADOW" & chr(2))
   re.Pattern="x01SHADOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)x02(.[^x01]*)x01/SHADOWx02"
   strContent=re.Replace(strContent,"$4")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_SHADOW=strContent
end function

function REUBB_GLOW(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "GLOW=$1,$2,$3" & chr(2))
  re.Pattern="[/GLOW]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/GLOW" & chr(2))
   re.Pattern="x01GLOW=*([0-9]*),*(#*[a-z0-9]*),*([0-9]*)x02(.[^x01]*)x01/GLOWx02"
   strContent=re.Replace(strContent,"$4")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_GLOW=strContent
end function

function REUBB_I(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[I]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "I" & chr(2))
  re.Pattern="[/I]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/I" & chr(2))
   re.Pattern="x01Ix02(.[^x01]*)x01/Ix02"
   strContent=re.Replace(strContent,"$1")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_I=strContent
end function

function REUBB_U(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[U]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "U" & chr(2))
  re.Pattern="[/U]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/U" & chr(2))
   re.Pattern="x01Ux02(.[^x01]*)x01/Ux02"
   strContent=re.Replace(strContent,"$1")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_U=strContent
end function

function REUBB_B(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[B]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "B" & chr(2))
  re.Pattern="[/B]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/B" & chr(2))
   re.Pattern="x01Bx02(.[^x01]*)x01/Bx02"
   strContent=re.Replace(strContent,"$1")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_B=strContent
end function

function REUBB_SIZE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[SIZE=([1-7])]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "SIZE=$1" & chr(2))
  re.Pattern="</font>"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/SIZE" & chr(2))
   re.Pattern="x01SIZE=([1-7])x02(.[^x01]*)x01/SIZEx02"
   strContent=re.Replace(strContent,"$2")
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_SIZE=strContent
end function

function REUBB_QUOTE(strText)
 dim strContent
 dim re,Test
 
 Set re=new RegExp
 re.IgnoreCase =true
 re.Global=True
 strContent=strText
 re.Pattern="[QUOTE]"
 Test=re.Test(strContent)
 if Test then
  strContent=re.replace(strContent, chr(1) & "QUOTE" & chr(2))
  re.Pattern="[/QUOTE]"
  Test=re.Test(strContent)
  if Test then
   strContent=re.replace(strContent, chr(1) & "/QUOTE" & chr(2))
   do
    re.Pattern="x01QUOTEx02(.[^x01]*)x01/QUOTEx02"
    strContent=re.Replace(strContent,"")
    Test=re.Test(strContent)
   loop while(Test)
   re.Pattern="x02"
   strContent=re.replace(strContent, "]")
  end if
  re.Pattern="x01"
  strContent=re.replace(strContent, "[")
 end if
 set re=Nothing
 REUBB_QUOTE=strContent
end function

 


'入口参数:strContent内容
function DvBCode(strContent)
'HTML Code
strContent = dvHTMLEncode(strContent)
'UbbCode

dim re
dim po,ii
Set re=new RegExp
re.IgnoreCase =true
re.Global=True

re.Pattern="(javascript)"
strContent=re.Replace(strContent,"<I>&#106avascript</I>")
re.Pattern="(jscript:)"
strContent=re.Replace(strContent,"<I>&#106script:</I>")
re.Pattern="(js:)"
strContent=re.Replace(strContent,"<I>&#106s:</I>")
re.Pattern="(value)"
strContent=re.Replace(strContent,"<I>&#118alue</I>")
re.Pattern="(about:)"
strContent=re.Replace(strContent,"<I>about&#58</I>")
re.Pattern="(file:)"
strContent=re.Replace(strContent,"<I>file&#58</I>")
re.Pattern="(document.cookie)"
strContent=re.Replace(strContent,"<I>documents&#46cookie</I>")
re.Pattern="(vbscript:)"
strContent=re.Replace(strContent,"<I>&#118bscript:</I>")
re.Pattern="(vbs:)"
strContent=re.Replace(strContent,"<I>&#118bs:</I>")
re.Pattern="(on(mouse|exit|error|click|key))"
strContent=re.Replace(strContent,"<I>&#111n$2</I>")


'IMG Code
strContent=UBB_IMG(strContent)

'UPLOAD Code
strContent=UBB_UPLOAD(strContent)

'DIR Code
strContent=UBB_DIR(strContent)

'QT Code
strContent=UBB_QT(strContent)

'MP Code
strContent=UBB_MP(strContent)

'RM Code
strContent=UBB_RM(strContent)

'FLASH Code
strContent=UBB_FLASH(strContent)

'SOUND Code
strContent=UBB_SOUND(strContent)

'URL Code
strContent=UBB_URL(strContent)

'EMAIL Code
strContent=UBB_EMAIL(strContent)

'HTML Code
strContent=UBB_HTML(strContent)

'CODE Code
strContent=UBB_CODE(strContent)

'COLOR Code
strContent=UBB_COLOR(strContent)

'FACE Code
strContent=UBB_FACE(strContent)

'ALIGN Code
strContent=UBB_ALIGN(strContent)

'FLY Code
strContent=UBB_FLY(strContent)

'MOVE Code
strContent=UBB_MOVE(strContent)

'CENTER Code
strContent=UBB_CENTER(strContent)

'SHADOW Code
strContent=UBB_SHADOW(strContent)

'GLOW Code
strContent=UBB_GLOW(strContent)

'I Code
strContent=UBB_I(strContent)

'U Code
strContent=UBB_U(strContent)

'B Code
strContent=UBB_B(strContent)

'SIZE Code
strContent=UBB_SIZE(strContent)

'QUOTE Code
strContent=UBB_QUOTE(strContent)

 

'自动识别网址
re.Pattern = "^((http|httphotoshop/ target=_blank class=infotextkey>ps|ftp|rtsp|mms):(//|//)[A-Za-z0-9./=?%-&_~`@[]/':+!]+)"
strContent = re.Replace(strContent,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=$1>$1</a>")
re.Pattern = "((http|https|ftp|rtsp|mms):(//|//)[A-Za-z0-9./=?%-&_~`@[]/':+!]+)$"
strContent = re.Replace(strContent,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=$1>$1</a>")
re.Pattern = "([^>=""])((http|https|ftp|rtsp|mms):(//|//)[A-Za-z0-9./=?%-&_~`@[]/':+!]+)"
strContent = re.Replace(strContent,"$1<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=$2>$2</a>")

'自动识别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,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=http://$2>$2</a>")

'自动识别Email地址,如打开本功能在浏览内容很多的帖子会引起服务器停顿
're.Pattern = "([^(=)])((w)+[@]{1}((w)+[.]){1,3}(w)+)"
'strContent = re.Replace(strContent,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=""mailto:$2"">$2</a>")

 

set re=Nothing
DvBcode=strContent
end function

function DvSignCode(strContent)

 strContent = dvHTMLEncode(strContent)

 

 DvSignCode=strContent


dim re,ii,po
dim reContent,Test
Set re=new RegExp
re.IgnoreCase =true
re.Global=True

re.Pattern="(javascript)"
strContent=re.Replace(strContent,"<I>&#106avascript</I>")
re.Pattern="(jscript:)"
strContent=re.Replace(strContent,"<I>&#106script:</I>")
re.Pattern="(js:)"
strContent=re.Replace(strContent,"<I>&#106s:</I>")
re.Pattern="(value)"
strContent=re.Replace(strContent,"<I>&#118alue</I>")
re.Pattern="(about:)"
strContent=re.Replace(strContent,"<I>about&#58</I>")
re.Pattern="(file:)"
strContent=re.Replace(strContent,"<I>file&#58</I>")
re.Pattern="(document.cookie)"
strContent=re.Replace(strContent,"<I>documents&#46cookie</I>")
re.Pattern="(vbscript:)"
strContent=re.Replace(strContent,"<I>&#118bscript:</I>")
re.Pattern="(vbs:)"
strContent=re.Replace(strContent,"<I>&#118bs:</I>")
re.Pattern="(on(mouse|exit|error|click|key))"
strContent=re.Replace(strContent,"<I>&#111n$2</I>")

'IMG Code
strContent=UBB_IMG(strContent)

'FLASH Code
strContent=UBB_FLASH(strContent)

'URL Code
strContent=UBB_URL(strContent)

'EMAIL Code
strContent=UBB_EMAIL(strContent)

'COLOR Code
strContent=UBB_COLOR(strContent)

'FACE Code
strContent=UBB_FACE(strContent)

'ALIGN Code
strContent=UBB_ALIGN(strContent)

'FLY Code
strContent=UBB_FLY(strContent)

'MOVE Code
strContent=UBB_MOVE(strContent)

'CENTER Code
strContent=UBB_CENTER(strContent)

'SHADOW Code
strContent=UBB_SHADOW(strContent)

'GLOW Code
strContent=UBB_GLOW(strContent)

'I Code
strContent=UBB_I(strContent)

'U Code
strContent=UBB_U(strContent)

'B Code
strContent=UBB_B(strContent)

'SIZE Code
strContent=UBB_SIZE(strContent)

'自动识别网址
re.Pattern = "^((http|https|ftp|rtsp|mms):(//|//)[A-Za-z0-9./=?%-&_~`@[]/':+!]+)"
strContent = re.Replace(strContent,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=$1>$1</a>")
re.Pattern = "((http|https|ftp|rtsp|mms):(//|//)[A-Za-z0-9./=?%-&_~`@[]/':+!]+)$"
strContent = re.Replace(strContent,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=$1>$1</a>")
re.Pattern = "([^>=""])((http|https|ftp|rtsp|mms):(//|//)[A-Za-z0-9./=?%-&_~`@[]/':+!]+)"
strContent = re.Replace(strContent,"$1<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=$2>$2</a>")

'自动识别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,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=http://$2>$2</a>")

'自动识别Email地址
're.Pattern = "([^(=)])((w)+[@]{1}((w)+[.]){1,3}(w)+)"
'strContent = re.Replace(strContent,"<font color=""#CC0000""><strong> ◆ </strong></font><a target=_blank href=""mailto:$2"">$2</a>")


set re=Nothing
DvSignCode=strContent
end function

function reUBBCode(CurContent)
dim strContent

strContent=CurContent
strContent = dvHTMLEncode(strContent)
dim re
Set re=new RegExp
re.IgnoreCase =true
re.Global=True
strContent=replace(strContent,"&nbsp;"," ")

'COLOR Code
strContent=REUBB_COLOR(strContent)

'FACE Code
strContent=REUBB_FACE(strContent)

'ALIGN Code
strContent=REUBB_ALIGN(strContent)

'FLY Code
strContent=REUBB_FLY(strContent)

'MOVE Code
strContent=REUBB_MOVE(strContent)

'CENTER Code
strContent=REUBB_CENTER(strContent)

'SHADOW Code
strContent=REUBB_SHADOW(strContent)

'GLOW Code
strContent=REUBB_GLOW(strContent)

'I Code
strContent=REUBB_I(strContent)

'U Code
strContent=REUBB_U(strContent)

'B Code
strContent=REUBB_B(strContent)

'SIZE Code
strContent=REUBB_SIZE(strContent)

'QUOTE Code
strContent=REUBB_QUOTE(strContent)

 

set re=Nothing
reUBBCode=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="(&#)"
t=re.Replace(v,"<I>&#</I>")
re.Pattern="(javascript)"
t=re.Replace(t,"<I>&#106avascript</I>")
re.Pattern="(jscript:)"
t=re.Replace(t,"<I>&#106script:</I>")
re.Pattern="(js:)"
t=re.Replace(t,"<I>&#106s:</I>")
re.Pattern="(value)"
t=re.Replace(t,"<I>&#118alue</I>")
re.Pattern="(about:)"
t=re.Replace(t,"<I>about&#58</I>")
re.Pattern="(file:)"
t=re.Replace(t,"<I>file&#58</I>")
re.Pattern="(document.cookie)"
t=re.Replace(t,"<I>documents&#46cookie</I>")
re.Pattern="(vbscript:)"
t=re.Replace(t,"<I>&#118bscript:</I>")
re.Pattern="(vbs:)"
t=re.Replace(t,"<I>&#118bs:</I>")
re.Pattern="(on(mouse|exit|error|click|key))"
t=re.Replace(t,"<I>&#111n$2</I>")
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, "&#", "<I>&#</I>")
 
  fString = Replace(fString, CHR(32), "&nbsp;")
  fString = Replace(fString, CHR(9), "&nbsp;")
  fString = Replace(fString, CHR(34), """)
  fString = Replace(fString, CHR(39), "&#39;")
  fString = Replace(fString, CHR(13), "")
  fString = Replace(fString, CHR(10) & CHR(10), "</P><P> ")
  fString = Replace(fString, CHR(10), "<BR> ")

  dvHTMLEncode = fString
end if
end function
%>


"改进后的UBB套件(使用详解)"由第二电脑网原创提供,转载请注明:http://www.002pc.com/master/College/Programming/ASP/2008-10-07/2928.html


关键字:

关于《改进后的UBB套件(使用详解)》文章的评论

站内搜索: 高级搜索

热门搜索: Windows style 系统 tr IP QQ CPU 安装 function 注册 if td