3 * Front controller for config view / download and clear
6 declare(strict_types
=1);
8 use PhpMyAdmin\Config\Forms\Setup\ConfigForm
;
10 use PhpMyAdmin\Response
;
11 use PhpMyAdmin\Setup\ConfigGenerator
;
14 if (! defined('ROOT_PATH')) {
15 // phpcs:disable PSR1.Files.SideEffects
16 define('ROOT_PATH', dirname(__DIR__
) . DIRECTORY_SEPARATOR
);
23 require ROOT_PATH
. 'setup/lib/common.inc.php';
25 $form_display = new ConfigForm($GLOBALS['ConfigFile']);
26 $form_display->save('Config');
28 $response = Response
::getInstance();
31 if (isset($_POST['eol'])) {
32 $_SESSION['eol'] = $_POST['eol'] === 'unix' ?
'unix' : 'win';
35 if (Core
::ifSetOr($_POST['submit_clear'], '')) {
36 // Clear current config and return to main page
37 $GLOBALS['ConfigFile']->resetConfigData();
39 $response->generateHeader303('index.php' . Url
::getCommonRaw());
43 if (Core
::ifSetOr($_POST['submit_download'], '')) {
44 // Output generated config file
45 Core
::downloadHeader('config.inc.php', 'text/plain');
47 echo ConfigGenerator
::getConfigFile($GLOBALS['ConfigFile']);
51 // Show generated config file in a <textarea>
52 $response->generateHeader303('index.php' . Url
::getCommonRaw(['page' => 'config']));