navigation.php 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. <?php
  2. /* vim: set expandtab sw=4 ts=4 sts=4: */
  3. /**
  4. * The navigation panel - displays server, db and table selection tree
  5. *
  6. * @package PhpMyAdmin-Navigation
  7. */
  8. // Include common functionalities
  9. require_once './libraries/common.inc.php';
  10. // Also initialises the collapsible tree class
  11. require_once './libraries/navigation/Navigation.class.php';
  12. $response = PMA_Response::getInstance();
  13. $navigation = new PMA_Navigation();
  14. if (! $response->isAjax()) {
  15. $response->addHTML(
  16. PMA_Message::error(
  17. __('Fatal error: The navigation can only be accessed via AJAX')
  18. )
  19. );
  20. exit;
  21. }
  22. $cfgRelation = PMA_getRelationsParam();
  23. if ($cfgRelation['navwork']) {
  24. if (isset($_REQUEST['hideNavItem'])) {
  25. if (! empty($_REQUEST['itemName'])
  26. && ! empty($_REQUEST['itemType'])
  27. && ! empty($_REQUEST['dbName'])
  28. ) {
  29. $navigation->hideNavigationItem(
  30. $_REQUEST['itemName'],
  31. $_REQUEST['itemType'],
  32. $_REQUEST['dbName'],
  33. (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
  34. );
  35. }
  36. exit;
  37. }
  38. if (isset($_REQUEST['unhideNavItem'])) {
  39. if (! empty($_REQUEST['itemName'])
  40. && ! empty($_REQUEST['itemType'])
  41. && ! empty($_REQUEST['dbName'])
  42. ) {
  43. $navigation->unhideNavigationItem(
  44. $_REQUEST['itemName'],
  45. $_REQUEST['itemType'],
  46. $_REQUEST['dbName'],
  47. (! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
  48. );
  49. }
  50. exit;
  51. }
  52. if (isset($_REQUEST['showUnhideDialog'])) {
  53. if (! empty($_REQUEST['dbName'])) {
  54. $response->addJSON(
  55. 'message',
  56. $navigation->getItemUnhideDialog($_REQUEST['dbName'])
  57. );
  58. }
  59. exit;
  60. }
  61. }
  62. // Do the magic
  63. $response->addJSON('message', $navigation->getDisplay());
  64. ?>