<!-- #include file="include/AMH_onlogin.asp" -->
<%
'=======================================================
' 欢迎使用《阿赛大型门户网站系统V2.0》，简称“AsaiMHV2”
' 技术支持、商业版咨询、官方唯一指定联系QQ“4941172”
' 官方网站：http://77ya.com      程序负责人：阿赛
'=======================================================

Server.ScriptTimeOut=999999
dim len_bbs_config,Bbsid,ddim
len_bbs_config=30
classid=Cls.code_id("class_id")
Bbsid=Cls.code_id("bbs_id")
Call Cls.Channel_Initialize(4)

Index_Url="Bbs"
call AMH_master(0,0)
tit_fir="论坛"
tit="论坛管理"

Call AMH_Header(1)
%>
<tr><td align=center colspan=2 height=30>
  <table border=0>
  <tr>
  <td><a href='?'>管理首页</a></td>
  <td width=10></td>
  <td><a href='?action=add'>添加新论坛</a></td>
  <td width=10></td>
  <td><a href='?action=mod'>合并论坛数据</a></td>
  <td width=10></td>
  <td><a href='?action=apart'>创建数据分表</a></td>
  <td width=10></td>
  <td><a href='?action=order'>重新计数排序</a></td>
  <td width=10></td>
  <td><a href='?action=event'>清理论坛日记</a></td>
  <!--
  <td width=10></td>
  <td><a href='?action=delete'>批量删除数据</a></td>
  -->
  </tr>
  </table>
</td></tr>
</table>
<%
call AMH_table(1)

select case action
case "del"
  call bbs_del()
case "event"
  call bbs_event()
case "apart"
  call bbs_apart()
  MenuHelp="注释：上面数据表中选中的为当前论坛所使用来保存帖子数据的表，一般情况下每个表中的数据越少论坛帖子显示速度越快，当您下列单个数据表中的数据有超过几十万的帖子时不妨新添一个数据表来保存帖子数据，您会发现论坛速度快很多。 您也可以将当前所使用的数据表在数据表中切换，当前所使用的帖子数据表即当前论坛用户发贴时默认保存帖子的数据表。<br />建议：ACCESS 版本超过 200,000 条数据建立新表 ； MSSQL 版本超过 500,000 条数据建立新表"
case "mod"
  call bbs_mod()
case "restore"
  call bbs_restore()
case "order"
  call bbs_order()
case "orders"
  call bbs_orders()
case "add"
  call bbs_add()
case "edit"
  call bbs_edit()
case "edit_parameter"
  call bbs_edit_parameter()
case else
  call bbs_main()
end select

Call AMH_Ender(tit)

sub cache_class_clear()
  call Cls.cache_del("bbs_class")
end sub

function is_bbs_data(strer)
  if strer="" then
    is_bbs_data=false
    exit function
  end if
  is_bbs_data=true
  on error resume next
  sql="select top 1 id from "&strer&" order by id"
  set rs=Cls.exec(sql,1)
  rs.close
  if error then
    err.clear
    is_bbs_data=false
  end if
end function

