问题:多个普通管理员按栏目分配权限,导致乱套
解决方法:打开admin/ks.admin.asp
找到
If KS.FoundInArr(Replace(Request("AdminPurview")," ",""),RSC(1),",") Then
If KS.IsNul(RSC(0)) Then
RSC(0)=UserName
Else
RSC(0)=FilterRepeat(RSC(0) & "," & UserName,",")
End If
RSC.Update
Else
If KS.IsNul(RSC(0)) Then
RSC(0)=""
Else
If Instr(RSC(0),",")=0 Then
RSC(0)=""
Else
RSC(0)=Replace(Replace(RSC(0),UserName &",",""),","&UserName,"")
End If
End If
RSC.Update
End If
Dim ENode:Set ENode=Application(KS.SiteSN&"_class").DocumentElement.SelectSingleNode("class[@ks0='" & RSC(1) & "']")
改成1300多行
If KS.FoundInArr(Replace(Request("AdminPurview")," ",""),RSC(1),",") Then
If KS.IsNul(RSC(0)) Then
RSC(0)=UserName
Else
RSC(0)=FilterRepeat(RSC(0) & "," & UserName,",")
End If
RSC.Update
Else
If KS.IsNul(RSC(0)) Then
RSC(0)=""
Else
RSC(0)=DelItemInArr(RSC(0),UserName,",")
End If
RSC.Update
End If
Dim ENode:Set ENode=Application(KS.SiteSN&"_class").DocumentElement.SelectSingleNode("class[@ks0='" & RSC(1) & "']")
继续将本文件拉到最后,然后增加以下函数
'去除数组的重复项
Function FilterRepeat(byval str,spliter)
if KS.IsNul(str) Then Exit Function
Dim strA:strA=Split(str,spliter)
Dim I,temp,newstr
For I=0 To Ubound(Stra)
If KS.FoundInArr(temp,strA(i),",")=false Then
if newstr="" then
newstr=stra(i)
else
newstr=newstr & spliter & stra(i)
end if
temp=temp & "," & stra(i)
End If
Next
FilterRepeat=newstr
End Function
'从数组中删除指定项
Function DelItemInArr(byval str,byval delstr,spliter)
if KS.IsNul(str) Then Exit Function
Dim strA:strA=Split(str,spliter)
Dim I,temp,newstr
For I=0 To Ubound(Stra)
If lcase(strA(i))<>lcase(delstr) Then
if newstr="" then
newstr=stra(i)
else
newstr=newstr & spliter & stra(i)
end if
End If
Next
DelItemInArr=newstr
End Function
End Class
红色为加上的函数代码.