<?php
/************************************************************/
/*	                     RUNCMS                             */
/* Relaible - Unique - Nocost &  Simplicity & ease off use  */
/*              < http://www.runcms.org >                   */
/************************************************************/

// Original Author: Nobse
// Author Website : http://www.e-xoops.de
// License Type   : GPL: See /manual/LICENSES/GPL.txt
// ------------------------------------------------------------------------- //


//Menue***********************************************
include_once("./admin_header.php");


function config() {
include_once("../cache/config.php");
xoops_cp_header();
OpenTable();
?>
<h4><?php echo _AM_PM_TEXT;?></h4><br />
<form action="index.php" method="post">
<table width="100%" border="0"><tr>
<?php
$chk1 = ''; $chk0 = '';
($pmConfig['allow_upload'] == 1) ? $chk1 = " checked='checked'" : $chk0 = " checked='checked'";
?>
<td nowrap><?php echo _AM_PM_UPLOAD;?></td>
<td width="100%">
<input type="radio" class="radio" name="allow_upload" value="1"<?php echo $chk1;?> /> <?php echo _YES;?>
<input type="radio" class="radio" name="allow_upload" value="0"<?php echo $chk0;?> /> <?php echo _NO;?>
</td></tr><tr>

<td nowrap><?php echo _AM_PM_DATEIGROESSE;?></td>
<td width="100%">
<input type="text" class="text" size="20" name="upload_limit" value="<?php echo $pmConfig['upload_limit'];?>" />
</td></tr><tr>

<td nowrap><?php echo _AM_PM_DATEIENDUNG;?></td>
<td width="100%">
<input type="text" class="text" size="30" name="accepted_files" value="<?php echo $pmConfig['accepted_files'];?>" />
</td></tr><tr>

<td nowrap><?php echo _AM_PM_PMS;?></td>
<td width="100%">
<input type="text" class="text" size="5" name="max_pms" value="<?php echo $pmConfig['max_pms'];?>" />
</td></tr><tr>

<?php
$chk1 = ''; $chk0 = '';
($pmConfig['sendmail'] == 1) ? $chk1 = " checked='checked'" : $chk0 = " checked='checked'";
?>
<td nowrap><?php echo _AM_PM_MAIL;?></td>
<td width="100%">
<input type="radio" class="radio" name="sendmail" value="1"<?php echo $chk1;?> /> <?php echo _YES;?>
<input type="radio" class="radio" name="sendmail" value="0"<?php echo $chk0;?> /> <?php echo _NO;?>
</td></tr>

<tr>
<td colspan="2">
<input type="hidden" name="op" value="save">
<input type="submit" class="button" name="submit" value="<?php echo _SAVE;?>">
<input type="button" class="button" value="<?php echo _CANCEL;?>" onclick="javascript:history.go(-1)">
</td></tr></table>
</form>

<?php
CloseTable();
xoops_cp_footer();
}

//*******************************************
function save() {
global $HTTP_POST_VARS, $myts;

$content  = "<?php\n";
$content .= "\$pmConfig['allow_upload']		   = ".intval($HTTP_POST_VARS['allow_upload']).";\n";
$content .= "\$pmConfig['accepted_files']      = '".$HTTP_POST_VARS['accepted_files']."';\n";
$content .= "\$pmConfig['upload_limit']        = ".intval($HTTP_POST_VARS['upload_limit']).";\n";
$content .= "\$pmConfig['max_pms']             = ".intval($HTTP_POST_VARS['max_pms']).";\n";
$content .= "\$pmConfig['sendmail']            = ".intval($HTTP_POST_VARS['sendmail']).";\n";
$content .= "?>";

$filename = "../cache/config.php";
if ( $file = fopen($filename, "w") ) {
	fwrite($file, $content);
	fclose($file);
	} else {
		redirect_header("index.php", 1, _NOTUPDATED);
		exit();
	}

redirect_header("index.php", 1, _UPDATED);
exit();
}

//---------------------------------------------------------------------------------------//
$op = !empty($HTTP_POST_VARS['op']) ? $HTTP_POST_VARS['op'] : $HTTP_GET_VARS['op'];

switch ($op) {

case "save":
	save();
	break;

default:
	config();
	break;
}


?>
