📄 savepost.asp
字号:
Myistopall=1
Else
Myistopall=0
End If
If Not CanTopTopic_a Then Myistopall=0
If Myistop="yes" and Myistopall=0 Then
Myistop=1
If Not CanTopTopic Then Myistop=0
ElseIf Myistopall=1 Then
Myistop=3
Else
Myistop=0
End If
If Not IsNumeric(MyTopicMode) or Dvbbs.GroupSetting(51)="0" Then MyTopicMode=0
If Not CanLockTopic Then MyLockTopic=0
TotalUseTable=Dvbbs.NowUseBbs
ElseIf Action = 6 Then
AnnounceID = request("followup")
If AnnounceID = "" Or Not IsNumeric(AnnounceID) Then Dvbbs.AddErrCode(30)
Dvbbs.ShowErr()
AnnounceID = Clng(AnnounceID)
ParentID = AnnounceID
RootID = request("RootID")
If RootID = "" Or Not IsNumeric(RootID) Then Dvbbs.AddErrCode(30)
Dvbbs.ShowErr()
RootID = Clng(RootID)
TotalUseTable=Request.Form("TotalUseTable")
TotalUseTable=checktable(TotalUseTable)
MyLockTopic=0
ElseIf Action = 8 Then
If Not IsNumeric(MyTopicMode) or Dvbbs.GroupSetting(51)="0" Then MyTopicMode=0
AnnounceID = request("replyID")
If AnnounceID = "" Or Not IsNumeric(AnnounceID) Then Dvbbs.AddErrCode(30)
Dvbbs.ShowErr()
AnnounceID = Clng(AnnounceID)
RootID = request("ID")
If RootID = "" Or Not IsNumeric(RootID) Then Dvbbs.AddErrCode(30)
Dvbbs.ShowErr()
RootID = Clng(RootID)
TotalUseTable=Request.Form("TotalUseTable")
TotalUseTable=checktable(TotalUseTable)
MyLockTopic=0
Dvbbs.ShowErr()
Set Rs=Dvbbs.Execute("select AnnounceID from "&TotalUseTable&" where ParentID=0 and rootid="&RootID)
If Not Rs.eof Then
If AnnounceID=Rs(0) Then
If Topic="" Then Dvbbs.AddErrCode(79)
End If
Else
Dvbbs.AddErrCode(30)
End If
End If
Dvbbs.Showerr()
SaveData()
'清空表单内容
mysessiondata=Session(Dvbbs.CacheName & "UserID")
mysessiondata(37)=""
Session(Dvbbs.CacheName & "UserID")=mysessiondata
End Sub
'保存数据
Private Sub SaveData()
If Not (Dvbbs.Master or Action = 8) Then CheckpostTime()
Dim Forumupload
If Dvbbs.GroupSetting(64)="1" Then
IsAudit=0
Else
If Dvbbs.Board_Setting(57)="1" Then
IsAudit=NeedIsAudit()
IsAuditcheck=IsAudit
End If
End If
locktopic=0
If MyLockTopic=1 Then locktopic=1
If IsAudit=1 And Action <> 8 Then
LockTopic=Dvbbs.BoardID
Dvbbs.BoardID=777
Response.Cookies("Dvbbs")=LockTopic
Else
Response.Cookies("Dvbbs")=Dvbbs.Boardid
End If
Forumupload=split(Dvbbs.Board_Setting(19),"|")
For i=0 to ubound(Forumupload)
If Instr(Content,"[upload="&Forumupload(i)&"]") or Instr(Content,"."&Forumupload(i)&"") or Instr(Content,"["&Forumupload(i)&"]") then
uploadpic_n=Forumupload(i)
Exit For
End If
Next
If InStr(Content,"viewfile.asp?ID=") Then uploadpic_n="down"
If Not Action = 8 Then
savepost()
updatepostuser()
Else
Update_Edit_Announce()
End If
succeed()
End Sub
'保存发贴,投票和回贴
Public Sub savepost()
If Action = 5 Or Action = 7 Then
ilayer=1:iOrders=0:ParentID=0
If Myistop=3 Then
MyLastPostTime=DateADD("d",300,Replace(Replace(CSTR(NOW()+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午",""))
ElseIf Myistop=1 Then
MyLastPostTime=DateADD("d",100,Replace(Replace(CSTR(NOW()+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午",""))
Else
MyLastPostTime=Replace(Replace(CSTR(NOW()+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午","")
End If
DateTimeStr=Replace(Replace(CSTR(NOW()+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午","")
If Action = 7 Then Insert_To_Vote()
Insert_To_Topic()
'更新总固顶和固顶的数据以及缓存数据
If MyIsTop=3 Then
'将总固顶ID插入总设置表
Dim iForum_AllTopNum
Set Rs=Dvbbs.Execute("Select Forum_AllTopNum From Dv_Setup")
If Trim(Rs(0))="" Or IsNull(Rs(0)) Then
iForum_AllTopNum = RootID
Else
iForum_AllTopNum = Rs(0) & "," & RootID
End If
Dvbbs.Execute("Update Dv_Setup Set Forum_AllTopNum='"&iForum_AllTopNum&"'")
Dvbbs.ReloadSetupCache iForum_AllTopNum,28
Set Rs=Nothing
ElseIf MyIsTop=1 Then
Dim BoardTopStr
Set Rs=Dvbbs.Execute("Select BoardID,BoardTopStr From Dv_Board Where BoardID="&Clng(Dvbbs.BoardID))
If Not (Rs.Eof And Rs.Bof) Then
If Rs(1)="" Or IsNull(Rs(1)) Then
BoardTopStr = RootID
Else
If InStr(","&Rs(1)&",","," & RootID & ",")>0 Then
BoardTopStr = Rs(1)
Else
BoardTopStr = Rs(1) & "," & RootID
End If
End If
Dvbbs.Execute("Update Dv_Board Set BoardTopStr='"&BoardTopStr&"' Where BoardID="&Rs(0))
Dvbbs.ReloadBoardInfo(Rs(0))
End If
Set Rs=Nothing
End If
ElseIf Action = 6 Then
Get_SaveRe_TopicInfo()
Get_ForumTreeCode()
DateTimeStr=Replace(Replace(CSTR(NOW()+Dvbbs.Forum_Setting(0)/24),"上午",""),"下午","")
End If
Insert_To_Announce()
If Action = 6 Then
topic=Replace(Replace(cutStr(topic,14),chr(10),""),"'","")
If topic="" Then
topic=Content
topic=Replace(cutStr(topic,14),chr(10),"")
Else
topic=Replace(cutStr(topic,14),chr(10),"")
End If
If ihaveupfile=1 Then Dvbbs.Execute("update dv_upfile set F_AnnounceID='"&RootID&"|"&AnnounceID&"',F_Readme='"&Replace(toptopic,"'","")&"',F_flag=0 where F_ID in ("&upfileinfo&")")
Else
If ihaveupfile=1 Then Dvbbs.Execute("update dv_upfile set F_AnnounceID='"&RootID&"|"&AnnounceID&"',F_Readme='"&Topic&"',F_flag=0 where F_ID in ("&upfileinfo&")")
End If
LastPost=Replace(username,"$","") & "$" & AnnounceID & "$" & DateTimeStr & "$" & Replace(cutStr(topic,20),"$","$") & "$" & uploadpic_n & "$" & Dvbbs.UserID & "$" & RootID & "$" & Dvbbs.BoardID
LastPost=reubbcode(Replace(LastPost,"'",""))
LastPost=Dvbbs.ChkBadWords(LastPost)
If IsAudit<>1 Then
If Action = 6 Then
If istop=3 Then
If IsSqlDataBase=1 Then
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd(day,300,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
Else
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd('d',300,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
End If
ElseIf istop=1 Then
If IsSqlDataBase=1 Then
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd(day,100,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
Else
SQL="update Dv_topic set child=child+1,LastPostTime=dateadd('d',100,"&SqlNowString&"),LastPost='"&LastPost&"' where TopicID="&RootID
End If
Else
SQL="update Dv_topic set child=child+1,LastPostTime="&SqlNowString&",LastPost='"&LastPost&"' where TopicID="&RootID
End If
Dvbbs.Execute(SQL)
Child=Child+2
If Child mod Dvbbs.Board_Setting(27)=0 Then
star=Child\Dvbbs.Board_Setting(27)
Else
star=(Child\Dvbbs.Board_Setting(27))+1
End If
Get_Chan_TopicOrder()
Else
Dvbbs.Execute("update Dv_topic set LastPost='"&LastPost&"' where topicid="&RootID)
End If
End If
If Action = 5 Or Action = 7 Then
toptopic=Replace(topic,"$","$")
Else
toptopic=Replace(cutStr(toptopic,20),"$","$")
End If
'toptopic =主标题,Content=内容
'判断是否是加密的论坛,如果是,则不显示最后发贴内容。
If Dvbbs.Board_Setting(2)="1" Then
LastPost_1="保密$" & AnnounceID & "$" & DateTimeStr & "$请认证用户进入查看$" & uploadpic_n & "$" & Dvbbs.UserID & "$" & RootID & "$" & Dvbbs.BoardID
Else
LastPost_1=Replace(username,"$","") & "$" & AnnounceID & "$" & DateTimeStr & "$" & toptopic & "$" & uploadpic_n & "$" & Dvbbs.UserID & "$" & RootID & "$" & Dvbbs.BoardID
End If
LastPost_1=reubbcode(Replace(LastPost_1,"'",""))
LastPost_1=Dvbbs.ChkBadWords(LastPost_1)
If IsAudit=0 Then
UpDate_BoardInfoAndCache()
UpDate_ForumInfoAndCache()
End If
Response.Cookies("Dvbbs")=Dvbbs.BoardID
End Sub
Public Sub Get_SaveRe_TopicInfo()
SQL="select locktopic,LastPost,title,smsuserlist,IsSmsTopic,istop,Child from Dv_topic where BoardID="&Dvbbs.BoardID&" And topicid="&cstr(RootID)
Set Rs=dvbbs.Execute(sql)
If Not Rs.EOF And Not Rs.BOF Then
toptopic=rs(2)
istop=rs(5)
Child=Rs("Child")
If rs("IsSmsTopic")=1 Then smsuserlist=rs("smsuserlist")
If Rs("LockTopic")=1 And Not (Dvbbs.Master Or Dvbbs.BoardMaster Or Dvbbs.SuperBoardMaster) Then Dvbbs.AddErrCode(78)
If Not IsNull(rs(1)) Then
LastPost=split(rs(1),"$")
If ubound(LastPost)=7 Then
UpLoadPic_n=LastPost(4)
Else
UpLoadPic_n=""
End If
End If
End If
Dvbbs.showErr()
Set Rs = Nothing
End Sub
Public Sub Insert_To_Vote()
'插入投票记录 GroupSetting(68)投票项目中是否可以使用HTML
If Dvbbs.GroupSetting(68)<>"1" Then vote=server.htmlencode(vote)
dvbbs.execute("insert into dv_vote (vote,votenum,votetype,timeout) values ('"&vote&"','"&votenum&"',"&votetype&",'"&votetimeout&"')")
set rs=dvbbs.execute("select Max(voteid) from dv_vote")
voteid=Rs(0)
isvote=1
Set Rs=Nothing
End Sub
Public Sub Insert_To_Topic()
'插入主题表
SQL="insert into Dv_topic (Title,Boardid,PostUsername,PostUserid,DateAndTime,Expression,LastPost,LastPostTime,PostTable,locktopic,istop,TopicMode,isvote,PollID,Mode) values ('"&topic&"',"&Dvbbs.boardid&",'"&username&"',"&Dvbbs.userid&",'"&DateTimeStr&"','"&Expression&"','$$"&DateTimeStr&"$$$$','"&MyLastPostTime&"','"&TotalUseTable&"',"&locktopic&","&Myistop&","&MyTopicMode&","&isvote&","&voteid&","&TopicMode&")"
Dvbbs.Execute(sql)
Set Rs=Dvbbs.Execute("select Max(topicid) from Dv_topic Where PostUserid="&Dvbbs.UserID)
RootID=rs(0)
End Sub
Public Sub Insert_To_Announce()
'插入回复表
DIM UbblistBody
UbblistBody = Content
Content = Html2Ubb(Content)
UbblistBody = Ubblist(Content)
SQL="insert into "&TotalUseTable&"(Boardid,ParentID,username,topic,body,DateAndTime,length,RootID,layer,orders,ip,Expression,locktopic,signflag,emailflag,isbest,PostUserID,isupload,IsAudit,Ubblist) values ("&Dvbbs.boardid&","&ParentID&",'"&username&"','"&topic&"','"&Content&"','"&DateTimeStr&"','"&Dvbbs.strlength(Content)&"',"&RootID&","&ilayer&","&iorders&",'"&Dvbbs.UserTrueIP&"','"&Expression&"',"&locktopic&","&signflag&","&mailflag&",0,"&Dvbbs.userid&","&ihaveupfile&","&IsAudit&",'"&UbblistBody&"')"
Dvbbs.Execute(sql)
Set rs=Dvbbs.Execute("select Max(AnnounceID) from "&TotalUseTable&" Where PostUserID="&Dvbbs.UserID)
AnnounceID=rs(0)
End Sub
'检查贴中是否含过滤字
Public Function NeedIsAudit()
NeedIsAudit=0
Dim i,ChecKData
If Dvbbs.Board_Setting(58)<>"0" Then
ChecKData=split(Dvbbs.Board_Setting(58),"|")
For i=0 to UBound(ChecKData)
If Trim(ChecKData(i))<>"" Then
If InStr(Content,ChecKData(i))>0 Or InStr(Topic,ChecKData(i))>0 Then
NeedIsAudit=1
Exit Function
End If
End If
Next
End If
End Function
Public Sub Get_Chan_TopicOrder()
If Dvbbs.Forum_ChanSetting(0)="1" And Not isnull(smsuserlist) and smsuserlist<>"" Then
'随机数
Dim MaxUserID,MaxLength
MaxLength=12
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -