Ubb_cls.Asp
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:19k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <%Const MaxLoopcount=100%>
  2. <script language=vbscript runat=server>
  3. Class YxBBsubb_Cls
  4. Public UbbString,Re
  5. Private Sub Class_Initialize()
  6. End Sub
  7. Rem 入口(内容,1=帖子|2=留言公告等)
  8. Public Function Ubb(Str,PostType)
  9. If isNull(Str) or Str="" then
  10. Ubb=""
  11. Exit function
  12. End if
  13. If UbbString="" Or IsNull(UbbString) Then
  14. UbbString=YxBBs.Fun.UbbString(Str)
  15. End If
  16. If instr(UbbString,",41,")>0 And PostType=1 Then
  17. Str=YxBBs_Code(Str,PostType)
  18. Else
  19. Str=YxBBs_UBB(str,postType)
  20. End If
  21. UBB=Str
  22. End Function
  23. Private Function YxBBs_UBB(Str,PostType)
  24. If isNull(Str) or Str="" then
  25. YxBBs_UBB=""
  26. Exit function
  27. End if
  28. Str=Html_Code(Str)
  29. Set re=new RegExp
  30. re.IgnoreCase =True
  31. re.Global=True
  32. If InStr(UbbString,",0,")>0 Then
  33. re.pattern="((javascript:)|(jscript:)|(object)|(js:)|(location.)|(vbscript:)|(vbs:)|(.value)|(about:)|(file:)|(document.cookie)|(on(mouse|exit|error|click|key|load)))"
  34. str=re.replace(str,"<font color=#000000>$1</font>")
  35. End If
  36.                 If InStr(UbbString,",35,")>0 Then Str=YxBBs_Ubb_Login(Str,PostType)
  37. If InStr(UbbString,",36,")>0 Then Str=YxBBs_Ubb_Sex(Str,PostType)
  38. If InStr(UbbString,",37,")>0 Then Str=YxBBs_Ubb_Name(Str,PostType)
  39. If InStr(UbbString,",38,")>0 Then Str=YxBBs_Ubb_Date(Str,PostType)
  40. If InStr(UbbString,",39,")>0 Then Str=YxBBs_Ubb_Reply(Str,PostType)
  41. If InStr(UbbString,",40,")>0 Then Str=YxBBs_Ubb_Buy(Str,PostType)
  42. If InStr(UbbString,",24,")>0 Then Str=YxBBs_Ubb2(Str,"[img]","[/img]","<img src=$1>","",YxBBs.BBSSetting(22)) 
  43. If InStr(UbbString,",25,")>0 Then
  44. If YxBBs.BBSSetting(22)="0" Then
  45. If Not YxBBs.FoundUser and YxBBs.BBSSetting(55)="0" Then 
  46. Str=YxBBs_Ubb3(Str,"[upload=(txt|zip|rar|mdb|swf),*(#*[0-9.]*),*(#*[0-9.]*),*(#*[0-9.]*),*(#*[0-9.]*)]","[/upload]","<fieldset><legend>上传的附件</legend><br>&nbsp;&nbsp;<font color=gray>抱歉,您所在的组无权下载附件,请<a href=register.asp>注册</a>或<a href=login.asp>登陆</a>.</font><br><br></fieldset>")
  47. Str=YxBBs_Ubb2(Str,"[upload=(gif|jpg|jpeg|bmp|png),*(#*[0-9.]*),([0-9]{1,3}),*(#*[0-9.]*),*(#*[0-9.]*)]","[/upload]","<fieldset><legend>上传的图片</legend><br>&nbsp;&nbsp;<font color=gray>抱歉,您所在的组无权下载附件,请<a href=register.asp>注册</a>或<a href=login.asp>登陆</a></font></fieldset>","",YxBBs.BBSSetting(22))
  48.                 Else
  49.         Str=YxBBs_Ubb3(Str,"[upload=(txt|zip|rar|mdb|swf),*(#*[0-9.]*),*(#*[0-9.]*),*(#*[0-9.]*),*(#*[0-9.]*)]","[/upload]","<fieldset><legend>上传的附件</legend><br>&nbsp;&nbsp;<IMG SRC=INc/Editor/images/common.gif align=absmiddle> <a href=""ViewFile.Asp?FileName=$6"" TARGET=_blank>$6</a> [ <font color=blue>$2</font> KB ]<br><br></fieldset>")
  50. Str=YxBBs_Ubb2(Str,"[upload=(gif|jpg|jpeg|bmp|png),*(#*[0-9.]*),([0-9]{1,3}),*(#*[0-9.]*),*(#*[0-9.]*)]","[/upload]","<fieldset><legend>上传的图片</legend><br>&nbsp;&nbsp;<img src=INc/Editor/images/image.gif align=absmiddle> <A HREF=""ViewFile.Asp?FileName=$6"" TARGET=_blank>$6</a> [ <font color=blue>$2</font> KB <font color=blue>$4</font>×<font color=blue>$5</font> ] <font color=#999999>(缩略时请点击查看原图)</font><br><br>&nbsp;&nbsp;<IMG SRC=""ViewFile.Asp?FileName=$6"" border=0><br><br></fieldset>","<A HREF=""ViewFile.Asp?FileName=$6"" TARGET=_blank>$6</a>",YxBBs.BBSSetting(22)) 
  51. End If
  52. End If
  53. End If
  54. If InStr(UbbString,",31,")>0 Then Str=UbbCode_Q(Str)
  55. If InStr(UbbString,",32,")>0 Then Str=YxBBs_GetUBB(Str,"[coin=*([0-9]*)]","[/coin]","$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.MyCoin)
  56. If InStr(UbbString,",33,")>0 Then Str=YxBBs_GetUBB(Str,"[mark=*([0-9]*)]","[/mark]","$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.MyMark)
  57. If InStr(UbbString,",34,")>0 Then Str=YxBBs_GetUBB(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.MyGradeNum)
  58.                 re.Pattern="[cc](.*?)[/cc]"
  59.                         str= re.Replace(str,"<embed src=""http://union.bokecc.com/$1"" width=""438"" height=""387"" type=""application/x-shockwave-flash""></embed>") 
  60.                 re.Pattern="<img(.[^>]*)>"
  61. str=re.replace(str,"<img$1 onmousewheel=""return bbimg(this)"" onload=""javascript:if(this.width>screen.width-500) this.style.width=screen.width-500;"" border=0>")
  62. Set re=Nothing
  63. YxBBs_UBB=Str
  64. End function
  65. Private Function Html_Code(byval Str)
  66. If IsNull(Str) then
  67.  Html_code=""
  68. Else
  69. Str=replace(Str,chr(39),"&#39;")
  70. Str=replace(Str,chr(36),"&#36;")
  71.                         str = Replace(str, "SCRIPT", "&#115cript")
  72. Str = Replace(Str, chr(10) &chr(10), "<br><br> ")
  73.                         Html_Code = Replace(Str, chr(10), "<p></p>")
  74. End if
  75. End Function
  76. Public Function Sign_Code(byval Str)
  77. If IsNull(Str) or Str="" Then
  78. Sign_Code=""
  79. Exit Function
  80. End If
  81. Str=Html_Code(Str)
  82. Set re=new regExp
  83. re.IgnoreCase=true
  84. re.Global=true
  85. re.pattern="((javascript:)|(jscript:)|(object)|(js:)|(location.)|(vbscript:)|(vbs:)|(.value)|(about:)|(file:)|(document.cookie)|(on(mouse|exit|error|click|key|load)))"
  86. str=re.replace(str,"<font color=#000000>$1</font>")
  87. If InStr(Lcase(Str),"[/b]")>0 Then Str=YxBBs_Ubb1(Str,"[b]","[/b]","<b>$1</b>")
  88. If InStr(Lcase(Str),"[/i]")>0 Then Str=YxBBs_Ubb1(Str,"[i]","[/i]","<i>$1</i>")
  89. If InStr(Lcase(Str),"[/u]")>0 Then Str=YxBBs_Ubb1(Str,"[u]","[/u]","<u>$1</u>")
  90.                 If InStr(Lcase(Str),"[/fly]")>0 Then Str=YxBBs_Ubb1(Str,"[fly]","[/fly]","<marquee width=90% behavior=alternate scrollamount=3>$1</marquee>") 
  91.                 If InStr(Lcase(Str),"[/url]")>0 Then Str=YxBBs_Ubb1(Str,"[url=(.{5,}?)]","[/url]","<a href=""$1"" target='_blank'>$2</a>")
  92.                 If InStr(Lcase(Str),"[/color]")>0 Then Str=YxBBs_Ubb1(Str,"[color=((#.{6})|.{3,6})]","[/color]","<font color=#$1>$3</font>") 
  93. If InStr(Lcase(Str),"[/img]")>0 Then Str=YxBBs_Ubb2(Str,"[img]","[/img]","<img src=$1 border=0 onload=""javascript:if(this.width>screen.width-333)this.width=screen.width-333"" >","",YxBBs.BBSSetting(22)) 
  94. Set re=nothing
  95. Sign_Code=Str
  96. End Function
  97. Private Function UbbCode_Q(strText)
  98. Dim s
  99. Dim Test
  100. Dim LoopCount
  101. LoopCount=0
  102. s=strText
  103. re.Pattern="[QUOTE]"
  104. Test=re.Test(s)
  105. If Test Then
  106. re.Pattern="[/QUOTE]"
  107. Test=re.Test(s)
  108. If Test Then
  109. re.Pattern="[QUOTE]"
  110. s=re.replace(s, chr(1) & "QUOTE" & chr(2))
  111. re.Pattern="[/QUOTE]"
  112. s=re.replace(s, chr(1) & "/QUOTE" & chr(2))
  113. Do
  114. re.Pattern="x01QUOTEx02x01/QUOTEx02"
  115. s=re.Replace(s,"")
  116. re.Pattern="x01QUOTEx02(.[^x01]*)x01/QUOTEx02"
  117. s=re.Replace(s,"<table cellpadding=0 cellspacing=0 border=1 WIDTH='90%' style='border-collapse: collapse' bordercolor=#CCCCCC align=center><tr><td bgcolor='#f2f8ff'><p style='margin:15'>$1</p></td></tr></table><br>")
  118. Test=re.Test(s)
  119. LoopCount=LoopCount+1
  120. If LoopCount>MaxLoopCount Then Exit Do
  121. Loop While(Test)
  122. re.Pattern="x02"
  123. s=re.replace(s, "]")
  124. re.Pattern="x01"
  125. s=re.replace(s, "[")
  126. End If 
  127. End If
  128. UbbCode_Q=s
  129. End Function
  130. Private Function YxBBs_Ubb1(Str,uCodeL,uCodeR,tCode)
  131. Dim s
  132. s=str
  133. re.Pattern=uCodeL&uCodeR
  134. s=re.Replace(s,"")
  135. re.Pattern=uCodeL&"(.+?)"&uCodeR
  136. s=re.Replace(s,tCode)
  137. re.Pattern=uCodeL
  138. s=re.Replace(s,"")
  139. re.Pattern=uCodeR
  140. s=re.Replace(s,"")
  141. YxBBs_Ubb1=s
  142. End Function
  143. Private Function YxBBs_Ubb2(Str,uCodeL,uCodeR,tCode1,tCode2,BBSCheck)
  144. Dim s
  145. s=str
  146. re.Pattern=uCodeL&uCodeR
  147. s=re.Replace(s,"")
  148. re.Pattern=uCodeL&"(.+?)"&uCodeR
  149. If BBScheck="0" Then
  150. s=re.Replace(s,tCode1)
  151. Else
  152. s=re.Replace(s,tCode2)
  153. End If
  154. re.Pattern=uCodeL
  155. s=re.Replace(s,"")
  156. re.Pattern=uCodeR
  157. s=re.Replace(s,"")
  158. YxBBs_Ubb2=s
  159. End Function
  160. Private Function YxBBs_Ubb3(Str,uCodeL,uCodeR,tCode)
  161. Dim s
  162. s=str
  163. re.Pattern=uCodeL&uCodeR
  164. s=re.Replace(s,"")
  165. re.Pattern=uCodeL&"(.+?)"&uCodeR
  166. s=re.Replace(s,tCode)
  167. YxBBs_Ubb3=s
  168. End Function
  169. Private Function YxBBs_Code(Str,PostType)
  170. dim ary_String,i,n,n_pos
  171. ary_String=split(Str,"[code]")
  172. n=ubound(ary_String)
  173. If n<1 then
  174. YxBBs_Code=YxBBs_UBB(Str,PostType)
  175. Exit function
  176. End If
  177. ary_String(0)=YxBBs_UBB(ary_String(0),postType)
  178. for i=1 to n
  179. n_pos=inStr(ary_String(i),"[/code]")
  180. If n_pos>0 then
  181.                                    ary_String(i)="<table cellpadding=0 cellspacing=0 border=1 WIDTH='98%' style='border-collapse: collapse' bordercolor=#CCCCCC align=center><tr><td bgcolor='#f2f8ff'><p style='margin:15'><b>本贴相关代码:</b><br>" & left(ary_String(i),n_pos-1) & "</p></td></tr></table><br>" & YXBBS_UBB(right(ary_String(i),len(ary_String(i))-n_pos-6),PostType)
  182. Else
  183. ary_String(i)="[code]" & YxBBs_UBB(ary_String(i),PostType)
  184. End if
  185. next
  186. YxBBs_Code=join(ary_String,"")
  187. End Function
  188. Rem 入口(内容,开始的UBB,结束的UBB,显示允许,显示不允许,标记:1=帖子/2=留言公告,用户的信息)
  189. 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)
  190. Private Function YxBBs_GetUBB(Str,uCodeL,uCodeR,tCode1,tCode2,postType,MyInfo)
  191. Dim Test
  192. Dim po,ii
  193. Dim LoopCount
  194. LoopCount=0
  195. Do While True
  196. re.Pattern=uCodeL
  197. Test=re.Test(Str)
  198. If Test Then
  199. re.Pattern=uCodeR
  200. Test=re.Test(Str)
  201. If Test Then
  202. If PostType=1 Then
  203. re.Pattern="(^.*)("&uCodeL&")(.+?)("&uCodeR&")(.*)"
  204. po=re.Replace(Str,"$3")
  205. If  IsNumeric(po) Then
  206. ii=int(po) 
  207. Else
  208. ii=0
  209. End If 
  210. If YxBBs.Founduser and (Lcase(YxBBs.MyName)=Lcase(UserName) or int(MyInfo)>=int(ii) or YxBBs.ClassID<=2 or YxBBs.IsBoardAdmin) Then
  211. Str=re.Replace(str,tCode1)
  212. Else
  213. Str=re.Replace(str,tCode2)
  214. End If
  215. Else
  216. re.Pattern="("&uCodeL&")(.+?)("&uCodeR&")"
  217. s=re.Replace(s,"$3")
  218. End If 
  219. Else
  220. Exit Do
  221. End If 
  222. Else
  223. Exit Do
  224. End If
  225. LoopCount=LoopCount + 1
  226. If LoopCount>MaxLoopCount Then Exit Do
  227. Loop
  228. YxBBs_GetUBB=Str
  229. End Function
  230. Private Function YxBBs_Ubb_Login(Str,PostType)
  231. Dim Test
  232. Dim LoopCount
  233. LoopCount=0
  234. Do While True
  235. re.Pattern="[login]"
  236. Test=re.Test(Str)
  237. If Test Then
  238. re.Pattern="[/login]"
  239. Test=re.Test(Str)
  240. If Test Then
  241. re.Pattern="(^.*)([login])(.+?)([/login])(.*)"
  242. If YxBBs.FoundUser Then
  243. Str=re.Replace(str,"$1<hr height=1><font color=#A2A2A2>此帖内容<b>必须登陆</b>后才能浏览</font><BR>$3</font><hr size=1>$5")
  244. Else
  245. Str=re.Replace(str,"$1<hr height=1><font color=Red>此帖内容<b>必须<a href=login.Asp>登陆</a></b>后才能浏览<BR></font><hr size=1>$5")
  246. End if
  247. Else
  248. Exit Do
  249. End If 
  250. Else
  251. Exit Do
  252. End If
  253. LoopCount=LoopCount + 1
  254. If LoopCount>MaxLoopCount Then Exit Do
  255. Loop
  256. YxBBs_Ubb_Login=Str
  257. End Function
  258. Private Function YxBBs_Ubb_Sex(Str,PostType)
  259. Dim Test
  260. Dim LoopCount
  261. Dim Tmp_Str,po
  262. LoopCount=0
  263. Do While True
  264. re.Pattern="[sex=*([0-1]*)]"
  265. Test=re.Test(Str)
  266. If Test Then
  267. re.Pattern="[/sex]"
  268. Test=re.Test(Str)
  269. If Test Then
  270. re.Pattern="(^.*)([sex=*([0-1]*)])(.+?)([/sex])(.*)"
  271. If PostType=1 Then
  272. po=re.replace(str,"$3")
  273. If isnumeric(po) then
  274. If int(po)=0 then Tmp_Str="女"
  275. If int(po)=1 then Tmp_Str="男"
  276. If Not YxBBs.FoundUser Then
  277. 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")
  278. Else
  279. If (YxBBs.MySex And int(po)=1) or (Not YxBBs.MySex And int(po)=0) or Lcase(YxBBs.MyName)=Lcase(UserName) Then
  280. 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")
  281. Else
  282. 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")
  283. End If
  284. End If
  285. End if
  286. Else
  287. Str=re.Replace(str,"$4")
  288. End If
  289. Else
  290. Exit Do
  291. End If 
  292. Else
  293. Exit Do
  294. End If
  295. LoopCount=LoopCount + 1
  296. If LoopCount>MaxLoopCount Then Exit Do
  297. Loop
  298. YxBBs_Ubb_Sex=Str
  299. End Function
  300. Private Function YxBBs_Ubb_Name(Str,PostType)
  301. Dim Test
  302. Dim LoopCount
  303. Dim Tmp_My,tmp_str,I
  304. LoopCount=0
  305. Do While True
  306. re.Pattern="[username=(.[^[]*)]"
  307. Test=re.Test(Str)
  308. If Test Then
  309. re.Pattern="[/username]"
  310. Test=re.Test(Str)
  311. If Test Then
  312. re.Pattern="(^.*)([username=(.[^[]*)])(.+?)([/username])(.*)"
  313. If PostType=1 Then
  314. Tmp_Str=re.replace(str,"$3")
  315. Tmp_Str=split(Tmp_Str,",")
  316. Tmp_My=False
  317. For i=0 to ubound(Tmp_Str)
  318. If lcase(YxBBs.MyName)=lcase(Tmp_Str(i)) then Tmp_My=True:Exit For
  319. Next
  320. If Tmp_My or Lcase(YxBBs.MyName)=Lcase(UserName) Then
  321. Str=re.Replace(str,"$1<hr size=1><font color=#A2A2A2>此内容只有作者和 <b>$3</b> 能浏览:</font><BR>$4<hr size=1>$6")
  322. Else
  323. Str=re.Replace(str,"$1<hr size=1><font color=Red>此内容只有作者和 <b>$3</b> 能浏览:</font><BR><hr size=1>$6")
  324. End if
  325. Else
  326. Str=re.Replace(str,"$4")
  327. End If
  328. Else
  329. Exit Do
  330. End If 
  331. Else
  332. Exit Do
  333. End If
  334. LoopCount=LoopCount + 1
  335. If LoopCount>MaxLoopCount Then Exit Do
  336. Loop
  337. YxBBs_Ubb_Name=Str
  338. End Function
  339. Private Function YxBBs_Ubb_Reply(Str,PostType)
  340. Dim Test
  341. Dim LoopCount
  342. LoopCount=0
  343. Do While True
  344. re.Pattern="[reply]"
  345. Test=re.Test(Str)
  346. If Test Then
  347. re.Pattern="[/reply]"
  348. Test=re.Test(Str)
  349. If Test Then
  350. re.Pattern="(^.*)([reply])((.|n)+?)([/reply])(.*)"
  351. IF PostType=1 Then
  352. 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
  353. str=re.Replace(str,"$1<hr size=1><font color=Red>此内容只有作者和已经回复此帖的浏览者能浏览:</font><BR>$3<hr size=1>$6")
  354. Else
  355. str=re.Replace(str,"$1<hr size=1><font color=Red>此内容只有作者和已经回复此帖的浏览者能浏览:</font><BR><hr size=1>$6")
  356. End if
  357. Else
  358. str=re.Replace(str,"$3")
  359. End If
  360. Else
  361. Exit Do
  362. End If 
  363. Else
  364. Exit Do
  365. End If
  366. LoopCount=LoopCount + 1
  367. If LoopCount>MaxLoopCount Then Exit Do
  368. Loop
  369. YxBBs_Ubb_Reply=Str
  370. End Function
  371. Private Function YxBBs_Ubb_Date(Str,PostType)
  372. Dim Tmp_int,Tmp_My,tmp_str
  373. Dim Test
  374. Dim LoopCount
  375. LoopCount=0
  376. Do While True
  377. re.Pattern="[date=(.[^[]*)]"
  378. Test=re.Test(Str)
  379. If Test Then
  380. re.Pattern="[/date]"
  381. Test=re.Test(Str)
  382. If Test Then
  383. re.Pattern="(^.*)([date=(.[^[]*)])(.[^[]*)([/date])(.*)"
  384. IF PostType=1 Then
  385. Tmp_Str=re.replace(str,"$3")
  386. If IsDate(Tmp_Str) Then Tmp_Int=Datediff("d",cdate(Tmp_Str),cdate(YxBBs.NowBbsTime)) Else Tmp_Int=-1
  387. If int(Tmp_Int)>0 Then
  388. Str=re.Replace(Str,"$1<hr size=1><font color=Red>此内容只有:<b>"&Tmp_Str&"</b>这天以后才能浏览:</font><BR>$4<hr size=1>$6")
  389. Else
  390. Str=re.Replace(str,"$1<hr size=1><font color=Red>此内容只有:<b>"&Tmp_Str&"</b>这天以后才能浏览:</font><BR><hr size=1>$6")
  391. End If
  392. Else
  393. Str=re.Replace(str,"$1")
  394. End If
  395. Else
  396. Exit Do
  397. End If 
  398. Else
  399. Exit Do
  400. End If
  401. LoopCount=LoopCount + 1
  402. If LoopCount>MaxLoopCount Then Exit Do
  403. Loop
  404. YxBBs_Ubb_Date=Str
  405. End Function
  406. Private Function YxBBs_Ubb_Buy(Str,PostType)
  407. Dim Tmp_int,Tmp_My,tmp_str,i
  408. Dim Test
  409. Dim LoopCount
  410. LoopCount=0
  411. Do While True
  412. re.Pattern="[buypost=*([0-9]*)]"
  413. Test=re.Test(Str)
  414. If Test Then
  415. re.Pattern="[/buypost]"
  416. Test=re.Test(Str)
  417. If Test Then
  418. re.Pattern="(^.*)([buypost=*([0-9]*)])(.+?)([/buypost])(.*)"
  419. If PostType=1 Then
  420. If Not YxBBs.FoundUser Then
  421. Str=re.Replace(str,"$1<hr size=1><font color=Red>此内容要求金钱数达到$3以上才可以购买并浏览</font><hr noshade size=1>$6")
  422. Else
  423. Tmp_My="<Form action='VoteSubmit.Asp?Action=buy' method='Get'><input type=hidden value="&BbsID&" name='ID'><input type=hidden value="&YxBBs.TB&" name='TB'><input type=submit  value='好黑啊…我…我买了!'></form>"
  424. Tmp_Int=re.Replace(str,"$3")
  425. If isnumeric(Tmp_Int) Then Tmp_Int=int(Tmp_Int) Else Tmp_Int=0
  426. If BBSID=0 Then
  427. Tmp_Str=""
  428. Else
  429. Tmp_Str=YxBBs.execute("select Buyer From[YX_bbs"&YxBBs.TB&"] where BbsID="&BbsID&"")(0)
  430. End If
  431. If Lcase(YxBBs.MyName)=Lcase(UserName) or YxBBs.ClassID<=2 Or YxBBs.IsBoardAdmin Then
  432. Dim PostBuyUser
  433. If (not isnull(Tmp_Str)) and Tmp_Str<>"" then
  434. Tmp_Str=split(Tmp_Str,"|")
  435. PostBuyUser=""
  436. For i=0 to ubound(Tmp_Str)
  437. PostBuyUser=PostBuyUser & "<option value="&i&">"&Tmp_Str(i)&"</option>"
  438. Next
  439. PostBuyUser="<select name=buyuser size=1><option value=0>共有"&ubound(Tmp_Str)&"位用户购买</option>"&PostBuyUser & "</select>"
  440. Else
  441. PostBuyUser="<select name=buyuser size=1><option value=0>还没有用户购买</option></select>"
  442. End if
  443. If YxBBs.MyName<>UserName Then PostBuyUser=Tmp_My&PostBuyUser
  444. Str=re.Replace(str,"$1<hr size=1><font color=Red>以下为需要金钱数达到<B>$3</B>才能浏览的内容</font>&nbsp;&nbsp;"&PostBuyUser&"<BR>$4<hr size=1>$6")
  445. Else
  446. If instr("|"&Tmp_Str&"|","|"&YxBBs.MyName&"|")>0 then
  447. Str=re.Replace(str,"$1<hr noshade size=1>以下为需要花 <del><B>$3</B></del> 金钱才能购买并浏览的内容,您已经购买本帖<BR>$4<hr noshade size=1>$6")
  448. Else
  449. If Int(YxBBs.MyCoin)>Tmp_Int then
  450. str=re.Replace(str,"$1<hr size=1><font color=Red>此帖子内容需要您花 <B>$3</B> 金钱来购买浏览&nbsp;&nbsp;"&Tmp_My&"</font><hr size=1>$6")
  451. Else
  452. str=re.Replace(str,"$1<hr size=1><font color=Red>此内容要求金钱数达到 <B>$3</B> 以上才可以购买并浏览</font><hr size=1>$6")
  453. end if
  454. End if
  455. End if
  456. End if
  457. Else
  458. Str=re.Replace(str,"$4")
  459. End If
  460. Else
  461. Exit Do
  462. End If 
  463. Else
  464. Exit Do
  465. End If
  466. LoopCount=LoopCount + 1
  467. If LoopCount>MaxLoopCount Then Exit Do
  468. Loop
  469. YxBBs_Ubb_Buy=Str
  470. End Function
  471. End Class
  472. </script>