sub bbs_apart()
  dim tmpdata,basedata,nowdata,tmpdim,tmpnum,bbs_data_num,tmp_Data_Name,tmp_Data_Name_true,Dim_BbsData
  basedata="AsaiMHBbsData"
  Dim_BbsData=Split(Cls.Web_BbsData,"|")
  nowdata=Dim_BbsData(0)
  tmpdata=Dim_BbsData(1)
  call AMH_td("论坛数据分表")
  if Cls.chk() then
    bbs_data_num=Cls.code_int("bbs_data_num",1)
    tmp_Data_Name=basedata&bbs_data_num
	if SqlType=0 then
      on error resume next
      call Cls.exec("create table "&tmp_Data_Name,0)
      if err then
	    error.clear
        call AMH_msg("数据库执行失败，请检查您是否有数据库执行权限！或者数据库里已经有该数据表！",pageurl&"action="&action,1)
	    exit sub
	  end if
      call Cls.exec("alter table "&tmp_Data_Name&" add column id autoincrement",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column bbs_id integer",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column reply_id integer",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column userid integer",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column username text(20) null",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column topic text(50) null",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column icon text(5) null",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column word memo",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column tim datetime",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column ip text(30) null",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column sys text(250) null",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column is_topic bit",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column is_shield bit",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column cod integer",0)
      call Cls.exec("alter table "&tmp_Data_Name&" add column rap memo",0)
	Else
     tmp_Data_Name_true=is_bbs_data(tmp_Data_Name)
     if int(bbs_data_num)<2 or instr(","&lcase(tmpdata)&",",","&tmp_Data_Name&",")>0 or not tmp_Data_Name_true then
      call AMH_msg("要创建的新数据表名不符合规则或已存在！",pageurl&"action="&action,1)
      exit sub
     end if
      sql="CREATE TABLE [dbo].["&tmp_Data_Name&"] (id int IDENTITY (1, 1) NOT NULL CONSTRAINT PK_"&tmp_Data_Name&" PRIMARY KEY," & _
        "bbs_id int NULL ," & _
        "reply_id int NULL ," & _
        "userid int NULL ," & _
        "username nvarchar(20) NULL ," & _
        "topic nvarchar(50) NULL ," & _
        "icon nvarchar(5) NULL ," & _
        "word ntext NULL ," & _
        "tim datetime NULL ," & _
        "ip nvarchar(30) NULL ," & _
        "sys nvarchar(250) NULL ," & _
        "is_topic bit NULL ," & _
        "is_shield bit NULL ," & _
        "cod int NULL ," & _
		"rap ntext NULL ,)"
       call Cls.Exec(sql,0)
	End If
	call Cls.Exec("update AsaiMHConfigs Set BbsData='"&tmp_Data_Name&"|"&tmpdata&","&tmp_Data_Name&"' Where ID=1",0)
	Call Cls.Cache_Del("Web_Info")
    call AMH_msg("成功创建了新的数据表："&tmp_Data_Name&"！",pageurl&"action="&action,1)
    exit sub
  end if
  call form_first()
%>
<td width='20%' class=htd>当前论坛数据表：</td>
<td width='80%'>
  <table cellspacing=1 cellpadding=3 class=table0>
  <tr align=center>
  <td class=td width='10%'>序号</td>
  <td class=td width='60%'>数据表名</td>
  <td class=td width='30%'>现有记录</td>
  </tr>
<%
  tmpdim=split(tmpdata,",")
  for i=0 to ubound(tmpdim)
    set rs=Cls.exec("select count(id) from "&tmpdim(i),1)
    tmpnum=rs(0)
    rs.close
    if not isnumeric(tmpnum) then tmpnum=0
%>
  <tr class=tr>
  <td class=tims align=center><%=i+1%></td>
  <td align=center <%if lcase(nowdata)=lcase(tmpdim(i)) then response.write " class=blue"%>><%=tmpdim(i)%></td>
  <td align=right><%=tmpnum%> <font class=Gys>条</font></td>
  </tr>
<%
  next
  bbs_data_num=1
  if len(nowdata)>len(basedata) then
    bbs_data_num=right(nowdata,len(nowdata)-len(basedata))
    if not isnumeric(bbs_data_num) then bbs_data_num=1
  end if
  bbs_data_num=bbs_data_num+1
%>
  </table>
</td>
</tr>
<form name=apart_create_frm action='<%response.write pageurl%>action=<%response.write action%>' method=post>
<input type=hidden name=chk value='yes'>
<tr valign=top>
<td>创建新的数据表：</td>
<td class=htd>
   <table border=0 cellspacing=1 cellpadding=4 width="100">
   <tr><td><b>新建数据表名：</b><%=basedata%><input type=input name=bbs_data_num value='<%=bbs_data_num%>' size=3 maxlength=2 style="text-align:center;"></td></tr>
   <tr><td><input type=submit value='执行创建' onclick="javascript:return click_return('执行创建新数据表的操作',0);" class=btn></td></tr>
   <tr><td><b>注意：</b> 新建的表名只能以“<%=basedata%>2”这样的形式命名，<font class=red>新创建的数据表将作为<u>论坛内容数据的默认表</u>！</font></td></tr>
   </table>
</td>
</tr>
</form>
<%
end sub

sub bbs_del()
  dim num_topic,num_data,fparent,tmp_tid
  sql="select top 1 bbs_parent from AsaiMHBbsClass where bbs_id="&Bbsid
  set rs=Cls.exec(sql,1)
  if rs.eof then
    rs.close
    call AMH_msg("要删除的论坛ID（"&Bbsid&"）不存！","?",1)
    exit sub
  end if
  fparent=rs("bbs_parent")
  rs.close
  sql="select count(bbs_id) from AsaiMHBbsClass where bbs_f="&Bbsid
  set rs=Cls.exec(sql,1)
  if rs(0)>0 then
    rs.close
    call AMH_msg("要删除的论坛ID（"&Bbsid&"）含有下级论坛！请先删除下级论坛。","?",1)
    exit sub
  end if
  rs.close
  sql="select count(id) from AsaiMHBbsTopic where bbs_id="&Bbsid
  set rs=Cls.exec(sql,1)
  num_topic=rs(0)
  rs.close
  sql="select count(id) from AsaiMHBbsData where bbs_id="&Bbsid
  set rs=Cls.exec(sql,1)
  num_data=rs(0)
  rs.close
  sql="select id from AsaiMHBbsTopic where bbs_id="&Bbsid&" order by id"
  call Cls.exe_conn(rs,sql,1)
  do while not rs.eof
    tmp_tid=rs(0)
    'call Cls.upload_del("Bbs",tmp_tid)
    call Cls.exec("delete from AsaiMHBbsVote where reply_id="&tmp_tid,0)
    rs.movenext
  loop
  rs.close
  sql="delete from AsaiMHBbsTopic where bbs_id="&Bbsid
  call Cls.exec(sql,0)
  sql="delete from AsaiMHBbsData where bbs_id="&Bbsid
  call Cls.exec(sql,0)
  sql="delete from AsaiMHBbsClass where bbs_id="&Bbsid
  call Cls.exec(sql,0)
  if Cls.Is_Null(fparent)<>"" then
    sql="update AsaiMHBbsClass set bbs_n=bbs_n-1,bbs_topic_num=bbs_topic_num-"&num_topic&",bbs_data_num=bbs_data_num-"&num_data&" where bbs_id in("&fparent&")"
    call Cls.exec(sql,0)
  end if
  call cache_class_clear()
  call AMH_msg("成功删除论坛ID（"&Bbsid&"）！","?",1)
end sub

sub bbs_event()
  dim data_type,clear_msg,s_d,s_tim
  s_d="'d'"
  s_tim="now()"
  If SqlType = 1 then
    s_d="d"
    s_tim="getdate()"
  end if
  call AMH_td("清理论坛日记")
  if Cls.chk() then
    data_type=trim(request.form("data_type"))
    select case data_type
    case "all"
      sql="delete from AsaiMHBbsEvent"
      clear_msg="所有"
    case "week"
      sql="delete from AsaiMHBbsEvent where datediff("&s_d&",tim,"&s_tim&")>7"
      clear_msg="一周前"
    case else	'"month"
      sql="delete from AsaiMHBbsEvent where datediff("&s_d&",tim,"&s_tim&")>30"
      clear_msg="一个月前"
    end select
    call Cls.exec(sql,0)
    call AMH_msg("已成功清理了"&clear_msg&"的论坛日记！",pageurl&"action="&action,1)
    exit sub
  end if
  call form_first()
%>
<form name=event_frm action='<%response.write pageurl%>action=<%response.write action%>' method=post>
<input type=hidden name=chk value='yes'>
<td width='20%' class=htd>注意：<br />清除后将不能再恢复</td>
<td width='80%'>
  <table border=0>
  <tr><td><input type=radio name=data_type value='month' checked>&nbsp;清除一个月前的论坛日记</td></tr>
  <tr><td><input type=radio name=data_type value='week'>&nbsp;清除一周前的论坛日记</td></tr>
  <tr><td><input type=radio name=data_type value='all'>&nbsp;清除所有的论坛日记</td></tr>
  </table>
</td>
</tr>
<tr>
<td></td>
<td><input type=submit value='执行清除操作' onclick="javascript:return click_return('执行清除操作',0);" class=btn></td>
</form>
<%
end sub

sub bbs_mod()
  dim temp1,bbs_topic_num,bbs_data_num,bbs_new_info,ftrue,fname1,fname2
  call AMH_td("合并论坛数据")
  if chk() then
    dim sel1,sel2
    sel1=trim(request.form("sel_1"))
    sel2=trim(request.form("sel_2"))
    if not(isnumeric(sel1)) or not(isnumeric(sel2)) then
      response.write "<tr><td align=center height=50 colspan=2><font class=red2>您没有选择要合并的论坛！</font></td></tr>"
    else
      sel1=int(sel1)
      sel2=int(sel2)
      ftrue=true
      sql="select bbs_topic_num,bbs_data_num,bbs_name from AsaiMHBbsClass where bbs_id="&sel2
      set rs=Cls.exec(sql,1)
      if rs.eof then
        ftrue=false
        response.write "<tr><td align=center height=50 colspan=2><font class=red2>转移论坛ID（"&sel1&"）不存在！</font></td></tr>"
      else
        bbs_topic_num=rs(0)
        bbs_data_num=rs(1)
        fname1=rs(2)
      end if
      rs.close
      if ftrue=true then
        sql="select bbs_topic_num,bbs_data_num,bbs_name from AsaiMHBbsClass where bbs_id="&sel1
        set rs=Cls.exec(sql,1)
        if rs.eof then
          ftrue=false
          response.write "<tr><td align=center height=50 colspan=2><font class=red2>主论坛ID（"&sel1&"）不存在！</font></td></tr>"
        else
          bbs_topic_num=bbs_topic_num+rs(0)
          bbs_data_num=bbs_data_num+rs(1)
          fname2=rs(2)
        end if
        rs.close
      end if
      if ftrue=true then
        sql="update AsaiMHBbsClass set bbs_topic_num=0,bbs_data_num=0,bbs_new_info='' where bbs_id="&sel1
        call Cls.exec(sql,0)
        sql="update AsaiMHBbsClass set bbs_topic_num="&bbs_topic_num&",bbs_data_num="&bbs_data_num&" where bbs_id="&sel2
        call Cls.exec(sql,0)
        sql="update AsaiMHBbsTopic set bbs_id="&sel2&" where bbs_id="&sel1
        call Cls.exec(sql,0)
        sql="update AsaiMHBbsData set bbs_id="&sel2&" where bbs_id="&sel1
        call Cls.exec(sql,0)
        call cache_class_clear()
        call AMH_msg("成功将论坛（"&fname1&"）数据合并到论坛（"&fname2&"）中！","?action=mod",0)
        exit sub
      end if
    end if
  end if
  call form_first()
  temp1=bbs_mod_list()
%>
<form action='?action=mod' method=post>
<input type=hidden name='chk' value='yes'>
<tr>
<td width='20%'>从论坛：</td>
<td width='80%' height=50><select name=sel_1><%response.write temp1%></select></td>
</tr>
<tr>
<td>合并到论坛：</td>
<td height=50><select name=sel_2><%response.write temp1%></select></td>
</tr>
<tr>
<td></td>
<td height=50><input type=submit value='开始合并' onclick="javascript:return click_return('合并当前选择的<%response.write tit_fir%>数据',0);" class=btn></td>
</tr>
</form>
<%
end sub

function bbs_mod_list()
  dim temp1,ncid,Bbsn
  ncid=0
  sql="select bbs_id,class_id,bbs_name,bbs_n,bbs_w,bbs_star,bbs_hidden,bbs_pro from AsaiMHBbsClass 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 class=bg_2>╋"&rs("bbs_name")&"</option>"
      ncid=classid
    else
      Bbsn=rs("bbs_n")
      temp1=temp1&vbcrlf&"<option value='"&rs("bbs_id")&"'>"
      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
  bbs_mod_list=temp1
end function

sub bbs_restore()
  dim Bbsparent,Bbsw,Bbsn,Bbstopicnum,Bbsdatanum,Bbsnewinfo,Bbsnewnum,frs,fsql,nBbsid,ntopic
  sql="select top 1 bbs_parent,bbs_w from AsaiMHBbsClass where bbs_id="&Bbsid
  set rs=Cls.exec(sql,1)
  if rs.eof then
    rs.close
    call AMH_msg("要进行数据修复的论坛ID（"&Bbsid&"）不存！","?",1)
    exit sub
  end if
  Bbsparent=rs("bbs_parent")
  Bbsw=rs("bbs_w")
  rs.close
  Bbsn=0
  Bbstopicnum=0
  Bbsdatanum=0
  Bbsnewinfo=""
  Bbsnewnum=0
  if not Bbsw then
    sql="select bbs_id,bbs_topic_num,bbs_data_num,bbs_new_num from AsaiMHBbsClass where bbs_hidden=0 and left(bbs_parent,"&(len(Bbsparent)+1)&")='"&Bbsparent&",'"
    set rs=Cls.exec(sql,1)
    do while not rs.eof
      nBbsid=rs(0)
      Bbsn=Bbsn+1
      Bbstopicnum=Bbstopicnum+rs(1)
      Bbsdatanum=Bbsdatanum+rs(2)
      Bbsnewnum=Bbsnewnum+rs(3)
      rs.movenext
    loop
    rs.close
  end if
  if int(Bbsn)=0 then
    sql="select count(id) from AsaiMHBbsTopic where bbs_id="&Bbsid
    set rs=Cls.exec(sql,1)
    Bbstopicnum=Bbstopicnum+rs(0)
    rs.close
    sql="select count(id) from AsaiMHBbsData where bbs_id="&Bbsid
    set rs=Cls.exec(sql,1)
    Bbsdatanum=Bbsdatanum+rs(0)
    rs.close
    sql="select count(id) from AsaiMHBbsData where bbs_id="&Bbsid&" and tim>"&s_mark&Cls.time_type(Cls.now_time,4)&" 00:00:00"&s_mark
    set rs=Cls.exec(sql,1)
    Bbsnewnum=Bbsnewnum+rs(0)
    rs.close
  end if
  sql="select top 1 id,topic,username,tim from AsaiMHBbsTopic where bbs_id="&Bbsid&" order by re_tim desc"
  set rs=Cls.exec(sql,1)
  if not rs.eof then
    ntopic=rs("topic")
    ntopic=replace(ntopic,"'","")
    ntopic=replace(ntopic,"|","")
    Bbsnewinfo=rs("username")&"|"&rs("tim")&"|"&rs("id")&"|"&ntopic
  end if
  rs.close
  sql="update AsaiMHBbsClass set bbs_topic_num="&Bbstopicnum&",bbs_data_num="&Bbsdatanum&",bbs_new_info='"&Bbsnewinfo&"',bbs_new_num="&Bbsnewnum&" where bbs_id="&Bbsid
  call Cls.exec(sql,0)
  call cache_class_clear()
  call AMH_msg("成功对论坛（ID："&Bbsid&"）进行了数据修复！","?",1)
end sub

sub bbs_order()

  if Cls.code_query("chk")<>"yes" then
    call AMH_td("重新计数排序")
%>
<tr>
<td width='20%'>注意：</td>
<td width='80%' height=60 class=htd>现在正在执行重新计算所有论坛计数、所属下级论坛、论坛排序等操作；<br />根据您的服务器情况可能会执行一到两秒钟左右的时间，请在些期间不要关闭本页！</td>
</tr>
<tr><td height=40 colspan=2 align=center><input type=button value='执行重新计数排序操作' onclick="javascript:location.href='?action=order&chk=yes';" class=btn></td></tr>
<%
    exit sub
  end if
  dim star_min
  sql="select top 1 bbs_star from AsaiMHBbsClass order by bbs_star"
  set rs=Cls.exec(sql,1)
  if rs.eof then
    rs.close
    call AMH_msg("暂时还没有论坛分类！","?",1)
    exit sub
  end if
  star_min=rs(0)
  rs.close
  if not Cls.is_int(star_min) then star_min=0
  if int(star_min)>0 then
    call AMH_msg("论坛分类出现严重错误！请与开发人员联系。","?",1)
    exit sub
  end if
  classid=1
  sql="select bbs_id,class_id from AsaiMHBbsClass where bbs_star="&star_min&" order by class_id,bbs_id"
  set rs=Cls.exec(sql,1)
  do while not rs.eof
    Bbsid=rs("bbs_id")
    call Cls.exec("update AsaiMHBbsClass set class_id="&classid&",bbs_f=0,bbs_n=0,bbs_order=0,bbs_star=0,bbs_parent='"&Bbsid&"' where bbs_id="&Bbsid,0)
    call bbs_order_board(classid,Bbsid,1,Bbsid,1,1)
    rs.movenext
    classid=classid+1
  loop
  rs.close
  call cache_class_clear()
  call AMH_msg("成功对所有论坛进行了重新计数排序！","?",1)
end sub

sub bbs_order_board(cid,fid,fstar,fparent,forder,fh)
  dim rsb,sqlb,nfid,ffp,fhh,nf_id,nf_topic,nf_username,nf_tim
  ffp=fparent&","
  if fparent="" then
    ffp=""
  end if
  sqlb="select bbs_id,bbs_star,bbs_hidden,bbs_topic_num,bbs_data_num from AsaiMHBbsClass where bbs_f="&fid&" order by bbs_order,bbs_id"
  set rsb=Cls.exec(sqlb,1)
  do while not rsb.eof
    fhh=fh
    nfid=rsb("bbs_id")
    nf_id=""
    nf_topic=""
    nf_username=""
    nf_tim=""
    call Cls.exec("update AsaiMHBbsClass set class_id="&cid&",bbs_f="&fid&",bbs_n=0,bbs_order="&forder&",bbs_star="&fstar&",bbs_parent='"&ffp&nfid&"' where bbs_id="&nfid,0)
    forder=forder+1
    if rsb("bbs_hidden")=true then fhh=0
    if int(fhh)=1 then
      call Cls.exec("update AsaiMHBbsClass set bbs_n=bbs_n+1 where class_id="&cid&" and bbs_id in("&fparent&")",0)
    end if
    call bbs_order_board(cid,nfid,fstar+1,ffp&nfid,forder,fhh)
    rsb.movenext
  loop
  rsb.close
  set rsb=nothing
end sub

sub bbs_orders()
  dim star_min,actions,Bbsf,Bbsorder,Bbsstar,Bbsparent,num1,num2,num3
  actions=Cls.code_query("actions")
  if Bbsid<1 or (actions<>"up" and actions<>"Down") then
    call AMH_msg("论坛排序参数出错！","?",1)
    exit sub
  end if
  sql="select top 1 class_id,bbs_f,bbs_order,bbs_star,bbs_parent from AsaiMHBbsClass where bbs_id="&Bbsid
  set rs=Cls.exec(sql,1)
  if rs.eof then
    rs.close
    call AMH_msg("论坛ID（"&Bbsid&"）不存在！","?",1)
    exit sub
  end if
  classid=rs("class_id")
  Bbsf=rs("bbs_f")
  Bbsorder=rs("bbs_order")
  Bbsstar=rs("bbs_star")
  Bbsparent=rs("bbs_parent")
  rs.close
  sql="select top 1 bbs_star from AsaiMHBbsClass order by bbs_star"
  set rs=Cls.exec(sql,1)
  star_min=rs(0)
  rs.close
  if int(Bbsstar)=int(star_min) then
    num1=classid
    sql="select top 1 class_id from AsaiMHBbsClass where class_id>"&classid&" order by class_id"
    if actions="up" then
      sql="select top 1 class_id from AsaiMHBbsClass where class_id<"&classid&" order by class_id desc"
    end if
    set rs=Cls.exec(sql,1)
    if rs.eof then
      rs.close
      call bbs_main()
      exit sub
    end if
    num2=rs(0)
    rs.close
    sql="select top 1 class_id from AsaiMHBbsClass order by class_id desc"
    set rs=Cls.exec(sql,1)
    num3=rs(0)+10000
    rs.close
    sql="update AsaiMHBbsClass set class_id="&num3&" where class_id="&classid
    call Cls.exec(sql,0)
    sql="update AsaiMHBbsClass set class_id="&classid&" where class_id="&num2
    call Cls.exec(sql,0)
    sql="update AsaiMHBbsClass set class_id="&num2&" where class_id="&num3
    call Cls.exec(sql,0)
    call bbs_main()
    exit sub
  end if
  dim Bbsid2,Bbsorder2,Bbsparent2,forder1,forder2
  sql="select top 1 bbs_id,bbs_order,bbs_parent from AsaiMHBbsClass where class_id="&classid&" and bbs_f="&Bbsf&" and bbs_star="&Bbsstar&" and bbs_id<>"&Bbsid&" and bbs_order>"&Bbsorder&" order by bbs_order"
  if actions="up" then
    sql="select top 1 bbs_id,bbs_order,bbs_parent from AsaiMHBbsClass where class_id="&classid&" and bbs_f="&Bbsf&" and bbs_star="&Bbsstar&" and bbs_id<>"&Bbsid&" and bbs_order<"&Bbsorder&" order by bbs_order desc"
  end if
  set rs=Cls.exec(sql,1)
  if rs.eof then
    rs.close
    call bbs_main()
    exit sub
  end if
  Bbsid2=rs("bbs_id")
  Bbsorder2=rs("bbs_order")
  Bbsparent2=rs("bbs_parent")
  rs.close
  sql="select top 1 bbs_order from AsaiMHBbsClass where class_id="&classid&" and ( left(bbs_parent,"&len(Bbsparent2)+1&")='"&Bbsparent2&",' or bbs_id="&Bbsid2&" ) order by bbs_order desc"
  set rs=Cls.exec(sql,1)
  forder2=rs(0)
  rs.close
  sql="select top 1 bbs_order from AsaiMHBbsClass where class_id="&classid&" and ( left(bbs_parent,"&len(Bbsparent)+1&")='"&Bbsparent&",' or bbs_id="&Bbsid&" ) order by bbs_order desc"
  set rs=Cls.exec(sql,1)
  forder1=rs(0)
  rs.close
  num1=forder1-Bbsorder+1
  num2=forder2-Bbsorder2+1
  sql="update AsaiMHBbsClass set bbs_order=bbs_order"
  if actions="up" then
    sql=sql&"-"
  else
    sql=sql&"+"
  end if
  sql=sql&num2&" where left(bbs_parent,"&len(Bbsparent)+1&")='"&Bbsparent&",' or bbs_id="&Bbsid
  call Cls.exec(sql,0)
  sql="update AsaiMHBbsClass set bbs_order=bbs_order"
  if actions="up" then
    sql=sql&"+"
  else
    sql=sql&"-"
  end if
  sql=sql&num1&" where left(bbs_parent,"&len(Bbsparent2)+1&")='"&Bbsparent2&",' or bbs_id="&Bbsid2
  call Cls.exec(sql,0)
  call cache_class_clear()
  call bbs_main()
end sub

sub bbs_edit()
  dim funder,ftrue,ftruen1,ftruen2,nfhidden,fir_true,Bbsname,Bbstype,Bbspro,Bbsstar,Bbsparent,Bbsorder,fparent,fstar,Bbshidden,fhidden,rs2,Bbsf,Bbsid2,classid2
  fhidden=false
  funder=false
  ftrue=false
  ftruen1=false
  ftruen2=false
  fir_true=false
  sql="select count(bbs_id) from AsaiMHBbsClass where bbs_f="&Bbsid
  set rs=Cls.exec(sql,1)
  if int(rs(0))>0 then funder=true
  rs.close
  sql="select top 1 * from AsaiMHBbsClass where bbs_id="&Bbsid
  call Cls.exe_conn(rs,sql,3)
  if rs.eof then
    rs.close
    call AMH_msg("论坛ID（"&Bbsid&"）不存在！","?",1)
    exit sub
  end if
  Bbsname=rs("bbs_name")
  if int(rs("bbs_star"))=0 and int(rs("bbs_f"))=0 then fir_true=true
  call AMH_td("编辑论坛（"&Bbsname&"）信息")
  if chk() then
    classid=rs("class_id")
    Bbsf=rs("bbs_f")
    Bbsparent=rs("bbs_parent")
    Bbshidden=rs("bbs_hidden")
    nfhidden=Bbshidden
    Bbsid2=Cls.code_int("bbs__id",1)
    if int(Bbsid2)<1 then Bbsid2=Bbsid
    Bbsname=Cls.code_admin("bbs_name",1,20)
    Bbstype=Cls.code_int("bbs_type",1)
    Bbspro=Cls.code_int("bbs_pro",1)
    if int(Bbspro)<>1 and int(Bbspro)<>2 then Bbspro=0
    if Bbsname="" then
      rs.close
      call AMH_error("论坛名称不能为空！")
      exit sub
    end if
    if funder=false and int(Bbsid2)<>int(Bbsid) and int(Bbsid2)<>int(Bbsf) and fir_true=false then
      sql="select top 1 class_id,bbs_star,bbs_parent,bbs_hidden from AsaiMHBbsClass where bbs_id="&Bbsid2
      set rs2=Cls.exec(sql,1)
      if rs2.eof then
        rs2.close
        set rs2=nothing
        rs.close
        call AMH_msg("要更改所属的父级论坛ID（"&Bbsid2&"）不存在！","?",1)
        exit sub
      end if
      classid2=rs2("class_id")
      fparent=rs2("bbs_parent")
      fhidden=rs2("bbs_hidden")
      fstar=rs2("bbs_star")+1
      rs2.close
      Bbsorder=0
      sql="select top 1 bbs_order from AsaiMHBbsClass where left(bbs_parent,"&len(fparent)+1&")='"&fparent&",' and class_id="&classid2&" order by bbs_order desc"
      set rs2=Cls.exec(sql,1)
      if not rs2.eof then
        Bbsorder=rs2(0)
      end if
      rs2.close
      set rs2=nothing
      sql="update AsaiMHBbsClass set bbs_order=bbs_order+1 where class_id="&classid2&" and bbs_id<>"&Bbsid&" and bbs_order>"&Bbsorder
      call Cls.exec(sql,0)
      rs("class_id")=classid2
      rs("bbs_f")=Bbsid2
      rs("bbs_parent")=fparent&","&Bbsid
      rs("bbs_star")=fstar
      rs("bbs_order")=Bbsorder+1
      ftrue=true
      ftruen1=true
      if Bbshidden=true then
        ftruen1=false
      end if
      ftruen2=true
      if fhidden=true then
        ftruen2=false
      end if
    end if
    if ftrue=false and fir_true=false then
      sql="select top 1 bbs_hidden from AsaiMHBbsClass where bbs_id="&Bbsf
      set rs2=Cls.exec(sql,1)
      if rs2.eof then
        rs2.close
        set rs2=nothing
        rs.close
        call AMH_msg("所属的父级论坛ID（"&Bbsf&"）不存在！","?",1)
        exit sub
      end if
      fhidden=rs2("bbs_hidden")
      rs2.close
      set rs2=nothing
      classid2=classid
      fparent=Bbsparent
      nfhidden=false
      if Cls.code_form("bbs_hidden")<>"no" then
        nfhidden=true
      end if
      ftruen1=false
      ftruen2=false
      if Bbshidden<>nfhidden then
        if Bbshidden=false then
          ftruen1=true
        else
          ftruen2=true
        end if
      end if
    end if
    if Cls.code_form("bbs_w")="yes" then
      rs("bbs_w")=true
    else
      rs("bbs_w")=false
    end if
    rs("bbs_name")=Bbsname
    rs("bbs_pic")=Cls.code_admin("bbs_pic",1,200)
    if ftrue=false then
      rs("bbs_hidden")=nfhidden
    end if
    rs("bbs_pro")=Bbspro
    rs("bbs_type")=Bbstype
    rs("bbs_remark")=Cls.code_admin("bbs_remark",1,250)
    rs("bbs_rule")=Cls.code_admin("bbs_rule",1,250)
    rs("bbs_power")=Cls.code_admin("bbs_power",1,50)
    rs("bbs_user")=Cls.code_remark("bbs_user")
    rs.update
    rs.close
    if ftruen1=true then
      call Cls.exec("update AsaiMHBbsClass set bbs_n=bbs_n-1 where class_id="&classid&" and bbs_id<>"&Bbsid&" and bbs_id in ("&Bbsparent&")",0)
    end if
    if ftruen2=true then
      call Cls.exec("update AsaiMHBbsClass set bbs_n=bbs_n+1 where class_id="&classid2&" and bbs_id<>"&Bbsid&" and bbs_id in ("&fparent&")",0)
    end if
    call cache_class_clear()
    call AMH_msg("成功编辑了论坛（"&Bbsname&"）信息！","?",1)
    exit sub
  end if
  call form_first()
  Bbstype=rs("bbs_type")
  Bbspro=rs("bbs_pro")
  Bbshidden=rs("bbs_hidden")
%>
<form action='?action=edit&bbs_id=<%response.write Bbsid%>' method=post>
<input type=hidden name='chk' value='yes'>
<tr><td width='20%'>论坛名称：</td><td width='80%'><input type=text name=bbs_name value='<%response.write Bbsname%>' size=30 maxlength=20></td></tr>
<tr><td>所属分类：</td><td><%
  if funder=true then
    response.write "<font class=red2>本论坛有下级论坛，不可更改所属分类</font><input type=hidden name=bbs__id value='"&Bbsid&"'>"
  else
    if Bbshidden=true then
      response.write "<font class=red>本论坛隐藏论坛，不可更改所属分类</font><input type=hidden name=bbs__id value='"&Bbsid&"'>"
    else
     call bbs_add_edit_list(Bbsid)
    end if
  end if
%></td></tr>
<tr><td>论坛类型：</td><td><select name=bbs_type size=1><%
  ddim=split(Cls.ChannelOption,"|")
  for i=0 to ubound(ddim)
    response.write vbcrlf&"<option value='"&i+1&"'"
    if int(Bbstype)=(i+1) then response.write " selected"
    response.write ">"&right(ddim(i),len(ddim(i))-instr(ddim(i),":"))&"</option>"
  next
  erase ddim
%><option value='0' class=tr1<%if int(Bbstype)=0 then response.write " selected"%>>认证论坛</option></select></td></tr>
<tr><td>开放隐藏：</td><td><input type=checkbox name=bbs_hidden value='no'<%if Bbshidden=false then response.write " checked"%>>&nbsp;（选上为开放，否则为隐藏）</td></tr>
<tr><td>论坛属性：</td><td><input type=radio name=bbs_pro value='0'<%if int(Bbspro)<>1 then response.write " checked"%>>正常&nbsp;<input type=radio name=bbs_pro value='1'<%if int(Bbspro)=1 then response.write " checked"%>>只读</td></tr>
<tr><td>发贴模式：</td><td><input type=checkbox name=bbs_w value='yes'<%if rs("bbs_w")=true then response.write " checked"%>>&nbsp;（选上为可以发表新的主题）</td></tr>
<tr><td>论坛图片：</td><td><input type=text name=bbs_pic value='<%response.write rs("bbs_pic")%>' size=30 maxlength=200> 例：<a title='代表 images/bbs_pic/sample.gif 这个图片<br />也可以直接填写图片的URL地址'>$sample.gif</a> （绝对地址也可以）</td></tr>
<tr><td>论坛版主：</td><td><input type=text name=bbs_power value='<%response.write rs("bbs_power")%>' size=50 maxlength=50><br />多个请用“|”分开，如：“AsaiMH|super1|andy”</td></tr>
<tr><td>论坛说明：<br /><br /><=250字</td><td><textarea name=bbs_remark rows=5 cols=50><%response.write Cls.code_word(rs("bbs_remark"))%></textarea></td></tr>
<tr><td>论坛规则：<br /><br /><=250字，支持html</td><td><textarea name=bbs_rule rows=5 cols=50><%response.write Cls.code_word(rs("bbs_rule"))%></textarea></td></tr>
<tr>
<td>认证用户：<br /><br />只在论坛类型为“认证论坛”时有效<br />多个请用“<font class=red>,</font>”格开，<br />如：apple,allen,mary</td>
<td><textarea name=bbs_user rows=6 cols=50><%response.write Cls.code_word(rs("bbs_user"))%></textarea></td>
</tr>
<%
  call submit_edit()
  rs.close
end sub

sub bbs_add_edit_list(fid)
  dim temp1,nfid,ncid,Bbsn,rsf,sqlf
  ncid=0
  temp1="<select name=bbs__id size=1><option value='0'>将本论坛作为主论坛分类</option>"
  sqlf="select bbs_id,class_id,bbs_name,bbs_n,bbs_w,bbs_star,bbs_hidden,bbs_pro from AsaiMHBbsClass order by class_id,bbs_order,bbs_star"
  set rsf=Cls.exec(sqlf,1)
  do while not rsf.eof
    classid=rsf("class_id")
    nfid=rsf("bbs_id")
    if int(ncid)<>int(classid) then
      temp1=temp1&vbcrlf&"<option class=bg_2 value='"&nfid&"'"
      if int(nfid)=int(fid) then temp1=temp1&" selected"
      temp1=temp1&">╋"&rsf("bbs_name")&"</option>"
      ncid=classid
    else
      Bbsn=rsf("bbs_n")
      temp1=temp1&vbcrlf&"<option value='"&nfid&"'"
      if int(nfid)=int(fid) then temp1=temp1&" selected"
      temp1=temp1&">"
      for i=1 to rsf("bbs_star")-1
        temp1=temp1&"│"
      next
      temp1=temp1&"├"&rsf("bbs_name")
      if rsf("bbs_w")=false then temp1=temp1&" <不可发贴>"
      if rsf("bbs_hidden")=true then temp1=temp1&" <隐>"
      if rsf("bbs_pro")=1 then temp1=temp1&" <只读>"
      temp1=temp1&"</option>"
    end if
    rsf.movenext
  loop
  rsf.close
  set rsf=nothing
  temp1=temp1&"</select>"
  response.write temp1
end sub

sub bbs_add()
  call AMH_td("添加新论坛")
  dim Bbsname,Bbsf,Bbsstar,Bbsparent,Bbsorder,Bbstype,Bbspro,fhidden,fo_id
  classid=1
  sql="select top 1 class_id from AsaiMHBbsClass order by class_id"
  set rs=Cls.exec(sql,1)
  if not rs.eof then classid=rs(0)-1
  rs.close
  Bbsparent=""
  Bbsorder=-1
  Bbsf=0
  fhidden=false
  if chk() then
    classid=0
    Bbsid=Cls.code_int("bbs__id",1)
    if int(Bbsid)<1 then
      sql="select top 1 class_id from AsaiMHBbsClass order by class_id desc"
      set rs=Cls.exec(sql,1)
      if not rs.eof then classid=rs(0)
      rs.close
      classid=classid+1
    else
      sql="select top 1 class_id,bbs_order,bbs_star,bbs_parent,bbs_hidden from AsaiMHBbsClass where bbs_id="&Bbsid
      set rs=Cls.exec(sql,1)
      if rs.eof then
        rs.close
        call AMH_msg("所属分类论坛ID（"&Bbsid&"）不存在！","?",1)
        exit sub
      end if
      classid=rs("class_id")
      Bbsorder=rs("bbs_order")
      Bbsstar=rs("bbs_star")
      Bbsparent=rs("bbs_parent")
      fhidden=rs("bbs_hidden")
      rs.close
      Bbsf=Bbsid
      fo_id=Bbsid
      sql="select top 1 bbs_id,bbs_order from AsaiMHBbsClass where left(bbs_parent,"&(len(Bbsparent)+1)&")='"&Bbsparent&",' order by bbs_order desc"
      set rs=Cls.exec(sql,1)
      if not rs.eof then
        fo_id=rs(0)
        Bbsorder=rs(1)
      end if
      rs.close
    end if
    Bbsname=Cls.code_admin("bbs_name",1,20)
    Bbstype=Cls.code_int("bbs_type",1)
    Bbspro=Cls.code_int("bbs_pro",1)
    if int(Bbspro)<>1 and int(Bbspro)<>2 then Bbspro=0
    if fhidden=false then
      if trim(request.form("bbs_hidden"))<>"no" then fhidden=true
    end if
    if Bbsname="" then
      call AMH_error("论坛名称不能为空！")
      exit sub
    end if
    if int(Bbsid)>0 then
      sql="select top 1 bbs_order from AsaiMHBbsClass where class_id="&classid&" and bbs_f="&fo_id&" order by bbs_order desc"
      set rs=Cls.exec(sql,1)
      if not rs.eof then Bbsorder=rs(0)
      rs.close
      if int(Bbsid)>0 then call Cls.exec("update AsaiMHBbsClass set bbs_order=bbs_order+1 where class_id="&classid&" and bbs_order>"&Bbsorder,0)
    end if
    sql="select * from AsaiMHBbsClass"
    call Cls.exe_conn(rs,sql,3)
    rs.addnew
    rs("class_id")=classid
    rs("bbs_order")=Bbsorder+1
    rs("bbs_f")=Bbsf
    rs("bbs_n")=0
    if trim(request.form("bbs_w"))="yes" then
      rs("bbs_w")=true
    else
      rs("bbs_w")=false
    end if
    if int(Bbsf)=0 then
      rs("bbs_star")=0
    else
      rs("bbs_star")=Bbsstar+1
    end if
    rs("bbs_name")=Bbsname
    rs("bbs_remark")=Cls.code_admin("bbs_remark",1,250)
    rs("bbs_rule")=Cls.code_admin("bbs_rule",1,250)
    rs("bbs_power")=Cls.code_admin("bbs_power",1,50)
    rs("bbs_pic")=Cls.code_admin("bbs_pic",1,50)
    rs("bbs_hidden")=fhidden
    rs("bbs_pro")=Bbspro
    rs("bbs_type")=Bbstype
    rs("bbs_new_num")=0
    rs("bbs_topic_num")=0
    rs("bbs_data_num")=0
    rs("bbs_new_info")="|||"
    rs("bbs_config")="|||||||||||||||||||||||||||||||"
    rs("bbs_user")=Cls.code_remark("bbs_user")
    rs("bbs_Special")=Cls.code_admin("bbs_Special",1,250)
    rs.update
    rs.close
    dim firid
    firid=first_id("AsaiMHBbsClass","bbs_id")
    if Cls.Is_Null(Bbsparent)<>"" then
      call Cls.exec("update AsaiMHBbsClass set bbs_parent='"&Bbsparent&","&firid&"' where bbs_id="&firid,0)
    else
      call Cls.exec("update AsaiMHBbsClass set bbs_parent='"&firid&"' where bbs_id="&firid,0)
    end if
    if fhidden=false and Cls.Is_Null(Bbsparent)<>"" then
      call Cls.exec("update AsaiMHBbsClass set bbs_n=bbs_n+1 where class_id="&classid&" and bbs_id in ("&Bbsparent&")",0)
    end if
    call cache_class_clear()
    call AMH_msg("成功添加一个新的论坛（"&Bbsname&"）！","?",1)
    exit sub
  end if
  call form_first()
%>
<form action='?action=add&bbs_id=<%response.write Bbsid%>' method=post>
<input type=hidden name='chk' value='yes'>
<tr><td width='20%'>论坛名称：</td><td width='80%'><input type=text name=bbs_name size=30 maxlength=20></td></tr>
<tr><td>所属分类：</td><td><%call bbs_add_edit_list(Bbsid)%></td></tr>
<tr><td>论坛类型：</td><td><select name=bbs_type size=1><%
  ddim=split(Cls.ChannelOption,"|")
  for i=0 to ubound(ddim)
    response.write vbcrlf&"<option value='"&i+1&"'>"&right(ddim(i),len(ddim(i))-instr(ddim(i),":"))&"</option>"
  next
  erase ddim
%><option value='0' class=tr1>认证论坛</option></select></td></tr>
<tr><td>开放隐藏：</td><td><input type=checkbox name=bbs_hidden value='no' checked>&nbsp;（选上为开放，否则为隐藏）</td></tr>
<tr><td>论坛属性：</td><td><input type=radio name=bbs_pro value='0' checked>正常&nbsp;<input type=radio name=bbs_pro value='1'>只读</td></tr>
<tr><td>发贴模式：</td><td><input type=checkbox name=bbs_w value='yes' checked>&nbsp;（选上为可以发表新的主题）</td></tr>
<tr><td>论坛图片：</td><td><input type=text name=bbs_pic value='' size=30 maxlength=200> 例：<a title='代表 images/bbs_pic/sample.gif 这个图片<br />也可以直接填写图片的URL地址'>$sample.gif</a> （绝对地址也可以）</td></tr>
<tr><td>论坛版主：</td><td><input type=text name=bbs_power size=50 maxlength=50><br />多个请用“|”分开，如：“AsaiMH|super1|andy”</td></tr>
<tr><td>论坛说明：<br /><br /><=250字</td><td><textarea name=bbs_remark rows=5 cols=50></textarea></td></tr>
<tr><td>论坛规则：<br /><br /><=250字，支持html</td><td><textarea name=bbs_rule rows=5 cols=50></textarea></td></tr>
<tr>
<td>认证用户：<br /><br />只在论坛类型为“认证论坛”时有效<br />多个请用“<font class=red>,</font>”格开，<br />如：apple,allen,mary</td>
<td><textarea name=bbs_user rows=5 cols=50></textarea></td>
</tr>
<%
  call submit_add()
end sub

sub bbs_main()
  dim classname,nBbsid,Bbsname,Bbsn,Bbsstar,oclassid,foo,fi,cc,fclass,up_Down
  oclassid=0
%>
<tr align=center>
<td width='50%' class=td>论坛分类/名称,是否可发贴,是否隐藏,今日新贴,主题数,贴子数</td>
<td width='15%' class=td>添加分论坛</td>
<td width='35%' class=td>相关操作</td>
</tr>
<%
  sql="select bbs_id,class_id,bbs_name,bbs_type,bbs_w,bbs_n,bbs_star,bbs_hidden,bbs_pro,bbs_topic_num,bbs_data_num,bbs_new_num from AsaiMHBbsClass order by class_id,bbs_order,bbs_star"
  set rs=Cls.exec(sql,1)
  do while not rs.eof
    nBbsid=rs("bbs_id")
    classid=rs("class_id")
    Bbsname=rs("bbs_name")
    Bbsn=rs("bbs_n")
    Bbsstar=rs("bbs_star")
    fclass="blue"
    up_Down=2
    cc="tr"
    foo=""
    if classid<>oclassid then
      fclass="red2"
      up_Down=1
      cc="tr3"
      oclassid=classid
    end if
    for fi=1 to Bbsstar
      foo=foo&"　"
    next
%>
<tr class=<%response.write cc%> align=center>
<td>
  <table border=0 cellspacing=0 cellpadding=0 width='100%'>
  <tr class=<%response.write cc%>>
  <td><font class=<%response.write fclass%>><b><%response.write foo&Bbsname%></b></font><%
    if int(Bbsn)>0 then response.write " <font class=red>"&Bbsn&"</font>"
    if int(rs("bbs_type"))=0 then
      response.write "&nbsp;<font class=Gys>认证区</font>"
    end if
%></td>
  <td align=right><%
    if rs("bbs_w")=false then response.write "<font class=Gys>不可发贴</font>&nbsp;"
    if rs("bbs_hidden")=true then response.write "<font class=Gys>隐藏</font>&nbsp;"
    if rs("bbs_pro")=1 then response.write "<font class=Gys>只读</font>&nbsp;"
    response.write "<font class=tims><font class=red>"&rs("bbs_new_num")&"</font>,"&rs("bbs_topic_num")&","&rs("bbs_data_num")&"</font>"
%></td>
  </tr>
  </table>
</td>
<td><a href='?action=add&bbs_id=<%response.write nBbsid%>'>添加分论坛</a></td>
<td>
<a href='?action=edit&bbs_id=<%response.write nBbsid%>'>基本设置</a>&nbsp;
<a href='?action=edit_parameter&bbs_id=<%response.write nBbsid%>'>参数设置</a>&nbsp;
<a href='?action=restore&bbs_id=<%response.write nBbsid%>' onclick="javascript:return click_return('对 <%response.write Bbsname%> 进行主题等数据修复',0);">修复</a>&nbsp;
<a href='?action=del&bbs_id=<%response.write nBbsid%>' onclick="javascript:return click_return('删除论坛（<%response.write Bbsname%>）及其下属论坛',0);">删除</a>&nbsp;&nbsp;
<a href='?bbs_id=<%response.write nBbsid%>&action=orders&actions=up'><%response.write img_admin("up_"&up_Down,"向上移动此论坛")%></a>&nbsp;
<a href='?bbs_id=<%response.write nBbsid%>&action=orders&actions=Down'><%response.write img_admin("Down_"&up_Down,"向下移动此论坛")%></a>
</td>
</tr>
<%
    rs.movenext
  loop
  rs.close
end sub

sub bbs_edit_parameter()
  dim Bbsname,Bbsconfig,BbsSpecial
  sql="select top 1 bbs_name,bbs_config,bbs_Special from AsaiMHBbsClass where bbs_id="&Bbsid
  call Cls.exe_conn(rs,sql,3)
  if rs.eof then
    rs.close
    call AMH_msg("论坛ID（"&Bbsid&"）不存在！","?",1)
    exit sub
  end if
  Bbsname=rs("bbs_name")
  call AMH_td("论坛（"&Bbsname&"）参数设置 &nbsp;&nbsp;==>>[注：不设置或留空表示采用论坛默认设置]")
  if chk() then
    for i=0 to len_bbs_config
      Bbsconfig=Bbsconfig&Trim(Request.Form("config_"&i))&"|"
      'Bbsconfig=Bbsconfig&Cls.code_int("config_"&i,1)&"|"
    next
    if right(Bbsconfig,1)="|" then
      Bbsconfig=left(Bbsconfig,len(Bbsconfig)-1)
    end if
	BbsSpecial=Cls.code_admin("bbs_Special",1,250)
    rs("bbs_config")=Bbsconfig
	rs("bbs_Special")=BbsSpecial
    rs.update
    rs.close
    call cache_class_clear()
    call AMH_msg("成功对论坛（"&Bbsname&"）进行了参数设置！","?action=edit_parameter&bbs_id="&Bbsid,1)
    exit sub
  end if
  call form_first()
  Bbsconfig=rs("bbs_config")
  Bbsconfig=split(Bbsconfig,"|")
  BbsSpecial=rs("bbs_Special")
%>
<form name=add_frm action='?action=edit_parameter&bbs_id=<%response.write Bbsid%>' method=post>
<input type=hidden name='chk' value='yes'>
<tr>
<td width="20%">开放用户信息：</td>
<td width="80%"><input type=radio name=config_17 value='0'<% if Bbsconfig(17)="0" then response.write " checked" %>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_17 value='1'<% if Bbsconfig(17)="1" then response.write " checked" %>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_17 value=''<% if Bbsconfig(17)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","开放用户信息","默认值：关闭<br />是否开放用户联系信息，浏览用户信息时对于管理员及好友无效")%></td>
</tr>
<tr>
<td>论坛验证码：</td>
<td><input type=radio name=config_16 value='0'<%if Bbsconfig(16)="0" then response.write " checked"%>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_16 value='1'<%if Bbsconfig(16)="1" then response.write " checked"%>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_16 value=''<% if Bbsconfig(16)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","论坛验证码","默认值：开启<br />是否开放论坛发布信息验证机制")%></td>
</tr>
<tr>
<td>规则导航显示：</td>
<td><input type=radio name=config_0 value='0'<%if Bbsconfig(0)="0" then response.write " checked"%>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_0 value='1'<%if Bbsconfig(0)="1" then response.write " checked"%>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_0 value=''<% if Bbsconfig(0)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","论坛导航显示","默认值：开启<br />是否显示论坛导航与论坛规则")%></td>
</tr>
<tr>
<td>论坛版主显示：</td>
<td><input type=radio name=config_1 value='0'<%if Bbsconfig(1)="0" then response.write " checked"%>>&nbsp;文字链接&nbsp;&nbsp;<input type=radio name=config_1 value='1'<%if Bbsconfig(1)="1" then response.write " checked"%>>&nbsp;下拉菜单框&nbsp;&nbsp;<input type=radio name=config_1 value=''<% if Bbsconfig(1)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","论坛版主显示","默认值：文字链接<br />论坛版主显示方式")%></td>
</tr>
<tr>
<td>论坛事件保密：</td>
<td><input type=radio name=config_2 value='0'<%if Bbsconfig(2)="0" then response.write " checked"%>>&nbsp;不保密&nbsp;&nbsp;<input type=radio name=config_2 value='1'<%if Bbsconfig(2)="1" then response.write " checked"%>>&nbsp;保密&nbsp;&nbsp;<input type=radio name=config_2 value=''<% if Bbsconfig(2)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","论坛事件保密","默认值：不保密<br />论坛操作时间保密机制，管理员无效。")%></td>
</tr>
<tr>
<td>论坛导航样式：</td>
<td><input type=radio name=config_28 value='0'<%if Bbsconfig(28)="0" then response.write " checked"%>>&nbsp;分离&nbsp;&nbsp;<input type=radio name=config_28 value='1'<%if Bbsconfig(28)="1" then response.write " checked"%>>&nbsp;合并&nbsp;&nbsp;<input type=radio name=config_28 value=''<% if Bbsconfig(28)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","论坛导航样式","默认值：分离<br />论坛论坛导航样式，管理员无效。")%></td>
</tr>
<tr>
<td>内容检测中文字符：</td>
<td><input type=radio name=config_29 value='0'<%if Bbsconfig(29)="0" then response.write " checked"%>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_29 value='1'<%if Bbsconfig(29)="1" then response.write " checked"%>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_29 value=''<% if Bbsconfig(29)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","论坛内容字符检测就是否存在中文开关","默认值：关闭")%></td>
</tr>
<tr class=tr1>
<td>购买贴可用：</td>
<td><input type=radio name=config_19 value='0'<%if Bbsconfig(19)="0" then response.write " checked"%>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_19 value='1'<%if Bbsconfig(19)="1" then response.write " checked"%>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_19 value=''<% if Bbsconfig(19)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","购买贴可用","默认值：关闭<br />是否可用购买贴")%></td>
</tr>
<tr class=tr1>
<td>可见贴可用：</td>
<td><input type=radio name=config_20 value='0'<%if Bbsconfig(20)="0" then response.write " checked"%>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_20 value='1'<%if Bbsconfig(20)="1" then response.write " checked"%>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_20 value=''<% if Bbsconfig(20)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","可见贴可用","默认值：关闭<br />是否可用可见贴")%></td>
</tr>
<tr class=tr1>
<td>回复贴可用：</td>
<td><input type=radio name=config_21 value='0'<%if Bbsconfig(21)="0" then response.write " checked"%>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_21 value='1'<%if Bbsconfig(21)="1" then response.write " checked"%>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_21 value=''<% if Bbsconfig(21)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","回复贴可用","默认值：关闭<br />是否可用回复贴")%></td>
</tr>
<tr class=tr1>
<td>指定贴可用：</td>
<td><input type=radio name=config_22 value='0'<%if Bbsconfig(22)="0" then response.write " checked"%>>&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_22 value='1'<%if Bbsconfig(22)="1" then response.write " checked"%>>&nbsp;开启&nbsp;&nbsp;<input type=radio name=config_22 value=''<% if Bbsconfig(22)="" then response.write " checked" %>>&nbsp;不设置&nbsp;&nbsp;<%Call AMH_Read("","指定贴可用","默认值：关闭<br />是否可用指定贴")%></td>
</tr>
<tr class=tr1>
<td>专题功能可用：</td>
<td><input type=radio name=config_23 value='0'<%if Bbsconfig(23)<>"1" then response.write " checked"%> onClick="BbsSpecial.style.display='none'">&nbsp;关闭&nbsp;&nbsp;<input type=radio name=config_23 value='1'<%if Bbsconfig(23)="1" then response.write " checked"%> onClick="BbsSpecial.style.display=''">&nbsp;开启&nbsp;&nbsp;<%Call AMH_Read("","专题功能可用","默认值：关闭<br />是否可用专题功能<br />选择专题功能可用以后,此处内容必须填写,否则视为不启用专题功能.")%></td>
</tr>
<tr id='BbsSpecial' <%if Bbsconfig(23)<>"1" then response.Write " style='display:none'"%>>
<td>包含专题信息：</td>
<td><input name=bbs_Special type=text value='<%=BbsSpecial%>' size=50 maxlength=250 id=bbs_Special>【<font class=red onclick="window.open('AMH_bbs_SpecialList.asp?ChannelIDs=4', 'SpecialList', 'width=400,height=450,resizable=0,scrollbars=yes');" style="cursor:hand;">选择</font>】&nbsp;&nbsp;<%call AMH_read("","包含专题信息","选择从属该版块的主题.")%></td>
</tr>
<tr>
<td>论坛列表页显示数：</td>
<td><input type=text name=config_3 value='<%response.write Bbsconfig(3)%>' size=10 maxlength=20>&nbsp;贴&nbsp;&nbsp;<%Call AMH_Read("","论坛列表页显示数","默认值：0<br />论坛列表页显示数，当该值大于0时，取频道机制中列表值")%></td>
</tr>
<tr>
<td>论坛浏览页显示数：</td>
<td><input type=text name=config_4 value='<%response.write Bbsconfig(4)%>' size=10 maxlength=20>&nbsp;贴&nbsp;&nbsp;<%Call AMH_Read("","论坛浏览页显示数","默认值：10")%></td>
</tr>
<tr>
<td>论坛发贴最小长度：</td>
<td><input type=text name=config_5 value='<%response.write Bbsconfig(5)%>' size=10 maxlength=20>&nbsp;B（字节）&nbsp;&nbsp;<%Call AMH_Read("","论坛发贴最小长度","默认值：5")%></td>
</tr>
<tr>
<td>论坛发贴最大长度：</td>
<td><input type=text name=config_6 value='<%response.write Bbsconfig(6)%>' size=10 maxlength=20>&nbsp;KB（千字节）&nbsp;&nbsp;<%Call AMH_Read("","论坛发贴最大长度","默认值：12")%></td>
</tr>
<tr>
<td>论坛发新贴得分：</td>
<td><input type=text name=config_7 value='<%response.write Bbsconfig(7)%>' size=10 maxlength=20>&nbsp;分&nbsp;&nbsp;<%Call AMH_Read("","论坛发新贴得分","默认值：3")%></td>
</tr>
<tr>
<td>论坛回贴得分：</td>
<td><input type=text name=config_8 value='<%response.write Bbsconfig(8)%>' size=10 maxlength=20>&nbsp;分&nbsp;&nbsp;<%Call AMH_Read("","论坛回贴得分","默认值：1")%></td>
</tr>
<tr>
<td>论坛发新贴扣除体力：</td>
<td><input type=text name=config_24 value='<%response.write Bbsconfig(24)%>' size=10 maxlength=20>&nbsp;点&nbsp;&nbsp;<%Call AMH_Read("","论坛发贴增加体力","默认值：2")%></td>
</tr>
<tr>
<td>论坛回贴扣除体力：</td>
<td><input type=text name=config_25 value='<%response.write Bbsconfig(25)%>' size=10 maxlength=20>&nbsp;点&nbsp;&nbsp;<%Call AMH_Read("","论坛回贴扣体力","默认值：1")%></td>
</tr>
<tr>
<td>论坛发新贴增加经验：</td>
<td><input type=text name=config_26 value='<%response.write Bbsconfig(26)%>' size=10 maxlength=20>&nbsp;点&nbsp;&nbsp;<%Call AMH_Read("","论坛发贴增加经验","默认值：1")%></td>
</tr>
<tr>
<td>论坛回帖增加经验：</td>
<td><input type=text name=config_27 value='<%response.write Bbsconfig(27)%>' size=10 maxlength=20>&nbsp;点&nbsp;&nbsp;<%Call  AMH_Read("","论坛回帖增加经验","默认值：1")%></td>
</tr>
<tr>
<td>论坛发颜色贴扣分：</td>
<td><input type=text name=config_9 value='<%response.write Bbsconfig(9)%>' size=10 maxlength=20>&nbsp;分&nbsp;&nbsp;<%Call AMH_Read("","论坛发颜色贴扣分","默认值：3")%></td>
</tr>
<tr>
<td>论坛发加粗贴扣分：</td>
<td><input type=text name=config_10 value='<%response.write Bbsconfig(10)%>' size=10 maxlength=20>&nbsp;分&nbsp;&nbsp;<%Call AMH_Read("","论坛发加粗贴扣分","默认值：3")%></td>
</tr>
<tr>
<td>论坛热贴回贴数：</td>
<td><input type=text name=config_11 value='<%response.write Bbsconfig(11)%>' size=10 maxlength=20>&nbsp;贴&nbsp;&nbsp;<%Call AMH_Read("","论坛热贴回贴数","默认值：10")%></td>
</tr>
<tr>
<td>论坛投票项数：</td>
<td><input type=text name=config_12 value='<%response.write Bbsconfig(12)%>' size=10 maxlength=20>&nbsp;项&nbsp;&nbsp;<%Call AMH_Read("","论坛投票项数","默认值：10")%></td>
</tr>
<tr>
<td>主题管理最高值：</td>
<td><input type=text name=config_13 value='<%response.write Bbsconfig(13)%>' size=10 maxlength=20>&nbsp;分&nbsp;&nbsp;<%Call AMH_Read("","主题管理最高值","默认值：10")%></td>
</tr>
<tr>
<td>论坛不可回复时间：</td>
<td><input type=text name=config_14 value='<%response.write Bbsconfig(14)%>' size=10 maxlength=20>&nbsp;天&nbsp;&nbsp;<%Call AMH_Read("","论坛不可回复时间","默认值：30")%></td>
</tr>
<tr>
<td>论坛不可编辑时间：</td>
<td><input type=text name=config_15 value='<%response.write Bbsconfig(15)%>' size=10 maxlength=20>&nbsp;天&nbsp;&nbsp;<%Call AMH_Read("","论坛不可编辑时间","默认值：30")%></td>
</tr>
<tr>
<td>论坛在线人数限制：</td>
<td><input type=text name=config_18 value='<%response.write Bbsconfig(18)%>' size=10 maxlength=20>&nbsp;人&nbsp;&nbsp;<%Call AMH_Read("","当前论坛允许在线人数限制","默认值：50")%></td>
</tr>
<%
  erase Bbsconfig
  rs.close
  call submit_edit()
end sub
'=====================================================
'AsaiMH 3.5 Sp2 网站内容管理系统
'Copyright (C) 2003-2007 77ya.Com All Rights Reserved.
'======================================================
%>
