<!-- #include file="Setup.asp" --><%
if SiteSettings("AdminPassword")<>session("pass") then response.redirect "Admin_Default.asp?menu=Login"
Log("")

TimeLimit=HTMLEncode(Request("TimeLimit"))
UserName=HTMLEncode(Request("UserName"))
ForumID=HTMLEncode(Request("ForumID"))
RoleID=HTMLEncode(Request("RoleID"))
Posts=HTMLEncode(Request("Posts"))
AdminTop

select case Request("menu")
case ""
error2("请选择您要操作的项目")

case "ForumStyle0"
sql="Select ForumName From [BBSXP_Forums] where FollowID="&ForumID&""
Set Rs=Conn.Execute(sql)
do while not Rs.eof
ForumName=rs("ForumName")
conn.execute("update [BBSXP_Forums] set ForumStyle=1 where ForumName='"&ForumName&"' or id="&ForumID&"")
Rs.movenext
loop
RS.Close
response.write "<br>已经将该论坛修改为简洁显示！<br><br><a href=javascript:history.back()>返 回</a>"

case "ForumStyle1"
sql="Select ForumName From [BBSXP_Forums] where FollowID="&ForumID&""
Set Rs=Conn.Execute(sql)
do while not Rs.eof
ForumName=rs("ForumName")
conn.execute("update [BBSXP_Forums] set ForumStyle=0 where ForumName='"&ForumName&"' or id="&ForumID&"")
Rs.movenext
loop
RS.Close
response.write "<br>已经将该论坛修改为详细显示！<br><br><a href=javascript:history.back()>返 回</a>"



case "ApplyManage"
ApplyManage

case "activation"
activation

case "bbsManage"
bbsManage

case "ViewForumPermissions"
ViewForumPermissions

case "DelPermissions"
Conn.execute("Delete from [BBSXP_ForumPermissions] where ForumID="&ForumID&" and RoleID="&RoleID&"")
response.redirect "Admin_bbs.asp?menu=ForumAdd&ForumID="&ForumID&""



case "RoleAdd"
if Conn.Execute("Select RoleID From [BBSXP_ForumPermissions] where ForumID="&ForumID&" and RoleID="&RoleID&"" ).Eof then
Conn.Execute("insert into [BBSXP_ForumPermissions] (ForumID,RoleID) values ('"&ForumID&"','"&RoleID&"')")
end if
response.redirect "Admin_bbs.asp?menu=ForumAdd&ForumID="&ForumID&""

case "ForumPermissionsUP"
Rs.Open "[BBSXP_ForumPermissions] where ForumID="&ForumID&" and RoleID="&RoleID&"",Conn,1,3
for each ho in Request.Form
Rs(ho)=Request(ho)
next
Rs.update
Rs.close
response.redirect "Admin_bbs.asp?menu=ForumAdd&ForumID="&ForumID&""


case "ForumAdd"
ForumAdd


case "ForumAddUp"
ForumAddUp

case "ManageForums"
ManageForums


case "upSiteSettings"
upSiteSettings

case "upSiteSettingsok"
upSiteSettingsok


case "bbsManageDel"
Conn.execute("Delete from [BBSXP_Forums] where id="&ForumID&"")
error2("已经将该论坛的所有数据删除了！")


case "DelThreads"
if ForumID<>"" then ForumIDList="and ForumID="&ForumID&""
Conn.execute("Delete from [BBSXP_Threads] where LastViewedDate<"&SqlNowString&"-"&TimeLimit&" "&ForumIDList&"")
error2("已经将"&TimeLimit&"天没有人查看过的主题删除了！")


case "DelUserTopicok"
if UserName="" then error2("您没有输入用户名！")
if ForumID<>"" then ForumIDList="and ForumID="&ForumID&""
Conn.execute("Delete from [BBSXP_Threads] where UserName='"&UserName&"' "&ForumIDList&"")
error2("已经将"&UserName&"发表的主题删除了！")



case "DelUserPost"
if UserName="" then error2("您没有输入用户名！")
if ForumID<>"" then ForumIDList="and ForumID="&ForumID&""
Conn.execute("Delete from ["&Posts&"] where UserName='"&UserName&"' and IsTopic=0 "&ForumIDList&"")
error2("已经将 "&UserName&" 发表的回帖从 ["&Posts&"] 表中删除了！")



