devilbox/.devilbox/www/htdocs/vendor/phpmyadmin-4.9.7/navigation.php

85 lines
2.3 KiB
PHP
Raw Normal View History

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
$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());