Translated using Weblate (Persian)
[phpmyadmin.git] / db_structure.php
blob41dd1c47d214eda4efe6c353a5bdfe4b2ade216b
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\Response;
14 if (! defined('ROOT_PATH')) {
15 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
18 require_once ROOT_PATH . 'libraries/common.inc.php';
19 require_once ROOT_PATH . 'libraries/db_common.inc.php';
21 /** @var Response $response */
22 $response = $containerBuilder->get(Response::class);
24 /** @var DatabaseInterface $dbi */
25 $dbi = $containerBuilder->get(DatabaseInterface::class);
27 /** @var StructureController $controller */
28 $controller = $containerBuilder->get(StructureController::class);
30 if ($response->isAjax() && ! empty($_REQUEST['favorite_table'])) {
31 $json = $controller->addRemoveFavoriteTablesAction([
32 'favorite_table' => $_REQUEST['favorite_table'],
33 'favoriteTables' => $_REQUEST['favoriteTables'] ?? null,
34 'sync_favorite_tables' => $_REQUEST['sync_favorite_tables'] ?? null,
35 'add_favorite' => $_REQUEST['add_favorite'] ?? null,
36 'remove_favorite' => $_REQUEST['remove_favorite'] ?? null,
37 ]);
38 if ($json !== null) {
39 $response->addJSON($json);
41 } elseif ($response->isAjax()
42 && isset($_REQUEST['real_row_count'])
43 && (bool) $_REQUEST['real_row_count'] === true
44 ) {
45 $response->addJSON($controller->handleRealRowCountRequestAction([
46 'real_row_count_all' => $_REQUEST['real_row_count_all'] ?? null,
47 'table' => $_REQUEST['table'] ?? null,
48 ]));
49 } else {
50 $response->getHeader()->getScripts()->addFiles([
51 'database/structure.js',
52 'table/change.js',
53 ]);
55 $response->addHTML($controller->index([
56 'submit_mult' => $_POST['submit_mult'] ?? null,
57 'selected_tbl' => $_POST['selected_tbl'] ?? null,
58 'mult_btn' => $_POST['mult_btn'] ?? null,
59 'sort' => $_REQUEST['sort'] ?? null,
60 'sort_order' => $_REQUEST['sort_order'] ?? null,
61 ]));