<!-- #Include File="Include/Config.asp" -->
<!-- #include file="Include/Con_bbs_Fir.asp" -->
<!-- #Include File="../Include/Cls_PageCute.asp" -->
<%

'=======================================================
' 欢迎使用《阿赛大型门户网站系统V3.0》，简称“AsaiMHV3”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

tit_fir=Cls.ChannelName
Dim sel_id,sel_id2,re_id,aname,rap_word,rapdel
sel_id=Cls.code_query("sel_id")
re_id=Cls.code_query("re_id")
'rapdel=""
If Cls.is_null(sel_id)="" Then
  Call format_redirect("List.asp?fid="&Bbsid)
End If

Select Case Action
Case "revert"
    aname="还原"
Case "restore"
    aname="修复"
Case "rap"
    aname="奖惩主题"
    rapdel="<input type=checkbox name=pf_del value='yes' ><font color=red>删除评语</font>"
Case "raps"
    aname="奖惩单贴"
    rapdel="<input type=checkbox name=pf_del value='yes' ><font color=red>删除评语</font>"
Case "move"
    aname="转移"
Case "istop"
    aname="固顶"
Case "istopz"
    aname="区固顶"
Case "istops"
    aname="总固顶"
Case "isgood"
    aname="精华"
Case "islock"
    aname="锁定"
Case "isshield"
    aname="单贴屏蔽"
Case "unshield"
    aname="解除屏蔽"
Case "del"
    aname="删除一条回贴"
    If not Cls.is_int(re_id) Then
        Call bbs_redirect("List.asp?fid="&Bbsid)
    End If
Case "delete"
    aname="删除"
Case "del_re"
    aname="删除回贴"
Case Else
    aname=""
    Action=""
    Call bbs_redirect("List.asp?fid="&Bbsid)
End Select

Dim Dim_cause,Action_num,num_err,num_ok
Dim_cause="奖励|扣罚"
ftit="主题管理."&aname

Call bbs_first()
Call DoWebHead(0,0)
Call bbs_load_power()
If Action="istops" Then
    If bbs_power_true("")=false Then
        Call bbs_End()
        Call web_error("power")
    End If
Else
    If is_super=false Then
        Call bbs_End()
        Call web_error("power")
    End If
End If
'----------------------------中间 开始----------------------------
call bbs_grade(0)
call bbs_top(0,"")
Action_num=bbs_config(13)
If Cls.chk() Then
    Call bbs_isAction_chk()
Else
    Call bbs_isAction_main()
End If
'----------------------------中间 结束----------------------------
Call bbs_End()
Call DoWebEnd()

