<%
'***********************************************************************
'** 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" -->
<%
    action = request.querystring("action")
	set my_Conn =   Server.CreateObject("ADODB.Connection")
	my_Conn.Open strConnString

    if mLev = 4 then
        On Error Resume Next
        Set objRec  =   Server.CreateObject("ADODB.RecordSet")
        Set objDict =   CreateObject("Scripting.Dictionary")   

        if action = "update" then
			slImages	=	cint(request.form("strIMGInPosts"))
			slEncode	=	cint(request.form("slEncode"))

			if slImages <> 1 then
				slImages = 0
			end if

			if slEncode <> 1 then
				slEncode = 0
			end if

            strSQL = "UPDATE " & strTablePrefix & "mods SET m_value = '" & request.form("slPosts") & _
                            "' WHERE m_name='news' AND m_code = 'slPosts';"
            my_Conn.Execute(strSQL) 

            strSQL = "UPDATE " & strTablePrefix & "mods SET m_value = '" & request.form("slLength") & _
                            "' WHERE m_name='news' AND m_code = 'slLength';"
            my_Conn.Execute(strSQL) 

            strSQL = "UPDATE " & strTablePrefix & "mods SET m_value = '" & request.form("slSort") & _
                            "' WHERE m_name='news' AND m_code = 'slSort';"
            my_Conn.Execute(strSQL) 

            strSQL = "UPDATE " & strTablePrefix & "mods SET m_value = '" & slImages & _
                            "' WHERE m_name='news' AND m_code = 'slImages';"
            my_Conn.Execute(strSQL) 

            strSQL = "UPDATE " & strTablePrefix & "mods SET m_value = '" & slEncode & _
                            "' WHERE m_name='news' AND m_code = 'slEncode';"
            my_Conn.Execute(strSQL) 

            slMessage = "Settings updated."
        end if    
        
        strSQL      =   "SELECT m_code, m_value FROM " & strTablePrefix & "mods WHERE m_name = 'news';"
        set objRec  =   my_conn.Execute(strSQL)

        if my_Conn.Errors.Count > 0 then
%>

<%
            response.end
        end if

        while not objRec.EOF    
            objDict.Add objRec.Fields.Item("m_code").Value, objRec.Fields.Item("m_value").Value
            objRec.moveNext
        wend     

        slPosts     	=   cint(objDict.Item("slPosts"))
        slLength    	=   cint(objDict.Item("slLength"))
        slSort      	=   cint(objDict.Item("slSort"))
        slEncode      	=   cint(objDict.Item("slEncode"))
		strIMGInPosts	=	cint(objDict.Item("slImages"))

        set objDict 	=   nothing        

		if strIMGInPosts = 1 then
			slImages = "checked"
		end if

		if slEncode = 1 then
			slEncode = "checked"
		end if

        Select Case slSort
        Case "2"    '   last post
            select2 = "selected"
    	Case "3"    '   last replied
            select3 = "selected"
    	Case Else   '   last created
            select1 = "selected"
    	End Select
%>
<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_topic.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;News
    </font></td>
  </tr>
</table>

<P><b><font face="<% =strDefaultFontFace %>" color="<% =strCategoryFontColor %>" size="<% =strDefaultFontSize %>"><%= slMessage %></FONT></b></P>
<FORM name="news" method="post" action="admin_news.asp?action=update">
<TABLE border="0" cellspacing="1" cellpadding="4" bgcolor="#000000" align="center">
    <TR> 
      <TD colspan="2" bgcolor="<% =strCategoryCellColor %>"> 
        <P><B><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">News</FONT></B></P>
      </TD>
    </TR>
    <TR bgcolor="<% =strForumCellColor %>"> 
      <TD> 
        <P><B><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">How many posts to show?</font></B></P>
      </TD>
      <TD> 
        <P> 
          <INPUT type="text" name="slPosts" size="3" maxlength="3" value="<%= slPosts %>">
          <font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">posts</font></P>
      </TD>
    </TR>
    <TR bgcolor="<% =strForumCellColor %>"> 
      <TD> 
        <P><B><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">How many characters display?</font></B></P>
      </TD>
      <TD> 
        <P> 
          <INPUT type="text" name="slLength" size="3" maxlength="3" value="<%= slLength %>">
          <font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">characters</font></P>
      </TD>
    </TR>
    <TR bgcolor="<% =strForumCellColor %>"> 
      <TD> 
        <P><B><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Order by?</font></B></P>
      </TD>
      <TD> 
        <P> 
          <SELECT name="slSort">
            <OPTION value="1" <%= select1 %>>last created</OPTION>
            <OPTION value="2" <%= select2 %>>last post</OPTION>
            <OPTION value="3" <%= select3 %>>hot topics</OPTION>
          </SELECT>
        </P>
      </TD>
    </TR>
    <TR bgcolor="<% =strForumCellColor %>"> 
      <TD> 
        <P><B><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Don't allow images?</font></B></P>
      </TD>
      <TD> 
        <P> 
            <INPUT type="checkbox" name="strIMGInPosts" value="1" <%= slImages %>>
          </P>
      </TD>
    </TR>
    <TR bgcolor="<% =strForumCellColor %>"> 
      <TD> 
        <P><B><font face="<% =strDefaultFontFace %>" size="<% =strDefaultFontSize %>">Allow Forum code?</font></B></P>
      </TD>
      <TD> 
        <P> 
            <INPUT type="checkbox" name="slEncode" value="1" <%= slEncode %>>
          </P>
      </TD>
    </TR>
    <TR align="center" bgcolor="<% =strForumCellColor %>"> 
      <TD colspan="2"> 
        <INPUT type="submit" value="Update">
      </TD>
    </TR>
  </TABLE>
</FORM>
<!--#include file="inc_news.asp"-->
<%
end if
%>
<!--#INCLUDE file="inc_footer.asp" -->
<% Else %><% Response.Redirect "admin_login.asp" %>
<% End IF %>