Converted referrals_report.php to standard security model, take 2.
[openemr.git] / phpmyadmin / setup / config.php
blobe7d2161590adbf7573c807b0ce3fbacf0a88dc1c
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($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();
33 // drop post data
34 header('HTTP/1.1 303 See Other');
35 header('Location: index.php' . PMA_URL_getCommon());
36 exit;
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']);
43 exit;
44 } elseif (PMA_ifSetOr($_POST['submit_save'], '')) {
46 // Save generated config file on the server
48 file_put_contents(
49 $config_file_path,
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');
54 exit;
55 } elseif (PMA_ifSetOr($_POST['submit_load'], '')) {
57 // Load config file from the server
59 $cfg = array();
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());
64 exit;
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());
72 exit;
73 } else {
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');
79 exit;