Translated using Weblate (Estonian)
[phpmyadmin.git] / navigation.php
blob560f3ab2186b63033a4605c17d87d55cc1e7b288
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\Navigation\Navigation;
12 use PhpMyAdmin\Relation;
13 use PhpMyAdmin\Response;
15 require_once './libraries/common.inc.php';
17 // Also initialises the collapsible tree class
18 $response = Response::getInstance();
19 $navigation = new Navigation();
20 if (! $response->isAjax()) {
21 $response->addHTML(
22 PhpMyAdmin\Message::error(
23 __('Fatal error: The navigation can only be accessed via AJAX')
26 exit;
29 if (isset($_REQUEST['getNaviSettings']) && $_REQUEST['getNaviSettings']) {
30 $response->addJSON('message', PageSettings::getNaviSettings());
31 exit();
34 $relation = new Relation();
35 $cfgRelation = $relation->getRelationsParam();
36 if ($cfgRelation['navwork']) {
37 if (isset($_REQUEST['hideNavItem'])) {
38 if (! empty($_REQUEST['itemName'])
39 && ! empty($_REQUEST['itemType'])
40 && ! empty($_REQUEST['dbName'])
41 ) {
42 $navigation->hideNavigationItem(
43 $_REQUEST['itemName'],
44 $_REQUEST['itemType'],
45 $_REQUEST['dbName'],
46 (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
49 exit;
52 if (isset($_REQUEST['unhideNavItem'])) {
53 if (! empty($_REQUEST['itemName'])
54 && ! empty($_REQUEST['itemType'])
55 && ! empty($_REQUEST['dbName'])
56 ) {
57 $navigation->unhideNavigationItem(
58 $_REQUEST['itemName'],
59 $_REQUEST['itemType'],
60 $_REQUEST['dbName'],
61 (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
64 exit;
67 if (isset($_REQUEST['showUnhideDialog'])) {
68 if (! empty($_REQUEST['dbName'])) {
69 $response->addJSON(
70 'message',
71 $navigation->getItemUnhideDialog($_REQUEST['dbName'])
74 exit;
78 // Do the magic
79 $response->addJSON('message', $navigation->getDisplay());