Sub bbs_isAction_chk()
    Dim tmp1,cause,c_topic,r_id,move_fid,move_fparent,pm,pn,ismail,m_topic,dDim,chk_msg,chk_num,chk_topic,chk_f,found_err,pf,pt,pj,pem,pf_del,pf_i,pf_s,pf_e,pf_l,now_bbs_data
    num_err=0
    num_ok=0
    chk_num=0
    chk_topic=""
    found_err=""
    cause=Cls.code_form("cause")
    If instr("|"&Dim_cause&"|","|"&cause&"|")<1 Then cause=""
    c_topic=Cls.code_form("c_topic")
    pm=Cls.code_form("pm")
    If pm<>"m" Then pm="p"
    If pm="p" Then 
    pf="+"
    Else
    pf="-"
    End If
    pn=Cls.code_int("pn",1)
    pt=Cls.code_int("pt",1)
    pj=Cls.code_int("pj",1)
    pem=Cls.code_int("pem",1)
    pn=cint(pn)
    pt=cint(pt)
    pj=cint(pj)
    pem=cint(pem)
    If pn>Action_num or pn<0 Then pn=0  '积分
    If pt>Action_num or pt<0 Then pt=0  '体力
    If pj>Action_num or pj<0 Then pj=0  '经验
    If pem>Action_num or pem<0 Then pem=0  '金币
    ismail=Cls.code_form("ismail")
    pf_del=Cls.code_form("pf_del")
    m_topic=Cls.code_form("m_topic")
    If Cls.IS_null(m_topic)="" Then m_topic="没有"
    move_fid=Cls.code_int("move_fid",1)
    move_fparent=move_fid
    sel_id2=replace(sel_id," ","")
    dDim=split(sel_id2,",")
    If cause="" and c_topic="" Then
        If pf_del="yes" Then
            found_err=""
        Else
            found_err=found_err&"+请先输入操作（"&aname&"）的原因！<br>"
        End If
    End If
    If pf_del="yes" Then 
        rap_word=""
    Else
        pf_l=""  '金币数
        pf_i=""  '积分数
        pf_s=""  '体力值
        pf_e=""  '经验值
        If pem<>0 Then pf_l="金币 <font class=red>"&pf&pem&"</font> 个,"
        If pn<>0 Then pf_i="积分 <font class=red>"&pf&pn&"</font> 分,"
        If pt<>0 Then pf_s="体力 <font class=red>"&pf&pt&"</font> 点,"
        If pj<>0 Then pf_e="经验 <font class=red>"&pf&pj&"</font> 点,"
        'rap_word="[br][br][color=red]管理评语: "&cause&c_topic&"[br]评 分 人: "&login_username&"[br]评分操作: "&pf&"积分 "&pn&" 分[br]操作时间: "&cls.time_type(cls.now_time,2)&"[/color]"
        If Action="rap" Then
            for i=0 to ubound(dDim)
                If isnumeric(dDim(i)) Then
                    Sql="Select id,bbs_data from AsaiMHBbsTopic where bbs_id="&Bbsid&" and ID="&dDim(i)
                    set rs=Cls.exec(sql,1)
                    now_bbs_data=rs(1)
                    If SqlType = 1 Then
                        Sql="Select top 1 rap from "&now_bbs_data&" where bbs_id="&Bbsid&" and reply_id="&dDim(i)&" and Is_topic=1"
                    Else
                        Sql="Select top 1 rap from "&now_bbs_data&" where bbs_id="&Bbsid&" and reply_id="&dDim(i)&" and Is_topic=true"
                    End If
                    set rs=Cls.exec(sql,1)
                End If
            next
            If rs.eof Then
                found_err=found_err&"+<font class=red>你要评论的主题不存在！！！</font><br>"
            Else
                rap_word=rs(0)
                rs.close
                rap_word="<font class=blue>"&login_username&"</font>：<font class=blue>"&c_topic&"</font>&nbsp;&nbsp;&nbsp;<font class=red2>"&cause&"</font>&nbsp;&nbsp;"&pf_l&pf_i&pf_s&pf_e&"&nbsp;&nbsp;&nbsp;<font class=tims>"&cls.time_type(cls.now_time,1)&"</font><br>||||"&rap_word
            End If
        End If
        If Action="raps" Then
            Sql="Select top 1 rap from AsaiMHBbsdata where id="&re_id
            set rs=Cls.exec(sql,1)
            If rs.eof Then
                found_err=found_err&"+<font class=red>你要评论的主题不存在！！！</font><br>"
            Else
                rap_word=rs(0)
                rs.close
                rap_word="<font class=blue>"&login_username&"</font>：<font class=blue>"&c_topic&"</font>&nbsp;&nbsp;&nbsp;<font class=red2>"&cause&"</font>&nbsp;&nbsp;"&pf_l&pf_i&pf_s&pf_e&"&nbsp;&nbsp;&nbsp;<font class=tims>"&cls.time_type(cls.now_time,1)&"</font><br>||||"&rap_word
            End If
        End If
    End If
    If Action="move" Then
        If int(move_fid)<1 or int(move_fid)=int(Bbsid) Then
            found_err=found_err&"+请先选择将主题要转移至的论坛！<br>"
        Else
            Sql="Select top 1 bbs_w,bbs_hidden,bbs_parent from AsaiMHBbsClass where bbs_id="&move_fid
            set rs=Cls.exec(sql,1)
            If rs.eof Then
                found_err=found_err&"+<font class=red>要转移至的论坛不存在！！！</font><br>"
            Else
                If rs("bbs_w")=false Then
                    found_err=found_err&"+要转移至的论坛已设置不可发贴！<br>"
                End If
                If rs("bbs_hidden")=true Then
                    found_err=found_err&"+要转移至的论坛已设置隐藏！<br>"
                End If
                move_fparent=rs("bbs_parent")
            End If
            rs.close
        End If
    End If
    If found_err<>"" Then
        Call bbs_msg(found_err) 'Response.Write found_error(found_err,320)
        Exit Sub
    End If
    for i=0 to ubound(dDim)
        If isnumeric(dDim(i)) Then
            chk_num=chk_num+1
            Call is_type(dDim(i),move_fid,move_fparent,cause,c_topic,pm,pem,pn,pt,pj,ismail,m_topic,chk_topic,chk_f,pf_del)
        End If
    next
        erase dDim
        If int(num_ok)>0 and (Action="del" or Action="delete" or Action="move" or Action="revert" or Action="restore") Then
            Call bbs_new_info_update(Bbsid)
        End If
        Call Cls.Cache_Del("web_menu")
        Call Cls.Cache_Del("Web_Info")
        Call Cls.Cache_Del("bbs_class")
        chk_msg=aname
        If int(chk_num)>1 Then
            chk_msg=chk_msg&chk_num&"帖主题"
        Else
            chk_msg=chk_msg&"《"&chk_topic&"》"
        End If
        chk_msg=chk_msg&"，原因："&cause&c_topic&"，分值操作："&chk_f
        tmp1=vbcrlf&"<table border=0>" & _
            vbcrlf&"<tr><td align=center>恭喜，操作（"&aname&"）成功！</td></tr>" & _
            vbcrlf&"<tr><td><font class=red2>"&chk_msg&"</font></td></tr>" & _
            vbcrlf&"<tr><td>统计信息：共 <font class=red>"&chk_num&"</font> 项，成功 <font class=red>"&num_ok&"</font> 项，失败 <font class=red>"&num_err&"</font> 项</td></tr>" & _
            vbcrlf&"<tr><td height=30>您现在可以选择以下操作：</td></tr>" & _
            vbcrlf&"<tr><td>　　1、<a href='List.asp?fid=" & Bbsid & "'>返回 <b>" & bbs_data(2) & "</b></a></td></tr>" & _
            vbcrlf&"<tr><td>　　2、<a href='Index.asp'>返回论坛首页</a></td></tr>" & _
            vbcrlf&"<tr><td height=30>系统将在 "&Format_Mid_Num(25)&" 秒钟后自动返回 <b>" & bbs_data(2) & "</b> ……</td></tr>" & _
            vbcrlf&"</table><meta http-equiv='refresh' content='"&Format_Mid_Num(25)&"; url=List.asp?fid=" & Bbsid & "'>"
    Cls.LoadTemplate(4)
    Cls.ReadPage "common"
    Cls.HtmlRcod "title",tit
    Cls.HtmlRcod "BbsGrade",bbs_grade(0)
    Cls.HtmlRcod "BbsTopBar",bbs_top(0,"")
    Cls.HtmlRcod "body","<tr class=bbs_tr><td align=center>"&tmp1&"</td></tr>"
    Cls.OutPage
