24 lines
720 B
PHP
24 lines
720 B
PHP
<?php chdir('../../../../') ?>
|
|
<?php require 'base.php' ?>
|
|
<?php
|
|
|
|
$software = trim($_GET['software']);
|
|
if (!in_array($software, $GLOBALS['supported_ap_software']))
|
|
apiresult(['error' => 'software type is not supported'], 400);
|
|
|
|
$instance = trim($_GET['instance']);
|
|
if (!preg_match('/^[a-zA-Z0-9\.\-\_]+$/', $instance))
|
|
apiresult(['error' => 'instance parameter is not correctly formatted'], 400);
|
|
|
|
$string = '';
|
|
foreach ($_POST as $k => $v) {
|
|
if (trim($v) === '')
|
|
continue;
|
|
$string .= strtolower(trim($k)).'='.trim($v)."\n";
|
|
}
|
|
|
|
$config_file = $GLOBALS['appconf']['data_dir'].'/instances/'.$software.'/'.$instance.'/config';
|
|
file_put_contents($config_file, $string);
|
|
|
|
header('Location: '.$_SERVER['HTTP_REFERER']);
|