2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Front controller for config view / download and clear
6 * @package PhpMyAdmin-Setup
8 use PMA\libraries\config\FormDisplay
;
9 use PMA\setup\lib\ConfigGenerator
;
14 require './lib/common.inc.php';
16 require './libraries/config/setup.forms.php';
18 $form_display = new FormDisplay($GLOBALS['ConfigFile']);
19 $form_display->registerForm('_config.php', $forms['_config.php']);
20 $form_display->save('_config.php');
21 $config_file_path = $GLOBALS['ConfigFile']->getFilePath();
23 if (isset($_POST['eol'])) {
24 $_SESSION['eol'] = ($_POST['eol'] == 'unix') ?
'unix' : 'win';
27 if (PMA_ifSetOr($_POST['submit_clear'], '')) {
29 // Clear current config and return to main page
31 $GLOBALS['ConfigFile']->resetConfigData();
33 header('HTTP/1.1 303 See Other');
34 header('Location: index.php' . PMA_URL_getCommon());
36 } elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
38 // Output generated config file
40 PMA_downloadHeader('config.inc.php', 'text/plain');
41 echo ConfigGenerator
::getConfigFile($GLOBALS['ConfigFile']);
43 } elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
45 // Save generated config file on the server
49 ConfigGenerator
::getConfigFile($GLOBALS['ConfigFile'])
51 header('HTTP/1.1 303 See Other');
52 header('Location: index.php' . PMA_URL_getCommon() . '&action_done=config_saved');
54 } elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
56 // Load config file from the server
59 include_once $config_file_path;
60 $GLOBALS['ConfigFile']->setConfigData($cfg);
61 header('HTTP/1.1 303 See Other');
62 header('Location: index.php' . PMA_URL_getCommon());
64 } elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
66 // Delete config file on the server
68 @unlink
($config_file_path);
69 header('HTTP/1.1 303 See Other');
70 header('Location: index.php' . PMA_URL_getCommon());
74 // Show generated config file in a <textarea>
76 header('HTTP/1.1 303 See Other');
77 header('Location: index.php' . PMA_URL_getCommon() . '&page=config');