End Sub

Sub is_type(ftid,t_move_fid,t_move_fparent,t_cause,t_c_topic,t_pm,t_pem,t_pn,t_pt,t_pj,t_ismail,t_m_topic,t_chk_topic,t_chk_f,pf_del)
    If not Cls.is_int(ftid) Then Exit Sub
    Dim n_istop
    n_istop=0
    Sql="Select id,topic,username,istop,bbs_data from AsaiMHBbsTopic where bbs_id="&Bbsid&" and id="&ftid
    set rs=Cls.exec(sql,1)
    If rs.eof Then
        rs.close
        num_err=num_err+1
        Exit Sub
    End If
    If Action="del" or Action="raps" Then
        now_bbs_data=rs(4)
        rs.close
        Sql="Select reply_id,topic,username from "&now_bbs_data&" where bbs_id="&Bbsid&" and reply_id="&ftid&" and id="&re_id
        set rs=Cls.exec(sql,1)
        If rs.eof Then
            rs.close
            num_err=num_err+1
            Exit Sub
        End If
    End If
    Dim it_topic,it_id,it_chk_msg,id_username,sql_0,sql_u,sql_t,sql_e,re_counter,re_username,re_tim,it_emoney,it_integral,numnew,numn,numt,numd,now_bbs_data,it_strength,it_expression,sqlu
    numnew=dateadd("d",0,date)
    it_id=rs(0)
    it_topic=rs(1)
    id_username=rs(2)
    If Action<>"del" and Action<>"raps" Then
        n_istop=rs(3)
        now_bbs_data=rs(4)
    End If
    rs.close
    If Action="del" or Action="raps" Then it_topic="本贴为回贴"
    t_chk_topic=it_topic
    it_chk_msg=aname&"帖子《"&it_topic&"》，原因："&t_cause&t_c_topic&"，分值操作："
    t_chk_f="没有"
    sql_u=""
	it_emoney=0
    it_integral=0
    it_strength=0
    it_expression=0
    If int(t_pem)>0 or int(t_pn)>0 or int(t_pt)>0 or int(t_pj)>0 Then
        If t_pm="m" Then
            sqlu="-"
            it_emoney=-it_emoney
            it_integral=-it_integral
            it_strength=-it_strength
            it_expression=-it_expression
            t_chk_f="减"
        Else
            sqlu="+"
            it_emoney=+it_emoney
            it_integral=+it_integral
            it_strength=+it_strength
            it_expression=+it_expression
            t_chk_f="加"
        End If
        it_emoney=int(t_pem)
        it_integral=int(t_pn)
        it_strength=int(t_pt)
        it_expression=int(t_pj)
        sql_u="update AsaiMHUserData set emoney=emoney"&sqlu&t_pem&",integral=integral"&sqlu&t_pn&",strength=strength"&sqlu&t_pt&",expression=expression"&sqlu&t_pj&""
        sql_u=sql_u&" where username='"&id_username&"'"
        t_chk_f=t_chk_f&t_pem&"金币,"&t_chk_f&t_pn&"积分，"&t_chk_f&t_pt&"体力，"&t_chk_f&t_pj&"经验"
    End If
    If pf_del="yes" Then
        it_chk_msg=aname&"帖子《"&it_topic&"》，原因：删除评语"
    Else
        it_chk_msg=it_chk_msg&t_chk_f
    End If
    Select Case Action
    Case "revert","restore"
        sql_0="select count(id) from "&now_bbs_data&" where bbs_id="&Bbsid&" and reply_id="&ftid
        set rs=Cls.exec(sql_0,1)
        re_counter=rs(0)
        rs.close
        sql_0="select top 1 username,tim from "&now_bbs_data&" where bbs_id="&Bbsid&" and reply_id="&ftid&" order by id desc"
        set rs=Cls.exec(sql_0,1)
        if not rs.eof then
            re_username=rs("username")
            re_tim=rs("tim")
        end if
        rs.close
        sql="update AsaiMHBbsTopic set re_counter="&re_counter-1&",re_username='"&re_username&"'"
        if action="revert" then sql=sql&",istop=0,isgood=0,islock=0"
        sql=sql&" where id="&ftid
        call Cls.exec(sql,0)
        Call Cls.cache_del("bbs_istops")
        Call Cls.cache_del("bbs_istopz_"&zid)
        Call Cls.cache_del("bbs_istop_"&Bbsid)
        Call Cls.Cache_Del("bbs_class")
    Case "rap"
        If SqlType = 1 Then
            Call Cls.exec("update AsaiMHBbsData set rap='"&rap_word&"' where bbs_id="&Bbsid&" and reply_id="&ftid&" and Is_topic=1",0)
        Else
            Call Cls.exec("update AsaiMHBbsData set rap='"&rap_word&"' where bbs_id="&Bbsid&" and reply_id="&ftid&" and Is_topic=true",0)
        End If
    Case "raps"
        Call Cls.exec("update AsaiMHBbsData set rap='"&rap_word&"' where id="&re_id,0)
    Case "move"
        Sql="Select count(id) from "&now_bbs_data&" where tim like '"&numnew&"%' and reply_id="&ftid 
        set rs=Cls.exec(sql,1)
        numn=rs(0)
        rs.close
        If not Cls.is_int(numn) Then numn=0
        if sqltype = 1 then
            Sql="Select count(id) from "&now_bbs_data&" where Is_Topic=1 and reply_id="&ftid
        else
            Sql="Select count(id) from "&now_bbs_data&" where Is_Topic=True and reply_id="&ftid
        End If
        set rs=Cls.exec(sql,1)
        numt=rs(0)
        rs.close
        If not Cls.is_int(numt) Then numt=0
        Sql="Select count(id) from "&now_bbs_data&" where reply_id="&ftid
        set rs=Cls.exec(sql,1)
        numd=rs(0)
        rs.close
        If not Cls.is_int(numd) Then numd=0
        Call Cls.exec("update AsaiMHBbsTopic set bbs_id="&t_move_fid&" where id="&ftid,0)
        Call Cls.exec("update "&now_bbs_data&" set bbs_id="&t_move_fid&" where reply_id="&ftid,0)
        Call Cls.exec("update AsaiMHBbsClass set bbs_new_num=bbs_new_num-"&numn&",bbs_topic_num=bbs_topic_num-"&numt&",bbs_data_num=bbs_data_num-"&numd&" where bbs_id in ("&bbs_data(7)&")",0)
        Call Cls.exec("update AsaiMHBbsClass set bbs_new_num=bbs_new_num+"&numn&",bbs_topic_num=bbs_topic_num+"&numt&",bbs_data_num=bbs_data_num+"&numd&" where bbs_id in ("&t_move_fparent&")",0)
        Call bbs_new_info_update(t_move_fid)
        Select Case int(n_istop)
        Case 1
            Call Cls.cache_del("bbs_istop_"&Bbsid)
            Call Cls.cache_del("bbs_istop_"&t_move_fid)
        Case 2
            Call Cls.cache_del("bbs_istops")
            Call Cls.cache_del("bbs_istop_"&t_move_fid)
        End Select
    Case "istop","istopz","istops","isgood","islock"
        Sql="update AsaiMHBbsTopic set "&Action&"=1 where id="&ftid
        Select Case Action
        Case "istopz"
            Sql="update AsaiMHBbsTopic set istop=2 where id="&ftid
        Case "istops"
            Sql="update AsaiMHBbsTopic set istop=3 where id="&ftid
        End Select
        Call Cls.exec(sql,0)
        If instr(",istop,istopz,istops,",","&Action&",")>0 Then
            Select Case int(n_istop)
            Case 1
                If Action<>"istop" Then Call Cls.cache_del("bbs_istop_"&Bbsid)
                If Action="istopz" Then Call Cls.cache_del("bbs_istopz_"&zid)
                If Action="istops" Then Call Cls.cache_del("bbs_istops")
            Case 2
                If Action="istop" Then Call Cls.cache_del("bbs_istop_"&Bbsid)
                If Action<>"istopz" Then Call Cls.cache_del("bbs_istopz_"&zid)
                If Action="istops" Then Call Cls.cache_del("bbs_istops")
            Case 3
                If Action="istop" Then Call Cls.cache_del("bbs_istop_"&Bbsid)
                If Action="istopz" Then Call Cls.cache_del("bbs_istopz_"&zid)
                If Action<>"istops" Then Call Cls.cache_del("bbs_istops")
            Case Else
                If Action="istop" Then Call Cls.cache_del("bbs_istop_"&Bbsid)
                If Action="istopz" Then Call Cls.cache_del("bbs_istopz_"&zid)
                If Action="istops" Then Call Cls.cache_del("bbs_istops")
            End Select
        End If
    Case "isshield"
        Call Cls.exec("update AsaiMHBbsData set is_shield=1 where bbs_id="&Bbsid&" and reply_id="&ftid&" and id="&re_id,0)
    Case "unshield"
        Call Cls.exec("update AsaiMHBbsData set is_shield=0 where bbs_id="&Bbsid&" and reply_id="&ftid&" and id="&re_id,0)
    Case "del"
        Call Cls.exec("delete from "&now_bbs_data&" where id="&re_id,0)
        Call Cls.exec("update AsaiMHBbsTopic set re_counter=re_counter-1 where id="&ftid,0)
        Call Cls.exec("update AsaiMHBbsClass set bbs_new_num=bbs_new_num-1,bbs_data_num=bbs_data_num-1 where bbs_id in ("&bbs_data(7)&")",0)
        Call Cls.exec("update AsaiMHUserData set bbs_del=bbs_del+1,bbs_counter=bbs_counter-1 where username='"&id_username&"'",0)
        Call Cls.exec("update AsaiMHChannel set ChannelHits=ChannelHits-1 Where ChannelIDs="&ChannelIDs&"",0)
        Call Cls.exec("update AsaiMHConfigs set Num_New=Num_New-1",0)
    Case "delete"
        Sql="Select count(id) from "&now_bbs_data&" where tim like '"&numnew&"%' and bbs_id="&Bbsid&" and reply_id="&ftid 
        set rs=Cls.exec(sql,1)
        numn=rs(0)
        rs.close
        If not Cls.is_int(numn) Then numn=0
        if sqltype = 1 then
            Sql="Select count(id) from "&now_bbs_data&" where Is_Topic=1 and bbs_id="&Bbsid&" and reply_id="&ftid
        else
            Sql="Select count(id) from "&now_bbs_data&" where Is_Topic=True and bbs_id="&Bbsid&" and reply_id="&ftid
        End If
        set rs=Cls.exec(sql,1)
        numt=rs(0)
        rs.close
        If not Cls.is_int(numt) Then numt=0
        Sql="Select count(id) from "&now_bbs_data&" where bbs_id="&Bbsid&" and reply_id="&ftid
        set rs=Cls.exec(sql,1)
        numd=rs(0)
        rs.close
        If not Cls.is_int(numd) Then numd=0
        Call Cls.exec("update "&now_bbs_data&" set bbs_id=999999999 where reply_id="&ftid,0)
        Call Cls.exec("update AsaiMHBbsTopic set bbs_id=999999999,form_id="&Bbsid&",istop=0 where id="&ftid,0)
        Call Cls.exec("update AsaiMHBbsClass set bbs_new_num=bbs_new_num-"&numn&",bbs_topic_num=bbs_topic_num-"&numt&",bbs_data_num=bbs_data_num-"&numd&" where bbs_id in ("&bbs_data(7)&")",0)
        Call Cls.exec("update AsaiMHUserData set bbs_del=bbs_del+"&numd&",bbs_counter=bbs_counter-"&numd&" where username='"&id_username&"'",0)
        Call Cls.exec("update AsaiMHChannel set ChannelCount=ChannelCount-"&numt&",ChannelHits=ChannelHits-"&numd&" Where ChannelIDs="&ChannelIDs&"",0)
        Call Cls.exec("update AsaiMHConfigs set Num_New=Num_New-"&numn&"",0)
        Select Case int(n_istop)
        Case 1
            Call Cls.cache_del("bbs_istop_"&Bbsid)
        Case 2
            Call Cls.cache_del("bbs_istopz_"&zid)
        Case 3
            Call Cls.cache_del("bbs_istops")
        End Select
    End Select
    If sql_u<>"" Then
        Call Cls.exec(sql_u,0)
    End If
    it_chk_msg=Cls.code_var(it_chk_msg)
    sql_e="insert into AsaiMHBbsEvent(bbs_id,topic_id,username,o_user,emoney,integral,strength,expression,remark,tim,ip) " & _
          "values("&Bbsid&","&ftid&",'"&login_username&"','"&id_username&"',"&it_emoney&","&it_integral&","&it_strength&","&it_expression&",'"&it_chk_msg&"','"&Cls.now_time&"','"&Cls.ip_sys(0)&"')"
    Call Cls.exec(sql_e,0)
    If t_ismail="yes" Then
        sql_e="insert into AsaiMHUserMail(sEnd_u,accept_u,topic,word,tim,types,isread) " & _
              "values('"&login_username&"','"&id_username&"','系统短信（论坛主题处理）','"&it_chk_msg&"；附加信息："&t_m_topic&"','"&Cls.now_time&"',1,0)"
        Call Cls.exec(sql_e,0)
    End If
    num_ok=num_ok+1
