// Change directory to project root chdir(__DIR__ . '/..'); // Use default autoload implementation require 'vendor/mindaphp/Loader.php'; // Load the libraries require 'config/loader.php'; // Load the config parameters $filename = 'config/config.php'; if ($_SERVER['REQUEST_METHOD'] == 'POST') { $code = Configurator::loadCode($filename); $config = Configurator::parseConfig($code); $config = Configurator::mergePost($config, $_POST); echo "<pre>"; $success = false; if (Configurator::testConfig($config)) { $code = Configurator::generateCode($config); Configurator::writeCode($filename, $code); echo "\nConfig written\n"; $success = true; } else { echo "\nConfig not written (invalid)\n"; } echo "</pre>"; if ($success) { echo '<input type="button" value="OK" onClick="window.location.href=window.location.href">'; } else { echo '<input type="button" value="Back" onClick="history.go(-1)">'; } die; } $code = Configurator::loadCode($filename);