2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * Generic AJAX endpoint for getting information about database
9 use PhpMyAdmin\Response
;
12 require_once 'libraries/common.inc.php';
14 $response = Response
::getInstance();
16 if (empty($_POST['type'])) {
17 Core
::fatalError(__('Bad type!'));
20 switch ($_POST['type']) {
21 case 'list-databases':
22 $response->addJSON('databases', $GLOBALS['dblist']->databases
);
25 Util
::checkParameters(array('db'));
26 $response->addJSON('tables', $GLOBALS['dbi']->getTables($_REQUEST['db']));
29 Util
::checkParameters(array('db', 'table'));
30 $response->addJSON('columns', $GLOBALS['dbi']->getColumnNames($_REQUEST['db'], $_REQUEST['table']));
34 Core
::fatalError(__('Bad type!'));