End Sub

Sub bbs_new_info_update(nfid)
    Dim rsnf,nf_id,nf_topic,nf_username,nf_tim
    nf_id=""
    nf_topic=""
    nf_username=""
    nf_tim=""
    set rsnf=Cls.exec("Select top 1 id,topic,re_username,re_tim from AsaiMHBbsTopic where bbs_id="&nfid&" order by re_tim desc",1)
    If not rsnf.eof Then
        nf_id=rsnf("id")
        nf_topic=rsnf("topic")
        nf_username=rsnf("re_username")
        nf_tim=rsnf("re_tim")
        nf_topic=replace(nf_topic,"'","")
        nf_topic=replace(nf_topic,"|","")
    End If
    rsnf.close
    set rsnf=nothing
    Call Cls.exec("update AsaiMHBbsClass set bbs_new_info='"&nf_username&"|"&nf_tim&"|"&nf_id&"|"&nf_topic&"' where bbs_id="&nfid,0)
End Sub

Sub bbs_isAction_main()
    Dim tmp1,dDim
    tmp1=vbcrlf&"<form name=isAction_frm Action='' method=post onSubmit=""javascript:frm_Submitonce(this);"">" & _
        vbcrlf&"<input type=hidden name=chk value='yes'>" & _
        vbcrlf&"<tr class=tr>" & _
        vbcrlf&"<td width='20%'>&nbsp;操作原因：</td>" & _
        vbcrlf&"<td width='80%'>&nbsp;<Select name=cause>" & _
        vbcrlf&"<option value='' Selected >自定义</option>"
    dDim=split(Dim_cause,"|")
    for i=0 to ubound(dDim)
        tmp1=tmp1&vbcrlf&"<option value='"&dDim(i)&"'>"&dDim(i)&"</option>"
    next
    erase dDim
        tmp1=tmp1&vbcrlf&"</Select>&nbsp;<input class=txt type=input name=c_topic size=47 maxlength=40>&nbsp;"&rapdel&"</td>" & _
            vbcrlf&"</tr>"
    If Action="move" Then
        tmp1=tmp1&vbcrlf&"<tr  class=tr>" & _
            vbcrlf&"<td>&nbsp;主题转移：</td>" & _
            vbcrlf&"<td>&nbsp;"&bbs_isAction_list(Bbsid)&"</td>" & _
            vbcrlf&"</tr>"
    End If
    tmp1=tmp1&vbcrlf&"<tr  class=tr>" & _
        vbcrlf&"<td>&nbsp;加减积分：</td>" & _
        vbcrlf&"<td>&nbsp;<Select name=pm>" & _
        vbcrlf&"<option value='p' Selected>加</option>" & _
        vbcrlf&"<option value='m'>减</option>" & _
        vbcrlf&"</Select>&nbsp;<Select name=pem>" & _
        vbcrlf&"<option class=bg_3 Selected>0</option>"
    for i=1 to Action_num
        tmp1=tmp1&vbcrlf&"<option>"&i&"</option>"
    next
        tmp1=tmp1&vbcrlf&"</Select>&nbsp;金币" & _
            vbcrlf&"<Select name=pn>" & _
            vbcrlf&"<option class=bg_3 Selected>0</option>"
    for i=1 to Action_num
        tmp1=tmp1&vbcrlf&"<option>"&i&"</option>"
    next
        tmp1=tmp1&vbcrlf&"</Select>&nbsp;积分" & _
            vbcrlf&"<Select name=pt>" & _
            vbcrlf&"<option class=bg_3 Selected>0</option>"
    for i=1 to Action_num
        tmp1=tmp1&vbcrlf&"<option>"&i&"</option>"
    next
        tmp1=tmp1&vbcrlf&"</Select>&nbsp;体力" & _
            vbcrlf&"<Select name=pj>" & _
            vbcrlf&"<option class=bg_3 Selected>0</option>"
	for i=1 to Action_num
        tmp1=tmp1&vbcrlf&"<option>"&i&"</option>"
    next
        tmp1=tmp1&vbcrlf&"</Select>&nbsp;经验" & _
            vbcrlf&"</td></tr>" & _
            vbcrlf&"<tr  class=tr>" & _
            vbcrlf&"<td>&nbsp;站内短信：</td>" & _
            vbcrlf&"<td>&nbsp;<input type=checkbox name=ismail value='yes' >&nbsp;&nbsp;附加内容：<input class=txt type=input name=m_topic size=60 maxlength=50></td>" & _
            vbcrlf&"</tr>" & _
            vbcrlf&"<tr  class=tre height=30>" & _
            vbcrlf&"<td>&nbsp;</td>" & _
            vbcrlf&"<td>&nbsp;<input type=Submit class=btn value=' 提 交 操 作 '>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type=reset class=btn value='重新填写'></td>" & _
            vbcrlf&"</tr>" & _
            vbcrlf&"</form>"
    Cls.LoadTemplate(4)
    Cls.ReadPage "common"
    Cls.HtmlRcod "title",tit
    Cls.HtmlRcod "BbsGrade",bbs_grade(0)
    Cls.HtmlRcod "BbsTopBar",bbs_top(0,"")
    Cls.HtmlRcod "body",tmp1
    Cls.OutPage
