Translated using Weblate (Slovenian)
[phpmyadmin.git] / db_structure.php
blobea02cd69f0f08de63454293e8b9b7f0d491a9058
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Database structure manipulation
6 * @package PhpMyAdmin
7 */
8 declare(strict_types=1);
10 use PhpMyAdmin\Controllers\Database\StructureController;
11 use PhpMyAdmin\DatabaseInterface;
12 use PhpMyAdmin\Di\Container;
13 use PhpMyAdmin\Relation;
14 use PhpMyAdmin\Replication;
15 use PhpMyAdmin\Response;
17 if (! defined('ROOT_PATH')) {
18 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
21 require_once ROOT_PATH . 'libraries/common.inc.php';
22 require_once ROOT_PATH . 'libraries/db_common.inc.php';
24 $container = Container::getDefaultContainer();
25 $container->factory(StructureController::class);
26 $container->set(Response::class, Response::getInstance());
27 $container->alias('response', Response::class);
29 /** @var DatabaseInterface $dbi */
30 $dbi = $container->get(DatabaseInterface::class);
32 /* Define dependencies for the concerned controller */
33 $dependency_definitions = [
34 'db' => $db,
35 'relation' => new Relation($dbi),
36 'replication' => new Replication(),
39 /** @var StructureController $controller */
40 $controller = $container->get(StructureController::class, $dependency_definitions);
42 /** @var Response $response */
43 $response = $container->get(Response::class);
45 if ($response->isAjax() && ! empty($_REQUEST['favorite_table'])) {
46 $json = $controller->addRemoveFavoriteTablesAction([
47 'favorite_table' => $_REQUEST['favorite_table'],
48 'favorite_tables' => $_REQUEST['favorite_tables'] ?? null,
49 'sync_favorite_tables' => $_REQUEST['sync_favorite_tables'] ?? null,
50 'add_favorite' => $_REQUEST['add_favorite'] ?? null,
51 'remove_favorite' => $_REQUEST['remove_favorite'] ?? null,
52 ]);
53 if ($json !== null) {
54 $response->addJSON($json);
56 } elseif ($response->isAjax()
57 && isset($_REQUEST['real_row_count'])
58 && (bool) $_REQUEST['real_row_count'] === true
59 ) {
60 $response->addJSON($controller->handleRealRowCountRequestAction([
61 'real_row_count_all' => $_REQUEST['real_row_count_all'] ?? null,
62 'table' => $_REQUEST['table'] ?? null,
63 ]));
64 } else {
65 $response->getHeader()->getScripts()->addFiles([
66 'db_structure.js',
67 'tbl_change.js',
68 ]);
70 $response->addHTML($controller->index([
71 'submit_mult' => $_POST['submit_mult'] ?? null,
72 'selected_tbl' => $_POST['selected_tbl'] ?? null,
73 'mult_btn' => $_POST['mult_btn'] ?? null,
74 'sort' => $_REQUEST['sort'] ?? null,
75 'sort_order' => $_REQUEST['sort_order'] ?? null,
76 ]));