<%
'#########################################################################
'插件编号:PLUS-B040520PA
'插件名称:BBSXP500特殊贴插件简装版
'插件介绍:
'         ==经验值可见==
'         ==回复可见==
'         ==文章数可见==
'         ==该贴回复数需达到==
'插件作者:夏都寒冰、DAYMOON、BUDDHI
'任何问题请登陆HTTP://PLUS.YUZI.NET
'##########################################################################
function UBBCode(content)
	dim check
   Set re = New RegExp
   re.IgnoreCase =True
   re.Global=True


'经验值可见
if instr(lcase(content),"[point=")>0 then
  if request.Cookies("username")=empty then
     re.Pattern="(\[point=)(\d*)(\])(.*)(\[/point\])"
  content=re.replace(content,"<font color=Teal><p align=center>此段内容为特殊内容，请先登陆</p></font>")   
  else
   re.Pattern="(.*)(\[point=)(\d*)(\])(.*)(\[/point\])(.*)"
  check=re.replace(content,"$3")   
 check=checkint(check)
		
	    if  conn.execute("select experience from [user] where username='"&HTMLencode(request.Cookies("username"))&"'")(0)>=check then
		     content=re.replace(content,"$1$5$7")   
		  else
		      content=re.replace(content,"$1[color=#ff0707][CENTER]此段内容需经验值达到"&check&"可见[/CENTER][/color]$7")      
	     end if
	end if
end if


'贴数可见
if instr(lcase(content),"[post=")>0 then
  if request.Cookies("username")=empty then
     re.Pattern="(\[post=)(\d*)(\])(.*)(\[/post\])"
  content=re.replace(content,"<font color=Teal><p align=center>此段内容为特殊内容，请先登陆</p></font>")   
  else
   re.Pattern="(.*)(\[post=)(\d*)(\])(.*)(\[/post\])(.*)"
  check=re.replace(content,"$3")   
 check=checkint(check)
		
	    if  conn.execute("select posttopic+postrevert from [user] where username='"&HTMLencode(request.Cookies("username"))&"'")(0)>=check then
		     content=re.replace(content,"$1$5$7")   
		  else
		      content=re.replace(content,"$1[color=#ff0707]<p align=center>此段内容需发贴数达到"&check&"可见</p>[/color]$7")      
	     end if
	end if
end if
'购买可见
if instr(lcase(content),"[buy=")>0 then
guy=replace(split(content,"[/guy]")(0),split(content,"[guy]")(0)&"[guy]","")
re.Pattern="(.*)(\[buy=)(\d*)(\])(.*)(\[/buy\])(.*)"
filtrate=split(content,"[/buy]")
contentT=""
contentT1=split(content,"[buy=")
contentT2=replace(content,contentT1(0)&"[buy=","")
check=split(contentT2,"]")(0)
if isnumeric(check) then
check=int(check)
if membercode>7 then
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/buy]","$1$5<br>$7") 
next
else
for i = 0 to ubound(filtrate)
contentT=contentT&re.replace(filtrate(i)&"[/buy]","$1此段内容需要支付金币"&check&"后才能浏览<br>$7") 
next
end if
content=replace(contentT,"[/buy]","")

content=re.replace(content,"")
end if
'content=re.replace(content,"<div align=right><hr width=80% noshade>授权用户:$2<div>")
end if

'回复数可见
if instr(lcase(content),"[replies=")>0 then
  if request.Cookies("username")=empty then
     re.Pattern="(\[replies=)(\d*)(\])(.*)(\[/replies\])"
  content=re.replace(content,"<font color=Teal><p align=center>此段内容为特殊内容，请先登陆</p></font>")   
  else
   re.Pattern="(.*)(\[replies=)(\d*)(\])(.*)(\[/replies\])(.*)"
  check=re.replace(content,"$3")   
 check=checkint(check)
		
	    if  rs("replies")>=check then
		     content=re.replace(content,"$1$5$7")   
		  else
		      content=re.replace(content,"$1<font color=Teal><p align=center>此段内容需回复数达到"&check&"可见</p></font>$7")      
	     end if
	end if
end if

'回复可见
if instr(lcase(content),"[replyview]")>0 then
   re.Pattern="(\[replyview\])(.*)(\[/replyview\])"
  if request.Cookies("username")=empty then
    content=re.replace(content,"<font color=Teal><p align=center>此段内容为特殊内容，请先登陆</p></font>")   
  else
  	    if  conn.execute("select count(id) from [reforum] where topicid="&int(request.QueryString("id"))&" and username='"&HTMLencode(request.Cookies("username"))&"'")(0)>0 then
		     content=re.replace(content,"$2")   
		  else
		      content=re.replace(content,"[color=#ff0707][CENTER]此段内容需回复可见[/CENTER][/color]")      
	     end if
	end if
end if


'威望一定值可见
if instr(lcase(content),"[power=")>0 then
  if request.Cookies("username")=empty then
     re.Pattern="(\[power=)(\d*)(\])(.*)(\[/power\])"
  content=re.replace(content,"<font color=Teal><p align=center>此段内容为特殊内容，请先登陆</p></font>")   
  else
   re.Pattern="(.*)(\[power=)(\d*)(\])(.*)(\[/power\])(.*)"
  check=re.replace(content,"$3")   
 check=checkint(check)
		
	    if  conn.execute("select power from [user] where username='"&HTMLencode(request.Cookies("username"))&"'")(0)>=check then
		     content=re.replace(content,"$1$5$7")   
		  else
		      content=re.replace(content,"$1[color=#009dff][CENTER]此段内容需威望值达到"&check&"可见[/CENTER][/color]$7")      
	     end if
	end if
end if

'魅力一定值可见
if instr(lcase(content),"[magicpower=")>0 then
  if request.Cookies("username")=empty then
     re.Pattern="(\[magicpower=)(\d*)(\])(.*)(\[/magicpower\])"
  content=re.replace(content,"<font color=Teal><p align=center>此段内容为特殊内容，请先登陆</p></font>")   
  else
   re.Pattern="(.*)(\[magicpower=)(\d*)(\])(.*)(\[/magicpower\])(.*)"
  check=re.replace(content,"$3")   
 check=checkint(check)
		
	    if  conn.execute("select magicpower from [user] where username='"&HTMLencode(request.Cookies("username"))&"'")(0)>=check then
		     content=re.replace(content,"$1$5$7")   
		  else
		      content=re.replace(content,"$1[color=#650065][CENTER]此段内容需魅力值达到"&check&"可见[/CENTER][/color]$7")      
	     end if
	end if
end if


'金钱一定值可见
if instr(lcase(content),"[money=")>0 then
  if request.Cookies("username")=empty then
     re.Pattern="(\[money=)(\d*)(\])(.*)(\[/money\])"
  content=re.replace(content,"<font color=Teal><p align=center>此段内容为特殊内容，请先登陆</p></font>")   
  else
   re.Pattern="(.*)(\[money=)(\d*)(\])(.*)(\[/money\])(.*)"
  check=re.replace(content,"$3")   
 check=checkint(check)
		
	    if  conn.execute("select money from [user] where username='"&HTMLencode(request.Cookies("username"))&"'")(0)>=check then
		     content=re.replace(content,"$1$5$7")   
		  else
		      content=re.replace(content,"$1[color=#0030ff][CENTER]此段内容需金钱达到"&check&"可见[/CENTER][/color]$7")      
	     end if
	end if
end if



	set re=Nothing
	UBBCode=content
end function

function checkint(check)
	if IsNumeric(check) then
		check=int(check)
	else
		check=0
	end if
	checkint=check
end function


%>


