%
'=========================================================
' File: admin_topiclist.asp
' Version:5.0
' Date: 2002-9-20
' Script Written by satan
'=========================================================
' Copyright (C) 2001,2002 AspSky.Net. All rights reserved.
' Web: http://www.aspsky.net,http://www.dvbbs.net
' Email: info@aspsky.net,eway@aspsky.net
'=========================================================
stats="帖子审核"
Dim currentPage
dim AdminLockTopic
dim p,announceIDRange1,announceIDRange2,tableclass
dim bBoardEmpty
bBoardEmpty=false
AdminLockTopic=false
if (master or superboardmaster or boardmaster) and Cint(GroupSetting(36))=1 then
AdminLockTopic=true
else
AdminLockTopic=false
end if
if Cint(GroupSetting(36))=1 and UserGroupID>3 then
AdminLockTopic=true
end if
if FoundUserPer and Cint(GroupSetting(36))=1 then
AdminLockTopic=true
elseif FoundUserPer and Cint(GroupSetting(36))=0 then
AdminLockTopic=false
end if
if not AdminLockTopic then
Errmsg=Errmsg+" "+"
您没有在本版面审核帖子的权限。"
founderr=true
end if
currentPage=request("page")
if BoardID="" or (not isInteger(BoardID)) or BoardID="0" then
Errmsg=Errmsg+" "+"
错误的版面参数!请确认您是从有效的连接进入。"
founderr=true
else
BoardID=clng(BoardID)
end if
if currentpage="" or not isInteger(currentpage) then
currentpage=1
else
currentpage=clng(currentpage)
end if
if founderr then
call nav()
call head_var(2,0,"","")
call dvbbs_error()
else
call nav()
call head_var(1,BoardDepth,0,0)
if request("action")="freetopic" then
call freetopic()
else
call main()
end if
if founderr then call dvbbs_error()
end if
call footer()
sub main()
dim totalrec,ii,page_count
dim n,pi
dim rs1,sql1
%>
"
end sub
sub freetopic()
if request.form("announceid")="" then
founderr=true
Errmsg=Errmsg+" "+"
请指定相关帖子。"
exit sub
end if
Dim id,trs,ars
Dim FoundID,MyID
dim bbsnum,topicnum,todaynum
dim haveaudit
bbsnum=0
topicnum=0
todaynum=0
for i=1 to request.form("Announceid").count
ID=replace(request.form("Announceid")(i),"'","")
if request("actiontype")=2 then
set rs=conn.execute("select rootid from "&NowUsebbs&" where parentid=0 and Announceid="&id)
if not (rs.eof and rs.bof) then
conn.execute("delete from topic where topicid="&rs(0))
conn.execute("delete from "&NowUseBBS&" where rootid="&rs(0))
FoundID=rs(0)
else
conn.execute("delete from "&NowUseBBS&" where Announceid="&id)
FoundID=0
end if
if FoundID>0 then
set rs=conn.execute("select count(*) from "&NowUsebbs&" where isaudit=1 and not parentid=0 and rootid="&FoundID)
MyID=rs(0)
if isnull(MyID) then MyID=0
if MyID=0 then
conn.execute("update "&NowUsebbs&" set isaudit=0 where parentid=0 and rootid="&FoundID)
end if
end if
elseif cint(request("actiontype"))=1 then
set rs=conn.execute("select rootid,dateandtime,PostUserID from "&NowUsebbs&" where parentid=0 and Announceid="&id)
if not (rs.eof and rs.bof) then
bbsnum=bbsnum+1
topicnum=topicnum+1
if datediff("d",rs(1),Now())=0 then todaynum=todaynum+1
conn.execute("update topic set locktopic=0 where topicid="&rs(0))
conn.execute("update "&NowUseBBS&" set locktopic=0,isaudit=0 where Announceid="&id)
conn.execute("update [user] set article=article+1,userWealth=userWealth+"&Forum_user(2)&",UserEP=UserEP+"&Forum_user(7)&",UserCP=UserCP+"&Forum_user(12)&" where userid="&rs(2))
set ars=conn.execute("select count(*) from "&NowUseBBS&" where locktopic=3 and rootid="&rs(0))
haveaudit=ars(0)
if isnull(haveaudit) or haveaudit=0 then conn.execute("update "&NowUseBBS&" set isaudit=0 where rootid="&rs(0))
else
set trs=conn.execute("select rootid,dateandtime,PostUserID from "&NowUseBBS&" where Announceid="&id)
if not (trs.eof and trs.bof) then
'更新主题最后回复数据和回复数
bbsnum=bbsnum+1
topicnum=topicnum+1
if datediff("d",trs(1),Now())=0 then todaynum=todaynum+1
conn.execute("update "&NowUseBBS&" set locktopic=0,isaudit=0 where Announceid="&id)
conn.execute("update [user] set article=article+1,userWealth=userWealth+"&Forum_user(2)&",UserEP=UserEP+"&Forum_user(7)&",UserCP=UserCP+"&Forum_user(12)&" where userid="&trs(2))
set ars=conn.execute("select count(*) from "&NowUseBBS&" where locktopic=3 and rootid="&trs(0))
haveaudit=ars(0)
if isnull(haveaudit) or haveaudit=0 then conn.execute("update "&NowUseBBS&" set isaudit=0 where rootid="&trs(0))
IsEndReply(trs(0))
end if
end if
end if
next
set rs=nothing
'更新论坛总数据和版面数据
if cint(request("actiontype"))=1 then
update boardid,bbsnum,topicnum,todaynum
end if
sucmsg="
操作成功!"
call dvbbs_suc()
end sub
function IsEndReply(TopicID)
isEndReply=false
dim trs
dim LastPostInfo,iTotalUseTable
dim LastTopic,body,LastRootid,LastPostTime,LastPostUser
dim LastPost,uploadpic_n,LastPostUserID,LastID
set trs=conn.execute("select LastPost,PostTable from Topic where Topicid="&Topicid)
if not (trs.eof and trs.bof) then
LastPostInfo=split(trs(0),"$")
iTotalUseTable=trs(1)
end if
set trs=conn.execute("select top 1 topic,body,Announceid,dateandtime,username,PostUserid,rootid from "&iTotalUseTable&" where rootid="&TopicID&" and locktopic<2 order by Announceid desc")
if not(trs.eof and trs.bof) then
body=trs(1)
LastRootid=trs(2)
LastPostTime=trs(3)
LastPostUser=replace(trs(4),"$","")
LastTopic=left(replace(body,"$",""),20)
LastPostUserID=trs(5)
LastID=trs(6)
else
LastTopic="无"
LastRootid=0
LastPostTime=now()
LastPostUser="无"
LastPostUserID=0
LastID=0
end if
LastPost=LastPostUser & "$" & LastRootid & "$" & LastPostTime & "$" & replace(left(replace(LastTopic,"'",""),20),"$","") & "$" & LastPostInfo(4) & "$" & LastPostUserID & "$" & LastID & "$" & BoardID
conn.execute("update topic set LastPost='"&LastPost&"',child=child+1,LastPostTime='"&LastPostTime&"' where topicid="&TopicID)
set trs=nothing
end function
'更新论坛总数据和版面数据
function update(boardid,bbsnum,topicnum,todaynum)
dim lastpost_1,trs
dim LastTopic,LastRootid,LastPostTime,LastPostUser
dim LastPost,uploadpic_n,Lastpostuserid,Lastid
dim UpdateBoardID
'本论坛和上级论坛ID
UpdateBoardID=BoardParentStr & "," & BoardID
'版面最后回复数据
set trs=conn.execute("select top 1 T.title,b.Announceid,b.dateandtime,b.username,b.postuserid,b.rootid from "&NowUseBBS&" b inner join Topic T on b.rootid=T.TopicID where b.boardid="&boardid&" and b.locktopic<2 order by b.announceid desc")
if not(trs.eof and trs.bof) then
Lasttopic=replace(left(replace(trs(0),"'",""),15),"$","")
LastRootid=trs(1)
LastPostTime=trs(2)
LastPostUser=trs(3)
LastPostUserid=trs(4)
Lastid=trs(5)
else
LastTopic="无"
LastRootid=0
LastPostTime=now()
LastPostUser="无"
LastPostUserid=0
Lastid=0
end if
set trs=nothing
LastPost=LastPostUser & "$" & LastRootid & "$" & LastPostTime & "$" & LastTopic & "$" & uploadpic_n & "$" & LastPostUserID & "$" & LastID & "$" & BoardID
'总版面最后回复数据
set trs=conn.execute("select top 1 T.title,b.Announceid,b.dateandtime,b.username,b.postuserid,b.rootid from "&NowUseBBS&" b inner join Topic T on b.rootid=T.TopicID where b.locktopic<2 order by b.announceid desc")
if not(trs.eof and trs.bof) then
Lasttopic=replace(left(replace(trs(0),"'",""),15),"$","")
LastRootid=trs(1)
LastPostTime=trs(2)
LastPostUser=trs(3)
LastPostUserid=trs(4)
Lastid=trs(5)
else
LastTopic="无"
LastRootid=0
LastPostTime=now()
LastPostUser="无"
LastPostUserid=0
Lastid=0
end if
LastPost_1=LastPostUser & "$" & LastRootid & "$" & LastPostTime & "$" & LastTopic & "$" & uploadpic_n & "$" & LastPostUserID & "$" & LastID & "$" & BoardID
Dim SplitUpBoardID,SplitLastPost
SplitUpBoardID=split(UpdateBoardID,",")
For i=0 to ubound(SplitUpBoardID)
set trs=conn.execute("select LastPost from board where boardid="&SplitUpBoardID(i))
if not (trs.eof and trs.bof) then
SplitLastPost=split(trs(0),"$")
if isnull(SplitLastPost(1)) then SplitLastPost(1)=0
if ubound(SplitLastPost)=7 and clng(LastRootID)<>clng(SplitLastPost(1)) then
conn.execute("update board set LastPost='"&LastPost&"' where boardid="&SplitUpBoardID(i))
end if
end if
Next
conn.execute("update board set LastBbsNum=Lastbbsnum+"&bbsnum&",LastTopicNum=LastTopicNum+"&TopicNum&",TodayNum=TodayNum+"&todaynum&" where boardid in ("&UpdateBoardID&")")
conn.execute("update config set BbsNum=bbsnum+"&bbsnum&",TopicNum=TopicNum+"&TopicNum&",TodayNum=TodayNum+"&todaynum&",LastPost='"&LastPost_1&"' where active=1")
set trs=nothing
end function
%>