case "DellikeTopicok"
Topic=HTMLEncode(Request("Topic"))
if Topic="" then error2("您没有输入字符！")
if ForumID<>"" then ForumIDList="and ForumID="&ForumID&""
Conn.execute("Delete from [BBSXP_Threads] where Topic like '%"&Topic&"%' "&ForumIDList&" ")
error2("已经将标题里包含有 "&Topic&" 的帖子全部删除了！")


case "DelForumsok"
Conn.execute("Delete from [BBSXP_Forums] where ForumHide=1 and lasttime<"&SqlNowString&"-"&TimeLimit&"")
error2("已经将"&TimeLimit&"天没有新帖子的论坛删除了！")

case "clean"
Conn.execute("Delete from [BBSXP_Threads] where IsDel=1 and lasttime<"&SqlNowString&"-"&TimeLimit&"")
error2("已经清空 "&TimeLimit&" 天以前的主题！")

case "uniteok"
hbbs=Request("hbbs")
YBBs=Request("YBBs")
if hbbs = YBBs then error2("不能选择相同论坛！")
if UserName<>"" then UserNamelist="and UserName='"&UserName&"'"
Conn.execute("update [BBSXP_Threads] set ForumID="&int(hbbs)&" where ForumID="&int(YBBs)&" and lasttime<"&SqlNowString&"-"&TimeLimit&" "&UserNamelist&"")
error2("移动论坛资料成功！")

case "BatchCensorship"
for each ho in request.form("ThreadID")
ho=int(ho)
Conn.execute("update [BBSXP_Threads] set IsDel=0 where id="&ho&"")
next
error2("已经将 激活/还原 所选帖子！")
case "BatchDel"
for each ho in request.form("ThreadID")
ho=int(ho)
Conn.execute("Delete from [BBSXP_Threads] where id="&ho&"")
next
error2("已经将删除所选帖子！")

case "Delapplication"
Application.contents.ReMoveAll()
error2("已经清除服务器上所有的application缓存！")

end select

sub ApplyManage
%>
<table cellspacing="1" cellpadding="2" width="100%" border="0" class="a2" align="center">
	<tr class="a1" id="TableTitleLink">
		<td align="center" height="25"><a href="?menu=ApplyManage&fashion=id">ID</a></td>
		<td width="20%" align="center" height="25">
		<a href="?menu=ApplyManage&fashion=ForumName">论坛</a></td>
		<td align="center" height="25">
		<a href="?menu=ApplyManage&fashion=ForumHide">属性</a></td>
		<td align="center" height="25">
		<a href="?menu=ApplyManage&fashion=Moderated">版主</a></td>
		<td align="center" height="25">
		<a href="?menu=ApplyManage&fashion=ForumToday">今日</a></td>
		<td align="center" height="25">
		<a href="?menu=ApplyManage&fashion=ForumThreads">主题</a></td>
		<td align="center" height="25">
		<a href="?menu=ApplyManage&fashion=ForumPosts">帖子</a></td>
		<td align="center" height="25">操作</td>
	</tr>
	<%

if Request("fashion")=empty then
fashion="ForumPosts"
else
fashion=Request("fashion")
end if


sql="select * from [BBSXP_Forums] order by "&fashion&" Desc"
Rs.Open sql,Conn,1

PageSetup=20 '设定每页的显示数量
Rs.Pagesize=PageSetup
TotalPage=Rs.Pagecount  '总页数
PageCount = cint(Request.QueryString("PageIndex"))
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
if TotalPage>0 then Rs.absolutePage=PageCount '跳转到指定页数
i=0
Do While Not Rs.EOF and i<PageSetup
i=i+1

%>
	<tr class="a3">
		<td align="center" height="25"><%=Rs("id")%></td>
		<td><a target="_blank" href="ShowForum.asp?ForumID=<%=Rs("id")%>"><%=Rs("ForumName")%></a></td>
		<td align="center"><%if ""&Rs("ForumHide")&""="1" then%><font color="#FF0000">隐藏</font><%elseif ""&Rs("followid")&""="0" then%><font color="#0000FF">类别</font><%else%>正常<%end if%></td>
		<td align="center" width="200"><%=Rs("Moderated")%></td>
		<td align="center"><b><font color="red"><%=Rs("ForumToday")%></font></b></td>
		<td align="center"><b><font color="red"><%=Rs("ForumThreads")%></font></b></td>
		<td align="center"><b><font color="red"><%=Rs("ForumPosts")%></font></b></td>
		<td align="center"><a href="?menu=ForumAdd&ForumID=<%=Rs("id")%>">编辑论坛</a> 
		|
		<a onclick="return confirm('您确定要删除该论坛的所有资料?')" href="?menu=bbsManageDel&ForumID=<%=Rs("id")%>">
		删除论坛</a> </td>
		<%
