Translated using Weblate (Czech)
[phpmyadmin.git] / db_multi_table_query.php
blobc624e85b1ed4ac0fffa2026fedc4b58dd33fd9b7
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Handles database multi-table querying
6 * @package PhpMyAdmin
7 */
8 declare(strict_types=1);
10 use PhpMyAdmin\Controllers\Database\MultiTableQueryController;
11 use PhpMyAdmin\DatabaseInterface;
12 use PhpMyAdmin\Response;
13 use PhpMyAdmin\Template;
15 if (! defined('ROOT_PATH')) {
16 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
19 require_once ROOT_PATH . 'libraries/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 MultiTableQueryController $controller */
28 $controller = $containerBuilder->get(MultiTableQueryController::class);
30 /** @var Template $template */
31 $template = $containerBuilder->get('template');
33 if (isset($_POST['sql_query'])) {
34 $controller->displayResults([
35 'sql_query' => $_POST['sql_query'],
36 'db' => $_REQUEST['db'] ?? null,
37 ]);
38 } elseif (isset($_GET['tables'])) {
39 $response->addJSON($controller->table([
40 'tables' => $_GET['tables'],
41 'db' => $_REQUEST['db'] ?? null,
42 ]));
43 } else {
44 $header = $response->getHeader();
45 $scripts = $header->getScripts();
46 $scripts->addFile('vendor/jquery/jquery.md5.js');
47 $scripts->addFile('database/multi_table_query.js');
48 $scripts->addFile('database/query_generator.js');
50 $response->addHTML($controller->index($template));