Translated using Weblate (Bulgarian)
[phpmyadmin.git] / setup / config.php
blob614f70fa2c3ecfde6c1f2577b140960cf4821d5e
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 declare(strict_types=1);
10 use PhpMyAdmin\Config\Forms\Setup\ConfigForm;
11 use PhpMyAdmin\Core;
12 use PhpMyAdmin\Response;
13 use PhpMyAdmin\Setup\ConfigGenerator;
14 use PhpMyAdmin\Url;
16 if (! defined('ROOT_PATH')) {
17 define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
20 /**
21 * Core libraries.
23 require ROOT_PATH . 'setup/lib/common.inc.php';
25 $form_display = new ConfigForm($GLOBALS['ConfigFile']);
26 $form_display->save('Config');
28 $response = Response::getInstance();
29 $response->disable();
31 if (isset($_POST['eol'])) {
32 $_SESSION['eol'] = ($_POST['eol'] == 'unix') ? 'unix' : 'win';
35 if (Core::ifSetOr($_POST['submit_clear'], '')) {
37 // Clear current config and return to main page
39 $GLOBALS['ConfigFile']->resetConfigData();
40 // drop post data
41 $response->generateHeader303('index.php' . Url::getCommonRaw());
42 exit;
43 } elseif (Core::ifSetOr($_POST['submit_download'], '')) {
45 // Output generated config file
47 Core::downloadHeader('config.inc.php', 'text/plain');
48 $response->disable();
49 echo ConfigGenerator::getConfigFile($GLOBALS['ConfigFile']);
50 exit;
51 } else {
53 // Show generated config file in a <textarea>
55 $response->generateHeader303('index.php' . Url::getCommonRaw(['page' => 'config']));
56 exit;