Rs.MoveNext
loop
Rs.Close

%>
	</tr>
</table>
<table border="0" width="100%" align="center">
	<tr>
		<td><%ShowPage()%></td>
	</tr>
</table>
<%

end sub


sub ManageForums
%>
<table border="0" width="80%">
	<tr>
		<td align="center">
		<form name="form" method="POST" action="?menu=ForumAddUp&ForumID=0">类别名称：（例如：电脑网络）<input name="ForumName" onkeyup="ValidateTextboxAdd(this, 'ForumName1')" onpropertychange="ValidateTextboxAdd(this, 'ForumName1')"><input type="submit" value="建立" id="ForumName1" disabled></form>
		</td>
		<td align="center">
		<form method="POST" action="?menu=ForumAdd">
			查找论坛：<input size="2" name="id" onkeyup="ValidateTextboxAdd(this, 'btnadd')" onpropertychange="ValidateTextboxAdd(this, 'btnadd')" onfocus="javascript:focusEdit(this)" onblur="javascript:blurEdit(this)" value="ID" helptext="ID">
			<input type="submit" value="确定" id="btnadd" disabled></form>
		</td>
	</tr>
</table>
<table cellspacing="1" cellpadding="2" width="80%" border="0" class="a2" align="center">
	<%
sort(0)
%>
</table>
<%

end sub




sub ForumAddUp

if Request("ForumName")="" then error2("请输入论坛名称")


master=split(Request("Moderated"),"|")
for i = 0 to ubound(master)
If Conn.Execute("Select id From [BBSXP_Users] where UserName='"&HTMLEncode(master(i))&"'" ).eof and master(i)<>"" Then error2(""&master(i)&"的用户资料还未注册")
next

sql="select * from [BBSXP_Forums] where id="&ForumID&""
Rs.Open sql,Conn,1,3
if Rs.eof then Rs.addNew
if Request("FollowID")<>"" then Rs("FollowID")=Request("FollowID")
if Request("SortNum")<>"" then Rs("SortNum")=int(Request("SortNum"))
if Request("IsModerated")<>"" then Rs("IsModerated")=Request("IsModerated")
if Request("ForumHide")<>"" then Rs("ForumHide")=Request("ForumHide")

Rs("ForumName")=HTMLEncode(Request("ForumName"))
Rs("Moderated")=Request("Moderated")
Rs("TolSpecialTopic")=Request("TolSpecialTopic")
Rs("ForumIntro")=HTMLEncode(Request.Form("ForumIntro"))
Rs("ForumRules")=HTMLEncode(Request.Form("ForumRules"))
Rs("Forumicon")=Request("Forumicon")
Rs("ForumLogo")=Request("ForumLogo")
Rs("NPostM")=Request("NPostM")'''分坛发贴添加金币
Rs("NPostE")=Request("NPostE")'''分坛发贴添加经验
Rs("HPostM")=Request("HPostM")'''分坛回贴添加金币
Rs("HPostE")=Request("HPostE")'''分坛回贴添加经验
Rs.update
ForumID=Rs("ID")
'默认设置
if Request("NPostM")="" then
conn.execute("update [BBSXP_Forums] set NPostM='1'")
conn.execute("update [BBSXP_Forums] set NPostE='1'")
conn.execute("update [BBSXP_Forums] set HPostM='1'")
conn.execute("update [BBSXP_Forums] set HPostE='1'")
end if
rs.close

if Conn.Execute("Select RoleID From [BBSXP_ForumPermissions] where ForumID="&ForumID&" and RoleID=0" ).Eof then
Conn.Execute("insert into [BBSXP_ForumPermissions] (ForumID) values ('"&ForumID&"')")
end if

%>添加/编辑成功<br><br><a href=javascript:history.back()>&lt; 返 回 &gt;</a><%
end sub


sub ForumAdd
FollowID=Request("FollowID")
If NPostM = Empty Then NPostM = "1"
If NPostE = Empty Then NPostE = "1"
If HPostM = Empty Then HPostM = "1"
If HPostE = Empty Then HPostE = "1"
If HPostC = Empty Then HPostC = "1"

