<?php
// $Id: setup.php,v 1.1 2004/07/11 10:28:45 Farsus Exp $
// -------------------------------------------------------------------------//
//			                 RUNCMS                                         //
//                                                                          //
//	 reliable - Unique - Nocost &  Simplicity & ease off use                //
//                       < http://www.runcms.org >                          //
// -------------------------------------------------------------------------//
// Original Author: i-Tech (Half-Dead)
// Author Website : http://www.i-Technology.NETm
// License Type   : LGPL: See /manual/LICENSES/LGPL.txt
// ------------------------------------------------------------------------- //

require("./xoops_header.php");
//------------------------------------------------------------------------------------------//

if ($HTTP_POST_VARS['submit']) {

$content  = "<?php\n";
$content .= "\$phprpc_cms      = \"".$HTTP_POST_VARS['cms']."\";\n";
$content .= "\$phprpc_path     = \"".$HTTP_POST_VARS['filepath']."\";\n";
$content .= "\$phprpc_debug    = ".$HTTP_POST_VARS['debug'].";\n";
$content .= "\$phprpc_encoding = \"".$HTTP_POST_VARS['encoding']."\";\n";
$content .= "\$phprpc_escaping = \"".$HTTP_POST_VARS['escaping']."\";\n";
$content .= "?>";

if	(
	isset($HTTP_POST_VARS['cms']) &&
	isset($HTTP_POST_VARS['filepath']) &&
	isset($HTTP_POST_VARS['debug']) &&
	isset($HTTP_POST_VARS['encoding']) &&
	isset($HTTP_POST_VARS['escaping'])
	) {

	$configfile  = '../../cache/config.php';
	if ($fp = fopen($configfile, 'w') ) {
		fwrite($fp, $content);
		fclose($fp);
		redirect_header("./index.php", 3, "Configuration Saved.");
		exit();
	}
}
}

//------------------------------------------------------------------------------------------//
require("../../cache/config.php");
xoops_cp_header();
OpenTable();
//------------------------------------------------------------------------------------------//
?>

<table width="100%" border="0" cellspacing="0" cellpadding="3"><tr>

<td><div align="center">
<h3><?php echo _AM_MAIN;?></h3>
</div></td>

</tr><tr>

<td>
<form name="phprpc_setup" method="post" action="./setup.php">
<table width="80%" border="0" align="center" cellpadding="3" cellspacing="0"><tr>

<td><?php echo _AM_DEBUG;?></td>
<td>
<?php echo _ON;?><input type="radio" class="radio" name="debug" value="1" <?php if ($phprpc_debug == 1) { echo " checked"; } ?>>
<?php echo _OFF;?><input type="radio" class="radio" name="debug" value="0" <?php if ($phprpc_debug == 0) { echo " checked"; } ?>>
</td>

</tr><tr>

<td><?php echo _AM_DATABASE;?></td>
<td><select class="select" name="database">
<option value="mysql" selected>mysql</option>
</select></td>

</tr><tr>

<td><?php echo _AM_ENCODING;?></td>
<td><select class="select" name="encoding">
<option value="ISO-8859-1"<?php if ($phprpc_encoding == "ISO-8859-1") { echo " selected"; } ?>>ISO-8859-1</option>
</select></td>

</tr><tr>

<td><?php echo _AM_ESCAPING;?></td>
<td><select class="select" name="escaping">
<option value="CDATA"<?php if ($phprpc_escaping == "CDATA") { echo " selected"; } ?>>CDATA</option>
</select></td>

</tr><tr>

<td><?php echo _AM_PATH;?></td>
<td><input type="text" class="text" name="filepath" size="45" value="<?php echo XOOPS_ROOT_PATH;?>/modules/phpRPC" readonly></td>

</tr><tr>

<td><?php echo _AM_CMS;?></td>
<td><select class="select" name="cms">
<option value="exoops" selected>E-Xoops</option>
</select></td>

</tr><tr>

<td>&nbsp;</td>
<td>&nbsp;</td>

</tr><tr>

<td>&nbsp;</td>
<td><input type="submit" class="button" name="submit" value="Submit"></td>

</tr></table>
</form></td>

</tr></table>

<?php
//------------------------------------------------------------------------------------------//
CloseTable();
xoops_cp_footer();
?>
