remove todo, after upgrade PHPExcel
[phpmyadmin/arisferyanto.git] / setup / config.php
blobf09b5fd29bdc6e70cea96c16685daf66baa91088
1 <?php
2 /**
3 * Front controller for config view / download and clear
5 * @package phpMyAdmin-setup
6 * @author Piotr Przybylski <piotrprz@gmail.com>
7 * @license http://www.gnu.org/licenses/gpl.html GNU GPL 2.0
8 * @version $Id$
9 */
11 /**
12 * Core libraries.
14 require './lib/common.inc.php';
15 require_once './setup/lib/Form.class.php';
16 require_once './setup/lib/FormDisplay.class.php';
18 $form_display = new FormDisplay();
19 $form_display->registerForm('_config.php');
20 $form_display->save('_config.php');
21 $config_file_path = ConfigFile::getInstance()->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 $_SESSION['ConfigFile'] = array();
32 // drop post data
33 header('HTTP/1.1 303 See Other');
34 header('Location: index.php');
35 exit;
36 } elseif (PMA_ifSetOr($_POST['submit_download'], '')) {
38 // Output generated config file
40 header('Content-Type: text/plain');
41 header('Content-Disposition: attachment; filename="config.inc.php"');
42 echo ConfigFile::getInstance()->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, ConfigFile::getInstance()->getConfigFile());
49 header('HTTP/1.1 303 See Other');
50 header('Location: index.php');
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 $_SESSION['ConfigFile'] = $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;