if ForumID<>0 then
sql="select * from [BBSXP_Forums] where id="&ForumID&""
Set Rs=Conn.Execute(sql)
if Rs.EOF then error2("系统不存在该论坛的资料")
ForumIntro=replace(""&Rs("ForumIntro")&"","<br>",vbCrlf)
ForumRules=replace(""&Rs("ForumRules")&"","<br>",vbCrlf)
ForumName=Rs("ForumName")
SortNum=Rs("SortNum")
FollowID=Rs("FollowID")
Moderated=Rs("Moderated")
TolSpecialTopic=Rs("TolSpecialTopic")
ForumIcon=Rs("ForumIcon")
ForumLogo=Rs("ForumLogo")
ForumHide=Rs("ForumHide")
IsModerated=Rs("IsModerated")
NPostM=Rs("NPostM")
NPostE=Rs("NPostE")
HPostM=Rs("HPostM")
HPostE=Rs("HPostE")

Rs.close
end if


%>
<form method="POST" action="?menu=ForumAddUp&ForumID=<%=ForumID%>" name="form">
	<table cellspacing="1" cellpadding="2" width="100%" border="0" class="a2" align="center">
		<tr height="25">
			<td class="a1" align="middle" colspan="2">添加/编辑论坛资料</td>
		</tr>
		<tr height="25">
			<td class="a3" width="40%"><b>名称</b><br>
			版块名称</td>
			<td class="a3">
			<input size="30" name="ForumName" value="<%=ForumName%>">&nbsp;&nbsp; 
			<b>排序</b> <input size="2" name="SortNum" value="<%=SortNum%>" onkeyup=if(isNaN(this.value))this.value=''> 从小到大排序</td>
		</tr>
		
	
		<tr height="25">
			<td class="a3"><b>版块类型图标地址(URL)</b><br>
						设定的图标将在首页显示</td>
			<td class="a3">
			
<input type="text" name="ForumIcon" size="30" value="<%=Forumicon%>">
	
			

</td>
		</tr>		<tr height="25">
			<td class="a3"><b>父版块</b><br>
			选择一个讨论组或者一个版块作为该版的父版块</td>
			<td class="a3"><select name="FollowID">
			<option value="<%=FollowID%>">默认</option>
			<option value="0">父版块</option>
			<%BBSList(0)%><%=ForumsList%></select></td>
		</tr>
		<tr height="25">
			<td class="a3"><b>论坛版主<br>
			</b>多版主添加请用“|”隔开，如：yuzi|裕裕 
			</td>
			<td class="a3">
			<input size="40" name="Moderated" value="<%=Moderated%>"> 
			</td>
		</tr>
		<tr class="a3">
			<td height="2"><b>帖子专题</b><br>
			添加请用“|”隔开，如：原创|转贴</td>
			<td height="2" align="Left" valign="middle">
			<input size="40" name="TolSpecialTopic" value="<%=TolSpecialTopic%>"></td>
		</tr>
		<tr height="25">
			<td class="a3"><b>版块Logo图片地址(URL)</b><br>
						设定的图片将在论坛左上角显示</td>
			<td class="a3">
			<input size="40" name="ForumLogo" value="<%=ForumLogo%>"></td>
		</tr>
		<tr height="25">
			<td class="a3" valign="top"><b>描述</b><br>
			简单描述一下该版，可以使用YBB语法</td>
			<td class="a3"><textarea rows="5" name="ForumIntro" cols="50"><%=ForumIntro%></textarea></td>
		</tr>
		<tr height="25">
			<td class="a3" valign="top"><b>规则与导读<br>
			</b>简单描述一下该版的规则与导读，可以使用YBB语法</td>
			<td class="a3"><textarea rows="5" name="ForumRules" cols="50"><%=ForumRules%></textarea></td>
		</tr>

<tr>

		<tr height="25">
			<td class="a3"><b>隐藏论坛</b><br>隐藏后论坛资料将不显示在首页，必须输入直接URL后才能访问</td>
			<td class="a3">
			<input type="radio" <%if forumhide=1 then%>checked<%end if%> value="1" name="ForumHide">是 
			<input type="radio" <%if forumhide=0 then%>checked<%end if%> value="0" name="ForumHide">否 
			</td>
		</tr>
		<tr height="25">
			<td class="a3"><b>帖子需要审批</b><br>
			启用该功能后，该版的帖子需要审批通过了才会显示出来</td>
			<td class="a3">
			<input type="radio" <%if IsModerated=1 then%>checked<%end if%> value="1" name="IsModerated">是 
			<input type="radio" <%if IsModerated=0 then%>checked<%end if%> value="0" name="IsModerated">否</td>
		</tr>


		<tr height="25">
			<td class="a3" align="middle" colspan="2">
			<input type="submit" value="添 加 / 编 辑 "></td>
		</tr>
	</table>
	<br>
