Translated using Weblate (Chinese (Simplified))
[phpmyadmin.git] / setup / config.php
blobae990596755afe8f673130247370978d85a0e024
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 */
8 use PhpMyAdmin\Setup\ConfigGenerator;
9 use PhpMyAdmin\Config\Forms\Setup\ConfigForm;
10 use PhpMyAdmin\Core;
11 use PhpMyAdmin\Url;
12 use PhpMyAdmin\Response;
14 /**
15 * Core libraries.
17 require './lib/common.inc.php';
19 $form_display = new ConfigForm($GLOBALS['ConfigFile']);
20 $form_display->save('Config');
22 $response = Response::getInstance();
24 if (isset($_POST['eol'])) {
25 $_SESSION['eol'] = ($_POST['eol'] == 'unix') ? 'unix' : 'win';
28 if (Core::ifSetOr($_POST['submit_clear'], '')) {
30 // Clear current config and return to main page
32 $GLOBALS['ConfigFile']->resetConfigData();
33 // drop post data
34 $response->generateHeader303('index.php' . Url::getCommonRaw());
35 exit;
36 } elseif (Core::ifSetOr($_POST['submit_download'], '')) {
38 // Output generated config file
40 Core::downloadHeader('config.inc.php', 'text/plain');
41 $response->disable();
42 echo ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']);
43 exit;
44 } else {
46 // Show generated config file in a <textarea>
48 $response->generateHeader303('index.php' . Url::getCommonRaw(array('page' => 'config')));
49 exit;