<?php
/* +----------------------------------------------------------------------+
| Netautor Professional Application Server |
+----------------------------------------------------------------------+
| Copyright (C) 1998-2005 digiconcept GmbH. <www.digiconcept.net> |
+----------------------------------------------------------------------+
| This file is subject to license, that is bundled with this package |
| in the file LICENSE.TXT, and is available at through the |
| world-wide-web at http://www.netautor.com/license/ |
| |
| If you did not receive a copy of the license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| hide@address.com so we can mail you a copy. |
+----------------------------------------------------------------------+
| Authors: Stefan Rottensteiner <hide@address.com> |
| Marek Kadziela <hide@address.com> |
| Gregor Wollner |
| Christian Unger |
| Helli Kleinhans |
+----------------------------------------------------------------------+*/
/**
* @version $Revision: 1.11 $
* @author Stefan Rottensteiner
*/
require_once('../../include/init.inc');
if(!$GLOBALS['USER']->check_feature('Admin'))
{
$GLOBALS['USER']->login_call();
}
// --- include necessary functions
includeNaPro( 'array,form,property,string,swish' );
$GLOBALS['LOCALE']->textdomain('index');
if (empty($config_path)) $config_path='';
if (!isset($status)) $status='';
if (basename($config_path)=='') $config_path.="/config.swish-e";
if (!empty($config_path) && !empty($_SERVER['WINDIR'])) $config_path= str_replace("/","\\",$config_path);
$WriteDefault = !empty($writedefault);
// Mögliche Config-Files einlesen
if (!file_exists($config_path))
{
$Config = create_SwishDefaultConfig();
if ($WriteDefault)
{
$Config->store($config_path);
$status ='dr';
}
else
{
$status ='d';
}
}
else
{
if (empty($status))
{
$Config = new property($config_path,' ');
$status ='gr';
}
else
{
$UserDefined = @parse_post_get_array(true,'cfg_',true);
$Plus = @parse_post_get_array(true,'plus_',true);
$Minus = @parse_post_get_array(true,'minus_',true);
$status = 'ud';
// Parameter erweitern
reset($Plus);
while (List($name,$Value)=each($Plus))
{
$name= chopright("_x",$name);
if (!empty($name) && isset($UserDefined[$name])) $UserDefined[$name][]="";
}
// Parameter reduzieren
reset($Minus);
while (List($name,$Value)=each($Minus))
{
$name= chopright("_x",$name);
if (!empty($name) && isset($UserDefined[$name])) unset($UserDefined[$name][count($UserDefined[$name])-1]);
}
// Parameter ordentlich einlesen
$Config = new property('',' ');
reset($UserDefined);
while (List($name,$Value)=each($UserDefined))
{
$Config->setProperty($name,$Value);
}
}
}
if (isset($command_ok))
{
$result = $Config->store($config_path);
if (!$result)
{
$message = "Error while ".($result==-1?"opening":"writing")." file '$config_path'";
}
else
{
echo("<script>window.close();</script>");
}
}
?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title><?php echo $GLOBALS['LOCALE']->gettext('idx_edit_config')." ".$config_path; ?></title>
<meta http-equiv="Content-Style-Type" content="text/css" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta name ="robots" content="noindex">
<link href="../../include/netautor.css" rel="stylesheet" type="text/css">
</head>
<body class="standard">
<script>
function simulate_button(name,wert,ask)
{
if(ask)
{
doit=confirm(ask);
}
else
{
doit=true;
}
if(doit)
{
document.forms[0].action=document.forms[0].action+"?"+name+"="+escape(wert);
window.setTimeout("document.forms[0].submit();",300);
}
}
</script>
<form method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
<input type="hidden" name="config_path" value="<?php echo($config_path);?>">
<input type="hidden" name="status" value="<?php echo($status);?>">
<table width="482" border="0" cellspacing="0" cellpadding="4" class="bgwindow482">
<tr>
<td width="474" colspan="2" align="left" valign="top" class="text">
<img src="../../grafik/pixel.gif" width="474" height="1"><br>
</td>
</tr>
<?php
$Props = $Config->Properties;
reset($Props);
while(List($name,$Values)=each($Props))
{
echo('<tr><td class="text">'.$name.'</td><td valign="center">');
if (is_array($Values))
{
reset($Values);
while(List($Index,$Value)=each($Values))
{
echo("<input class='input285' type='text' size='35' name='cfg_$name"."[$Index]"."' value='$Value'> ");
if ($Index==0)
echo("<input border='0' name='plus_$name' type='image' src='../../grafik/na_plus.gif'>");
if ($Index==(count($Values)-1) && $Index>0)
echo("<input border='0' name='minus_$name' type='image' src='../../grafik/na_minus.gif'>");
echo("");
}
}
else
{
echo("<input type='text' size='35' name='cfg_$name"."[0]"."' value='$Values'>");
}
echo("</td></tr>");
}
?>
<tr>
<td align="center" width="30%" ><input type="submit" class="create" name="command_ok" value="<?php echo $GLOBALS['LOCALE']->gettext('save'); ?>"></td>
<td align="center" width="70%" ><input type="button" class="close" name="command_cancel" value="<?php echo $GLOBALS['LOCALE']->gettext('cancel'); ?>" onClick="window.close();"></td>
</tr>
</table>
<img src="../../grafik/bgwindow_482_stop.gif" width="482" height="14"><br>
<?php if (!empty($message)) :?>
<script language="JavaScript" type="text/javascript">
<!--
alert('<?php echo strtr($message,array("\r"=>'',"\n"=>'',"'"=>''));?>');
//-->
</script>
<?php endif; ?>
</form>
</body>
</html>