</form>
<%if ForumID<>0 then%>
<table cellspacing="1" cellpadding="5" width="100%" border="0" class="a2" align="center">
	<tr height="25" class="a1">
		<td>版块权限</td>
		<td align="middle" width="8%">浏览</td>
		<td align="middle" width="8%">阅读</td>
		<td align="middle" width="8%">发帖</td>
		<td align="middle" width="8%">回复</td>
		<td align="middle" width="8%">编辑</td>
		<td align="middle" width="8%">删除</td>
		<td align="middle" width="8%">发起投票</td>
		<td align="middle" width="8%">投票</td>
		<td align="middle" width="8%">附件</td>
		<td align="middle" width="8%">管理</td>
		<td align="middle" width="8%">动作</td>
	</tr>
	
<form method="POST" action="?menu=RoleAdd&ForumID=<%=ForumID%>" name="form">
	<tr height="25" class="a3">
		<td><select name="RoleID">
<%
sql="select * from [BBSXP_Roles] order by ID"
Set Rs=Conn.Execute(sql)
Do While Not Rs.EOF 
%>		
<option value="<%=RS("ID")%>"><%=RS("Name")%></option>
<%
Rs.MoveNext
loop
Rs.Close
%>	
</select></td>
		<td align="middle" colspan="10">　</td>
		<td align="middle">
		<input type="submit" value="增加"></td>
	</tr>
	
</form>
	
	<%
sql="select * from [BBSXP_ForumPermissions] where ForumID="&ForumID&" order by RoleID"
Set Rs=Conn.Execute(sql)
Do While Not Rs.EOF 
%>

	<tr height="25" class="a3">
		<td><a href="?menu=ViewForumPermissions&ForumID=<%=ForumID%>&RoleID=<%=RS("RoleID")%>"><%=Conn.Execute("Select Name From [BBSXP_Roles] where ID="&RS("RoleID")&"")(0)%></a></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsView")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsRead")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsPost")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsReply")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsEdit")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsDelete")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsCreatePoll")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsVote")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsAttachment")%>.gif"></td>
		<td align="middle"><img src="Images/ForumPermissions<%=RS("PermissionsManage")%>.gif"></td>
		<td align="middle"><input type="button" value="删除" onclick="document.location.href='?menu=DelPermissions&ForumID=<%=ForumID%>&RoleId=<%=RS("RoleID")%>'"></td>
	</tr>
	<%
Rs.MoveNext
loop
Rs.Close
%>
</table>
<%end if%>
<center><br>
<a href="javascript:history.back()">&lt; 返 回 &gt;</a> <%
end sub
sub ViewForumPermissions

sql="select * from [BBSXP_ForumPermissions] where ForumID="&ForumID&" and RoleID="&RoleID&""
Set Rs=Conn.Execute(sql)
%>
<b>版块权限管理</b><br>
为一个给定的角色设置个人论坛权限。  
<form method="POST" action="?menu=ForumPermissionsUP&ForumID=<%=ForumID%>&RoleId=<%=RoleId%>" name="form">

