Continue to replace warning level with error level
[phpmyadmin/ammaryasirr.git] / setup / config.php
blobfa181069f7032c0da367bed095a90316bffd099b
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Front controller for config view / download and clear
6 * @package phpMyAdmin-setup
7 */
9 /**
10 * Core libraries.
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();
20 $form_display->registerForm('_config.php', $forms['_config.php']);
21 $form_display->save('_config.php');
22 $config_file_path = ConfigFile::getInstance()->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 ConfigFile::getInstance()->resetConfigData();
33 // drop post data
34 header('HTTP/1.1 303 See Other');
35 header('Location: index.php');
36 exit;
37 } elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
39 // Output generated config file
41 header('Content-Type: text/plain');
42 header('Content-Disposition: attachment; filename="config.inc.php"');
43 echo ConfigGenerator::getConfigFile();
44 exit;
45 } elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
47 // Save generated config file on the server
49 file_put_contents($config_file_path, ConfigGenerator::getConfigFile());
50 header('HTTP/1.1 303 See Other');
51 header('Location: index.php');
52 exit;
53 } elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
55 // Load config file from the server
57 $cfg = array();
58 require_once $config_file_path;
59 ConfigFile::getInstance()->setConfigData($cfg);
60 header('HTTP/1.1 303 See Other');
61 header('Location: index.php');
62 exit;
63 } elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
65 // Delete config file on the server
67 @unlink($config_file_path);
68 header('HTTP/1.1 303 See Other');
69 header('Location: index.php');
70 exit;
71 } else {
73 // Show generated config file in a <textarea>
75 header('HTTP/1.1 303 See Other');
76 header('Location: index.php?page=config');
77 exit;