<% End Function Function SaveMove() Dim g1,g2,rs,rst g1=Int(Request.Form("g1")) g2=Int(Request.Form("g2")) If g1=g2 Then Response.Redirect "admin_groups.asp" oblog.Execute "Update oblog_user Set user_group=" & g2 & " Where user_group=" & g1 oblog.CountGroupUser EventLog "进行用户组的转移操作,用户组ID"&g1&"转移到用户组ID"&g2,oblog.NowUrl&"?"&Request.QueryString %> <% End Function Set oblog = Nothing %>&忹宪蟪U_颉3噖躋喙揹Xゥ玆{*辊駶旋眒q陚,j..G'(鍞竑mk0赐朰L賢9G邳箪掓(贌%阽鯃娄w綂J抮{W汦\x椬 o%噀飇J頛跈趜3)7钍颺\d蔃螋囃u0f0龡牚糃8猞n5嵏箎廂^5戎+謾PIG苏?N嗕铟E蓪#Z霴金ォJ三再臱v;9脜讧oz騢冸 耞裔跥^暶F滕紘姖3噱U<~溹{JQ0,鯻@蜨麯 $斶*?" b&嬻R兿f籭"6慂bj岼籇(Sh3i 聒B貖l%_* 鵛"痝P _6鮉杤[,NY產娏忏 R憿#俌蜶|g蜔!甚"尐嬫巡tY<+X箨胵癃G鼪栠沘Ad随3薫 j菽蜆G綢閲se鹐庽"棘仂+j倥2^鮤蘞b&U鴁镙湥)痊袛垲,碰g-萀4瀇~,褐q9hR蝣L`疶n焭q#芓鉜,"o阉躼蠮 4饛% O闱,`騛)谾%反N=AUz,疻脬"桺铩4箰琨I緋泾Eň樗崯-@粍{浥濇磃絮4,Q7M/气沬捬鷽8欌Y犑i7鯚D7E趠猟s=閤蔟荳痙窷]掎 簜r酻2?< 戴_岲歭有)嘴糺萏n8筻﹫c垘eG乙翫焓xX襸$釲伫#=趶5U0-=艜!棙熁H螤阁 瑗玷-冮;(!衹b4墲骢悵罍/踇蠃炣/梺0鱧涟觤獴貫v敕癗:韬u#铞yN)俓&驭灻琲毰N@~汆58鳅x2j]浞x蒡锘讠嫞6?打 埗F_奖W}揕K靂y'訔l幬F彶,務1l黧x=哏S躧@隹NX,3櫡^籮黕⿹蛐/呬瓺8颶楾撐觚p醛s_╄殱凯 鸑7獊栓侵虹蒩頏莉?',稄晜# {Y腓圾#啾[Ba]鸌_Nc韺3t驝\4妘4粡丈_v╛Щ礸煹5>;贕岑覞琐eP濋{.l 垸氳]&zX昏E8簘喂T2 $X-?m惋杛.棯帍j鑘╨巅 dN沄鍘謙\鳃醺2n唶倧b%c(s=憺繠饕惕犭馚2!z]L.b5l韕泸趈_&M句}櫇,橩崨限已骀秖蝙壏光4貢w%R暝f /胵e旭訕舠}fq<K ~粙塄s-?禇伩栰哦,鮠g{$:UuΩ!*读 #mVT馄汜楨6t猳G0XF|描膮x稁I-藦P}w]UF遳;g+[]隴"希/w汀鏳页卤:* (閄wK]&穧嚣(~ 琍倔慚偁;`tL啤儤艢珊$hX hSs鹳A6 Ρ(噚 譖Z霧犧単t篲R詜夎:茨ㄇ, 呌,緉1臿 % ;*!u⑺ #複g漀蕝塭俄灲 漢吠Wy潒硹睤芠.?+> 瑅垺{柷际嶯瑀[m襅f肊厶 鯶hM剔P庒Mup哎 2".I颣兠牣毒J聵v0ZI楱霹魲覫*/;c#S錉櫢#@V 粜)O┻掐差襱$8 0鉏盔庥皝aOp惭v+鷣y1D隡绝P破冞 噄x櫢俿鈅屟,旽僫~'柀rsw⒘舯鐮淎痌=P4艌劚4B;wc飼蓾鵪>阒慡hZ┘ |'r~ε碊害瘲塩羬绉`w束1]{邦:<3琗揓疂5To通玘&9=狢弇!+伬行H 腌 璃3蹹a?m2穁幌'鶬1eOC&承嫙nAB扂僖掎嫩m2喂愁\咺,鷔w泬鮸 闄"T肾跾涁D飘B窻莰喧 讂乨觝iKH侲 撉汷Z^'&=vA誮 \( @JJ痖Y艁PM vxX翆夁驣讳鄃J賨Cz旟輡凖C悰-蝗厓j蚂=J杒>樠-莜1Zs箥騴w=.o歾zT彈齩%狎6邔2錓.蚸,YY瘜嘫x囀&u@K1*I圱bh@?搃瑓訦-r炆膞摴i~>/(瞐 蟤^ 窗y駔 U錅T$5内`left">
  • <% rsClass.close set rsClass=nothing end sub sub OrderN() dim sqlClass,rsClass,i,iCount,trs,UpMoveNum,DownMoveNum sqlClass="select * From oblog_logclass where idtype="&t&" order by RootID,OrderID" set rsClass=Server.CreateObject("adodb.recordset") rsClass.open sqlClass,conn,1,1 %> <% do while not rsClass.eof %> <% if rsClass("ParentID")>0 then '如果不是一级分类,则算出相同深度的分类数目,得到该分类在相同深度的分类中所处位置(之上或者之下的分类数) '所能提升最大幅度应为For i=1 to 该版之上的版面数 set trs=conn.execute("select count(id) From oblog_logclass where ParentID="&rsClass("ParentID")&" and OrderID<"&rsClass("OrderID")&"") UpMoveNum=trs(0) if isnull(UpMoveNum) then UpMoveNum=0 if UpMoveNum>0 then Response.write "" else Response.write "" end if trs.close '所能降低最大幅度应为For i=1 to 该版之下的版面数 set trs=conn.execute("select count(id) From oblog_logclass where ParentID="&rsClass("ParentID")&" and orderID>"&rsClass("orderID")&"") DownMoveNum=trs(0) if isnull(DownMoveNum) then DownMoveNum=0 if DownMoveNum>0 then Response.write "" else Response.write "" end if trs.close else Response.write "" end if %> <% UpMoveNum=0 DownMoveNum=0 rsClass.movenext loop %>
    N 级 分 类 排 序
    <% for i=1 to rsClass("Depth") Response.write "   " next if rsClass("Child")>0 then Response.write "" else Response.write "" end if if rsClass("ParentID")=0 then Response.write "" end if Response.write rsClass("classname") if rsClass("Child")>0 then Response.write "(" & rsClass("Child") & ")" end if %>
    " Response.write "" Response.write " " Response.write " 
    " Response.write "" Response.write " " Response.write "   
    <% rsClass.close set rsClass=nothing end sub sub Reset() %>
    复 位 所 有 分 类
    注意:
        如果选择复位所有分类,则所有分类都将作为一级分类,这时您需要重新对各个分类进行归属的基本设置。不要轻易使用该功能,仅在做出了错误的设置而无法复原分类之间的关系和排序的时候使用。
       
    <% end sub sub Unite() %>
    分 类 合 并
      将分类 合并到
               
    注意事项:
        所有操作不可逆,请慎重操作!!!
        不能在同一个分类内进行操作,不能将一个分类合并到其下属分类中。目标分类中不能含有子分类。
        合并后您所指定的分类(或者包括其下属分类)将被删除,所有用户将转移到目标分类中。
    <% end sub %> <% sub SaveAdd() dim id,classname,Readme,PrevOrderID dim sql,rs,trs dim RootID,ParentDepth,ParentPath,ParentStr,ParentName,Maxid,MaxRootID dim PrevID,NextID,Child classname=Trim(Request("classname")) Readme=Trim(Request("Readme")) if classname="" then Response.Write "
  • 分类名称不能为空!
  • " Response.End() end If If InStr(classname, "=") > 0 Or InStr(classname, "%") > 0 Or InStr(classname, Chr(32)) > 0 Or InStr(classname, "?") > 0 Or InStr(classname, "&") > 0 Or InStr(classname, ";") > 0 Or InStr(classname, ",") > 0 Or InStr(classname, "'") > 0 Or InStr(classname, ",") > 0 Or InStr(classname, Chr(34)) > 0 Or InStr(classname, Chr(9)) > 0 Or InStr(classname, "") > 0 Or InStr(classname, "$") > 0 Or InStr(classname, ".") > 0 Or InStr(classname, ">") > 0 Or InStr(classname, "<") > 0 Or InStr(classname, "/") > 0 then Response.Write "
  • 分类名称中含有非法字符!
  • " Response.End() End If set rs = conn.execute("select Max(id) From oblog_logclass") Maxid=rs(0) if isnull(Maxid) then Maxid=0 end if rs.close id=Maxid+1 set rs=conn.execute("select max(rootid) From oblog_logclass") MaxRootID=rs(0) if isnull(MaxRootID) then MaxRootID=0 end if rs.close RootID=MaxRootID+1 if ParentID>0 then sql="select * From oblog_logclass where id=" & ParentID & "" rs.open sql,conn,1,1 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 所属分类已经被删除!
  • " end if if FoundErr=True then rs.close set rs=nothing exit sub else RootID=rs("RootID") ParentName=rs("classname") ParentDepth=rs("Depth") ParentPath=rs("ParentPath") Child=rs("Child") ' If ParentPath = "0" Then ParentPath = "" ParentPath=ParentPath & "," & ParentID '得到此分类的父级分类路径 PrevOrderID=rs("OrderID") if Child>0 then dim rsPrevOrderID '得到与本分类同级的最后一个分类的OrderID set rsPrevOrderID=conn.execute("select Max(OrderID) From oblog_logclass where ParentID=" & ParentID) PrevOrderID=rsPrevOrderID(0) set trs=conn.execute("select id From oblog_logclass where ParentID=" & ParentID & " and OrderID=" & PrevOrderID) PrevID=trs(0) '得到同一父分类但比本分类级数大的子分类的最大OrderID,如果比前一个值大,则改用这个值。 set rsPrevOrderID=conn.execute("select Max(OrderID) From oblog_logclass where ParentPath like '" & ParentPath & ",%'") if (not(rsPrevOrderID.bof and rsPrevOrderID.eof)) then if not IsNull(rsPrevOrderID(0)) then if rsPrevOrderID(0)>PrevOrderID then PrevOrderID=rsPrevOrderID(0) end if end if end if else PrevID=0 end if end if rs.close else if MaxRootID>0 then set trs=conn.execute("select id From oblog_logclass where RootID=" & MaxRootID & " and Depth=0") PrevID=trs(0) trs.close else PrevID=0 end if PrevOrderID=0 ParentPath="0" end if sql="select * From oblog_logclass Where ParentID=" & ParentID & " and idtype="&t&" AND classname='" & classname & "'" set rs=Server.CreateObject("adodb.recordset") rs.open sql,conn,1,1 if not(rs.bof and rs.eof) then FoundErr=True if ParentID=0 then ErrMsg=ErrMsg & "
  • 已经存在一级分类:" & classname & "
  • " else ErrMsg=ErrMsg & "
  • “" & ParentName & "”中已经存在子分类“" & classname & "”!
  • " end if rs.close set rs=nothing exit sub end if rs.close sql="select top 1 * From oblog_logclass" rs.open sql,conn,2,2 rs.addnew rs("id")=id rs("classname")=classname rs("RootID")=RootID rs("ParentID")=ParentID if ParentID>0 then rs("Depth")=ParentDepth+1 else rs("Depth")=0 end if rs("ParentPath")=ParentPath rs("OrderID")=PrevOrderID rs("Child")=0 rs("Readme")=Readme rs("PrevID")=PrevID rs("NextID")=0 rs("idType")=t rs.update rs.Close set rs=Nothing '更新与本分类同一父分类的上一个分类的“NextID”字段值 if PrevID>0 then conn.execute("update oblog_logclass set NextID=" & id & " where id=" & PrevID) end if if ParentID>0 then '更新其父类的子分类数 conn.execute("update oblog_logclass set child=child+1 where id="&ParentID) '更新该分类排序以及大于本需要和同在本分类下的分类排序序号 conn.execute("update oblog_logclass set OrderID=OrderID+1 where rootid=" & rootid & " and OrderID>" & PrevOrderID) conn.execute("update oblog_logclass set OrderID=" & PrevOrderID & "+1 where id=" & id) end if 'call CloseConn() Response.Redirect "admin_logclass.asp?t=" & t end sub sub SaveModify() dim classname,Readme,IsElite,ShowOnTop,Setting,ClassMaster,ClassPicUrl,LinkUrl,SkinID,LayoutID,BrowsePurview,AddPurview dim trs,rs dim id,sql,rsClass,i dim SkinCount,LayoutCount id=Trim(Request("id")) if id="" then FoundErr=True ErrMsg=ErrMsg & "
  • 参数不足!
  • " else id=CLng(id) end if classname=Trim(Request("classname")) Readme=Trim(Request("Readme")) if classname="" then FoundErr=True ErrMsg=ErrMsg & "
  • 分类名称不能为空!
  • " end if if FoundErr=True then exit sub end if sql="select * From oblog_logclass where id=" & id set rsClass=Server.CreateObject ("Adodb.recordset") rsClass.open sql,conn,1,3 if rsClass.bof and rsClass.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的分类!
  • " rsClass.close set rsClass=nothing exit sub end if if FoundErr=True then rsClass.close set rsClass=nothing exit sub end if rsClass("classname")=classname rsClass("Readme")=Readme rsClass.update rsClass.close set rsClass=nothing set rs=nothing set trs=nothing 'call CloseConn() Response.Redirect "admin_logclass.asp?t=" & t end sub sub DeleteClass() dim sql,rs,PrevID,NextID,id id=Trim(Request("id")) if id="" then FoundErr=True ErrMsg=ErrMsg & "
  • 参数不足!
  • " exit sub else id=CLng(id) end if sql="select id,RootID,Depth,ParentID,Child,PrevID,NextID From oblog_logclass where id="&id set rs=Server.CreateObject ("Adodb.recordset") rs.open sql,conn,1,3 if rs.bof and rs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 分类不存在,或者已经被删除
  • " else if rs("Child")>0 then FoundErr=True ErrMsg=ErrMsg & "
  • 该分类含有子分类,请删除其子分类后再进行删除本分类的操作
  • " end if end if if FoundErr=True then rs.close set rs=nothing exit sub end if PrevID=rs("PrevID") NextID=rs("NextID") if rs("Depth")>0 then conn.execute("update oblog_logclass set child=child-1 where id=" & rs("ParentID")) end if rs.delete rs.update rs.close set rs=nothing '修改上一分类的NextID和下一分类的PrevID if PrevID>0 then conn.execute "update oblog_logclass set NextID=" & NextID & " where id=" & PrevID end if if NextID>0 then conn.execute "update oblog_logclass set PrevID=" & PrevID & " where id=" & NextID end if 'call CloseConn() Response.redirect "admin_logclass.asp?t=" & t end sub sub SaveMove() dim id,sql,rsClass,i dim rParentID dim trs,rs dim ParentID,RootID,Depth,Child,ParentPath,ParentName,iParentID,iParentPath,PrevOrderID,PrevID,NextID id=Trim(Request("id")) if id="" then FoundErr=True ErrMsg=ErrMsg & "
  • 参数不足!
  • " exit sub else id=CLng(id) end if sql="select * From oblog_logclass where id=" & id set rsClass=Server.CreateObject ("Adodb.recordset") rsClass.open sql,conn,1,3 if rsClass.bof and rsClass.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 找不到指定的分类!
  • " rsClass.close set rsClass=nothing exit sub end if rParentID=Trim(Request("ParentID")) if rParentID="" then rParentID=0 else rParentID=CLng(rParentID) end if if rsClass("ParentID")<>rParentID then '更改了所属分类,则要做一系列检查 if rParentID=rsClass("id") then FoundErr=True ErrMsg=ErrMsg & "
  • 所属分类不能为自己!
  • " end if '判断所指定的分类是否为外部分类或本分类的下属分类 if rsClass("ParentID")=0 then if rParentID>0 then set trs=conn.execute("select rootid From oblog_logclass where id="&rParentID) if trs.bof and trs.eof then FoundErr=True ErrMsg=ErrMsg & "
  • 不能指定外部分类为所属分类
  • " else if rsClass("rootid")=trs(0) then FoundErr=True ErrMsg=ErrMsg & "
  • 不能指定该分类的下属分类作为所属分类
  • " end if end if trs.close set trs=nothing end if else set trs=conn.execute("select id From oblog_logclass where ParentPath like '"&rsClass("ParentPath")&"," & rsClass("id") & "%' and id="&rParentID) if not (trs.eof and trs.bof) then FoundErr=True ErrMsg=ErrMsg & "
  • 您不能指定该分类的下属分类作为所属分类
  • " end if trs.close set trs=nothing end if end if if FoundErr=True then rsClass.close set rsClass=nothing exit sub end if if rsClass("ParentID")=0 then ParentID=rsClass("id") iParentID=0 else ParentID=rsClass("ParentID") iParentID=rsClass("ParentID") end if Depth=rsClass("Depth") Child=rsClass("Child") RootID=rsClass("RootID") ParentPath=rsClass("ParentPath") PrevID=rsClass("PrevID") NextID=rsClass("NextID") rsClass.close set rsClass=nothing '假如更改了所属分类 '需要更新其原来所属分类信息,包括深度、父级ID、分类数、排序、继承版主等数据 '需要更新当前所属分类信息 '继承版主数据需要另写函数进行更新--取消,在前台可用id in ParentPath来获得 dim mrs,MaxRootID set mrs=conn.execute("select max(rootid) From oblog_logclass") MaxRootID=mrs(0) set mrs=nothing if isnull(MaxRootID) then MaxRootID=0 end if dim k,nParentPath,mParentPath dim ParentSql,ClassCount dim rsPrevOrderID if CLng(parentid)<>rParentID and not (iParentID=0 and rParentID=0) then '假如更改了所属分类 '更新原来同一父分类的上一个分类的NextID和下一个分类的PrevID if PrevID>0 then conn.execute "update oblog_logclass set NextID=" & NextID & " where id=" & PrevID end if if NextID>0 then conn.execute "update oblog_logclass set PrevID=" & PrevID & " where id=" & NextID end if if iParentID>0 and rParentID=0 then '如果原来不是一级分类改成一级分类 '得到上一个一级分类分类 sql="select id,NextID From oblog_logclass where RootID=" & MaxRootID & " and Depth=0" set rs=Server.CreateObject("Adodb.recordset") rs.open sql,conn,1,3 PrevID=rs(0) '得到新的PrevID rs(1)=id '更新上一个一级分类分类的NextID的值 rs.update rs.close set rs=nothing MaxRootID=MaxRootID+1 '更新当前分类数据 conn.execute("update oblog_logclass set depth=0,OrderID=0,rootid="&maxrootid&",parentid=0,ParentPath='0',PrevID=" & PrevID