<table cellspacing="1" cellpadding="5" width="100%" border="0" class="a2" align="center">
	<tr height="25" class="a1">
		<td colspan="2">论坛权限</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>版块名称</b></td>
		<td width="50%"><a href="?menu=ForumAdd&ForumID=<%=ForumID%>"><%=Conn.Execute("Select ForumName From [BBSXP_Forums] where ID="&ForumID&"")(0)%></a></td>
	</tr>
	<tr height="25" class="a3">
		<td><b>角色名称</b></td>
		<td><a href="Admin_Role.asp?menu=ViewRole&RoleId=<%=RoleId%>"><%=Conn.Execute("Select Name From [BBSXP_Roles] where ID="&RoleID&"")(0)%></a></td>
	</tr>
	<tr height="25" class="a3">
		<td><b>浏览</b><br>
		角色里的成员能够浏览贴子列表 </td>
		<td><input type="radio" value="1" name="PermissionsView" <%if RS("PermissionsView")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsView" <%if RS("PermissionsView")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>阅读</b><br>
		角色里的成员能够阅读个人的帖子</td>
		<td><input type="radio" value="1" name="PermissionsRead" <%if RS("PermissionsRead")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsRead" <%if RS("PermissionsRead")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>发贴</b><br>
		角色里的成员能够在论坛上发表新贴</td>
		<td><input type="radio" value="1" name="PermissionsPost" <%if RS("PermissionsPost")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsPost" <%if RS("PermissionsPost")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>回复</b><br>
		角色里的成员能够回复帖子 </td>
		<td><input type="radio" value="1" name="PermissionsReply" <%if RS("PermissionsReply")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsReply" <%if RS("PermissionsReply")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>编辑</b><br>
		角色里的成员能够编辑他们自己的帖子</td>
		<td><input type="radio" value="1" name="PermissionsEdit" <%if RS("PermissionsEdit")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsEdit" <%if RS("PermissionsEdit")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>删除</b><br>
		角色里的成员能够删除他们自己的帖子</td>
		<td><input type="radio" value="1" name="PermissionsDelete" <%if RS("PermissionsDelete")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsDelete" <%if RS("PermissionsDelete")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>发起投票</b><br>
		角色里的成员能够创建投票的选举</td>
		<td><input type="radio" value="1" name="PermissionsCreatePoll" <%if RS("PermissionsCreatePoll")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsCreatePoll" <%if RS("PermissionsCreatePoll")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>投票</b><br>
		角色里的成员能够在已有的选举上投票</td>
		<td><input type="radio" value="1" name="PermissionsVote" <%if RS("PermissionsVote")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsVote" <%if RS("PermissionsVote")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>附件</b><br>
		角色里的成员能够添加附件到本论坛的帖子中</td>
		<td><input type="radio" value="1" name="PermissionsAttachment" <%if RS("PermissionsAttachment")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsAttachment" <%if RS("PermissionsAttachment")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td><b>管理</b><br>
		角色里的成员能够管理本版块</td>
		<td><input type="radio" value="1" name="PermissionsManage" <%if RS("PermissionsManage")=1 then%>checked<%end if%>>允许 <input type="radio" value="0" name="PermissionsManage" <%if RS("PermissionsManage")=0 then%>checked<%end if%>>拒绝</td>
	</tr>
	<tr height="25" class="a3">
		<td colspan="2" align="right"><input type="submit" value="保存"></td>
	</tr>
</table></form><a href=javascript:history.back()>&lt; 返 回 &gt;</a>
<%
Rs.Close

end sub
sub bbsManage
BBSList(0)
%> 论坛数：<b><font color="red"><%=Conn.execute("Select count(id)from [BBSXP_Forums]")(0)%></font></b>　　主题数：<b><font color="red"><%=Conn.execute("Select count(id)from [BBSXP_Threads]")(0)%></font></b><br>
<table cellspacing="1" cellpadding="2" width="100%" border="0" class="a2" align="center">
	<tr height="25">
		<td class="a1" align="middle" colspan="3">批量删除主题</td>
	</tr>
	<form method="POST" action="?menu=DelThreads">
		<tr height="25" class="a3">
			<td align="middle" width="50%">删除 
			<select name="TimeLimit" size="1">
			<option value="30">30</option>
			<option value="60">60</option>
			<option value="90" selected>90</option>
			<option value="180">180</option>
			<option value="360">360</option>
			</select> 天没有人查看过的主题</td>
			<td align="middle"><select name="ForumID">
			<option value="">所有论坛</option>
			<%=ForumsList%></select></td>
			<td align="middle"><input type="submit" value=" 确 定 "></td>
		</tr>
	</tr>
	</form>
		<form method="POST" action="?menu=DelUserTopicok">
	<tr class="a3">
		<td align="middle">
			删除 <input size="10" name="UserName"> 发表的所有主题 
		</td>
		<td align="middle"><select name="ForumID">
		<option value="">所有论坛</option>
		<%=ForumsList%></select></td>
		<td align="middle"><input type="submit" value=" 确 定 "></td>
	</tr>
	</form>
		<form method="POST" action="?menu=DellikeTopicok">
	<tr height="25" class="a3">
		<td align="middle">
			删除标题里包含有 <input size="10" name="Topic"> 的所有主题 
		</td>
		<td align="middle"><select name="ForumID">
		<option value="">所有论坛</option>
		<%=ForumsList%></select></td>
		<td align="middle"><input type="submit" value=" 确 定 "></td>
	</tr>
		</form>