End Sub

function bbs_isAction_list(il_Bbsid)
    Dim temp1,ncid,Bbsn,nfid,classid
    ncid=0
    temp1="<Select name=move_fid>"
    Sql="Select bbs_id,class_id,bbs_name,bbs_n,bbs_w,bbs_star,bbs_hidden,bbs_pro from AsaiMHBbsClass where bbs_hidden=0 order by class_id,bbs_order,bbs_star"
    set rs=Cls.exec(sql,1)
    do while not rs.eof
        classid=rs("class_id")
        If int(ncid)<>int(classid) Then
            temp1=temp1&vbcrlf&"<option s>╋"&rs("bbs_name")&"</option>"
            ncid=classid
        Else
            Bbsn=rs("bbs_n")
            nfid=rs("bbs_id")
            temp1=temp1&vbcrlf&"<option value='"&nfid&"'"
            If int(nfid)=int(il_Bbsid) Then
                temp1=temp1&" Selected"
            End If
            temp1=temp1&">"
            for i=1 to rs("bbs_star")-1
                temp1=temp1&"│"
            next
                temp1=temp1&"├"&rs("bbs_name")
            If rs("bbs_w")=false Then temp1=temp1&" <不可发贴>"
            If rs("bbs_hidden")=true Then temp1=temp1&" <隐>"
            If rs("bbs_pro")=1 Then temp1=temp1&" <只读>"
            temp1=temp1&"</option>"
        End If
    rs.movenext
    loop
    rs.close
    temp1=temp1&"</Select>"
    bbs_isAction_list=temp1
End function

function ReplaceDispose(str)
    Dim strer,re
    strer = str
    Set re=new RegExp
    re.IgnoreCase=True
    re.Global=True
    re.Pattern="\[align=right\]\[color\=\#000066\]本贴已被(.|\n)*\[\/align\]"
    strer=re.Replace(strer,"")
    set re = nothing
    ReplaceDispose = strer
End function
%>
