<%
'***********************************************************************
'** Copyright (C) 2001 - 2004 Max Yuan All Rights Reserved
'**
'** By using this program, you are agreeing to the terms of the
'** GNU General Public License.
'**
'** This program is free software; you can redistribute it and/or
'** modify it under the terms of the GNU General Public License
'** as published by the Free Software Foundation; either version 2
'** of the License, or any later version.
'**
'** All copyright notices regarding MaxWebPortal must remain intact
'** in the scripts and in the outputted HTML.
'** The "powered by" text/logo with a link back to 
'** http://www.maxwebportal.com in the footer of the pages MUST
'** remain visible when the pages are viewed on the internet or intranet.
'**
'** Support can be obtained from support forums at:
'** http://www.maxwebportal.com
'**
'** Email: maxwebportal@hotmail.com
'** ICQ: 148111300
'***********************************************************************
%><!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_adminvar.asp" --><%If Session(strCookieURL & "Approval") = "256697926329" and instr(strWebMaster,lcase(strAdmin1UserName)&",") <> 0 and not lcase(strAdmin1UserName) = "" and not lcase(strAdmin1UserName) = " " Then %>
<!--#INCLUDE FILE="inc_functions.asp"-->
<!--#INCLUDE FILE="inc_top.asp"-->
<table border="0" width="100%">
  <tr>
    <td width="33%" align="left" nowrap><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
    <img src="icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="default.asp">Home</a><br>
    <img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_folder_open.gif" height=15 width=15 border="0">&nbsp;<a href="admin_home.asp">Admin Section</a><br>
    <img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_blank.gif" height=15 width=15 border="0"><img src="icon_folder_open_topic.gif" height=15 width=15 border="0">&nbsp;Moderator Configuration<br>
    </font></td>
  </tr>
</table>
<%
	if request("Forum") = "" then
		txtMessage = "select a forum to edit moderators for that forum"
	else
		if request("userid") = "" then
			txtMessage = "Select a user to grant/revoke moderator powers for that user.	Users in bold are currently moderators of this forum."
		else
			if Request("action") = "" then
				txtMessage = "Select an action for this user"
			else
				txtMessage = "Action Successful"
			end if
		end if
	end if
%>
<table border="0" width="95%" cellspacing="0" cellpadding="0" align="center">
  <tr>
    <td bgcolor="<% =strTableBorderColor %>">
<table border="0" width="100%" cellspacing="1" cellpadding="4">
  <tr>
    <td bgcolor="<% =strCategoryCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strCategoryFontColor %>" size"<% =strDefaultFontSize %>"><b>Moderator Configuration</b><%if txtMessage <> "" Then%><br><%=txtMessage%><%End If%></font></td>
  </tr>
  <tr>
    <td bgcolor="<% =strForumCellColor %>"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
<%	if Request("Forum") = "" then %>
<UL>
<%

		'## Forum_SQL
		strSql = "SELECT " & strTablePrefix & "FORUM.CAT_ID, " & strTablePrefix & "FORUM.FORUM_ID, " & strTablePrefix & "FORUM.F_SUBJECT "
		strSql = strSql & " FROM " & strTablePrefix & "FORUM "
		strSql = strSql & " ORDER BY " & strTablePrefix & "FORUM.CAT_ID ASC, " & strTablePrefix & "FORUM.F_SUBJECT ASC;"

		set rs = my_Conn.Execute(strSql)

		do until rs.EOF
%>
<br>
<LI><a href="admin_moderators.asp?forum=<%=rs("FORUM_ID")%>"><%=rs("F_SUBJECT")%></a></LI>
<%
rs.MoveNext
		loop
