2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Front controller for config view / download and clear
6 * @package PhpMyAdmin-Setup
12 require './lib/common.inc.php';
13 require_once './libraries/config/Form.class.php';
14 require_once './libraries/config/FormDisplay.class.php';
15 require_once './setup/lib/ConfigGenerator.class.php';
17 require './libraries/config/setup.forms.php';
19 $form_display = new FormDisplay($GLOBALS['ConfigFile']);
20 $form_display->registerForm('_config.php', $forms['_config.php']);
21 $form_display->save('_config.php');
22 $config_file_path = $GLOBALS['ConfigFile']->getFilePath();
24 if (isset($_POST['eol'])) {
25 $_SESSION['eol'] = ($_POST['eol'] == 'unix') ?
'unix' : 'win';
28 if (PMA_ifSetOr($_POST['submit_clear'], '')) {
30 // Clear current config and return to main page
32 $GLOBALS['ConfigFile']->resetConfigData();
34 header('HTTP/1.1 303 See Other');
35 header('Location: index.php' . PMA_URL_getCommon());
37 } elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
39 // Output generated config file
41 PMA_downloadHeader('config.inc.php', 'text/plain');
42 echo ConfigGenerator
::getConfigFile($GLOBALS['ConfigFile']);
44 } elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
46 // Save generated config file on the server
50 ConfigGenerator
::getConfigFile($GLOBALS['ConfigFile'])
52 header('HTTP/1.1 303 See Other');
53 header('Location: index.php' . PMA_URL_getCommon() . '&action_done=config_saved');
55 } elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
57 // Load config file from the server
60 include_once $config_file_path;
61 $GLOBALS['ConfigFile']->setConfigData($cfg);
62 header('HTTP/1.1 303 See Other');
63 header('Location: index.php' . PMA_URL_getCommon());
65 } elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
67 // Delete config file on the server
69 @unlink
($config_file_path);
70 header('HTTP/1.1 303 See Other');
71 header('Location: index.php' . PMA_URL_getCommon());
75 // Show generated config file in a <textarea>
77 header('HTTP/1.1 303 See Other');
78 header('Location: index.php' . PMA_URL_getCommon() . '&page=config');