<!--#include file="conn.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/dv_clsother.asp"-->
<!--#include file="inc/dv_ubbcode.asp"-->
<%
Dim totalusetable,AnnounceID,ReplyID
Dim MyPost,UserName
Dim postbuyuser,bgcolor
Dvbbs.Loadtemplates("post")
Set MyPost = New Dvbbs_Post
Dvbbs.Stats = MyPost.ActionName
Dvbbs.Nav()
Dvbbs.Head_var 1,Dvbbs.Board_Data(4,0),"",""
Dim dv_ubb,abgcolor
Dim EmotPath
EmotPath=Split(Dvbbs.Forum_emot,"|||")(0)		'em心情路径
GetBoardPermission
Set dv_ubb=new Dvbbs_UbbCode
MyPost.Show_Post_Body
Set MyPost = Nothing
Dvbbs.ActiveOnline
Dvbbs.Footer

Class Dvbbs_Post
	Public Action,ActionName,Star,Page,IsAudit,ToAction
	Private ParentID,RootID,Topic,Content,char_changed,signflag,mailflag,iLayer,iOrders
	Private TopTopic,IsTop,LastPost,LastPost_1,UpLoadPic_n,ihaveupfile,smsuserlist,upfileinfo
	Private UserPassWord,UserPost,GroupID,UserClass,DateAndTime,DateTimeStr,Expression,MyLastPostTime,LastPostTimes
	Private LockTopic,MyLockTopic,MyIsTop,MyIsTopAll,MyTopicMode
	Private CanLockTopic,CanTopTopic,CanTopTopic_a,CanEditPost,Rs,SQL,i
	Private vote,votetype,votenum,votetimeout,voteid,isvote
	Private Sub Class_Initialize()
		Action = Request("Action")
		TotalUseTable = Dvbbs.NowUseBBS
		Select Case Action
		Case "new"
			Action = 1
			ActionName = template.Strings(0)
			ToAction = "SavePost.asp?Action=snew&boardid="&Dvbbs.BoardID
			If Dvbbs.GroupSetting(3)="0" Then Dvbbs.AddErrCode(70)
		Case "re"
			Action = 2
			ActionName = template.Strings(2)
			ToAction = "SavePost.asp?Action=sre&method=Topic&boardid="&Dvbbs.BoardID
			If Dvbbs.GroupSetting(5)="0" then Dvbbs.AddErrCode(71)
		Case "vote"
			Action = 3
			ActionName = template.Strings(4)
			ToAction = "SavePost.asp?Action=svote&boardid="&Dvbbs.BoardID
			If Dvbbs.GroupSetting(8)="0" then Dvbbs.AddErrCode(56)
		Case "edit"
			Action = 4
			ActionName = template.Strings(6)
			ToAction = "SavePost.asp?Action=sedit&boardid="&Dvbbs.BoardID
		Case Else
			Action = 1
			ActionName = template.Strings(0)
		End Select
		Star = Request("star")
		If Star = "" Or Not IsNumeric(Star) Then Star = 1
		Star = Clng(Star)
		Page = Request("page")
		If Page = "" Or Not IsNumeric(Page) Then Page = 1
		Page = Clng(Page)
		IsAudit = Cint(Dvbbs.Board_Setting(3))
	End Sub

	'发贴、回帖、投票和编辑主体部分
	Public Function Show_Post_Body()
		Chk_Post()
		Dim TempStr,TempArray,TempStr1,TempStr2,PostType
		signflag=1
		mailflag=0
		If Dvbbs.UserID = 0 Then Dvbbs.AddErrCode(6)
		Dvbbs.ShowErr()
		TempStr = template.html(0)
		TempArray = Split(template.html(6),"||")
		If IsAudit = 1 Then TempStr = Replace(TempStr,"{$auditinfo}",template.Strings(9))
		TempStr = Replace(TempStr,"{$auditinfo}","")
		Select Case Action
		Case 1
			TempStr = Replace(TempStr,"{$topicmode}",TopicMode(TempArray(4)))
		Case 2
			Dim retopicloop
			retopicloop = Get_Re_TopicInfo
			TempStr = Replace(TempStr,"{$retopicloop}",retopicloop)
			TempStr = Replace(TempStr,"{$content}",Content)
			TempStr = Replace(TempStr,"{$retitle}",Topic)
			TempStr = Replace(TempStr,"{$rehiddeninput}",Re_HiddenInput())
			TempStr = Replace(TempStr,"{$reinfo1}",TempArray(0))
			TempStr = Replace(TempStr,"{$topicmode}","")
		Case 3
			TempStr1 = template.html(1)
			TempStr1 = Replace(TempStr1,"{$votelimited}",Dvbbs.Board_Setting(32))
			TempStr1 = Replace(TempStr1,"{$posttimesel}",TempArray(2))
			TempStr = Replace(TempStr,"{$voteinfo}",TempStr1)
			TempStr = Replace(TempStr,"{$topicmode}",TopicMode(TempArray(4)))
		Case 4
			Get_Edit_TopicInfo()
			TempStr = Replace(TempStr,"{$topic}",Topic)
			TempStr = Replace(TempStr,"{$content}",Content)
			TempStr = Replace(TempStr,"{$edithiddeninput}",Edit_HiddenInput())
			TempStr = Replace(TempStr,"{$topicmode}","")
		End Select

		If signflag=1 Then TempStr = Replace(TempStr,"{$checkbox1}","checked")
		TempStr = Replace(TempStr,"{$checkbox1}","")
		Select Case mailflag
		Case 0
			TempStr = Replace(TempStr,"{$checkbox2}","checked")
		Case 1
			TempStr = Replace(TempStr,"{$checkbox3}","checked")
		Case 2
			TempStr = Replace(TempStr,"{$checkbox4}","checked")
		Case 3
			TempStr = Replace(TempStr,"{$checkbox5}","checked")
		Case Else
			TempStr = Replace(TempStr,"{$checkbox2}","checked")
		End Select
		TempStr = Replace(TempStr,"{$checkbox2}","")
		TempStr = Replace(TempStr,"{$checkbox3}","")
		TempStr = Replace(TempStr,"{$checkbox4}","")
		TempStr = Replace(TempStr,"{$checkbox5}","")
		If Dvbbs.GroupSetting(51)="1" And (Action=1 Or Action=3) Then TempStr = Replace(TempStr,"{$useraction}",TempArray(3))

		TempStr = Replace(TempStr,"{$rehiddeninput}","")
		TempStr = Replace(TempStr,"{$reinfo1}","")
		TempStr = Replace(TempStr,"{$edithiddeninput}","")
		TempStr = Replace(TempStr,"{$voteinfo}","")
		TempStr = Replace(TempStr,"{$useraction}","")
		TempStr = Replace(TempStr,"{$retopicloop}","")
		TempStr = Replace(TempStr,"{$content}","")
		TempStr = Replace(TempStr,"{$retitle}","")
		TempStr = Replace(TempStr,"{$topic}","")
		'话题
		TempStr1 = Split(template.Strings(8),",")
		For i = 0 To Ubound(TempStr1)
			TempStr2 = TempStr2 & "<option value="&TempStr1(i)&">"&TempStr1(i)&"</option>"
		Next
		TempStr = Replace(TempStr,"{$topictype}",TempStr2)
		'特殊标题
		If Dvbbs.GroupSetting(51)="1" Then TempStr = Replace(TempStr,"{$topicstatsinfo}",TempArray(1))
		TempStr = Replace(TempStr,"{$topicstatsinfo}","")
		'头像
		TempStr = Replace(TempStr,"{$Forum_PostFace}",Dvbbs.Forum_PostFace)
		'上传
		If Dvbbs.GroupSetting(7)="1" Or Dvbbs.GroupSetting(7)="2" Then TempStr = Replace(TempStr,"{$uploadinfo}",Temp_FileUpload)
		TempStr = Replace(TempStr,"{$uploadinfo}","")
		'标签判断部分
		TempStr = Replace(TempStr,"{$ihtml}",Dvbbs.Board_Setting(5))
		TempStr = Replace(TempStr,"{$iubb}",Dvbbs.Board_Setting(6))
		TempStr = Replace(TempStr,"{$iimg}",Dvbbs.Board_Setting(7))
		TempStr = Replace(TempStr,"{$iflash}",Dvbbs.Board_Setting(44))
		TempStr = Replace(TempStr,"{$imidea}",Dvbbs.Board_Setting(9))
		TempStr = Replace(TempStr,"{$iemot}",Dvbbs.Board_Setting(8))
		TempStr = Replace(TempStr,"{$iupload}",Dvbbs.GroupSetting(7))
		TempStr = Replace(TempStr,"{$bodylimited}",Dvbbs.Board_Setting(16))
		TempStr = Replace(TempStr,"{$imoney}",Dvbbs.Board_Setting(10))
		TempStr = Replace(TempStr,"{$ipoint}",Dvbbs.Board_Setting(11))
		TempStr = Replace(TempStr,"{$iusercp}",Dvbbs.Board_Setting(12))
		TempStr = Replace(TempStr,"{$ipower}",Dvbbs.Board_Setting(13))
		TempStr = Replace(TempStr,"{$iarticle}",Dvbbs.Board_Setting(14))
		TempStr = Replace(TempStr,"{$ireplyview}",Dvbbs.Board_Setting(15))
		TempStr = Replace(TempStr,"{$iusemoney}",Dvbbs.Board_Setting(23))
		'ubb部分
		'If Dvbbs.Board_Setting(4)="1" Then TempStr = Replace(TempStr,"{$getubb}",Temp_UBB)
		'If Dvbbs.Board_Setting(4)="1" Then TempStr = Replace(TempStr,"{$getubb}",Temp_UBBHTML())
		PostType = Dvbbs.Board_Setting(4)
		If Dvbbs.GroupSetting(67) = 2 Then
			PostType = 0
		ElseIf Dvbbs.GroupSetting(67) = 3 Then
			PostType = 1
		End IF
		TempStr = Replace(TempStr,"{$PostType}",PostType)
		TempStr = Replace(TempStr,"{$getubb}",Temp_UBBHTML())
		TempStr = Replace(TempStr,"{$getubb}","")
		'发贴心情
		TempStr = Replace(TempStr,"{$Forum_emot}",Dvbbs.Forum_emot)
		TempStr = Replace(TempStr,"{$Forum_sn}",Dvbbs.Forum_sn)
		TempStr = Replace(TempStr,"{$star}",Star)
		TempStr = Replace(TempStr,"{$page}",Page)
		TempStr = Replace(TempStr,"{$actionname}",ActionName)
		TempStr = Replace(TempStr,"{$toaction}",ToAction)
		TempStr = Replace(TempStr,"{$membername}",Dvbbs.MemberName)
		TempStr = Replace(TempStr,"{$memberword}",Dvbbs.MemberWord)
		TempStr = Replace(TempStr,"{$totalusetable}",TotalUseTable)
		TempStr = Replace(TempStr,"{$topiclimited}",Dvbbs.Board_Setting(45))
		TempStr = Replace(TempStr,"{$boardid}",Dvbbs.BoardID)
		TempStr = Replace(TempStr,"{$width}",Dvbbs.mainsetting(0))
		TempStr = Replace(TempStr,"{$alertcolor}",Dvbbs.mainsetting(1))
		TempStr = Replace(TempStr,"{$Forum_Emot}",Replace(Dvbbs.Forum_Emot,"|||","<><><>"))
		If Dvbbs.GroupSetting(67)="1" or Dvbbs.GroupSetting(67)="3" Then 
			TempStr = Replace(TempStr,"{$htmltool}",template.html(12))
		Else
			TempStr = Replace(TempStr,"{$htmltool}",template.html(13))
		End If
		If Dvbbs.GroupSetting(62)="0"  Then
			TempStr = Replace(TempStr,"{$AffordPost}","无限制")
		Else
			TempStr = Replace(TempStr,"{$AffordPost}",Dvbbs.GroupSetting(62))
		End If
		TempStr = Replace(TempStr,"{$UserToday}",Dvbbs.UserToday(0))
		Response.Write TempStr
		Response.Write "<script language=""javascript"">canusehtml='"&Dvbbs.GroupSetting(67)&"';</script>"
				
		Response.Cookies("Dvbbs")=""		
	End Function

	'专题下拉模式读取
	Public Function TopicMode(SelectMode)
		If Cint(Dvbbs.GroupSetting(65))=0 Then Exit Function
		If Replace(Dvbbs.Board_Setting(48),"$$","")="" Then Exit Function
		Dim BoardTopic,iii
		BoardTopic=Split(Dvbbs.Board_Setting(48),"$$")
		For iii=0 to Ubound(BoardTopic)-1
			TopicMode=TopicMode+"<option value="&(iii+1)
			TopicMode=TopicMode+" >"&BoardTopic(iii)&"</option>"
		Next
		TopicMode=Replace(SelectMode,"{$TopicMode}",TopicMode)
	End Function

	'通用判断
	Public Function Chk_Post()
		If Dvbbs.Board_Setting(43)="1" Then Dvbbs.AddErrCode(72)
		If Dvbbs.Board_Setting(1)="1" and Dvbbs.GroupSetting(37)="0" Then Dvbbs.AddErrCode(26)
		If Dvbbs.UserID>0 Then
			If Clng(Dvbbs.GroupSetting(52))>0 And DateDiff("s",Dvbbs.MyUserInfo(14),Now)<Clng(Dvbbs.GroupSetting(52))*60 Then Response.redirect "showerr.asp?ErrCodes=<li>"&Replace(template.Strings(21),"{$timelimited}",Dvbbs.GroupSetting(52))&"&action=OtherErr"
			If Dvbbs.GroupSetting(62)<>"0" And Not Action = 4 Then
				If Clng(Dvbbs.GroupSetting(62))<=Clng(Dvbbs.UserToday(0)) Then Response.redirect "showerr.asp?ErrCodes=<li>"&Replace(template.Strings(27),"{$topiclimited}",Dvbbs.GroupSetting(62))&"&action=OtherErr"
			End If
		End If
		If Dvbbs.GroupSetting(3)="0" And (Action = 1 Or Action = 3) Then Response.redirect "showerr.asp?ErrCodes=<li>您没有发表新主题的权限&action=OtherErr"
			If Dvbbs.GroupSetting(5)="0" And (Action = 2) Then Response.redirect "showerr.asp?ErrCodes=<li>您没有回复别人贴子的权限&action=OtherErr"
	End Function

	'得到回复或引用帖子的判断和相关信息
	Public Function Get_Re_TopicInfo()
		Get_M_Request()
		ReplyID = Request("replyid")
		If ReplyID = "" Or Not IsNumeric(ReplyID) Then ReplyID = AnnounceID
		Set Rs=Dvbbs.Execute("select PostTable,LockTopic from dv_topic where BoardID="&Dvbbs.BoardID&" And TopicID="&AnnounceID)
		If Not (Rs.EOF And Rs.BOF) Then
			TotalUseTable=rs(0)
			If Rs("LockTopic")=1 And Not (Dvbbs.Master Or Dvbbs.BoardMaster Or Dvbbs.SuperBoardMaster) Then
				Dvbbs.AddErrCode(78)
			End If
		Else
			Dvbbs.AddErrCode(48)
		End If
		Set Rs=Nothing
		Dvbbs.ShowErr()
		If ReplyID = AnnounceID Then
			Set Rs=Dvbbs.Execute("select top 1 AnnounceID from "&TotalUseTable&" where RootID="&AnnounceID&" order by AnnounceID")
			If Not(Rs.BOF And Rs.EOF) Then
				ReplyID=rs(0)
			Else
				Dvbbs.AddErrCode(48)
			End If
			Set Rs=Nothing
			Dvbbs.ShowErr()
		End If
		Set Rs=Dvbbs.Execute("select b.body,b.topic,b.locktopic,b.username,b.dateandtime,b.isbest,u.lockuser,u.UserGroupID,b.UbbList from "&TotalUseTable&" b inner join [dv_user] u on b.postuserid=u.userid Where b.AnnounceID="&ReplyID)
		If Rs.EOF And Rs.BOF Then
			Dvbbs.AddErrCode(48)
		Else
			If rs("lockuser")=1 Or rs("lockuser")=2 Then
				Content=""
			ElseIf Rs("locktopic")=2 Then 
				Content=""
			ElseIf rs("isbest")=1 and Dvbbs.GroupSetting(41)="0" Then
				Content=""
			Else
				Content=rs("body")
			End If
			Topic=Rs("topic")
			UserName=rs("username")
			DateAndTime=rs("dateandtime")
			UbbLists=Rs("UbbList")
			If UserName=Dvbbs.membername Then
				If Cint(Dvbbs.GroupSetting(4))=0 Then Dvbbs.AddErrCode(73)
			Else
				If Cint(Dvbbs.GroupSetting(2))=0 Then Dvbbs.AddErrCode(31)
			End If
		End If
		Set Rs=Nothing
		Dvbbs.ShowErr()
		If Topic<> "" Then
			Topic="回复：（" & UserName & "）" & Topic
		Else
			Topic="回复：（" & UserName & "）" & Content
		End If
		Topic=cutStr(Topic,50)
		Topic=Replace(Replace(Replace(Replace(Topic,"\","\\"),"'","\'"),VbCrLf,"\n"),chr(13),"")
		If Request("reply")="true" Then
			Content = reubbcode(Content)
			Content = Ubb2Html(Content)
			'Content = Replace(Content, "&gt;", ">")
			'Content = Replace(Content, "&lt;", "<")
			'Content = Replace(Content, "</P><P>", CHR(10) & CHR(10))
			'Content = Replace(Content, "<BR>", CHR(10))
			Content = "<DIV class=quote><B>以下是引用<i>"&UserName&"在"&DateAndTime&"</i>的发言：</B><BR>" & Content & "</DIV><BR>"
			Content = Server.HtmlEncode(Content)
		Else
			Content = ""
		End If
		'主题跟贴部分信息
		Dim PostUserGroup,TempStr1,TempStr2,TempStr3
		TempStr1 = template.html(7)	'<!--post.asp##回帖帖子循环部分-->
		Set Rs=Dvbbs.Execute("Select top 10 b.UserName,b.Topic,b.dateandtime,b.body,b.AnnounceID,b.isbest,u.lockuser,u.UserGroupID,b.postbuyuser,b.ubblist from "&TotalUseTable&" b inner join [dv_user] u on b.postuserid=u.userid where b.boardid="&Dvbbs.boardid&" and b.RootID="&AnnounceID&" order by b.AnnounceID desc")
		Do While Not Rs.EOF
			TempStr2 = TempStr1
			UserName = Rs("UserName")
			PostUserGroup=rs("UserGroupID")
			postbuyuser=rs("postbuyuser")
			UbbLists=Rs("UbbList")
			If bgcolor="tablebody1" Then 
				bgcolor="tablebody2"
				abgcolor="tablebody1"
			Else 
				bgcolor="tablebody1"
				abgcolor="tablebody2"
			End If
			TempStr2 = Replace(TempStr2,"{$tablebody}",bgcolor)
			TempStr2 = Replace(TempStr2,"{$username}",Dvbbs.HtmlEncode(Rs("UserName")))
			TempStr2 = Replace(TempStr2,"{$dateandtime}",Rs("DateAndTime"))
			TempStr2 = Replace(TempStr2,"{$topic}",Dvbbs.HtmlEncode(Rs("Topic")))
			If Rs("lockuser")=2 Then
				TempStr2 = Replace(TempStr2,"{$body}",template.Strings(10))
			ElseIf Rs("lockuser")=1 Then
				TempStr2 = Replace(TempStr2,"{$body}",template.Strings(11))
			ElseIf Rs("isbest")=1 and Dvbbs.GroupSetting(41)="0" Then
				TempStr2 = Replace(TempStr2,"{$body}",template.Strings(12))
			Else
				If InStr(Ubblists,",39,") > 0  Then
				TempStr2 = Replace(TempStr2,"{$body}",dv_ubb.Dv_UbbCode(Rs("body"),PostUserGroup,1,0))
				Else
				TempStr2 = Replace(TempStr2,"{$body}",dv_ubb.Dv_UbbCode(Rs("body"),PostUserGroup,1,1))
				End If
			End If
			TempStr3 = TempStr3 & TempStr2
		Rs.MoveNext 
		Loop
		Set Rs=Nothing
		Get_Re_TopicInfo = TempStr3
	End Function

	'取得编辑贴页面信息
	Public Function Get_Edit_TopicInfo()
		Get_M_Request()
		ReplyID = Request("replyid")
		If ReplyID = "" Or Not IsNumeric(ReplyID) Then Dvbbs.AddErrCode(30)
		Dvbbs.ShowErr()
		ReplyID = Clng(ReplyID)
		Set Rs=Dvbbs.Execute("select PostTable from dv_topic where TopicID="&AnnounceID)
		If Rs.Eof And Rs.Bof Then
			Dvbbs.AddErrCode(48)
		Else
			TotalUseTable=rs(0)
		End If

		Get_Edit_PermissionInfo()

		If Content<>"" then
			'Content=Server.HtmlEncode(Content)
			'Content=Replace(Content,"<br>",chr(13))
			'Content=Replace(Content,"&nbsp;","")
			'Content=Content & "<br>"
			Dim re
			Set re=new RegExp
			re.IgnoreCase =true
			re.Global=True
			re.Pattern="<div align=right><font color=#000066>(.|\n)*<\/font><\/div>"
			Content=re.Replace(Content,"")
			re.Pattern="\[align=right\]\[color=#000066\](.|\n)*\[\/color\]\[\/align\]"
			Content=re.Replace(Content,"")
			re.Pattern="\[i\](.*)\[\/i\]"
			Content=re.Replace(Content,"$1")
			set re=Nothing
			Content=Ubb2Html(Content)
			Content=Server.htmlencode(Content)
		End If
		
	End Function

	'判断用户是否有编辑权限且提取相关信息
	Public Function Get_Edit_PermissionInfo()
		Dim old_user
		If Action = 4 Then
		Set Rs=Dvbbs.Execute("select b.username,b.topic,b.body,b.dateandtime,u.UserGroupID,b.signflag,b.emailflag,b.UbbList from "&TotalUseTable&" b,[dv_user] u where b.postuserid=u.userid and b.RootID="&AnnounceID&" and b.AnnounceID="&replyID)
		Else
		Set Rs=Dvbbs.Execute("select b.username,b.topic,b.body,b.dateandtime,u.UserGroupID,b.signflag,b.emailflag,b.UbbList from "&TotalUseTable&" b,[dv_user] u where b.postuserid=u.userid and b.RootID="&RootID&" and b.AnnounceID="&AnnounceID)
		End If
		If Rs.Eof And Rs.Bof Then
			Dvbbs.AddErrCode(48)
		Else
			If Action = 4 Then
				signflag=Rs("signflag")
				mailflag=Rs("emailflag")
				Topic=rs("topic")
				If Topic<>"" Then Topic = Server.HtmlEncode(Topic)
				Content=rs("body")
				old_user=rs("username")
				UbbLists=rs("UbbList")
			Else
				If Clng(Dvbbs.forum_setting(50))>0 then
					If Datediff("s",rs("dateandtime"),Now())>Clng(Dvbbs.forum_setting(50))*60 then
						Content = Content+chr(13)+chr(10)+char_changed+chr(13)
					Else
						Content = Content
					End If
				Else
					Content = Content+chr(13)+chr(10)+char_changed+chr(13)
				End If
			End If
			If Clng(Dvbbs.forum_setting(51))>0 and not (Dvbbs.master or Dvbbs.boardmaster or Dvbbs.superboardmaster) Then 
				If DateDiff("s",rs("dateandtime"),Now())>Clng(Dvbbs.forum_setting(51))*60 then Response.redirect "showerr.asp?ErrCodes=<li>"&Replace(Replace(template.Strings(22),"{$posttime}",Datediff("s",rs("dateandtime"),Now())/60),"{$etlimited}",Dvbbs.forum_setting(51))&"&action=OtherErr"
			End If 
			If Rs("username")=Dvbbs.membername Then 
				If Dvbbs.GroupSetting(10)="0" then
					Dvbbs.AddErrCode(74)
					CanEditPost=False
				Else 
					CanEditPost=True
				End If 
			Else 
				If (Dvbbs.master or Dvbbs.superboardmaster or Dvbbs.boardmaster) and Dvbbs.GroupSetting(23)="1" then
					CanEditPost=True
				Else 
					CanEditPost=False
				End  If 
				If Cint(Dvbbs.UserGroupID) > 3 And Dvbbs.GroupSetting(23)="1" Then CanEditPost=true
				If Dvbbs.GroupSetting(23)="1" and Dvbbs.founduserPer Then 
					CanEditPost=True
				ElseIf Dvbbs.GroupSetting(23)="0" And Dvbbs.founduserPer Then 
					CanEditPost=False
				End If
				If Cint(Dvbbs.UserGroupID) < 4 And Cint(Dvbbs.UserGroupID) = rs("UserGroupID") Then 
					Dvbbs.AddErrCode(75)
				ElseIf Cint(Dvbbs.UserGroupID) < 4 and Cint(Dvbbs.UserGroupID) > rs("UserGroupID") Then
					Dvbbs.AddErrCode(76)
				End If 
				If Not CanEditPost Then Dvbbs.AddErrCode(77)
			End If
		End If
		Set Rs=Nothing
		Dvbbs.ShowErr()
		If Action = 4 Then Dvbbs.MemberName=old_user
	End Function

	'返回判断和参数
	Public Function Get_M_Request()
		AnnounceID = Request("ID")
		If AnnounceID = "" Or Not IsNumeric(AnnounceID) Then Dvbbs.AddErrCode(30)
		Dvbbs.ShowErr()
		AnnounceID = Clng(AnnounceID)
	End Function
	'只读，获得回复隐含Input模板
	Public Property Get Re_HiddenInput()
		Re_HiddenInput = template.html(4)
		Re_HiddenInput = Replace(Re_HiddenInput,"{$announceid}",AnnounceID)
		Re_HiddenInput = Replace(Re_HiddenInput,"{$replyid}",ReplyID)
	End Property
	'只读，获得编辑隐含Input模板
	Public Property Get Edit_HiddenInput()
		Edit_HiddenInput = template.html(5)
		Edit_HiddenInput = Replace(Edit_HiddenInput,"{$announceid}",AnnounceID)
		Edit_HiddenInput = Replace(Edit_HiddenInput,"{$replyid}",ReplyID)
	End Property
	'只读，获得上传表单模板
	Public Property Get Temp_FileUpload()
		Dim TempArray,TempStr1
		Temp_FileUpload = template.html(2)
		TempArray = Split(Dvbbs.Board_Setting(19),"|")
		For i = 0 To Ubound(TempArray)
			TempStr1 = TempStr1 & "<div class=menuitems><a href=#>"&TempArray(i)&"</a></div>"
		Next
		Temp_FileUpload = Replace(Temp_FileUpload,"{$uploadlist}",TempStr1)
	End Property
	'只读，获得UBB模板
	Public Property Get Temp_UBB()
		Dim TempArray
		Temp_UBB = template.html(3)
		TempArray = Split(template.html(9),"|")
		For i = 1 To Ubound(TempArray)
			Temp_UBB = Replace(Temp_UBB,"{$ubb"&i&"}",TempArray(0) & TempArray(i))
		Next
	End Property
	'只读，获得UBB——HTML编辑器模板
	Public Property Get Temp_UBBHTML()
		Dim TempArray
		Temp_UBBHTML = template.html(11)
		Temp_UBBHTML=Replace(Temp_UBBHTML,"{$old_oldToolbars}",Temp_UBB)
	End Property
End Class

'截取指定字符
Function cutStr(str,strlen)
	Dim l,t,c,i
	l=Len(str)
	t=0
	For i=1 to l
		c=Abs(Asc(Mid(str,i,1)))
		If c>255 Then
			t=t+2
		Else
			t=t+1
		End If
		If t>=strlen Then
			cutStr=left(str,i)&"..."
			Exit For
		Else
			cutStr=str
		End If
	Next
	cutStr=Replace(cutStr,chr(10),"")
End Function
'过滤不必要UBB
Function reUBBCode(strContent)
	Dim re
	Set re=new RegExp
	re.IgnoreCase =True
	re.Global=True
	re.Pattern="(<DIV class=quote><b>以下是引用(.|\n)*<\/div>)"
	strContent=re.Replace(strContent,"")
	re.Pattern="<div align=right><font color=#000066>(.|\n)*<\/font><\/div>"
	strContent=re.Replace(strContent,"")
	re.Pattern="\[align=right\]\[color=#000066\](.|\n)*\[\/color\]\[\/align\]"
	strContent=re.Replace(strContent,"")
	strContent=Replace(strContent,"&nbsp;"," ")
	're.Pattern="(\[QUOTE\])(.[^\[]*)(\[\/QUOTE\])"
	'strContent=re.Replace(strContent,"$2")
	re.Pattern="(\[point=*([0-9]*)\])(.*)(\[\/point\])"
	strContent=re.Replace(strContent,"&nbsp;")
	re.Pattern="(\[post=*([0-9]*)\])(.*)(\[\/post\])"
	strContent=re.Replace(strContent,"&nbsp;")
	re.Pattern="(\[power=*([0-9]*)\])(.*)(\[\/power\])"
	strContent=re.Replace(strContent,"&nbsp;")
	re.Pattern="(\[usercp=*([0-9]*)\])(.*)(\[\/usercp\])"
	strContent=re.Replace(strContent,"&nbsp;")
	re.Pattern="(\[money=*([0-9]*)\])(.*)(\[\/money\])"
	strContent=re.Replace(strContent,"&nbsp;")
	re.Pattern="(\[replyview\])(.*)(\[\/replyview\])"
	strContent=re.Replace(strContent,"&nbsp;")
	re.Pattern="(\[usemoney=*([0-9]*)\])(.*)(\[\/usemoney\])"
	strContent=re.Replace(strContent,"&nbsp;")
	strContent=Replace(strContent,"<I><\/I>","")
	set re=Nothing
	reUBBCode=strContent
End Function

'编辑时用（对旧数据兼容）
Function Ubb2Html(str)
	If Str<>"" And Not IsNull(Str) Then
		If InStr(Ubblists,",39,")=0 or IsNull(Ubblists) Then
			str = replace(str, ">", "&gt;")
			str = replace(str, "<", "&lt;")
			str = Replace(str, CHR(32), "<I></I>&nbsp;")
			str = Replace(str, CHR(34), "&quot;")
			str = Replace(str, CHR(10), "<BR> ")
		End If
		Str = Replace(Str, Chr(9) ,"&nbsp;")
		Str = Replace(Str, CHR(10) & CHR(10),"</P><P>")
		str = Replace(str, Chr(36), "&#36;")
		str = Replace(str, CHR(39), "&#39;")
		str = Replace(str, CHR(13), "")
		Ubb2Html = Str
	Else
		Ubb2Html = ""
	End If
End Function

%>