2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * The navigation panel - displays server, db and table selection tree
6 * @package PhpMyAdmin-Navigation
8 declare(strict_types
=1);
10 use PhpMyAdmin\Config\PageSettings
;
11 use PhpMyAdmin\DatabaseInterface
;
12 use PhpMyAdmin\Di\Container
;
13 use PhpMyAdmin\Message
;
14 use PhpMyAdmin\Navigation\Navigation
;
15 use PhpMyAdmin\Relation
;
16 use PhpMyAdmin\Response
;
17 use PhpMyAdmin\Template
;
20 if (! defined('ROOT_PATH')) {
21 define('ROOT_PATH', __DIR__
. DIRECTORY_SEPARATOR
);
24 require_once ROOT_PATH
. 'libraries/common.inc.php';
26 $container = Container
::getDefaultContainer();
27 $container->set(Response
::class, Response
::getInstance());
29 /** @var Response $response */
30 $response = $container->get(Response
::class);
32 /** @var DatabaseInterface $dbi */
33 $dbi = $container->get(DatabaseInterface
::class);
35 /** @var Navigation $navigation */
36 $navigation = $containerBuilder->get('navigation');
37 if (! $response->isAjax()) {
40 __('Fatal error: The navigation can only be accessed via AJAX')
46 if (isset($_POST['getNaviSettings']) && $_POST['getNaviSettings']) {
47 $response->addJSON('message', PageSettings
::getNaviSettings());
51 if (isset($_POST['reload'])) {
52 Util
::cacheSet('dbs_to_test', false);// Empty database list cache, see #14252
55 /** @var Relation $relation */
56 $relation = $containerBuilder->get('relation');
57 $cfgRelation = $relation->getRelationsParam();
58 if ($cfgRelation['navwork']) {
59 if (isset($_POST['hideNavItem'])) {
60 if (! empty($_POST['itemName'])
61 && ! empty($_POST['itemType'])
62 && ! empty($_POST['dbName'])
64 $navigation->hideNavigationItem(
68 (! empty($_POST['tableName']) ?
$_POST['tableName'] : null)
74 if (isset($_POST['unhideNavItem'])) {
75 if (! empty($_POST['itemName'])
76 && ! empty($_POST['itemType'])
77 && ! empty($_POST['dbName'])
79 $navigation->unhideNavigationItem(
83 (! empty($_POST['tableName']) ?
$_POST['tableName'] : null)
89 if (isset($_POST['showUnhideDialog'])) {
90 if (! empty($_POST['dbName'])) {
93 $navigation->getItemUnhideDialog($_POST['dbName'])
101 $response->addJSON('message', $navigation->getDisplay());