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\Message
;
13 use PhpMyAdmin\Navigation\Navigation
;
14 use PhpMyAdmin\Relation
;
15 use PhpMyAdmin\Response
;
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()) {
35 __('Fatal error: The navigation can only be accessed via AJAX')
41 if (isset($_POST['getNaviSettings']) && $_POST['getNaviSettings']) {
42 $response->addJSON('message', PageSettings
::getNaviSettings());
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'])
59 $navigation->hideNavigationItem(
63 (! empty($_POST['tableName']) ?
$_POST['tableName'] : null)
69 if (isset($_POST['unhideNavItem'])) {
70 if (! empty($_POST['itemName'])
71 && ! empty($_POST['itemType'])
72 && ! empty($_POST['dbName'])
74 $navigation->unhideNavigationItem(
78 (! empty($_POST['tableName']) ?
$_POST['tableName'] : null)
84 if (isset($_POST['showUnhideDialog'])) {
85 if (! empty($_POST['dbName'])) {
88 $navigation->getItemUnhideDialog($_POST['dbName'])
96 $response->addJSON('message', $navigation->getDisplay());