Translation update done using Pootle.
[phpmyadmin-themes.git] / setup / config.php
blobe2bd132147d523717ac73d0a6fe12c046867b31f
1 <?php
2 /**
3 * Front controller for config view / download and clear
5 * @package phpMyAdmin-setup
6 * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
7 * @version $Id$
8 */
10 /**
11 * Core libraries.
13 require './lib/common.inc.php';
14 require_once './setup/lib/Form.class.php';
15 require_once './setup/lib/FormDisplay.class.php';
17 $form_display = new FormDisplay();
18 $form_display->registerForm('_config.php');
19 $form_display->save('_config.php');
20 $config_file_path = ConfigFile::getInstance()->getFilePath();
22 if (isset($_POST['eol'])) {
23 $_SESSION['eol'] = ($_POST['eol'] == 'unix') ? 'unix' : 'win';
26 if (PMA_ifSetOr($_POST['submit_clear'], '')) {
28 // Clear current config and return to main page
30 $_SESSION['ConfigFile'] = array();
31 // drop post data
32 header('HTTP/1.1 303 See Other');
33 header('Location: index.php');
34 exit;
35 } elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
37 // Output generated config file
39 header('Content-Type: text/plain');
40 header('Content-Disposition: attachment; filename="config.inc.php"');
41 echo ConfigFile::getInstance()->getConfigFile();
42 exit;
43 } elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
45 // Save generated config file on the server
47 file_put_contents($config_file_path, ConfigFile::getInstance()->getConfigFile());
48 header('HTTP/1.1 303 See Other');
49 header('Location: index.php');
50 exit;
51 } elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
53 // Load config file from the server
55 $cfg = array();
56 require_once $config_file_path;
57 $_SESSION['ConfigFile'] = $cfg;
58 header('HTTP/1.1 303 See Other');
59 header('Location: index.php');
60 exit;
61 } elseif (PMA_ifSetOr($_POST['submit_delete'], '')) {
63 // Delete config file on the server
65 @unlink($config_file_path);
66 header('HTTP/1.1 303 See Other');
67 header('Location: index.php');
68 exit;
69 } else {
71 // Show generated config file in a <textarea>
73 header('HTTP/1.1 303 See Other');
74 header('Location: index.php?page=config');
75 exit;