Translated using Weblate (Bulgarian)
[phpmyadmin.git] / setup / index.php
blob8ff4bf201219115d523f950e5486126585335d64
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Front controller for setup script
6 * @package PhpMyAdmin-Setup
7 * @license https://www.gnu.org/licenses/gpl.html GNU GPL 2.0
8 */
9 declare(strict_types=1);
11 use PhpMyAdmin\Controllers\Setup\ConfigController;
12 use PhpMyAdmin\Controllers\Setup\FormController;
13 use PhpMyAdmin\Controllers\Setup\HomeController;
14 use PhpMyAdmin\Controllers\Setup\ServersController;
15 use PhpMyAdmin\Core;
16 use PhpMyAdmin\Template;
17 use PhpMyAdmin\Url;
19 if (! defined('ROOT_PATH')) {
20 define('ROOT_PATH', dirname(__DIR__) . DIRECTORY_SEPARATOR);
23 global $cfg;
25 require ROOT_PATH . 'setup/lib/common.inc.php';
27 if (@file_exists(CONFIG_FILE) && ! $cfg['DBG']['demo']) {
28 Core::fatalError(__('Configuration already exists, setup is disabled!'));
31 $page = Core::isValid($_GET['page'], 'scalar') ? (string) $_GET['page'] : null;
32 $page = preg_replace('/[^a-z]/', '', $page);
33 if ($page === '') {
34 $page = 'index';
37 Core::noCacheHeader();
39 if ($page === 'form') {
40 $controller = new FormController($GLOBALS['ConfigFile'], new Template());
41 echo $controller->index([
42 'formset' => $_GET['formset'] ?? null,
43 ]);
44 } elseif ($page === 'config') {
45 $controller = new ConfigController($GLOBALS['ConfigFile'], new Template());
46 echo $controller->index([
47 'formset' => $_GET['formset'] ?? null,
48 'eol' => $_GET['eol'] ?? null,
49 ]);
50 } elseif ($page === 'servers') {
51 $controller = new ServersController($GLOBALS['ConfigFile'], new Template());
52 if (isset($_GET['mode']) && $_GET['mode'] === 'remove' && $_SERVER['REQUEST_METHOD'] == 'POST') {
53 $controller->destroy([
54 'id' => $_GET['id'] ?? null,
55 ]);
56 header('Location: index.php' . Url::getCommonRaw());
57 } else {
58 echo $controller->index([
59 'formset' => $_GET['formset'] ?? null,
60 'mode' => $_GET['mode'] ?? null,
61 'id' => $_GET['id'] ?? null,
62 ]);
64 } else {
65 $controller = new HomeController($GLOBALS['ConfigFile'], new Template());
66 echo $controller->index([
67 'formset' => $_GET['formset'] ?? null,
68 'action_done' => $_GET['action_done'] ?? null,
69 'version_check' => $_GET['version_check'] ?? null,
70 ]);