<% Const MaxDepth=5 '可以自由设置最大论坛等级深度,默认为5级论坛 Head() CheckString "11" Response.Write "
论坛版面管理
论坛管理】【增加分类】【增加论坛】【分类排序】【论坛整理】【论坛合并
" Select Case Request("Action") Case "AddClass" CheckString "12" AddClass Case "SaveClass" :SaveClass Case "EditClass" :EditClass Case "SaveEditClass" :SaveEditClass Case "DelClass" :DelClass Case "AddBoard" CheckString "13" AddBoard Case "SaveBoard" :SaveBoard Case "EditBoard" :EditBoard Case "SaveEditBoard" :SaveEditBoard Case "DelBoard" :DelBoard Case "ClassOrders" :ClassOrders Case "SaveClassOrders" :SaveClassOrders Case "BoardUnite" :BoardUnite Case "SaveBoardUnite" :SaveBoardUnite Case "ClearData" :ClearData Case "StartClearData" :StartClearData Case "PassUser" :PassUser Case "SavePassUser" :SavePassUser Case "BoardUpdate" :BoardUpdate Case "OrdersTopBoard" :OrdersTopBoard Case else BoardInfo() end select Footer() Sub BoardInfo Dim Brs,i,Install,Temp,II,Po,Strings,BoardTypeName Response.Write"
论坛版块
" Set Rs=MNBoard.execute("Select BoardID,BoardName,ParentID,Depth,Child,Strings from [i_board] order by Rootid,orders") If Rs.Bof Then Response.Write "
论坛版面类别相应操作
" GoBack "","论坛没有分类!请先 添加分类" Exit Sub End If Brs=Rs.GetRows(-1) Rs.close For I=0 To Ubound(Brs,2) Temp="" Install=""&IconA&"添加论坛" If Brs(3,i)=0 Then'分类 BoardTypeName="分类" Temp="" If Brs(4,i)>0 Then'如果有子论坛 Temp=Temp&Brs(1,i)&" ("&Brs(4,i)&")" Else Temp=Temp&Brs(1,i) End If Install=Install &""&IconE&"编辑分类 " If Brs(4,i)>0 Then Install=Install &"" Else Install=Install &"" End If Install=Install&IconD&"删除分类" Else'版面 Strings=Split(Brs(5,i),"|") If Strings(7)="1" Then BoardTypeName="锁定论坛" ElseIf Strings(6)="1" or Strings(5)="1" Then BoardtypeName="特殊论坛" ElseIf Strings(9)="1" or Strings(3)="1" Then BoardTypeName="限制论坛" Else BoardtypeName="普通论坛" End If If Strings(0)="1" Then BoardtypeName=BoardtypeName&"(类)" Po="" For II=1 To Brs(3,i) Po=Po&"| " Next If Brs(4,i)>0 Then'如果有子论坛 Temp=Temp&Po&Brs(1,i)&" ("&Brs(4,i)&")" Else Temp=Temp&Po&Brs(1,i) End If Install=Install &""&IconE&"版面设置" If Brs(4,i)>0 Then Install=Install &" "&IconD&"删除版面" Else Install=Install &" "&IconD&"删除论坛" End If Install=Install &" 清理数据" Install=Install & " 排序置上" If Strings(6)="1" Then Install=Install & " 认证用户" End If End If Response.Write Temp&""&BoardTypeName&""&Install&"" Next Response.Write"" End Sub Sub AddClass Dim NewBoardID Set Rs=MNBoard.Execute("select Max(BoardID) from [i_Board]") IF Rs.Eof or Rs.Bof Then NewBoardID=1 Else NewBoardID=Rs(0)+1 End If If Not isnumeric(NewBoardID) Then NewBoardID=1 Rs.Close Response.Write"
添加分类
" DIVTR"分类名称:","论坛的分类名称","",40,1 DIVTR"论坛简洁显示:","设置版面的下属论坛是否以简洁方式显示","是",40,1 DIVTR"简洁显示个数:","当设置为简洁显示,每一行显示的个数","个",40,1 Response.Write"
" End Sub Sub SaveClass Dim BoardName,NewBoardID,MaxRootID,Rs,S1,S2,Temp BoardName=Replace(MNBoard.Fun.GetStr("BoardName"),",",",") NewBoardID=MNBoard.Fun.GetStr("NewBoardID") S1=MNBoard.Fun.GetStr("s1") S2=MNBoard.Fun.GetStr("s2") IF BoardName="" Or Not isnumeric(NewBoardID) Then GoBack"","":Exit Sub Else Set Rs=MNBoard.Execute("select BoardID from [i_Board] where BoardID="&NewBoardID) If Not (rs.eof and rs.bof) then GoBack"内部系统出错","不能指定和别的论坛一样的序号,如果不能解决此问题,请到MNBoard官方论坛寻求帮助!" Exit Sub End if Rs.Close Set Rs=MNBoard.Execute("Select Max(RootID) From [i_Board]") MaxRootID=Rs(0)+1 If isnull(MaxRootID) then MaxRootID=1 Rs.Close MNBoard.execute("Insert into [i_Board](BoardName,BoardID,RootID,Depth,ParentID,Orders,Child,ParentStr,Strings)Values('"&BoardName&"',"&NewBoardID&","&MaxRootID&",0,0,0,0,'0','0|"&s1&"|"&s2&"|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0')") MNBoard.Cache.clean("BoardInfo") Temp="添加了论坛分类 "&BoardName&" 成功!" MNBoard.netLog "操作后台_"&Temp Suc"",Temp,"?" End If End Sub Sub EditClass Dim BoardID,Rs,Strings Set Rs=MNBoard.Execute("Select BoardName,Strings from[i_Board] where BoardID="&MNBoard.BoardID&"") If Rs.Eof Then GoBack "系统出错","论坛找不到这个分类,可能已经删除了。":Exit Sub End If Strings=Split(Rs(1),"|") Response.Write"
编辑分类
" DIVTR"分类名称:","修改论坛分类的名称","",40,1 DIVTR"论坛简洁显示:","设置版面的下属论坛是否以简洁方式显示",GetRadio("s1","否",Strings(1),0)&GetRadio("s1","是",Strings(1),1),40,1 DIVTR"简洁显示个数:","当设置为简洁显示,每一行显示的个数","个",40,1 Response.Write"
" Rs.Close End Sub Sub SaveEditClass Dim BoardName,BoardID,S1,S2,Temp BoardName=Replace(MNBoard.Fun.GetStr("BoardName"),",",",") BoardID=Request.Form("BoardID") S1=MNBoard.Fun.GetStr("s1") S2=MNBoard.Fun.GetStr("s2") IF BoardName="" Or Not isnumeric(BoardID) Then GoBack"","":Exit Sub Else If MNBoard.Execute("select BoardID from [i_Board] where BoardID="&BoardID).eof then GoBack"系统出错","论坛找不到这个分类,可能已经删除了。":Exit Sub End if MNBoard.execute("Update [i_Board] Set BoardName='"&BoardName&"',Strings='0|"&s1&"|"&s2&"|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0' where BoardID="&BoardID) Temp="论坛分类名称改为 "&BoardName&" 成功!" MNBoard.netLog "操作后台_"&Temp MNBoard.Cache.clean("BoardInfo") Suc "",Temp,"?" End If End Sub Sub DelClass Dim Temp IF MNBoard.Execute("Select Count(BoardID) From[i_Board] where ParentID="&MNBoard.BoardID)(0)=0 Then MNBoard.Execute("Delete From[i_Board] where ParentID=0 And BoardID="&MNBoard.BoardID) MNBoard.Cache.clean("BoardInfo") Temp="删除论坛分类成功!" MNBoard.netLog "操作后台_"&Temp Suc"",Temp,"?" End If End Sub Sub DelBoard Dim AllTable,I,II,Depth,ParentID,RootID,Orders,Temp Set Rs=MNBoard.Execute("Select Depth,ParentID,RootID,Orders,Child From[i_Board] where BoardID="&MNBoard.BoardID) If Rs.Eof Then Goback"","不存在,论坛可能已经删除了 !" Exit Sub ElseIf Rs(4)>0 Then Goback"","该论坛含有属下论坛,不能删除 !" Exit sub Else Depth=Rs(0) ParentID=Rs(1) RootID=Rs(2) Orders=Rs(3) End If Rs.Close AllTable=Split(MNBoard.BBStable(0),",") For i=0 To uBound(AllTable) MNBoard.Execute("Delete from [i_Bbs"&AllTable(i)&"] where BoardID="&MNBoard.BoardID&"") Next Set Rs=MNBoard.Execute("Select TopicID From[i_Topic] where BoardID="&MNBoard.BoardID&" And IsVote=1 ") Do While Not Rs.Eof MNBoard.Execute("Delete from [i_TopicVote] where TopicID="&Rs(0)) MNBoard.Execute("Delete from [i_TopicVoteUser] where TopicID="&Rs(0)) Rs.MoveNext Loop Rs.Close '删除主题记录 MNBoard.Execute("Delete From[i_Topic] where BoardID="&MNBoard.BoardID) MNBoard.Execute("Delete From[i_Board] where BoardID="&MNBoard.BoardID) '更新其父类的版面数 MNBoard.Execute("update [i_Board] set Child=child-1 where BoardID="&ParentID) '更新其父类的其它版面排序 MNBoard.Execute("Update [i_Board] Set Orders=Orders-1 where RootID="&RootID&" and Orders>"&Orders) '更新其所属论坛数据 For II=1 to Depth '得到其父类的父类的版面ID Set rs=MNBoard.Execute("select ParentID from [i_Board] where BoardID="&ParentID) if not (rs.eof and rs.bof) then ParentID=rs(0) '更新其父类的父类版面数 MNBoard.Execute("update [i_Board] set child=child-1 where boardid="&ParentID) End IF Rs.Close Next MNBoard.Cache.clean("BoardInfo") MNBoard.Cache.clean("Board"&MNBoard.BoardID) Temp="成功的删除论坛版面 (包括该论坛的所有帖子)!" MNBoard.netLog "操作后台_"&Temp Suc"",Temp,"Admin_Board.asp" End Sub Sub AddBoard If MNBoard.execute("Select BoardID from [i_Board] where Depth=0").Eof Then GoBack"","没有分类不能添加论坛!请先 添加分类" Exit Sub End if Response.Write"
" Response.Write"
论坛添加
" DIVTR"属于分类或论坛:","选择要属于那个分类或那个论坛","*",40,1 DIVTR"论坛名称:","论坛版面的名称","*",40,2 DIVTR"标志图片:","论坛版面Logo地址,可以不填","",40,1 DIVTR"论坛介绍:","论坛版面描述","*",58,2 DIVTR"作为小类:","是否设置为类,设置后该版面不能发帖","是",40,1 DIVTR"论坛简洁显示:","设置版面的下属论坛是否以简洁方式显示","是",40,2 DIVTR"简洁显示个数:","当设置为简洁显示,每一行显示的个数","个",40,1 DIVTR"论坛类型:","设置论坛的类型,可以多选","会员(只有会员才能浏览帖子)
只读(可以浏览帖子,但只有站长、超版、版主能发帖)
VIP(只有vip用户才能进入)
认证(只有通过认证的用户才能进入)",90,2 DIVTR"锁定论坛:","论坛除了站长外一律不得进入","开放锁定",40,1 DIVTR"设置限制:","用户达到这些资源便可以进入","帖数:
"&MNBoard.Info(121)&":
"&MNBoard.Info(120)&":
"&MNBoard.Info(122)&":",120,2 DIVTR"上传设置:","当论坛系统默认禁止上传后,将不起作用。","禁止 全部会员 只有VIP会员",40,1 Response.Write"
" End Sub Sub SaveBoard Dim Strings(14),BoardName,Introduce,BoardImg,ParentID,NewBoardID,RootID,Depth,Child,Orders,ParentStr,I BoardName=Replace(MNBoard.Fun.GetStr("BoardName"),",",",") Introduce=MNBoard.Fun.GetStr("Introduce") BoardImg=MNBoard.Fun.GetStr("BoardImg") ParentID=MNBoard.Fun.GetStr("ParentID") For i =0 to 14 Strings(i)=Request.Form("s"&i) If Strings(i)="" Then Strings(i)=0 If Not Isnumeric(strings(i)) Then GoBack"","一些项目必需用数字填写!":Exit Sub Next '如果设置限制资源 For I=10 To 13 If Int(Strings(I))>0 Then Strings(9)=1 Exit For End If Next If Not isnumeric(ParentID) or BoardName="" Or Introduce="" Then GoBack"","":Exit Sub End If Set Rs=MNBoard.Execute("select Max(BoardID) from [i_Board]") IF Rs.Eof or Rs.Bof Then GoBack"","没有分类不能添加论坛!请先添加分类" Exit Sub Else NewBoardID=Rs(0)+1 End If Rs.Close Set Rs=MNBoard.execute("Select RootID,Depth,Child,Orders,ParentStr,ParentID From[i_Board] where BoardID="&ParentID&"") IF Rs.Eof or Rs.Bof Then GoBack"系统程式出错!","没有指定父类或父论坛!" Exit Sub End If RootID=Rs(0) Depth=Rs(1) Child=Rs(2) Orders=Rs(3) ParentStr=Rs(4) Rs.Close If Depth+1>MaxDepth Then GoBack "","考滤到论坛的实用易用,本论坛限制了最多只能有" & MaxDepth & "级论坛。^_^" Exit Sub End If If ParentStr=0 Then ParentStr=ParentID Else ParentStr=ParentStr & "," & ParentID End If MNBoard.execute("Insert into [i_Board](BoardID,BoardName,Introduce,BoardImg,RootID,Depth,ParentID,ParentStr,Orders,Child,Strings,LastReply)Values("&NewBoardID&",'"&BoardName&"','"&Introduce&"','"&BoardImg&"',"&RootID&","&Depth+1&","&ParentID&",'"&ParentStr&"',"&Orders+1&",0,'"&join(Strings,"|")&"','|||||||||')") If ParentID<>0 then If Depth>0 then '当上级分类深度大于0的时候要更新其父类(或父类的父类)的版面数和相关排序 For i=1 to Depth '更新其父类版面数 MNBoard.Execute("update [i_Board] set Child=Child+1 where BoardID="&parentID) '得到其父类的父类的版面ID Set rs=MNBoard.Execute("select ParentID from [i_Board] where BoardID="&parentID) If not (rs.eof and rs.bof) then ParentID=rs(0) End if Rs.Close '当循环次数大于1并且运行到最后一次循环的时候直接进行更新 If i=depth then MNBoard.Execute("update [i_Board] set Child=Child+1 where BoardID="&parentID) End if next '更新该版面排序以及大于本需要和同在本分类下的版面排序序号 MNBoard.Execute("update [i_Board] set Orders=orders+1 where RootID="&RootID&" And orders>"&orders) MNBoard.Execute("update [i_Board] set Orders="&Orders&"+1 where BoardID="&NewBoardID&"") Else '当上级分类深度为0的时候只要更新上级分类版面数 MNBoard.Execute("update [i_Board] set child=child+1 where Boardid="&ParentID) Set rs=MNBoard.Execute("select max(Orders) from [i_Board]") MNBoard.Execute("update [i_Board] set Orders="&rs(0)&"+1 where BoardID="&NewBoardID ) Rs.Close End if End if If Strings(6)="1" Then Suc"","成功的添加了论坛 "&BoardName&" !
  • 此论坛为认证论坛,暂时只有最高管理员能够进入。
  • 你可以通过 管理 项目来添加可以进入该论坛的用户","Admin_Board.asp" Else Suc"","成功的添加了论坛 "&BoardName&" !","Admin_Board.asp" End IF MNBoard.netLog"操作后台_添加论坛"&BoardName&"成功!" MNBoard.Cache.clean("BoardInfo") MNBoard.Cache.clean("Board"&NewBoardID) End Sub Sub EditBoard Dim BoardName,Strings,Introduce,BoardImg,ParentID Dim Temp,Chk Set Rs=MNBoard.execute("Select ParentID,BoardName,Strings,Introduce,BoardImg From[i_Board] Where BoardID="&MNBoard.BoardID&"") If Rs.eof Then GoBack"","该版面不存在,可能已经删除了" Exit Sub Else ParentID=Rs(0) BoardName=Rs(1) Strings=split(Rs(2),"|") Introduce=Rs(3) BoardImg=Rs(4) End IF Rs.Close Response.Write"
    " Response.Write"
    编辑论坛
    " DIVTR"论坛名称:","论坛版面的名称","*",40,1 DIVTR"属于分类或论坛:","选择要属于那个分类或那个论坛","*",40,2 DIVTR"标志图片:","论坛版面Logo地址,可以不填","",40,1 DIVTR"论坛介绍:","论坛版面描述","*",58,2 DIVTR"作为小类:","是否设置为类,设置后该版面不能发帖",GetRadio("s0","否",Strings(0),0)&GetRadio("s0","是",Strings(0),1),40,1 DIVTR"论坛简洁显示:","设置版面的下属论坛是否以简洁方式显示",GetRadio("s1","否",Strings(1),0)&GetRadio("s1","是",Strings(1),1),40,2 DIVTR"简洁显示个数:","当设置为简洁显示,每一行显示的个数","个",40,1 If Strings(3)="1" Then Chk="checked" Else Chk="" Temp="会员(只有会员才能浏览帖子)
    " If Strings(4)="1" Then Chk="checked" Else Chk="" Temp=Temp&"只读(可以浏览帖子,但只有站长、超版、版主能发帖)
    " If Strings(5)="1" Then Chk="checked" Else Chk="" Temp=Temp&"VIP(只有vip用户才能进入)
    " If Strings(6)="1" Then Chk="checked" Else Chk="" Temp=Temp&"认证(只有通过认证的用户才能进入)" DIVTR"论坛类型:","设置论坛的类型,可以多选",Temp,90,2 DIVTR"锁定论坛:","论坛除了站长外一律不得进入",GetRadio("s7","开放",Strings(7),0)&GetRadio("s7","锁定",Strings(7),1),40,1 DIVTR"设置限制:","用户达到这些资源便可以进入","帖数:
    "&MNBoard.Info(121)&":
    "&MNBoard.Info(120)&":
    "&MNBoard.Info(122)&":",90,2 DIVTR"上传设置:","当论坛系统默认禁止上传后,将不起作用。",GetRadio("s14","禁止",Strings(14),0)&GetRadio("s14","全部会员",Strings(14),1)&GetRadio("s14","只有VIP会员",Strings(14),2),40,1 Response.Write"
    " End Sub Sub SaveEditBoard Dim Strings(14),BoardID,BoardName,Introduce,BoardImg,ParentID,RootID,Depth,Child,Orders,ParentStr,I Dim NewParentID,BoardNum,P_Rs BoardID=MNBoard.Fun.GetStr("BoardID") BoardName=Replace(MNBoard.Fun.GetStr("BoardName"),",",",") Introduce=MNBoard.Fun.GetStr("Introduce") BoardImg=MNBoard.Fun.GetStr("BoardImg") NewParentID=MNBoard.Fun.GetStr("ParentID") For i =0 to 14 Strings(i)=Request.Form("s"&i) If Strings(i)="" Then Strings(i)=0 If Not Isnumeric(strings(i)) Then GoBack"","一些项目必需用数字填写!":Exit Sub Next '如果设置限制资源 For I=10 To 13 If Int(Strings(I))>0 Then Strings(9)=1 Exit For End If Next If Not isnumeric(NewParentID) or BoardName="" Or Introduce="" Then GoBack"","":Exit Sub ElseIF BoardID=NewParentID Then GoBack"","所属论坛不能指定自己!":Exit Sub End If Set Rs=MNBoard.execute("Select RootID,Depth,Child,Orders,ParentID,ParentStr From[i_Board] where BoardID="&BoardID) IF Rs.Eof or Rs.Bof Then GoBack"系统出错!","该版面不存在,可能已经删除了!" Exit Sub End If RootID=Rs(0) Depth=Rs(1) Child=Rs(2) Orders=Rs(3) ParentID=Rs(4) ParentStr=Rs(5) Rs.Close If ParentID=0 then GoBack"系统出错!","分类不能设置":Exit Sub ElseIf Int(NewParentID)<>Int(ParentID) Then '判断所指定的论坛是否其下属论坛 Set Rs=MNBoard.Execute("select BoardID from [i_board] where ParentStr like '%"&ParentStr&","&BoardID&"%' and BoardID="&NewParentID) if not (Rs.eof and Rs.bof) then GoBack"","您不能指定该版面的下属子论坛作为所属论坛" Exit sub End if Rs.Close '获得新选的父级 Set P_rs=MNBoard.Execute("select * from [i_board] where Boardid="&NewParentID) If P_rs("Depth")+1> MaxDepth Or (Child>0 And P_Rs("Depth")+2>MaxDepth) Then GoBack "","本论坛限制了最多只能有" & MaxDepth & "级论坛。如果想使用更多级论坛,请到MNBoard官方论坛寻求帮助!" P_rs.Close Set P_rs=Nothing Exit Sub End If End if MNBoard.Execute("Update [i_Board] Set BoardName='"&BoardName&"',Strings='"&Join(Strings,"|")&"',Introduce='"&Introduce&"',BoardImg='"&BoardImg&"' where BoardID="&BoardID&"") If Int(NewParentID)<>Int(ParentID) Then '将一个分论坛移动到其他分论坛下 '获得所指定的论坛的相关信息 '得到其下属版面数 ParentStr=ParentStr & "," BoardNum=MNBoard.Execute("select count(*) from [i_Board] where ParentStr like '%"&ParentStr & BoardID&"%'")(0) If Isnull(BoardNum) Then BoardNum=1 '在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据 MNBoard.Execute("update [i_Board] set orders=Orders + "&BoardNum&"+1 where RootID="&P_rs("RootID")&" And orders>"&P_rs("orders")&"") '更新当前版面数据 If P_rs("parentstr")="0" Then MNBoard.Execute("update [i_Board] set Depth="&P_Rs("Depth")&"+1,orders="&P_Rs("orders")&"+1,rootid="&P_rs("Rootid")&",ParentID="&NewParentID&",ParentStr='" & P_Rs("BoardID") & "' Where BoardID="&BoardID) Else MNBoard.Execute("update [i_Board] set Depth="&P_Rs("Depth")&"+1,orders="&P_Rs("orders")&"+1,rootid="&P_rs("Rootid")&",ParentID="&NewParentID&",ParentStr='" & P_Rs("ParentStr") & ","& P_Rs("BoardID") &"' Where BoardID="&BoardID) End If Dim TempParentStr i=1 '更新下属,同时获得移动总数i '如果有则更新下属版面数据 '深度为原有深度加上当前所属论坛的深度 Set Rs=MNBoard.Execute("select * from [i_Board] where ParentStr like '%"&ParentStr & BoardID&"%' order by orders") Do while not rs.eof i=i+1 If P_rs("parentstr")="0" Then'如果其父级为类,那么其下属的版面数据 TempParentStr=P_rs("boardid") & "," & Replace(rs("parentstr"),ParentStr,"") Else TempParentStr=P_rs("parentstr") & "," & P_rs("boardID") & "," & replace(Rs("Parentstr"),ParentStr,"") End If MNBoard.Execute("update [i_Board] set depth=depth+"&P_rs("depth")&"-"&depth&"+1,orders="&P_rs("orders")&"+"&I&",Rootid="&P_rs("Rootid")&",ParentStr='"&TempParentStr&"' where BoardID="&Rs("BoardID")) Rs.movenext Loop Rs.Close Dim TempParentID,II TempParentID=NewParentID If RootID=P_rs("RootID") then'在同一分类下移动 '更新所指向的上级论坛版面数,i为本次移动过来的版面数 '更新其父类版面数 MNBoard.Execute("update [i_Board] set Child=child+"&i&" where (not ParentID=0) and BoardID="&TempParentID) For II=1 to P_Rs("depth") '得到其父类的父类的版面ID Set Rs=MNBoard.Execute("Select ParentID from [i_Board] where (not ParentID=0) and BoardID="&TempParentID) If Not (rs.eof and rs.bof) then TempParentid=Rs(0) '更新其父类的父类版面数 MNBoard.Execute("update [i_Board] set Child=child+"&i&" where (not ParentID=0) and BoardID="&TempParentID) End if Next '更新其原父类版面数 MNBoard.Execute("update [i_Board] set Child=child-"&i&" where (not ParentID=0) and BoardID="&ParentID) '更新其原来所属论坛数据 For II=1 to Depth '得到其原父类的父类的版面ID Set rs=MNBoard.Execute("select ParentID from [i_Board] where (not ParentID=0) and BoardID="&ParentID) if not (rs.eof and rs.bof) then ParentID=rs(0) '更新其原父类的父类版面数 MNBoard.Execute("update [i_Board] set child=child-"&i&" where (not ParentID=0) and boardid="&ParentID) End IF Next Else '更新所指向的上级论坛版面数,i为本次移动过来的版面数 '更新其父类版面数 MNBoard.Execute("update [i_Board] set Child=child+"&i&" where BoardID="&TempParentID) For II=1 to P_Rs("depth") '得到其父类的父类的版面ID Set Rs=MNBoard.Execute("Select ParentID from [i_Board] where BoardID="&TempParentID) If Not (rs.eof and rs.bof) then TempParentid=Rs(0) '更新其父类的父类版面数 MNBoard.Execute("update [i_Board] set Child=child+"&i&" where BoardID="&TempParentID) End if Next '更新其原父类版面数 MNBoard.Execute("update [i_Board] set Child=child-"&i&" where BoardID="&ParentID) '更新其原父类的其它版面排序 MNBoard.Execute("Update [i_Board] Set Orders=Orders-"&i&" where RootID="&RootID&" and Orders>"&Orders) '更新其原来所属论坛数据 For II=1 to Depth '得到其原父类的父类的版面ID Set rs=MNBoard.Execute("select ParentID from [i_Board] where BoardID="&ParentID) if not (rs.eof and rs.bof) then ParentID=rs(0) '更新其原父类的父类版面数 MNBoard.Execute("update [i_Board] set child=child-"&i&" where boardid="&ParentID) End IF Next End if P_rs.Close:Set P_rs=Nothing End If Suc"","论坛修改成功 !","Admin_Board.asp" MNBoard.netLog"操作后台_论坛修改成功!" MNBoard.Cache.clean("BoardInfo") End Sub Sub ClassOrders Dim BoardID Set Rs=MNBoard.Execute("Select BoardID,BoardName,RootID from[i_Board] where Depth=0 order by RootID") If Rs.Eof Then GoBack"","论坛没有分类!请先 添加分类" Exit Sub End If Response.Write"
    分类排序
    排序方式按从小到大排序,请用数字填写,排序数字不能相同。
    " Do while not rs.eof DIVTR Rs(1),"","",25,1 Rs.MoveNext Loop Response.Write"
    " Rs.Close End Sub Sub SaveClassOrders Dim BoardID,RootID,NewRootID,Temp,I Temp="," For i=1 to request.form("BoardID").count BoardID = request.form("BoardID")(i) RootID = request.form("RootID")(i) NewRootID = request.form("NewRootID")(i) If InStr(Temp,","&NewRootID&",")>0 Then GoBack "排序错误","各分类排序的数字不能一样!" Exit Sub End If Temp=Temp&NewRootID&"," IF Not IsNumeric(BoardID) or Not isnumeric(NewRootID) Then GoBack "排序错误","请用数字填写!" Exit Sub End IF Next For i=1 to request.form("BoardID").count BoardID = request.form("BoardID")(i) RootID = request.form("RootID")(i) NewRootID = request.form("NewRootID")(i) If RootID<>NewRootID Then MNBoard.Execute("Update [i_Board]Set RootID="&NewRootID&" where BoardID="&BoardID) Temp=BoardID MNBoard.Execute("Update [i_Board] Set RootID="&NewRootID&" where ParentStr like '%"&Temp&"%' And RootID="&RootID&"") End If Next Suc"","分类排序成功!","?" MNBoard.netLog"操作后台_分类排序成功!" MNBoard.Cache.clean("BoardInfo") End Sub Sub BoardUnite Response.Write"
    论坛合并
    "&_ "
    将论坛: 合并到论坛:
    "&_ "
    注意事项:此操作不可恢复,请慎重操作!
    分类不能操作,不能和其属下的论坛合并。
    合并后原论坛(包括属下论坛)将被删除,所有帖子(包括属下论坛的帖子)将转移到指定的目标论坛中
    " End Sub Sub SaveBoardUnite Dim BoardID,NewBoardID,TempParentStr,TempParentID,Rs1,S Dim I,AllTable Dim ParentStr,Depth,ParentID,Child,RootID BoardID=MNBoard.Fun.Getstr("BoardID") NewBoardID=MNBoard.Fun.Getstr("NewBoardID") IF BoardID="" Or NewBoardID="" Then GoBack"","请先指定论坛后再进行合并!" Exit Sub ElseIf BoardID=NewBoardID Then Goback"","同一个论坛不用合并了!" Exit sub End If Set Rs=MNBoard.Execute("Select ParentStr,BoardID,Depth,ParentID,Child,RootID from [i_board] where BoardID="&BoardID) If Rs(2)="0" then Goback"系统错误","分类不能做合并操作!" Exit Sub End If ParentStr=Rs(0) & "," & Rs(1) ParentID=Rs(3) TempParentStr=rs(1) DepTh=rs(2) Child=rs(4)+1 RootID=rs(5) Rs.Close TempParentID=ParentID '判断是否合并到下属论坛 Set Rs=MNBoard.Execute("Select BoardID From [i_Board] where BoardID="&NewBoardID&" And ParentStr like '%"&ParentStr&"%'") If Not (rs.eof and rs.bof) then Goback"","不能将论坛合并到其下属论坛中!" Exit Sub End if Rs.Close '得到全部下属论坛ID i=0 Set Rs=MNBoard.Execute("Select BoardID from [i_Board] where RootID="&RootID&" And ParentStr like '%"&ParentStr&"%'") do while not rs.eof If i=0 then TempParentStr=Rs(0) Else TempParentStr=TempParentStr & "," & Rs(0) End if i=i+1 Rs.movenext loop If i>0 then ParentStr=TempParentStr & "," & BoardID Else ParentStr=BoardID End if '更新其原来所属论坛版面数 MNBoard.Execute("update [i_Board] set Child=Child-"&child&" where BoardID="&TempParentID) '更新其原来所属论坛数据,排序相当于剪枝而不需考虑 For I=1 to Depth '得到其父类的父类的版面ID Set rs=MNBoard.Execute("select ParentID from [i_Board] where boardID="&TempParentID) If Not (rs.eof and rs.bof) then TempParentID=rs(0) MNBoard.Execute("update [i_Board] set Child=Child-"&Child&" where boardid="&TempParentID) End if Next '更新论坛帖子数据 AllTable=Split(MNBoard.BBStable(0),",") For i=0 To uBound(AllTable) MNBoard.Execute("update [i_BBS"&AllTable(i)&"] set BoardID="&NewBoardID&" where BoardID in ("&ParentStr&")") Next MNBoard.Execute("update [i_Topic] set BoardID="&NewBoardID&" where BoardID in ("&ParentStr&")") '删除被合并论坛 Set Rs=MNBoard.Execute("Select Sum(EssayNum),sum(TopicNum),sum(TodayNum) from [i_Board] where RootID="&RootID&" And BoardID in ("&ParentStr&")") MNBoard.Execute("Delete from [i_Board] where RootID="&RootID&" And BoardID in ("&ParentStr&")") '更新新论坛帖子计数 MNBoard.Execute("update [i_Board] set EssayNum=EssayNum+"&rs(0)&",TopicNum=TopicNum+"&rs(1)&",TodayNum=TodayNum+"&rs(2)&" where BoardID ="&NewBoardID&"") '更新上级版块 set Rs1=MNBoard.Execute("select Depth,ParentStr,Boardid from [i_Board] where BoardID="&NewBoardID) If Rs1(0)>1 Then ParentStr=Rs1(0) MNBoard.Execute("update [i_Board] set EssayNum=EssayNum+"&rs(0)&",TopicNum=TopicNum+"&rs(1)&",TodayNum=TodayNum+"&rs(2)&" where boardid in ("&ParentStr&")") End If Rs1.Close:Set Rs1=Nothing Rs.Close '调整版主 Set Rs=MNBoard.Execute("select name from [i_Admin] where BoardID="&NewBoardID&" or BoardID="&BoardID) If Not Rs.eof then do while not rs.eof S=S&Rs(0)&"|" Rs.movenext Loop S=left(S,len(S)-1) MNBoard.execute("update [i_Board] Set BoardAdmin='"&S&"' where BoardID="&NewBoardID) MNBoard.Execute("update [i_Admin] set boardID="&NewBoardID&" where boardID="&BoardID) End if Rs.Close Suc"","合并成功!已经将原论坛(包括属下)的所有帖子合并到目标论坛。","?" MNBoard.netLog"操作后台_合并论坛成功!" '更新版块缓存 MNBoard.Cache.clean("BoardInfo") MNBoard.Cache.clean("Board"&NewBoardID) MNBoard.Cache.clean("Board"&BoardID) End Sub Sub ClearData Set Rs=MNBoard.execute("Select BoardName,TopicNum,EssayNum From[i_Board] where BoardID="&MNBoard.BoardID&"") IF Rs.Eof Then GoBack"","论坛版面不存在,可能经被删除了" Exit Sub End If Response.Write"
    "&Rs("BoardName")&" 数据清理
    "&_ "
    本版的帖子信息
    主题数:"&Rs("TopicNum")&"  总帖数:"&Rs("EssayNum")&"  精华主题数:"&MNBoard.Execute("Select Count(TopicID) From[i_Topic] where IsGood=1 and BoardID="&MNBoard.BoardID&"")(0)&"
    "&_ "
    清除 "&Rs(0)&" 天前的帖子。
    "&_ "
    注意事项
    此操作不可恢复!精华帖子不会被删除!
    如果您的论坛数据众多,执行此操作将消耗大量的服务器资源。
    执行过程请耐心等候,最好选择夜间在线人少的时候更新。
    " Rs.Close End Sub Sub StartClearData Dim SqlTableID,ClearDate,BoardID,AllTable,i,Temp SqlTableID=request.form("SqlTableID") ClearDate=request.form("ClearDate") BoardID=request.form("BoardID") If Not isnumeric(ClearDate) or Not isNumeric(SqlTableID) or Not isNumeric(BoardID) Then GoBack"","请用数字填写!" Exit Sub End If IF Int(SqlTableID)=0 Then AllTable=Split(MNBoard.BBStable(0),",") Else AllTable=Split(SqlTableID,",") End if For i=0 to uBound(AllTable) Set Rs=MNBoard.Execute("Select TopicID,isVote From[i_Topic] where BoardID="&BoardID&" And IsGood=False And DATEDIFF('d',[LastTime],'"&MNBoard.NowBbsTime&"')>"&ClearDate&" ") Do While Not Rs.Eof MNBoard.Execute("Delete from [i_Bbs"&AllTable(i)&"] where BoardID="&BoardID&" And (TopicId="&RS(0)&" Or ReplyTopicId="&RS(0)&")") IF Rs(1)=1 Then'删除投票 MNBoard.Execute("Delete from [i_TopicVote] where TopicID="&RS(0)&"") MNBoard.Execute("Delete from [i_TopicVoteUser] where TopicID="&RS(0)&"") End If Rs.movenext Loop Rs.Close MNBoard.Execute("Delete From[i_Topic] where BoardID="&BoardID&" And SqlTableID="&AllTable(i)&" And IsGood=0 And DATEDIFF('d',[LastTime],'"&MNBoard.NowBbsTime&"')>"&ClearDate&" ") Next Temp=MNBoard.Execute("Select BoardName From[i_Board] where BoardID="&BoardID)(0) MNBoard.netLog"操作后台_清理论坛版面:"&Temp&" 在"&ClearDate&"天前的数据成功!" Suc"","成功的清理了论坛数据!建议做一下论坛整理","?" End Sub Sub PassUser Dim Temp Set Rs=MNBoard.execute("Select PassUser,BoardName,Strings From [i_Board] where BoardID="&MNBoard.BoardID&" And ParentID<>0") IF Rs.eof Then GoBack"","此论坛的类型不是认证论坛,不能设置认证用户。" Exit Sub End If Temp=Split(Rs(2),"|") If Temp(6)="0" Then GoBack"","此论坛的类型不是认证论坛,不能设置认证用户。":Exit Sub Response.Write"
    修改论坛论证用户
    " DIVTR"所在论坛:","",""&Rs("BoardName"),25,1 DIVTR"通过认证的用户:","各用户之间用“|”隔开
    请不要使用回车键Enter","",70,2 Response.Write"
    " Rs.Close End Sub Sub SavePassUser Dim PassUsers,BoardID BoardID=MNBoard.Fun.GetStr("BoardID") PassUsers=Trim(Replace(Request.Form("PassUser"),"'","")) PassUsers=Replace(PassUsers,chr(10), "") PassUsers=Replace(PassUsers,chr(13), "") MNBoard.Execute("Update [i_Board] Set PassUser='"&PassUsers&"' where BoardID="&BoardID&" And ParentID<>0") MNBoard.netLog"操作后台_更新认证会员成功!" Suc"","成功的更新了该论坛的认证会员!","?" MNBoard.Cache.clean("BoardInfo") End Sub Sub BoardUpdate Response.Write"
    "&_ "
    数据版面正在整理,请稍等
    进度条
    "&_ "
    0%
    " Response.Flush Dim BoardNum,EssayNum,TopicNum,TodayNum,BoardAdmin,ParentStr,LastReply,LastCaption Dim AllTable,I,II,III,SQL,ReRs BoardNum=MNBoard.Execute("Select Count(BoardID) from[i_Board] Where ParentID<>0")(0) II=0 Set Rs=MNBoard.Execute("Select BoardID,BoardName,Child,ParentStr,RootID from[i_Board] Where ParentID<>0 Order by Child,RootID,Orders Desc") If Not Rs.EOF Then SQL=Rs.GetRows() Rs.Close For i=0 to UBound(SQL,2) EssayNum=0 TopicNum=0 TodayNum=0 BoardAdmin="" LastReply="|||0||||||" LastCaption="无" AllTable=Split(MNBoard.BBStable(0),",") For III=0 To uBound(AllTable) EssayNum=EssayNum+MNBoard.Execute("Select Count(*) From[i_Bbs"&AllTable(III)&"] where BoardID="&SQL(0,i)&" And IsDel=0")(0) TodayNum=TodayNum+MNBoard.Execute("Select Count(*) From[i_Bbs"&AllTable(III)&"] where BoardID="&SQL(0,i)&" And IsDel=0 And DATEDIFF('d',[LastTime],'"&MNBoard.NowBbsTime&"')<1")(0) Next TopicNum=MNBoard.Execute("Select Count(TopicID) From[i_Topic] where BoardID="&SQL(0,i)&" and IsDel=0")(0) Set Rs=MNBoard.Execute("Select Name From[i_Admin] Where BoardID="&SQL(0,i)&"") Do While Not Rs.Eof BoardAdmin=BoardAdmin&Rs(0)&"|" Rs.Movenext Loop If BoardAdmin<>"" Then BoardAdmin=left(BoardAdmin,len(BoardAdmin)-1) Rs.Close Set Rs=MNBoard.execute("Select top 1 TopicID,Name,Caption,AddTime,Face,SqlTableID,ReplyNum From [i_Topic] where IsDel=0 And BoardID="&SQL(0,i)&" order by LastTime desc,TopicID desc") If Not Rs.eof then If Rs(6) > 0 Then Set ReRs=MNBoard.execute("Select top 1 TopicID,Name,Caption,AddTime,Face From [i_bbs"&Rs(5)&"] where ReplyTopicID="&Rs(0)&" And BoardID="&SQL(0,i)&" And IsDel=0 order by LastTime desc,BbsID desc") If Not ReRs.eof then LastCaption=replace(MNBoard.Fun.StrLeft(ReRs("Caption"),22),"'","''") LastReply=ReRs("Name")&"|"&LastCaption&"|"&ReRs("AddTime")&"|"&ReRs("Face")&"|"&Rs("TopicID")&"|"&SQL(0,i)&"|"&Rs("SqlTableID")&"" End If ReRs.close Else LastCaption=replace(MNBoard.Fun.StrLeft(Rs("Caption"),22),"'","''") LastReply=Rs("Name")&"|"&LastCaption&"|"&Rs("AddTime")&"|"&Rs("Face")&"|"&Rs("TopicID")&"|"&SQL(0,i)&"|"&Rs("SqlTableID")&"" End If End If Rs.Close MNBoard.Execute("update [i_Board] Set EssayNum="&EssayNum&",TodayNum="&TodayNum&",TopicNum="&TopicNum&",BoardAdmin='"&BoardAdmin&"',LastReply='"&LastReply&"' where BoardID="&SQL(0,i)&"") '如果有上级论坛,那么更新上级论坛 If SQL(2,I)>0 Then ParentStr=SQL(3,i) & "," & SQL(0,i) Set Rs=MNBoard.Execute("Select Sum(EssayNum),Sum(TopicNum),Sum(TodayNum) From [i_Board] Where ParentStr = '"&ParentStr&"'") If Not IsNull(Rs(0)) Then EssayNum = Rs(0) + EssayNum If Not IsNull(Rs(1)) Then TopicNum = Rs(1) + TopicNum If Not IsNull(Rs(2)) Then TodayNum = Rs(2) + TodayNum Rs.Close Set Rs=MNBoard.execute("Select top 1 TopicID,Name,Caption,AddTime,Face,SqlTableID,BoardID,ReplyNum From [i_Topic] where IsDel=0 And BoardID In ("&ParentStr&") Order by LastTime desc,LastTime Desc") If Not Rs.eof then If Rs(7) > 0 Then Set ReRs=MNBoard.execute("Select top 1 TopicID,Name,Caption,AddTime,Face From [i_bbs"&Rs(5)&"] where ReplyTopicID="&Rs(0)&" And BoardID="&Rs("BoardID")&" And IsDel=0 order by LastTime desc,BbsID desc") If Not ReRs.eof then LastCaption=replace(MNBoard.Fun.StrLeft(ReRs("Caption"),22),"'","''") LastReply=ReRs("Name")&"|"&LastCaption&"|"&ReRs("AddTime")&"|"&ReRs("Face")&"|"&Rs("TopicID")&"|"&Rs("BoardID")&"|"&Rs("SqlTableID")&"" End If ReRs.close Else LastCaption=replace(MNBoard.Fun.StrLeft(Rs("Caption"),22),"'","''") LastReply=Rs("Name")&"|"&LastCaption&"|"&Rs("AddTime")&"|"&Rs("Face")&"|"&Rs("TopicID")&"|"&Rs("BoardID")&"|"&Rs("SqlTableID")&"" End If End If Rs.Close MNBoard.Execute("update [i_Board] Set EssayNum="&EssayNum&",TodayNum="&TodayNum&",TopicNum="&TopicNum&",LastReply='"&LastReply&"' where BoardID="&SQL(0,i)&"") End IF If BoardAdmin="" Then BoardAdmin="无" Else BoardAdmin=Replace(Boardadmin,"|","、") End If '更新缓存 MNBoard.Cache.clean("Board"&SQL(0,i)) Table "论坛 "&SQL(1,i)&" 整理成功","总帖数"&EssayNum&" | 主题数:"&TopicNum&" | 今日帖:"&TodayNum&" | 版主:"&BoardAdmin&" | 最新主题:"&LastCaption&"" II=II+1 Response.Write "" & VbCrLf Response.Flush Next End If Response.Write "" MNBoard.netLog"操作后台_整理论坛!" End Sub Function SqlTableList() Dim AllTable,I AllTable=Split(MNBoard.BBStable(0),",") For i=0 To uBound(AllTable) SqlTableList=SqlTableList&"" Next End Function Sub Table(Str1,Str2) Response.Write"
    "&Str1&"
    "&Str2&"
    " Response.Flush End Sub Sub OrdersTopBoard Dim BoardID,ParentID,RootID,Orders,ParentStr,I,BoardNum,P_Rs BoardID=MNBoard.BoardID Set Rs=MNBoard.execute("Select Orders,ParentID,ParentStr From[i_Board] where BoardID="&MNBoard.BoardID) IF Rs.Eof or Rs.Bof Then GoBack"系统出错!","该版面不存在,可能已经删除了!" Exit Sub End If Orders=Rs(0) ParentID=Rs(1) ParentStr=Rs(2) Rs.Close '当版面为类时 If ParentID=0 then GoBack"系统出错!","版面ID出错。":Exit Sub '得到其下属版面数 ParentStr=ParentStr & "," BoardNum=MNBoard.Execute("select count(*) from [i_Board] where ParentStr like '%"&ParentStr & BoardID&"%'")(0) If Isnull(BoardNum) Then BoardNum=1 '获得父级信息 Set P_rs=MNBoard.Execute("select * from [i_board] where Boardid="&ParentID) '在获得移动过来的版面数后更新排序在指定论坛之后的论坛排序数据 MNBoard.Execute("update [i_Board] set orders=Orders + "&BoardNum&"+1 where RootID="&P_rs("RootID")&" And orders>"&P_rs("orders")&"") '更新当前版面数据 MNBoard.Execute("update [i_Board] set orders="&P_Rs("orders")&"+1 Where BoardID="&BoardID) Dim TempParentStr i=1 '更新下属,同时获得移动总数i '如果有则更新下属版面数据 Set Rs=MNBoard.Execute("select * from [i_Board] where ParentStr like '%"&ParentStr & BoardID&"%' order by orders") Do while not rs.eof i=i+1 If P_rs("parentstr")="0" Then'如果其父级为类,那么其下属的版面数据 TempParentStr=P_rs("boardid") & "," & Replace(rs("parentstr"),ParentStr,"") Else TempParentStr=P_rs("parentstr") & "," & P_rs("boardID") & "," & replace(Rs("Parentstr"),ParentStr,"") End If MNBoard.Execute("update [i_Board] set orders="&P_rs("orders")&"+"&I&",ParentStr='"&TempParentStr&"' where BoardID="&Rs("BoardID")) Rs.movenext Loop Rs.Close P_Rs.Close Set P_Rs=Nothing MNBoard.Cache.clean("BoardInfo") MNBoard.netLog"操作后台_调整论坛排序成功!" Response.Redirect"?" Response.End End Sub %>