%>
</UL>
<%
	else

		if Request("action") = "" then
			if Request("UserID") = "" then

				'## Forum_SQL
				strSql = "SELECT " & strMemberTablePrefix & "MEMBERS.MEMBER_ID, " & strMemberTablePrefix & "MEMBERS.M_NAME "
				strSql = strSql & " FROM " & strMemberTablePrefix & "MEMBERS "
				strSql = strSql & " WHERE " & strMemberTablePrefix & "MEMBERS.M_LEVEL > 1 "
				strSql = strSql & " AND   " & strMemberTablePrefix & "MEMBERS.M_STATUS = " & 1

				strSql = strSql & " ORDER BY " & strMemberTablePrefix & "MEMBERS.M_NAME ASC;"

				set rs = my_Conn.Execute(strSql)

%>
<br>
<UL>
<%
				do until rs.EOF
%>
  <LI><% if chkForumModerator(Request("Forum"), rs("M_NAME")) then %><b><% end if %><a href="admin_moderators.asp?forum=<%=Request("Forum")%>&UserID=<%=rs("MEMBER_ID")%>"><%=rs("M_NAME")%></a><%If chkForumModerator(Request("Forum"), rs("M_NAME")) Then%></b><%End If%></LI>
<%
				rs.MoveNext
				loop
%>
</UL>
<%
			else

				'## Forum_SQL
				strSql = "SELECT " & strTablePrefix & "MODERATOR.FORUM_ID, " & strTablePrefix & "MODERATOR.MEMBER_ID, " & strTablePrefix & "MODERATOR.MOD_TYPE "
				strSql = strSql & " FROM " & strTablePrefix & "MODERATOR "
				strSql = strSql & " WHERE " & strTablePrefix & "MODERATOR.MEMBER_ID = " & Request("UserID") & " "
				strSql = strSql & " AND " & strTablePrefix & "MODERATOR.FORUM_ID = " & Request("Forum") & " "

				set rs = my_Conn.Execute(strSql)

				if rs.EOF then
%>
<center>
<br>
The selected user is not a moderator of the selected forum<br>
<br>
If you would like to make this user the moderator of this forum, <a href="admin_moderators.asp?forum=<%=Request("Forum")%>&UserID=<%=Request("UserID")%>&action=1">click here</a>.
</center>
<br>
<%				else %>
<center>
<br>
The selected user is currently a moderator of the selected forum<br>
<br>
If you would like to remove this user's moderator status in this forum, <a href="admin_moderators.asp?forum=<%=Request("Forum")%>&UserID=<%=Request("UserID")%>&action=2">click here</a>.
</center>
<br>
<%
				end if
			end if
		else
			select case Request("action")
				case 1

					'## Forum_SQL
					strSql = "INSERT INTO " & strTablePrefix & "MODERATOR "
					strSql = strSql & "(FORUM_ID"
					strSql = strSql & ", MEMBER_ID"
					strSql = strSql & ") VALUES (" 
					strSql = strSql & Request("Forum")
					strSql = strSql & ", " & Request("UserID")
					strSql = strSql & ")"

					my_Conn.Execute strSql
%>
<br>
<center>
The selected user is now a moderator of the selected forum<br>
<br>
<a href="admin_moderators.asp">Back to Moderator Options</a>
</center><br>
<%
				case 2

					'## Forum_SQL
					strSql = "DELETE FROM " & strTablePrefix & "MODERATOR "
					strSql = strSql & " WHERE " & strTablePrefix & "MODERATOR.FORUM_ID = " & Request("Forum") & " "
					strSql = strSql & " AND   " & strTablePrefix & "MODERATOR.MEMBER_ID = " & Request("UserID")

					my_Conn.Execute strSql

%>
<br>
<center>
The selected user's moderator status in the selected forum has been removed<br>
<br>
<a href="admin_moderators.asp">Back to Moderator Options</a>
</center>
<br>
<%
			end select
		end if
	end if
%>
    </font></td>
  </tr>
</table>
    </td>
  </tr>
</table>
<!--#INCLUDE FILE="inc_footer.asp"-->
<% else %>
<%	Response.Redirect "admin_login.asp" %>
<% end iF %>