</table>
<br>
<table cellspacing="1" cellpadding="2" width="100%" border="0" class="a2" align="center">
	<tr height="25">
		<td class="a1" align="middle" colspan="4">批量删除回帖</td>
	</tr>
		<form method="POST" action="?menu=DelUserPost">
	<tr height="25" class="a3">
		<td align="middle">
			删除 <input size="10" name="UserName"> 发表的所有回帖</td>
		<td align="middle">
<select name="Posts">
<%
set Rs=conn.openSchema(20)
Do Until Rs.EOF
if instr(Rs("TABLE_NAME"),"BBSXP_Posts")>0 and Rs("TABLE_TYPE")="TABLE" then
%><option value="<%=Rs("TABLE_NAME")%>"><%=Rs("TABLE_NAME")%></option>
<%
end if
Rs.movenext
Loop
%></select>



</td>
		<td align="middle"><select name="ForumID">
		<option value="">所有论坛</option>
		<%=ForumsList%></select></td>
		<td align="middle"><input type="submit" value=" 确 定 "></td>
	</tr>
		</form>
	
</table>


<br>


<form method="POST" action="?menu=DelForumsok">
	<table cellspacing="1" cellpadding="2" width="100%" border="0" class="a2" align="center">
		<tr height="25">
			<td class="a1" align="middle">批量删除论坛</td>
		</tr>
		<tr height="25">
			<td class="a3" align="middle">删除 
			<select name="TimeLimit" size="1">
			<option value="30">30</option>
			<option value="60">60</option>
			<option value="90">90</option>
			<option value="180" selected>180</option>
			<option value="360">360</option>
			</select>
 天没有新帖子的论坛 
			<input type="submit" value=" 确 定 "></td>
		</tr>
	</table>
</form>
<form method="POST" action="?menu=uniteok">
	<table cellspacing="1" cellpadding="2" width="100%" border="0" class="a2" align="center">
		<tr height="25">
			<td class="a1" align="middle" colspan="3">移动论坛帖子</td>
		</tr>
		<tr>
			<td class="a3" align="middle">将 <select name="YBBs"><%=ForumsList%>
			</select> 移动到 </td>
			<td class="a3" align="middle"><select name="hbbs"><%=ForumsList%>
			</select> </td>
			<td class="a3" align="middle" rowspan="2">
			<input type="submit" value=" 确 定 "></td>
		</tr>
		<tr>
			<td class="a3" align="middle" width="49%">仅移动 
			<input size="2" name="TimeLimit" value="0"> 天前的帖子 </td>
			<td class="a3" align="middle">仅移动 <input size="8" name="UserName"> 发表的帖子</td>
		</tr>
	</table>
</form>
<%
end sub

sub upSiteSettings
%>
<table cellspacing="1" cellpadding="2" width="100%" border="0" class="a2" align="center">
	<tr height="25">
		<td class="a1" align="middle" colspan="2">社区资料更新</td>
	</tr>
	<tr height="25">
		<td class="a3" align="middle" colspan="2">此操作将更新论坛资料，修复论坛统计的信息<br>
		<a href="?menu=upSiteSettingsok">点击这里更新论坛统计数据</a><br>
		<a href="?menu=Delapplication">清除服务器上的application缓存</a><br>
		</td>
	</tr>
</table>
<br>
<%
end sub

sub upSiteSettingsok


Rs.Open "[BBSXP_Forums]",Conn
do while not Rs.eof

allarticle=Conn.execute("Select count(ID) from [BBSXP_Threads] where IsDel=0 and ForumID="&Rs("id")&"")(0)
if allarticle>0 then
allrearticle=Conn.execute("Select sum(replies) from [BBSXP_Threads] where IsDel=0 and ForumID="&Rs("id")&"")(0)
else
allrearticle=0
end if

Conn.execute("update [BBSXP_Forums] set ForumThreads="&allarticle&",ForumPosts="&allarticle+allrearticle&" where ID="&Rs("id")&"")


Rs.Movenext
loop
Rs.close

%> 操作成功！<br>
<br>
已经更新社区所有论坛的统计数据<br>
<%
end sub

htmlend

