<?php
/************************************************************************/
/* Maximus CMS: Web Portal System                                       */
/* ==============================                                       */
/*                                                                      */
/* Copyright (c) 2002 - 2006                                            */
/* http://www.php-maximus.fr                                            */
/* dev@php-maximus.org                                                  */
/*                                                                      */
/* 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.       */
/************************************************************************/
/* Based on PHP-NUKE: Web Portal System                                 */
/************************************************************************/
if (!defined('ADMIN_ALLOW') && !defined('ADMIN_MAX')) {
    Header("Location: index.php");
}

        $pagetitle = ": "._NE_NEWSCONFIG;
        incoh();
	if (is_file("kernel/tabs/tabwindow.php")) {
		include_once "kernel/tabs/tabwindow.php";
		}
	menunews();
        $ne_config = ne_get_configs();
        title(_NE_NEWSCONFIG);

	$currentTabs=new Tabs("set1");
		$currentTabs->StartTabWindow();
		$currentTabs->AddTab("Config");

	echo "<form action=\"".$admin_file.".php\" method=\"post\">\n";
        echo "<center>\n<table border=\"0\" cellpadding=\"2\" cellspacing=\"2\">\n";

        echo "<tr>\n<td align=\"left\">"._NE_DISPLAYTYPE.":</td>\n<td><select name=\"xcolumns\">";
        if ($ne_config['columns'] == 0) { $ck1 = " selected"; $ck2 = ""; } else { $ck1 = ""; $ck2 = " selected"; }
        echo "<option value=\"0\"$ck1>"._NE_SINGLE."</option>\n<option value=\"1\"$ck2>"._NE_DUAL."</option>\n</select></td>\n</tr>\n";

        echo "<tr>\n<td align=\"left\">"._NE_READLINK.":</td>\n<td><select name=\"xreadmore\">";
        if ($ne_config['readmore'] == 0) { $ck1 = " selected"; $ck2 = ""; } else { $ck1 = ""; $ck2 = " selected"; }
        echo "<option value=\"0\"$ck1>"._NE_PAGE."</option>\n<option value=\"1\"$ck2>"._NE_POPUP."</option>\n</select></td>\n</tr>\n";

        echo "<tr>\n<td align=\"left\">"._NE_TEXTTYPE.":</td>\n<td><select name=\"xtexttype\">";
        if ($ne_config['texttype'] == 0) { $ck1 = " selected"; $ck2 = ""; } else { $ck1 = ""; $ck2 = " selected"; }
        echo "<option value=\"0\"$ck1>"._NE_COMPLETE."</option>\n<option value=\"1\"$ck2>"._NE_TRUNCATE."</option>\n</select></td>\n</tr>\n";

        echo "<tr>\n<td align=\"left\" valign=\"top\">"._NE_NOTIFYAUTH.":</td>\n<td><select name=\"xnotifyauth\">";
        if ($ne_config['notifyauth'] == 0) { $ck1 = " selected"; $ck2 = ""; } else { $ck1 = ""; $ck2 = " selected"; }
        echo "<option value=\"0\"$ck1>"._NE_NO."</option>\n<option value=\"1\"$ck2>"._NE_YES."</option>\n</select><br />\n("._NE_NOTIFYAUTHNOTE.")</td>\n</tr>\n";

        echo "<tr>\n<td align=\"left\">"._NE_HOMETOPIC.":</td>\n<td><select name=\"xhometopic\">";
        echo "<option value=\"0\"";
        if ($ne_config['hometopic'] == 0) { echo " selected"; }
        echo ">"._NE_ALLTOPICS."</option>\n";
        $result = $db->sql_query("SELECT topicid, topictext FROM ".TABLE_TOPICS." ORDER BY topictext");
        while(list($topicid, $topicname) = $db->sql_fetchrow($result)) {
            echo "<option value=\"$topicid\"";
            if ($ne_config['hometopic'] == $topicid) { echo " selected"; }
            echo ">$topicname</option>\n";
        }
        echo "</select></td>\n</tr>\n";

        echo "<tr>\n<td align=\"left\" valign=\"top\">"._NE_HOMENUMBER.":</td>\n<td><select name=\"xhomenumber\">\n";
        echo "<option value=\"0\"";
        if ($ne_config['homenumber'] == 0) { echo " selected"; }
        echo ">"._NE_NUKEDEFAULT."</option>\n";
        $i = 1;
        while ($i <= 10) {
            $k = $i * 5;
            echo "<option value=\"$k\"";
            if ($ne_config['homenumber'] == $k) { echo " selected"; }
            echo">$k "._NE_ARTICLES."</option>\n";
            $i++;
        }
        echo "</select><br />\n("._NE_HOMENUMNOTE.")</td>\n</tr>\n";

        echo "<tr><td align=\"center\" colspan=\"2\"><input type=\"hidden\" name=\"op\" value=\"NENewsConfigSave\"><input type=\"submit\" value=\""._NE_SAVECHANGES."\"></td></tr>";
        echo "</table>\n</center>\n\n";
       // Max_CloseTable();

