📄 ubb_cls.asp
字号:
Private Function YxBBs_Ubb3(Str,uCodeL,uCodeR,tCode)
Dim s
s=str
re.Pattern=uCodeL&uCodeR
s=re.Replace(s,"")
re.Pattern=uCodeL&"(.+?)"&uCodeR
s=re.Replace(s,tCode)
YxBBs_Ubb3=s
End Function
Private Function YxBBs_Ubb2(Str,uCodeL,uCodeR,tCode1,tCode2,BBSCheck)
Dim s
s=str
re.Pattern=uCodeL&uCodeR
s=re.Replace(s,"")
re.Pattern=uCodeL&"(.+?)"&uCodeR
If BBScheck="0" Then
s=re.Replace(s,tCode1)
Else
s=re.Replace(s,tCode2)
End If
re.Pattern=uCodeL
s=re.Replace(s,"")
re.Pattern=uCodeR
s=re.Replace(s,"")
YxBBs_Ubb2=s
End Function
Private Function YxBBs_Code(Str,PostType)
dim ary_String,i,n,n_pos
ary_String=split(Str,"[code]")
n=ubound(ary_String)
If n<1 then
YxBBs_Code=YxBBs_UBB(Str,PostType)
Exit function
End If
ary_String(0)=YxBBs_UBB(ary_String(0),postType)
for i=1 to n
n_pos=inStr(ary_String(i),"[/code]")
If n_pos>0 then
ary_String(i)="<b>以下为程序代码:</b><br><form><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td width='95%'><textarea style='border:solid 1px #EEAF71;width:100%' name='dbg' rows='10'>" & text_encode(left(ary_String(i),n_pos-1)) & "</textarea><br><input type='button' class='button' value='运行此代码' style='width:80px' onclick='runit(this.form.dbg)'> <input type='button' class='button' value='复制到剪贴板' style='width:90px' onclick='copyit(this.form.dbg)'> <input type='button' class='button' value='代码另存为' style='width:80px' onclick='saveAs(this.form.dbg)'> </td><td width='5%' valign='top'><input type='button' style='BACKGROUND: url(Images/plus.gif); width:20;height:20;border:0;cursor:hand' onclick='textarea_Size(5,this.form.dbg)' ><br><br><input type='button' style='BACKGROUND: url(Images/minus.gif); width:20;height:20;border:0;cursor:hand' onclick='textarea_Size(-5,this.form.dbg)'></td></tr></table></form>" & YXBBS_UBB(right(ary_String(i),len(ary_String(i))-n_pos-6),PostType)
Else
ary_String(i)="[code]" & YxBBs_UBB(ary_String(i),PostType)
End if
next
YxBBs_Code=join(ary_String,"")
End Function
Rem 入口(内容,开始的UBB,结束的UBB,显示允许,显示不允许,标记:1=帖子/2=留言公告,用户的信息)
Rem (Str,"\[grade=*([0-9]*)\]","\[\/grade\]","$1<hr noshade size=1><font color=gray>以下内容需要等级为 <b>$3</b> 或更高的等级以及作者才能浏览</font><BR>$4<hr noshade size=1>$6","$1<hr noshade size=1><font color=Red>以下内容需要等级为<B>$3</B>或更高的等级以及作者才可以浏览</font><hr noshade size=1>$6",PostType,YxBBs.MyGrade)
Private Function YxBBs_GetUBB(Str,uCodeL,uCodeR,tCode1,tCode2,postType,MyInfo)
Dim Test
Dim po,ii
Dim LoopCount
LoopCount=0
Do While True
re.Pattern=uCodeL
Test=re.Test(Str)
If Test Then
re.Pattern=uCodeR
Test=re.Test(Str)
If Test Then
If PostType=1 Then
re.Pattern="(^.*)("&uCodeL&")(.+?)("&uCodeR&")(.*)"
po=re.Replace(Str,"$3")
If IsNumeric(po) Then
ii=int(po)
Else
ii=0
End If
If YxBBs.Founduser and (Lcase(YxBBs.MyName)=Lcase(UserName) or int(MyInfo)>=int(ii) or YxBBs.ClassID<=2 or YxBBs.IsBoardAdmin) Then
Str=re.Replace(str,tCode1)
Else
Str=re.Replace(str,tCode2)
End If
Else
re.Pattern="("&uCodeL&")(.+?)("&uCodeR&")"
s=re.Replace(s,"$3")
End If
Else
Exit Do
End If
Else
Exit Do
End If
LoopCount=LoopCount + 1
If LoopCount>MaxLoopCount Then Exit Do
Loop
YxBBs_GetUBB=Str
End Function
Private Function YxBBs_Ubb_Login(Str,PostType)
Dim Test
Dim LoopCount
LoopCount=0
Do While True
re.Pattern="\[login\]"
Test=re.Test(Str)
If Test Then
re.Pattern="\[\/login\]"
Test=re.Test(Str)
If Test Then
re.Pattern="(^.*)(\[login\])(.+?)(\[\/login\])(.*)"
If YxBBs.FoundUser Then
Str=re.Replace(str,"$1<hr height=1><font color=#A2A2A2>此帖内容<b>必须登陆</b>后才能浏览</font><BR>$3</font><hr size=1>$5")
Else
Str=re.Replace(str,"$1<hr height=1><font color=Red>此帖内容<b>必须<a href=login.Asp>登陆</a></b>后才能浏览<BR></font><hr size=1>$5")
End if
Else
Exit Do
End If
Else
Exit Do
End If
LoopCount=LoopCount + 1
If LoopCount>MaxLoopCount Then Exit Do
Loop
YxBBs_Ubb_Login=Str
End Function
Private Function YxBBs_Ubb_Sex(Str,PostType)
Dim Test
Dim LoopCount
Dim Tmp_Str,po
LoopCount=0
Do While True
re.Pattern="\[sex=*([0-1]*)\]"
Test=re.Test(Str)
If Test Then
re.Pattern="\[\/sex\]"
Test=re.Test(Str)
If Test Then
re.Pattern="(^.*)(\[sex=*([0-1]*)\])(.+?)(\[\/sex\])(.*)"
If PostType=1 Then
po=re.replace(str,"$3")
If isnumeric(po) then
If int(po)=0 then Tmp_Str="女"
If int(po)=1 then Tmp_Str="男"
If Not YxBBs.FoundUser Then
str=re.Replace(str,"$1<hr size=1><font color=Red>此内容需要性别为<font color=red> <b>"&Tmp_Str&"</b></font> 和作者才能浏览:</font><BR><hr size=1>$6")
Else
If (YxBBs.MySex And int(po)=1) or (Not YxBBs.MySex And int(po)=0) or Lcase(YxBBs.MyName)=Lcase(UserName) Then
str=re.Replace(str,"$1<hr size=1><font color=#A2A2A2>此内容需要性别为<font color=red> <b>"&Tmp_Str&"</b></font> 和作者才能浏览:</font><BR>$4<hr size=1>$6")
Else
str=re.Replace(str,"$1<hr size=1><font color=Red>此内容需要性别为<font color=red> <b>"&Tmp_Str&"</b></font> 和作者才能浏览:</font><BR><hr size=1>$6")
End If
End If
End if
Else
Str=re.Replace(str,"$4")
End If
Else
Exit Do
End If
Else
Exit Do
End If
LoopCount=LoopCount + 1
If LoopCount>MaxLoopCount Then Exit Do
Loop
YxBBs_Ubb_Sex=Str
End Function
Private Function YxBBs_Ubb_Name(Str,PostType)
Dim Test
Dim LoopCount
Dim Tmp_My,tmp_str,I
LoopCount=0
Do While True
re.Pattern="\[username=(.[^\[]*)\]"
Test=re.Test(Str)
If Test Then
re.Pattern="\[\/username\]"
Test=re.Test(Str)
If Test Then
re.Pattern="(^.*)(\[username=(.[^\[]*)\])(.+?)(\[\/username\])(.*)"
If PostType=1 Then
Tmp_Str=re.replace(str,"$3")
Tmp_Str=split(Tmp_Str,",")
Tmp_My=False
For i=0 to ubound(Tmp_Str)
If lcase(YxBBs.MyName)=lcase(Tmp_Str(i)) then Tmp_My=True:Exit For
Next
If Tmp_My or Lcase(YxBBs.MyName)=Lcase(UserName) Then
Str=re.Replace(str,"$1<hr size=1><font color=#A2A2A2>此内容只有作者和 <b>$3</b> 能浏览:</font><BR>$4<hr size=1>$6")
Else
Str=re.Replace(str,"$1<hr size=1><font color=Red>此内容只有作者和 <b>$3</b> 能浏览:</font><BR><hr size=1>$6")
End if
Else
Str=re.Replace(str,"$4")
End If
Else
Exit Do
End If
Else
Exit Do
End If
LoopCount=LoopCount + 1
If LoopCount>MaxLoopCount Then Exit Do
Loop
YxBBs_Ubb_Name=Str
End Function
Private Function YxBBs_Ubb_Reply(Str,PostType)
Dim Test
Dim LoopCount
LoopCount=0
Do While True
re.Pattern="\[reply\]"
Test=re.Test(Str)
If Test Then
re.Pattern="\[\/reply\]"
Test=re.Test(Str)
If Test Then
re.Pattern="(^.*)(\[reply\])((.|\n)+?)(\[\/reply\])(.*)"
IF PostType=1 Then
If YxBBs.ClassID=1 or Not(YxBBs.execute("select BbsID From[YX_bbs"&YxBBs.TB&"] where ReplyTopicID="&ID&" and name='"&YxBBs.MyName&"'").eof) or Lcase(YxBBs.MyName)=Lcase(UserName) then
str=re.Replace(str,"$1<hr size=1><font color=Red>此内容只有作者和已经回复此帖的浏览者能浏览:</font><BR>$3<hr size=1>$6")
Else
str=re.Replace(str,"$1<hr size=1><font color=Red>此内容只有作者和已经回复此帖的浏览者能浏览:</font><BR><hr size=1>$6")
End if
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -