Adding composer lock for 5.0.1
[phpmyadmin.git] / navigation.php
bloba548b9a5e437e5adf52e13cba8ece17e1ae670d5
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * The navigation panel - displays server, db and table selection tree
6 * @package PhpMyAdmin-Navigation
7 */
8 declare(strict_types=1);
10 use PhpMyAdmin\Config\PageSettings;
11 use PhpMyAdmin\DatabaseInterface;
12 use PhpMyAdmin\Message;
13 use PhpMyAdmin\Navigation\Navigation;
14 use PhpMyAdmin\Relation;
15 use PhpMyAdmin\Response;
16 use PhpMyAdmin\Util;
18 if (! defined('ROOT_PATH')) {
19 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
22 require_once ROOT_PATH . 'libraries/common.inc.php';
24 /** @var Response $response */
25 $response = $containerBuilder->get(Response::class);
27 /** @var DatabaseInterface $dbi */
28 $dbi = $containerBuilder->get(DatabaseInterface::class);
30 /** @var Navigation $navigation */
31 $navigation = $containerBuilder->get('navigation');
32 if (! $response->isAjax()) {
33 $response->addHTML(
34 Message::error(
35 __('Fatal error: The navigation can only be accessed via AJAX')
38 exit;
41 if (isset($_POST['getNaviSettings']) && $_POST['getNaviSettings']) {
42 $response->addJSON('message', PageSettings::getNaviSettings());
43 exit;
46 if (isset($_POST['reload'])) {
47 Util::cacheSet('dbs_to_test', false);// Empty database list cache, see #14252
50 /** @var Relation $relation */
51 $relation = $containerBuilder->get('relation');
52 $cfgRelation = $relation->getRelationsParam();
53 if ($cfgRelation['navwork']) {
54 if (isset($_POST['hideNavItem'])) {
55 if (! empty($_POST['itemName'])
56 && ! empty($_POST['itemType'])
57 && ! empty($_POST['dbName'])
58 ) {
59 $navigation->hideNavigationItem(
60 $_POST['itemName'],
61 $_POST['itemType'],
62 $_POST['dbName'],
63 (! empty($_POST['tableName']) ? $_POST['tableName'] : null)
66 exit;
69 if (isset($_POST['unhideNavItem'])) {
70 if (! empty($_POST['itemName'])
71 && ! empty($_POST['itemType'])
72 && ! empty($_POST['dbName'])
73 ) {
74 $navigation->unhideNavigationItem(
75 $_POST['itemName'],
76 $_POST['itemType'],
77 $_POST['dbName'],
78 (! empty($_POST['tableName']) ? $_POST['tableName'] : null)
81 exit;
84 if (isset($_POST['showUnhideDialog'])) {
85 if (! empty($_POST['dbName'])) {
86 $response->addJSON(
87 'message',
88 $navigation->getItemUnhideDialog($_POST['dbName'])
91 exit;
95 // Do the magic
96 $response->addJSON('message', $navigation->getDisplay());