// notification
	$currentTabs->AddTab("Notification");
		echo "<center><font class=\"option\"><b>" . _MAIL2ADMIN . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _NOTIFYSUBMISSION . "</td><td>";
		$notify = $db->XMFbin($ne_config['notify']);
		if ($notify==1) {
			echo "<input type=\"radio\" name=\"xnotif\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xnotif\" value=\"0\">" . _NO . "";
		} else {
			echo "<input type=\"radio\" name=\"xnotif\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xnotif\" value=\"0\" checked>" . _NO . "";
		}
		$notify_email = stripslashes($ne_config['notify_email']);
		$notify_subject = stripslashes($ne_config['notify_subject']);
		$notify_message = stripslashes($ne_config['notify_message']);
		$notify_from = stripslashes($ne_config['notify_from']);
		echo "</td></tr><tr><td>"
		."" . _EMAIL2SENDMSG . ":</td><td><input type=\"text\" name=\"xnotif_email\" value=\"$notify_email\" size=\"30\" maxlength=\"100\">"
		."</td></tr><tr><td>"
		."" . _EMAILSUBJECT . ":</td><td><input type=\"text\" name=\"xnotif_subject\" value=\"$notify_subject\" size=\"40\" maxlength=\"100\">"
		."</td></tr><tr><td>"
		."" . _EMAILMSG . ":</td><td><textarea name=\"xnotif_message\" cols=\"70\" rows=\"15\">$notify_message</textarea>"
		."</td></tr><tr><td>"
		."" . _EMAILFROM . ":</td><td><input type=\"text\" name=\"xnotif_from\" value=\"$notify_from\" size=\"15\" maxlength=\"25\">"
		."</td></tr></table>";
		br('2');
		echo "<center><input type=\"hidden\" name=\"op\" value=\"NENewsConfigSave\"><input type='submit' value='"._NE_SAVECHANGES."'></center>";
// comments
	$currentTabs->AddTab("Comments");
		echo "<center><font class=\"option\"><b>" . _COMMENTSMOD . "</b></font></center>"
		."<table border=\"0\"><tr><td width=\"40%\">"
		."" . _MODTYPE . ":</td><td>"
		."<select name=\"xmoderat\">";
		$moderate = $db->XMFnum($ne_config['moderate']);
		if ($moderate==1) {
			$sel1 = "selected";
			$sel2 = "";
			$sel3 = "";
		} elseif ($moderate==2) {
			$sel1 = "";
			$sel2 = "selected";
			$sel3 = "";
		} elseif ($moderate==0) {
			$sel1 = "";
			$sel2 = "";
			$sel3 = "selected";
		}
		echo "<option name=\"xmoderat\" value=\"1\" $sel1>" . _MODADMIN . "</option>"
		."<option name=\"xmoderat\" value=\"2\" $sel2>" . _MODUSERS . "</option>"
		."<option name=\"xmoderat\" value=\"0\" $sel3>" . _NOMOD . "</option>"
		."</select></td></tr></table>";

		br('1');

		$commentlimit = $db->XMFnum($ne_config['commentlimit']);
		echo "<center><font class=\"option\"><b>" . _COMMENTSOPT . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _COMMENTSLIMIT . ":</td><td><input type=\"text\" name=\"xcommentlimit\" value=\"$commentlimit\" size=\"11\" maxlength=\"10\">"
		."</td></tr><tr><td>"
		."" . _COMMENTSPOLLS . "</td><td>";
		$pollcomm = $db->XMFbin($ne_config['pollcomm']);
		if ($pollcomm==1) {
		echo "<input type=\"radio\" name=\"xpollcom\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xpollcom\" value=\"0\">" . _NO . "";
		} else {
		echo "<input type=\"radio\" name=\"xpollcom\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xpollcom\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr><tr><td>"
		."" . _COMMENTSARTICLES . "</td><td>";
		$articlecomm = $db->XMFbin($ne_config['articlecomm']);
		if ($articlecomm==1) {
		echo "<input type=\"radio\" name=\"xarticlecom\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xarticlecom\" value=\"0\">" . _NO . "";
		} else {
		echo "<input type=\"radio\" name=\"xarticlecom\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xarticlecom\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr></table>";

		br('1');

		echo "<center><font class=\"option\"><b>" . _CENSOROPTIONS . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _CENSORMODE . "</td><td>";
		$CensorMode = $db->XMFnum($ne_config['CensorMode']);
		if ($CensorMode == 0) {
			$sel0 = "selected";
			$sel1 = "";
			$sel2 = "";
			$sel3 = "";
		} elseif ($CensorMode == 1) {
			$sel0 = "";
			$sel1 = "selected";
			$sel2 = "";
			$sel3 = "";
		} elseif ($CensorMode == 2) {
			$sel0 = "";
			$sel1 = "";
			$sel2 = "selected";
			$sel3 = "";
		} elseif ($CensorMode == 3) {
			$sel0 = "";
			$sel1 = "";
			$sel2 = "";
			$sel3 = "selected";
		}

		echo "<select name=\"xCensorMod\">"
		."<option name=\"xCensorMod\" value=\"0\" $sel0>" . _NOFILTERING . "</option>"
		."<option name=\"xCensorMod\" value=\"1\" $sel1>" . _EXACTMATCH . "</option>"
		."<option name=\"xCensorMod\" value=\"2\" $sel2>" . _MATCHBEG . "</option>"
		."<option name=\"xCensorMod\" value=\"3\" $sel3>" . _MATCHANY . "</option>"
		."</select>"
		."</td></tr><tr><td>" . _CENSORREPLACE . "</td><td>";
		$CensorReplace = stripslashes($ne_config['CensorReplace']);
		echo "<input type=\"text\" name=\"xCensorReplac\" value=\"$CensorReplace\" size=\"10\" maxlength=\"10\">"
		."</td></tr><br /><br />"
		."</table>";
		br('2');
		echo "<center><input type=\"hidden\" name=\"op\" value=\"NENewsConfigSave\"><input type='submit' value='"._NE_SAVECHANGES."'></center></form>";

	$currentTabs->EndTabWindow();

        incof();