Translation update done using Pootle.
[phpmyadmin/madhuracj.git] / setup / config.php
blobb90d24cda965f809cd9d82f975f1c82a8492ce87
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 PMA_download_header('config.inc.php', 'text/plain');
42 echo ConfigGenerator::getConfigFile();
43 exit;
44 } elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
46 // Save generated config file on the server
48 file_put_contents($config_file_path, ConfigGenerator::getConfigFile());
49 header('HTTP/1.1 303 See Other');
50 header('Location: index.php?action_done=config_saved');
51 exit;
52 } elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
54 // Load config file from the server
56 $cfg = array();
57 require_once $config_file_path;
58 ConfigFile::getInstance()->setConfigData($cfg);
59 header('HTTP/1.1 303 See Other');
60 header('Location: index.php');
61 exit;
62 } elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
64 // Delete config file on the server
66 @unlink($config_file_path);
67 header('HTTP/1.1 303 See Other');
68 header('Location: index.php');
69 exit;
70 } else {
72 // Show generated config file in a <textarea>
74 header('HTTP/1.1 303 See Other');
75 header('Location: index.php?page=config');
76 exit;