Update ChangeLog for security issues PMASA-2019-1 and PMASA-2019-2
[phpmyadmin.git] / navigation.php
blob4877d8339f7b1b27ae54f1836fde795d5b653057
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($_POST['getNaviSettings']) && $_POST['getNaviSettings']) {
30 $response->addJSON('message', PageSettings::getNaviSettings());
31 exit();
34 $relation = new Relation();
35 $cfgRelation = $relation->getRelationsParam();
36 if ($cfgRelation['navwork']) {
37 if (isset($_POST['hideNavItem'])) {
38 if (! empty($_POST['itemName'])
39 && ! empty($_POST['itemType'])
40 && ! empty($_POST['dbName'])
41 ) {
42 $navigation->hideNavigationItem(
43 $_POST['itemName'],
44 $_POST['itemType'],
45 $_POST['dbName'],
46 (! empty($_POST['tableName']) ? $_POST['tableName'] : null)
49 exit;
52 if (isset($_POST['unhideNavItem'])) {
53 if (! empty($_POST['itemName'])
54 && ! empty($_POST['itemType'])
55 && ! empty($_POST['dbName'])
56 ) {
57 $navigation->unhideNavigationItem(
58 $_POST['itemName'],
59 $_POST['itemType'],
60 $_POST['dbName'],
61 (! empty($_POST['tableName']) ? $_POST['tableName'] : null)
64 exit;
67 if (isset($_POST['showUnhideDialog'])) {
68 if (! empty($_POST['dbName'])) {
69 $response->addJSON(
70 'message',
71 $navigation->getItemUnhideDialog($_POST['dbName'])
74 exit;
78 // Do the magic
79 $response->addJSON('message', $navigation->getDisplay());