sub activation
if Request("type")="Recycle" then
sql="select * from [BBSXP_Threads] where IsDel=1 and PostTime<>lasttime order by lasttime Desc"
response.write "回 收 站"
elseif Request("type")="Censorship" then
sql="select * from [BBSXP_Threads] where IsDel=1 and PostTime=lasttime order by lasttime Desc"
response.write "审 查 区"
end if
%><form method="POST" action="?">
<table cellspacing="1" cellpadding="5" width="100%" align="center" border="0" class="a2">
	<tr id="TableTitleLink" class="a1">
		<td align="center" colspan="3">主题</td>
		<td align="center" width="10%">作者</td>
		<td align="center" width="6%">回复</td>
		<td align="center" width="6%">点击</td>
		<td align="center" width="25%">最后更新</td>
	</tr>
	<%
Rs.Open sql,Conn,1

PageSetup=20 '设定每页的显示数量
Rs.Pagesize=PageSetup
TotalPage=Rs.Pagecount  '总页数
PageCount = cint(Request.QueryString("PageIndex"))
if PageCount <1 then PageCount = 1
if PageCount > TotalPage then PageCount = TotalPage
if TotalPage>0 then Rs.absolutePage=PageCount '跳转到指定页数
i=0
Do While Not Rs.EOF and i<PageSetup
i=i+1
ShowThread()


Rs.MoveNext
loop
Rs.Close


%>
</table>
<table border="0" width="100%" align="center">
	<tr>
		<td valign="top">
		<input type="checkbox" name="chkall" onclick="ThreadIDCheckAll(this.form)" value="ON">全选 
		<%
if Request("type")="Recycle" then
%><input type="radio" value="BatchCensorship" name="menu">还原主题<%
elseif Request("type")="Censorship" then
%><input type="radio" value="BatchCensorship" name="menu">通过审查<%
end if
%> <input type="radio" value="BatchDel" name="menu">彻底删除 
		<input onclick="return confirm('您确定执行本次操作?');" type="submit" value=" 执 行 ">
		</td></form>
		<td>
		<form method="POST" action="?menu=clean">
			清空 <input maxlength="1" size="1" value="7" name="TimeLimit"> 天以前的主题 
			<input type="submit" onclick="return confirm('执行本操作将清空回收站和审查区的主题?');" value="确定"></form>
		</td>
		<td align="right" valign="top"><%ShowPage()%></td>
	</tr>
</table>

<%
end sub

dim ii
ii=0
sub sort(selec)
	sql="Select * From [BBSXP_Forums] where FollowID="&selec&" and ForumHide=0 order by SortNum"
	Set Rs1=Conn.Execute(sql)

	do while not rs1.eof
ForumStyle=Conn.Execute("Select ForumStyle From [BBSXP_Forums] where ForumName='"&rs1("ForumName")&"'")(0)
if selec=0 then
%>
<tr class="a1" id="TableTitleLink" height="25">
<td>　<a target="_blank" href="ShowForum.asp?ForumID=<%=rs1("id")%>"><%=rs1("ForumName")%></a>| <%if ForumStyle=1 then%>
<a href=?menu=ForumStyle1&ForumID=<%=rs1("id")%> title="转到详细模式">目前简洁模式</a>
<%else%>
<a href=?menu=ForumStyle0&ForumID=<%=rs1("id")%> title="转到简洁模式">目前详细模式</a>
<%end if%>

</td>
<td align="right" width="200">
<a href="?menu=ForumAdd&ForumID=0&FollowID=<%=rs1("id")%>">建立论坛</a> |
<a href="?menu=ForumAdd&ForumID=<%=rs1("id")%>">编辑论坛</a> |
<a onclick="return confirm('您确定要删除该论坛的所有资料?')" href="?menu=bbsManageDel&ForumID=<%=rs1("id")%>">
删除论坛</a>
</tr>
<%
else
%>
<tr class="a3" height="25">
<td>　<%=string(ii*2,"　")%><a target="_blank" href="ShowForum.asp?ForumID=<%=rs1("id")%>"><%=rs1("ForumName")%></a></td>
<td align="right"><a href="?menu=ForumAdd&ForumID=0&FollowID=<%=rs1("id")%>">建立论坛</a> 
| <a href="?menu=ForumAdd&ForumID=<%=rs1("id")%>">编辑论坛</a> |
<a onclick="return confirm('您确定要删除该论坛的所有资料?')" href="?menu=bbsManageDel&ForumID=<%=rs1("id")%>">
删除论坛</a>
</tr>
</center><%
end if
ii=ii+1
	sort rs1("id")
ii=ii-1
	rs1.Movenext
	loop
	Set Rs1 = Nothing
end sub

%>