<%
'#################################################################################
'## Copyright (C) 2000  Michael Anderson and Pierre Gorissen
'## 
'## 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 Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to 
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'## 
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
'## GNU General Public License for more details.
'## 
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
'## 
'## Support can be obtained from support forums at:
'## http://forum.snitz.com 
'##
'## Correspondence and Marketing Questions can be sent to:
'## reinhold@bigfoot.com
'## 
'## or
'## 
'## Snitz Communications 
'## C/O: Michael Anderson
'## PO Box 200
'## Harpswell, ME 04079
'#################################################################################
'# File Attachment Mod by Huw Reddick
'#################################################################################
%>

<!--#INCLUDE FILE="config.asp" -->
<% If Session(strCookieURL & "Approval") = "15916941253" Then %>
<!--#INCLUDE file="inc_functions.asp" -->
<!--#INCLUDE file="inc_top.asp" -->
<%

	Dim objDict
	Set objDict = Server.CreateObject("Scripting.Dictionary")
	set objRec = my_Conn.execute("SELECT * FROM " & strTablePrefix & "MODS WHERE (M_NAME = 'Attachment') OR (M_CODE = 'Attachment')")

	while not objRec.EOF 
	objDict.Add objRec.Fields.Item("m_code").Value, objRec.Fields.Item("m_value").Value
	objRec.moveNext
	wend 

	if Request.Form("Method_Type") = "Write_Configuration" then 
	if Request.Form("strAllowUploads") = "" then
		intAllowUploads = 0
	else
		intAllowUploads = Request.Form("strAllowUploads")
	end if
	
		Err_Msg = ""
	
		if Err_Msg = "" then

			'## Forum_SQL
			objDict.Item("faAllowedForums") = Request.Form("strAllowedForums")
			objDict.Item("faMaxSize") = Request.Form("intMaxFileSize")
			objDict.Item("faExtensions") = Request.Form("strFileType")
			objDict.Item("attach") = Request.Form("strAttachPath")
			objDict.Item("my_upload") = Request.Form("strmyFilesPath")
			objDict.Item("filelibrary") = Request.Form("strLibPath")
			objDict.Item("updatelibrary") = Request.Form("strLibPath")
			objDict.Item("Attachment") = intAllowUploads
			a = objDict.Keys
			b = objDict.Items
   			For i = 0 To objDict.Count -1 ' Iterate the array.
			strSql = "UPDATE " & strTablePrefix & "MODS "
			strSql = strSql & " SET M_VALUE ='" & b(i) & "'"
			strSQL = strSql & " WHERE M_CODE = '" & a(i) & "' "

			my_Conn.Execute (strSql)
   			Next


			Application(strCookieURL & "ConfigLoaded") = ""

%>
<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Configuration Posted!</font></p>


<p align="center"><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">Congratulations!</font></p>
<meta http-equiv="Refresh" content="2; URL=admin_home.asp">
<%		else %>
	<p align=center><font face="<% =strDefaultFontFace %>" size="<% =strHeaderFontSize %>">There Was A Problem With Your Details</font></p>

	<table align=center border=0>
	  <tr>
	    <td><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">
		<ul>
		<% =Err_Msg %>
		</ul>
	    </font></td>
	  </tr>
	</table>

	<p align=center><font face="<% =strDefaultFontFace %>" size=<% =strDefaultFontSize %>><a href="JavaScript:history.go(-1)">Go Back To Enter Data</a></font></p>
<%		end if 
	else 
%><br>
<form action="admin_fileattachment.asp" method="post" id="Form1" name="Form1">
<input type="hidden" name="Method_Type" value="Write_Configuration">
<table border="0" cellspacing="0" cellpadding="0" align=center>
  <tr>
    <td bgcolor="<% =strPopUpBorderColor %>">
