Fix merge conflicts from 4.7.9 release
[phpmyadmin.git] / navigation.php
blobe67c600927282d48afb34c357baf6584bcddc2ae
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 */
9 // Include common functionalities
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 $cfgRelation = Relation::getRelationsParam();
35 if ($cfgRelation['navwork']) {
36 if (isset($_REQUEST['hideNavItem'])) {
37 if (! empty($_REQUEST['itemName'])
38 && ! empty($_REQUEST['itemType'])
39 && ! empty($_REQUEST['dbName'])
40 ) {
41 $navigation->hideNavigationItem(
42 $_REQUEST['itemName'],
43 $_REQUEST['itemType'],
44 $_REQUEST['dbName'],
45 (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
48 exit;
51 if (isset($_REQUEST['unhideNavItem'])) {
52 if (! empty($_REQUEST['itemName'])
53 && ! empty($_REQUEST['itemType'])
54 && ! empty($_REQUEST['dbName'])
55 ) {
56 $navigation->unhideNavigationItem(
57 $_REQUEST['itemName'],
58 $_REQUEST['itemType'],
59 $_REQUEST['dbName'],
60 (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
63 exit;
66 if (isset($_REQUEST['showUnhideDialog'])) {
67 if (! empty($_REQUEST['dbName'])) {
68 $response->addJSON(
69 'message',
70 $navigation->getItemUnhideDialog($_REQUEST['dbName'])
73 exit;
77 // Do the magic
78 $response->addJSON('message', $navigation->getDisplay());