<?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')) {
	die ("Access Denied");
}
if ($acces == 1) {
if($admintest && $adminsecu)  {
		incoh();
		if (is_file('kernel/tabs/tabwindow.php')) {
		include_once ('kernel/tabs/tabwindow.php');
		}
		$sql = "SELECT `sitename`, `nukeurl`, `site_logo`, `slogan`, `startdate`, `adminmail`, `anonpost`, `Default_Theme`, `foot1`, `foot2`, `foot3`, `anonymous`, `broadcast_msg`, `my_headlines`, `top`, `user_news`, `oldnum`, `ultramode`, `banners`, `backend_title`, `backend_language`, `language`, `locale`, `decalage`, `multilingual`, `useflags`, `admingraphic`, `httpref`, `httprefmax`, `wysiwyg`, `dbi`, `rewrite` from `".TABLE_CONFIG."` ";
		if ( !($result = $db->sql_query($sql)) )
{ query_die(GENERAL_ERROR, 'Could not obtain Admin Config WebSite', '', __LINE__, __FILE__, $sql);}
		$row = $db->sql_fetchrow($result);
		$sitename      = stripslashes($row['sitename']);
		$nukeurl       = stripslashes($row['nukeurl']);
		$site_logo     = stripslashes($row['site_logo']);
		$slogan        = stripslashes($row['slogan']);
		$startdate     = stripslashes($row['startdate']);
		$adminmail     = stripslashes($row['adminmail']);
		$anonpost      = $db->XMFnum($row['anonpost']);
		$Default_Theme = stripslashes($row['Default_Theme']);
		$foot1         = stripslashes($row['foot1']);
		$foot2         = stripslashes($row['foot2']);
		$foot3         = stripslashes($row['foot3']);
		$anonymous     = stripslashes($row['anonymous']);
		$broadcast_msg = $db->XMFbin($row['broadcast_msg']);
		$my_headlines  = $db->XMFbin($row['my_headlines']);
		$top           = $db->XMFnum($row['top']);
		$user_news     = $db->XMFnum($row['user_news']);
		$oldnum        = $db->XMFnum($row['oldnum']);
		$ultramode     = $db->XMFbin($row['ultramode']);
		$banners       = $db->XMFbin($row['banners']);
		$backend_title = stripslashes($row['backend_title']);
		$backend_language = stripslashes($row['backend_language']);
		$language      = $db->XMFlang($row['language']);
		$locale        = stripslashes($row['locale']);
		$decalage      = $db->XMFnum($row['decalage']);
		$multilingual  = $db->XMFbin($row['multilingual']);
		$useflags      = $db->XMFbin($row['useflags']);
		$admingraphic  = $db->XMFbin($row['admingraphic']);
		$httpref       = $db->XMFbin($row['httpref']);
		$httprefmax    = $db->XMFnum($row['httprefmax']);
		$wysiwyg       = stripslashes($row['wysiwyg']);
		$cldbi         = $db->XMFbin($row['dbi']);
		$rewrite       = $db->XMFbin($row['rewrite']);

		menu('1');
		br('1');
$currentTabs=new Tabs("set1");
$currentTabs->StartTabWindow();

$currentTabs->AddTab(""._INFOS."");
		echo "<center><font class=\"option\"><b>" . _GENSITEINFO . "</b></font></center>"
		."<form action=\"".$admin_file.".php\" method=\"post\">"
		."<table border=\"0\"><tr><td>"
		."" . _SITENAME . ":</td><td><input type=\"text\" name=\"xsitename\" value=\"$sitename\" size=\"40\" maxlength=\"255\">"
		."</td></tr><tr><td>"
		."" . _SITEURL . ":</td><td><input type=\"text\" name=\"xnukeurl\" value=\"$nukeurl\" size=\"40\" maxlength=\"255\">"
		."</td></tr><tr><td>"
		."" . _DOCROOT . ":</td><td><input type=\"text\" value=\"$doc_root\" size=\"40\" maxlength=\"255\" >"
		."</td></tr><tr><td>"
		."" . _SITELOGO . ":</td><td><input type=\"text\" name=\"xsite_logo\" value=\"$site_logo\" size=\"20\" maxlength=\"255\"> <font class=\"tiny\">[ " . _MUSTBEINIMG . " ]</font>"
		."</td></tr><tr><td>"
		."" . _SITESLOGAN . ":</td><td><input type=\"text\" name=\"xslogan\" value=\"$slogan\" size=\"40\" maxlength=\"255\">"
		."</td></tr><tr><td>"
		."" . _STARTDATE . ":</td><td><input type=\"text\" name=\"xstartdate\" value=\"$startdate\" size=\"20\" maxlength=\"50\">"
		."</td></tr><tr><td>"
		."" . _ADMINEMAIL . ":</td><td><input type=\"text\" name=\"xadminmail\" value=\"$adminmail\" size=\"30\" maxlength=\"255\">"
		."</td></tr><tr><td>"
		."" . _ANONYMOUSNAME . ":</td><td><input type=\"text\" name=\"xanonymous\" value=\"$anonymous\">"
		."</td></tr><tr><td> ";
		if ($wysiwyg == 'fck' ) { $ck1 = " checked"; $ck2 = ""; $ck3 = "";
		} elseif ($wysiwyg == 'tiny' ) { $ck1 = ""; $ck2 = " checked"; $ck3 = "";
		} else { $ck1 = ""; $ck2 = ""; $ck3 = " checked"; }
	   echo "" . _SITE_EDITOR . " $wysiwyg</td><td>"
	   . "<input type=\"radio\" name=\"Xwysiwyg\" value=\"fck\"$ck1> FCKeditor &nbsp;";
if ( is_dir('includes/tiny_mce') ) {
           echo "<input type=\"radio\" name=\"Xwysiwyg\" value=\"tiny\"$ck2> Tiny MCE 2.x &nbsp;";
}
	   echo "<input type=\"radio\" name=\"Xwysiwyg\" value=\"no\"$ck3> "._NOEDITOR."</td></tr>"
	   ."</td></tr><tr><td>";
	   	if ($cldbi ==1) { $ck1 = " checked"; $ck2 = ""; } else { $ck1 = ""; $ck2 = " checked"; }
	   echo "" . _SITE_DBI . "</td><td>"
	  . "<input type=\"radio\" name=\"Cldbi\" value=\"1\"$ck1>"._YES." &nbsp;"
          ."<input type=\"radio\" name=\"Cldbi\" value=\"0\"$ck2>"._NO."</td></tr>"
	  ."</td></tr><tr><td>";
	   	if ($rewrite ==1) { $ck1 = " checked"; $ck2 = ""; } else { $ck1 = ""; $ck2 = " checked"; }
	  echo ""._SITE_URLREWR ."</td><td>"
	  . "<input type=\"radio\" name=\"xrewrite\" value=\"1\"$ck1>"._YES." &nbsp;"
          ."<input type=\"radio\" name=\"xrewrite\" value=\"0\"$ck2>"._NO."</td></tr>"
	  ."</td></tr>"
 	  ."</td></tr><tr><td>"
	  ."" . _DEFAULTTHEME . ":</td><td><select name=\"xDefault_Theme\">";
		$handle=opendir('themes');
		while ($file = readdir($handle)) {
			if ( (!ereg("[.]",$file)) ) {
			$themelist .= "$file ";
			}
		}
		closedir($handle);
		$themelist = explode(" ", $themelist);
		sort($themelist);
		for ($i=0; $i < sizeof($themelist); $i++) {
			if($themelist[$i]!="") {
				echo "<option name=\"xDefault_Theme\" value=\"$themelist[$i]\" ";
				if($themelist[$i]==$Default_Theme) echo "selected";
				echo ">$themelist[$i]\n";
			}
		}
		echo "</select>"
		."</td></tr><tr><td>"
		."" . _SELLANGUAGE . ":</td><td>"
		."<select name=\"xlanguage\">";
		$handle=opendir('language');
		while ($file = readdir($handle)) {
			if (ereg("^lang\-(.+)\.php", $file, $matches)) {
				$langFound = $matches[1];
				$languageslist .= "$langFound ";
			}
		}
		closedir($handle);
		$languageslist = explode(" ", $languageslist);
		sort($languageslist);
		for ($i=0; $i < sizeof($languageslist); $i++) {
			if($languageslist[$i]!="") {
				echo "<option name=\"xlanguage\" value=\"$languageslist[$i]\" ";
				if($languageslist[$i]==$language) echo "selected";
				echo ">".ucfirst($languageslist[$i])."\n";
			}
		}
		echo "</select>"
		."</td></tr><tr><td>"
		."" . _LOCALEFORMAT . ":</td><td><input type=\"text\" name=\"xlocale\" value=\"$locale\" size=\"20\" maxlength=\"40\">"
		."</td></tr><tr><td>"._DECALAGE.":</td><td><input type=\"text\" name=\"xdecalage\" value=\"$decalage\" size=\"20\">"
		."</td></tr></table>";
		br('2');
	echo "<br /><br /><input type=\"hidden\" name=\"op\" value=\"ConfigSave\">"
		."<center><input type=\"submit\" value=\"" . _SAVECHANGES . "\"></center>";

$currentTabs->AddTab(""._LANGUES."");
	echo "<center><font class=\"option\"><b>" . _MULTILINGUALOPT . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _ACTMULTILINGUAL . "</td><td>";
		if ($multilingual==1) {
			echo "<input type=\"radio\" name=\"xmultilingual\" value=\"1\" checked>" . _YES . " &nbsp;"
			."<input type=\"radio\" name=\"xmultilingual\" value=\"0\">" . _NO . "";
		} else {
			echo "<input type=\"radio\" name=\"xmultilingual\" value=\"1\">" . _YES . " &nbsp;"
			."<input type=\"radio\" name=\"xmultilingual\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr><tr><td>"
		."" . _ACTUSEFLAGS . "</td><td>";
		if ($useflags==1) {
			echo "<input type=\"radio\" name=\"xuseflags\" value=\"1\" checked>" . _YES . " &nbsp;"
			."<input type=\"radio\" name=\"xuseflags\" value=\"0\">" . _NO . "";
		} else {
			echo "<input type=\"radio\" name=\"xuseflags\" value=\"1\">" . _YES . " &nbsp;"
			."<input type=\"radio\" name=\"xuseflags\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr></table>";
		br('1');
		echo "<input type=\"hidden\" name=\"op\" value=\"ConfigSave\">"
		."<center><input type=\"submit\" value=\"" . _SAVECHANGES . "\"></center>";

$currentTabs->AddTab(""._GRAPHICS."");
	echo "<center><font class=\"option\"><b>" . _BANNERSOPT . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _ACTBANNERS . "</td><td>";
		if ($banners==1) {
			echo "<input type=\"radio\" name=\"xbanners\" value=\"1\" checked>" . _YES . " &nbsp;"
			."<input type=\"radio\" name=\"xbanners\" value=\"0\">" . _NO . "";
		} else {
			echo "<input type=\"radio\" name=\"xbanners\" value=\"1\">" . _YES . " &nbsp;"
			."<input type=\"radio\" name=\"xbanners\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr></table>";
				echo "<center><font class=\"option\"><b>" . _GRAPHICOPT . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _ADMINGRAPHIC . "</td><td>";
		if ($admingraphic==1) {
		echo "<input type=\"radio\" name=\"xadmingraphic\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xadmingraphic\" value=\"0\">" . _NO . "";
		} else {
		echo "<input type=\"radio\" name=\"xadmingraphic\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xadmingraphic\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr></table>";
	br('2');
	echo "<input type=\"hidden\" name=\"op\" value=\"ConfigSave\">"
		."<center><input type=\"submit\" value=\"" . _SAVECHANGES . "\"></center>";

$currentTabs->AddTab(""._FOOTER."");
	echo "<center><font class=\"option\"><b>" . _FOOTERMSG . "</b></font></center>"
		."<table border=\"0\"><tr><td valign=\"top\">"
		."" . _FOOTERLINE1 . ":</td><td><textarea name=\"xfoot1\" cols=\"70\" rows=\"7\">" . stripslashes($foot1) . "</textarea>"
		."</td></tr><tr><td valign=\"top\">"
		."" . _FOOTERLINE2 . ":</td><td><textarea name=\"xfoot2\" cols=\"70\" rows=\"7\">" . stripslashes($foot2) . "</textarea>"
		."</td></tr><tr><td valign=\"top\">"
		."" . _FOOTERLINE3 . ":</td><td><textarea name=\"xfoot3\" cols=\"70\" rows=\"7\">" . stripslashes($foot3) . "</textarea>"
		."</td></tr></table>";
		echo "<br /><br /><input type=\"hidden\" name=\"op\" value=\"ConfigSave\">"
		."<center><input type=\"submit\" value=\"" . _SAVECHANGES . "\"></center>";

$currentTabs->AddTab(""._BACKEND."");
	echo "<center><font class=\"option\"><b>" . _BACKENDCONF . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _BACKENDTITLE . ":</td><td><input type=\"text\" name=\"xbackend_title\" value=\"$backend_title\" size=\"40\" maxlength=\"100\">"
		."</td></tr><tr><td>"
		."" . _BACKENDLANG . ":</td><td><input type=\"text\" name=\"xbackend_language\" value=\"$backend_language\" size=\"10\" maxlength=\"10\">"
		."</td></tr></table>"
		."<br /><br /><input type=\"hidden\" name=\"op\" value=\"ConfigSave\">"
		."<center><input type=\"submit\" value=\"" . _SAVECHANGES . "\"></center>";

$currentTabs->AddTab(""._OTHERS."");
		echo "<center><font class=\"option\"><b>" . _MISCOPT . "</b></font></center>"
		."<table border=\"0\"><tr><td>"
		."" . _ITEMSTOP . ":</td><td><select name=\"xtop\">"
		."<option name=\"xtop\">$top</option>"
		."<option name=\"xtop\">5</option>"
		."<option name=\"xtop\">10</option>"
		."<option name=\"xtop\">15</option>"
		."<option name=\"xtop\">20</option>"
		."<option name=\"xtop\">25</option>"
		."<option name=\"xtop\">30</option>"
		."</select>"
		."</td></tr><tr><td>"
		."" . _OLDSTORIES . ":</td><td><select name=\"xoldnum\">"
		."<option name=\"xoldnum\">$oldnum</option>"
		."<option name=\"xoldnum\">10</option>"
		."<option name=\"xoldnum\">20</option>"
		."<option name=\"xoldnum\">30</option>"
		."<option name=\"xoldnum\">40</option>"
		."<option name=\"xoldnum\">50</option>"
		."</select>"
		."</td></tr><tr><td>"
		."" . _ACTULTRAMODE . "</td><td>";
		if ($ultramode==1) {
			echo "<input type=\"radio\" name=\"xultramode\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xultramode\" value=\"0\">" . _NO . "";
		} else {
			echo "<input type=\"radio\" name=\"xultramode\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xultramode\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr><tr><td>" . _ALLOWANONPOST . " </td><td>";
		if ($anonpost==1) {
			echo "<input type=\"radio\" name=\"xanonpost\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xanonpost\" value=\"0\">" . _NO . "";
		} else {
	echo "<input type=\"radio\" name=\"xanonpost\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xanonpost\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr><tr><td>"

		."" . _ACTIVATEHTTPREF . "</td><td>";
		if ($httpref==1) {
		echo "<input type=\"radio\" name=\"xhttpref\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=xhttpref value=\"0\">" . _NO . "";
		} else {
		echo "<input type=\"radio\" name=\"xhttpref\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xhttpref\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr><tr><td>"
		."" . _MAXREF . "</td><td>"
		."<select name=\"xhttprefmax\">"
		."<option name=\"xhttprefmax\" value=\"$httprefmax\">$httprefmax</option>"
		."<option name=\"xhttprefmax\" value=\"100\">100</option>"
		."<option name=\"xhttprefmax\" value=\"250\">250</option>"
		."<option name=\"xhttprefmax\" value=\"500\">500</option>"
		."<option name=\"xhttprefmax\" value=\"1000\">1000</option>"
		."<option name=\"xhttprefmax\" value=\"2000\">2000</option>"
		."</select>"
		."</td></tr><tr><td>"
	        ."</table><br /><br /><center><font class=\"option\"><b>" . _USERSOPTIONS . "</b></font></center>"
		."<table border=\"0\">"
		."<tr><td>" . _BROADCASTMSG . "</td><td>";
		if ($broadcast_msg == 1) {
		echo "<input type=\"radio\" name=\"xbroadcast_msg\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xbroadcast_msg\" value=\"0\">" . _NO . "";
		} else {
		echo "<input type=\"radio\" name=\"xbroadcast_msg\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xbroadcast_msg\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr><tr><td>" . _MYHEADLINES . "</td><td>";
		if ($my_headlines == 1) {
		echo "<input type=\"radio\" name=\"xmy_headlines\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xmy_headlines\" value=\"0\">" . _NO . "";
		} else {
		echo "<input type=\"radio\" name=\"xmy_headlines\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xmy_headlines\" value=\"0\" checked>" . _NO . "";
		}
		echo "</td></tr><tr><td>" . _USERSHOMENUM . "</td><td>";
		if ($user_news == 1) {
		echo "<input type=\"radio\" name=\"xuser_news\" value=\"1\" checked>" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xuser_news\" value=\"0\">" . _NO . "";
		} else {
		echo "<input type=\"radio\" name=\"xuser_news\" value=\"1\">" . _YES . " &nbsp;
	<input type=\"radio\" name=\"xuser_news\" value=\"0\" checked>" . _NO . "";
		}
	echo "</td></tr></table>"
	    ."<br /><br /><input type=\"hidden\" name=\"op\" value=\"ConfigSave\">"
	    ."<center><input type=\"submit\" value=\"" . _SAVECHANGES . "\"></center></form>";

$currentTabs->AddTab(""._ADMIN."");
	$sql2 = "SELECT admintheme from ".TABLE_CONFIG_ADMIN."";
		if ( !($result2 = $db->sql_query($sql2)) )
{ query_die(GENERAL_ERROR, 'Could not obtain Admin Config WebSite', '', __LINE__, __FILE__, $sql2);}
		$row2 = $db->sql_fetchrow($result2);
		$xAdmin_Default_Theme = stripslashes($row2['admintheme']);
		echo "<table><form action=\"".$admin_file.".php\" method=\"post\"><tr><td>"
		."" . _ADMIN_DEFAULTTHEME . ":</td><td><select name=\"xAdmin_Default_Theme\">";
		$handle2 = opendir('admin/themes');
		while ($file2 = readdir($handle2)) {
			if ( (!ereg("[.]",$file2)) ) {
			$themelist2 .= "$file2 ";
			}
		}
		closedir($handle2);
		$themelist2 = explode(" ", $themelist2);
		sort($themelist2);
		for ($i=0; $i < sizeof($themelist2); $i++) {
			if($themelist2[$i]!="") {
				echo "<option name=\"xAdmin_Default_Theme\" value=\"$themelist2[$i]\" ";
				if($themelist2[$i]==$xAdmin_Default_Theme) echo "selected";
				echo ">$themelist2[$i]\n";
			}
		}
	echo "</select></td></tr>"
	    ."<tr><td><br /><br /><input type=\"hidden\" name=\"op\" value=\"ConfigSaveAdmin\">"
	."<center><input type=\"submit\" value=\"" . _SAVECHANGES . "\"></center></td></tr></table></form>";

$currentTabs->AddTab(""._CONFIGPHP."");
	echo "<table border=\"1\" width=\"100%\"><center><font class=\"option\"><b>"._CONFIGINFO."</FONT></b></center>"
	."<tr><td WIDTH=\"30%\">"._CONFIGVALOR." \$dbhost</td><td><b>$dbhost</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR1."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$dbuname</td><td><b>$dbuname</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR2."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$dbname</td><td><b>$dbname</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR3."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$dbpass</td><td><b>$dbpass</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR4."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$prefix</td><td><b>$prefix</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR5."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$user_prefix</td><td><b>$user_prefix</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR6."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$dbtype</td><td><b>$dbtype</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR7."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$sitekey</td><td><b>$sitekey</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR8."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$gfx_chk</td><td><b>$gfx_chk</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR9."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$admin_file</td><td><b>$admin_file</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR10."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$display_errors</td><td><b>$display_errors</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR11."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$cache</td><td><b>$cache</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR12."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$cache_prefix</td><td><b>$cache_prefix</b><br /><i><font color=\"green\">"._HELPCONFIGVALOR13."</i></tr>"
	."<tr><td>"._CONFIGVALOR." \$doc_root</td><td><b>$doc_root</b></tr>"
	."</table>";
$currentTabs->EndTabWindow();

incof();

}
} else {
	echo "Access Denied";
}