<table border="0" cellspacing="1" cellpadding="1" width="100%">
  <tr valign="top">
    <td bgcolor="<% =strHeadCellColor %>" colspan="2"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>" color="<% =strHeadFontColor %>"><b>File Attachment Configuration</b></font></td>
  </tr>
  <tr valign="top">
    <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Max Size:</b>&nbsp;</font></td>
    <td bgColor="<% =strPopUpTableColor %>">
    <input type="text" name="intMaxFileSize" size="6" value="<%= cLng(objDict.Item("faMaxSize")) %>"> (Kb)
    </td>
  </tr>
  <tr valign="top">
    <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Allowed File Types:</b>&nbsp;</font></td>
    <td bgColor="<% =strPopUpTableColor %>">
    <input type="text" name="strFileType" value="<% if objDict.Item("faExtensions") <> "" then response.write(objDict.Item("faExtensions")) else response.write(".zip:.lha") %>"> 

    </td>
  </tr>
    <tr valign="top">
    <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Upload Directories:</b>&nbsp;</font></td>
    <td bgColor="<% =strPopUpTableColor %>">
    &nbsp;Attachments:&nbsp;<input size="12" type="text" name="strAttachPath" value="<% if objDict.Item("attach") <> "" then response.write(objDict.Item("attach")) else response.write("uploaded") %>"><br>
    Mods/Addons:&nbsp;<input size="12" type="text" name="strLibPath" value="<% if objDict.Item("filelibrary") <> "" then response.write(objDict.Item("filelibrary")) else response.write("library") %>"><br>
	&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;My files:&nbsp;<input size="12" type="text" name="strmyFilesPath" value="<% if objDict.Item("my_upload") <> "" then response.write(objDict.Item("my_upload")) else response.write("uploaded") %>"> 
    </td>
  </tr>

  <tr valign="top">
    <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Allow Uploads:</b>&nbsp;</font></td>
    <td bgColor="<% =strPopUpTableColor %>">
    &nbsp;<input type="radio" class="radio" name="strAllowUploads" value="0" <% if objDict.Item("Attachment") = 0 then Response.Write("checked") %>>&nbsp;<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Off</font><br>
    &nbsp;<input type="radio" class="radio" name="strAllowUploads" value="1" <% if objDict.Item("Attachment") = 1 then Response.Write("checked") %>>&nbsp;<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Moderators Only</font><br>
    &nbsp;<input type="radio" class="radio" name="strAllowUploads" value="2" <% if objDict.Item("Attachment") = 2 then Response.Write("checked") %>>&nbsp;<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Selected Users</font><br>
    &nbsp;<input type="radio" class="radio" name="strAllowUploads" value="3" <% if objDict.Item("Attachment") = 3 then Response.Write("checked") %>>&nbsp;<font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">All Users</font>
    </td>
  </tr>
  <tr valign="top">
    <td bgColor="<% =strPopUpTableColor %>" align="right"><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><b>Allowed Forums:</b>&nbsp;</font></td>
    <td bgColor="<% =strPopUpTableColor %>">
<% 	aryAllowed = split(objDict.Item("faAllowedForums"),",")

	strSql = "SELECT FORUM_ID,F_SUBJECT FROM " & strTablePrefix & "FORUM ORDER BY F_ORDER,F_SUBJECT"
	set rs = my_conn.execute(strSQL)
	do while not rs.eof
		Response.write "<input type=""checkbox"" name=""strAllowedForums"" value=""" & rs("FORUM_ID")  & """ "
		for x = Lbound(aryAllowed) to Ubound(aryAllowed)
			if rs("FORUM_ID") = cInt(aryAllowed(x)) then response.write "checked "
		next
		Response.write ">&nbsp;<font face=" & strDefaultFontFace & " size=" & strDefaultFontSize & ">" & rs("F_SUBJECT") & "</font><BR>"
		rs.movenext
	loop
	%>	
	</td>
  </tr>

  <tr valign="top">
    <td bgColor="<% =strPopUpTableColor %>" colspan="2" align="center"><input type="submit" value="Submit New Config" id="submit1" name="submit1"> <input type="reset" value="Reset Old Values" id="reset1" name="reset1"></td>
  </tr>
</table>
    </td>
  </tr>
</table>
</form>
</font>
<%	end if %>
<div align="center">    <p><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>"><a href="admin_home.asp">Back to Admin</A></font></p></div>
    </font>
    </center>

<%
	WriteFooter
Else
	scriptname = split(request.servervariables("SCRIPT_NAME"),"/")
	Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname))
End IF%>








