Translated using Weblate (Ukrainian)
[phpmyadmin.git] / ajax.php
blob868e137bf80eef56239b543b355c602e677cfe8e
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Generic AJAX endpoint for getting information about database
6 * @package PhpMyAdmin
7 */
9 use PhpMyAdmin\Response;
10 use PhpMyAdmin\Util;
11 use PhpMyAdmin\Core;
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);
23 break;
24 case 'list-tables':
25 Util::checkParameters(array('db'));
26 $response->addJSON('tables', $GLOBALS['dbi']->getTables($_REQUEST['db']));
27 break;
28 case 'list-columns':
29 Util::checkParameters(array('db', 'table'));
30 $response->addJSON('columns', $GLOBALS['dbi']->getColumnNames($_REQUEST['db'], $_REQUEST['table']));
31 break;
33 default:
34 Core::fatalError(__('Bad type!'));