<%@ codepage ="936" %>
<!-- #include file="setup.asp" -->
<!-- #include file="inc/validate.asp" -->
<!-- #include file="jhconst.asp" -->
<%
if isnumeric(""&Q_id&"") = flase then
mgerr("<li>非法操作")
end if
if isnumeric(""&Q_retopicid&"") and Q_retopicid<>"" then
	sql="select * from reforum where topicid="&Q_id&" and forumid="&Q_forumid&" and id="&Q_retopicid&""
else
	sql="select * from forum where id="&Q_id&" and forumid="&Q_forumid&""
end if
rs.Open sql,Conn,1,3
if rs.eof then 
rs.close
mgerr("<li>非法操作,数据库中没有找到这个贴子!")
end if
jhid = rs("jhid")
mname = rs("username")
mtp=rs("topic")
mtp3=" target=online_window2>"&left(replace(mtp,"<font color=red>(荐)</font>",""),10)&"...</a>"
mname=" 发表人<font color=#9900ff>[" & mname & "  ID:" & jhid & "]</font>"
mname2=mname
nickname2="论坛管理员<font color=#9900ff>[" & nickname & "]</font>"
mtp2="<a href=../bbs/showtopic.asp?id="&Q_id&"&forumid="&Q_forumid & mtp3
select case b_menu
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "deltopic"
	conn.execute("update [forum] set deltopic=1,lasttime=now,lastname='"&nickname&"' where id="&Q_id&" and forumid="&Q_forumid&"")
	conn.execute("update [bbsconfig] set toltopic=toltopic-1,tolrestore=tolrestore-1 where id="&Q_forumid&"")
	my_sql="update 用户 set 泡豆点数=泡豆点数-"&bbs_del1&" where id="&jhid
        showstr=nickname2 & "删除主题:" & mtp2 & mname2 & "[损失豆点"&bbs_del1&"个]"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "delretopic"
	if isnumeric(""&Q_retopicid&"") = flase then
		mgerr("<li>非法操作")
	end if
	conn.execute("delete * from [reforum] where topicid="&Q_id&" and forumid="&Q_forumid&" and id="&Q_retopicid&"")
	conn.execute("update [forum] set replies=replies-1 where id="&Q_id&" and forumid="&Q_forumid&"")
	conn.execute("update [bbsconfig] set tolrestore=tolrestore-1 where id="&Q_forumid&"")
	showstr="删除回贴成功"
	my_sql="update 用户 set 泡豆点数=泡豆点数-"&bbs_del2&" where id="&jhid
        showstr=nickname2 & "删除回贴:" & mtp2 & mname2 & "[损失豆点"&bbs_del2&"个]"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "toptopic"
	if rs("toptopic")=1 then
		mgerr("<li>此帖子已经置顶了，无需重复置顶")
	end if
	conn.execute("update [forum] set toptopic=1 where id="&Q_id&" and forumid="&Q_forumid&"")
	showstr="置顶主题成功"
	my_sql="update 用户 set 泡豆点数=泡豆点数+"&bbs_add5&" where id="&jhid
        showstr=nickname2 & "置顶主题:" & mtp2 & mname2 & "[获得豆点"&bbs_add5&"个]"

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "deltoptopic"
	conn.execute("update [forum] set toptopic=0 where id="&Q_id&" and forumid="&Q_forumid&"")
	showstr="取消置顶主题成功"
	my_sql=""
        showstr=nickname2 & "取消了置顶主题:" & mtp2
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "goodtopic"
	if rs("goodtopic")=1 then
		mgerr("<li>此帖子已经加入精华区了，无需重复添加")
	end if
	rs("goodtopic")=1
	rs.update
	rs.close
	my_sql="update 用户 set 泡豆点数=泡豆点数+"&bbs_add6&" where id="&jhid
        showstr=nickname2 & "加入精华区:" & mtp2 & mname2 & "[获得豆点"&bbs_add6&"个]"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "delgoodtopic"
	if rs("goodtopic")=0 then
		mgerr("<li>此帖子已经移出精华区了")
	end if
	rs("goodtopic")=0
	rs.update
	rs.close
	my_sql=""
        showstr=nickname2 & "移出精华区:" & mtp2
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "locktopic"
	conn.execute("update [forum] set locktopic=1 where id="&Q_id&" and forumid="&Q_forumid&"")
	showstr="关闭主题成功"
	my_sql="update 用户 set 泡豆点数=泡豆点数-"&bbs_del3&" where id="&jhid
        showstr=nickname2 & "关闭了主题:" & mtp2 & mname2 & "[损失豆点"&bbs_del3&"个]"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "dellocktopic"
	conn.execute("update [forum] set locktopic=0 where id="&Q_id&" and forumid="&Q_forumid&"")
	showstr="开放主题成功"
	my_sql=""
        showstr=nickname2 & "开放主题:" & mtp2
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "movenew"
	conn.execute("update [forum] set lasttime=now where id="&Q_id&" and forumid="&Q_forumid&"")
	showstr="拉前主题成功"
	my_sql="update 用户 set 泡豆点数=泡豆点数+"&bbs_add3&" where id="&jhid
        showstr=nickname2 & "拉前主题:" & mtp2 & mname2 & "[获得豆点"&bbs_add3&"个]"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "recommend"
	if instr(mtp," <font color=red>(荐)</font>")>0 then
		mgerr("<li>此主题已经推荐过了")
	end if
	rs("topic")=""&mtp&" <font color=red>(荐)</font>"
	rs.update
	rs.close
	my_sql=""
        showstr=nickname2 & "推荐主题:" & mtp2
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "unrecommend"
	if instr(mtp," <font color=red>(荐)</font>")=0 then
		mgerr("<li>此主题已经取消推荐主题，无需重复取消")
	end if
	rs("topic")=replace(mtp," <font color=red>(荐)</font>","")
	rs.update
	rs.close
	my_sql=""
        showstr=nickname2 & "取消推荐的主题:" & mtp2
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
case "move"
	if Q_moveid ="" then
		mgerr("<li>您没有选择要将主题移动哪个论坛")
	end if
	rs("forumid")=""&Q_moveid &""
	rs("toptopic")=0
	rs("goodtopic")=0
	rs("locktopic")=0
	rs("lasttime")=now
	rs.update
	replies=rs("replies")
	rs.close
	if replies<>0 then
		conn.execute("update [reforum] set forumid='"&Q_moveid &"' where topicid="&Q_id&" and forumid="&Q_forumid&"")
	end if
	my_sql="update 用户 set 泡豆点数=泡豆点数-"&bbs_del4&" where id="&jhid
	mtp2="<a href=../bbs/showtopic.asp?id="&Q_id&"&forumid=" & Q_moveid & mtp3
        showstr=nickname2 & "移动主题:" & mtp2 & mname2&"[损失豆点"&bbs_del4&"个]"
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
end select
if showstr="" then
	mgerr("<li>无效命令")
end if
succtitle="操作成功"
showstr2="<li>" & replace(showstr,"../twtbbs/","")
showstr="<font color=#E75500><b>〖论坛消息〗</b></font><font color=#ff0000>" & showstr & "<br> </font>"
call showchat(showstr)
message=message&showstr2&"<li><a href=forumdisplay.asp?forumid="&Q_forumid&">"&bbsname&"</a><li><a href=index.asp>返回论坛首页</a>"
if my_sql<>"" then connj.execute(my_sql)
	connj.close
	set rs2=nothing
	set connj=nothing
succeed(""&message&"<meta http-equiv=refresh content=3;url=forumdisplay.asp?forumid="&Q_forumid&">")
sub mgerr(mess)
	connj.close
	set rs2=nothing
	set connj=nothing
	error(mess)
end sub
%>
<!--#include file="../showchat.asp"-->