2016-10-22 14:57:10 +00:00
|
|
|
<?php
|
|
|
|
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
|
|
|
/**
|
|
|
|
* The navigation panel - displays server, db and table selection tree
|
|
|
|
*
|
|
|
|
* @package PhpMyAdmin-Navigation
|
|
|
|
*/
|
|
|
|
|
|
|
|
// Include common functionalities
|
2018-04-14 09:18:00 +00:00
|
|
|
use PhpMyAdmin\Config\PageSettings;
|
|
|
|
use PhpMyAdmin\Navigation\Navigation;
|
|
|
|
use PhpMyAdmin\Relation;
|
|
|
|
use PhpMyAdmin\Response;
|
2019-12-08 07:14:01 +00:00
|
|
|
use PhpMyAdmin\Util;
|
2016-10-22 14:57:10 +00:00
|
|
|
|
|
|
|
require_once './libraries/common.inc.php';
|
|
|
|
|
|
|
|
// Also initialises the collapsible tree class
|
2017-04-20 10:55:30 +00:00
|
|
|
$response = Response::getInstance();
|
2016-10-22 14:57:10 +00:00
|
|
|
$navigation = new Navigation();
|
|
|
|
if (! $response->isAjax()) {
|
|
|
|
$response->addHTML(
|
2018-04-14 09:18:00 +00:00
|
|
|
PhpMyAdmin\Message::error(
|
2016-10-22 14:57:10 +00:00
|
|
|
__('Fatal error: The navigation can only be accessed via AJAX')
|
|
|
|
)
|
|
|
|
);
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2018-12-16 14:31:03 +00:00
|
|
|
if (isset($_POST['getNaviSettings']) && $_POST['getNaviSettings']) {
|
2016-10-22 14:57:10 +00:00
|
|
|
$response->addJSON('message', PageSettings::getNaviSettings());
|
|
|
|
exit();
|
|
|
|
}
|
|
|
|
|
2019-12-08 07:14:01 +00:00
|
|
|
if (isset($_POST['reload'])) {
|
|
|
|
Util::cacheSet('dbs_to_test', false);// Empty database list cache, see #14252
|
|
|
|
}
|
|
|
|
|
2018-04-14 09:18:00 +00:00
|
|
|
$relation = new Relation();
|
|
|
|
$cfgRelation = $relation->getRelationsParam();
|
2016-10-22 14:57:10 +00:00
|
|
|
if ($cfgRelation['navwork']) {
|
2018-12-16 14:31:03 +00:00
|
|
|
if (isset($_POST['hideNavItem'])) {
|
|
|
|
if (! empty($_POST['itemName'])
|
|
|
|
&& ! empty($_POST['itemType'])
|
|
|
|
&& ! empty($_POST['dbName'])
|
2016-10-22 14:57:10 +00:00
|
|
|
) {
|
|
|
|
$navigation->hideNavigationItem(
|
2018-12-16 14:31:03 +00:00
|
|
|
$_POST['itemName'],
|
|
|
|
$_POST['itemType'],
|
|
|
|
$_POST['dbName'],
|
|
|
|
(! empty($_POST['tableName']) ? $_POST['tableName'] : null)
|
2016-10-22 14:57:10 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2018-12-16 14:31:03 +00:00
|
|
|
if (isset($_POST['unhideNavItem'])) {
|
|
|
|
if (! empty($_POST['itemName'])
|
|
|
|
&& ! empty($_POST['itemType'])
|
|
|
|
&& ! empty($_POST['dbName'])
|
2016-10-22 14:57:10 +00:00
|
|
|
) {
|
|
|
|
$navigation->unhideNavigationItem(
|
2018-12-16 14:31:03 +00:00
|
|
|
$_POST['itemName'],
|
|
|
|
$_POST['itemType'],
|
|
|
|
$_POST['dbName'],
|
|
|
|
(! empty($_POST['tableName']) ? $_POST['tableName'] : null)
|
2016-10-22 14:57:10 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
2018-12-16 14:31:03 +00:00
|
|
|
if (isset($_POST['showUnhideDialog'])) {
|
|
|
|
if (! empty($_POST['dbName'])) {
|
2016-10-22 14:57:10 +00:00
|
|
|
$response->addJSON(
|
|
|
|
'message',
|
2018-12-16 14:31:03 +00:00
|
|
|
$navigation->getItemUnhideDialog($_POST['dbName'])
|
2016-10-22 14:57:10 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Do the magic
|
|
|
|
$response->addJSON('message', $navigation->getDisplay());
|