2 /* vim: set expandtab sw=4 ts=4 sts=4: */
4 * searches the entire database
6 * @todo make use of UNION when searching multiple tables
7 * @todo display executed query, optional?
10 declare(strict_types
=1);
12 use PhpMyAdmin\Database\Search
;
13 use PhpMyAdmin\DatabaseInterface
;
14 use PhpMyAdmin\Di\Container
;
15 use PhpMyAdmin\Response
;
18 if (! defined('ROOT_PATH')) {
19 define('ROOT_PATH', __DIR__
. DIRECTORY_SEPARATOR
);
22 require_once ROOT_PATH
. 'libraries/common.inc.php';
24 $container = Container
::getDefaultContainer();
25 $container->set(Response
::class, Response
::getInstance());
27 /** @var Response $response */
28 $response = $container->get(Response
::class);
30 /** @var DatabaseInterface $dbi */
31 $dbi = $container->get(DatabaseInterface
::class);
33 $header = $response->getHeader();
34 $scripts = $header->getScripts();
35 $scripts->addFile('db_search.js');
36 $scripts->addFile('sql.js');
37 $scripts->addFile('makegrid.js');
39 require ROOT_PATH
. 'libraries/db_common.inc.php';
41 // If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
42 if (! $GLOBALS['cfg']['UseDbSearch']) {
50 $url_query .= '&goto=db_search.php';
51 $url_params['goto'] = 'db_search.php';
53 // Create a database search instance
54 $db_search = new Search($dbi, $GLOBALS['db']);
56 // Display top links if we are not in an Ajax request
57 if (! $response->isAjax()) {
68 ) = Util
::getDbInfo($db, isset($sub_part) ?
$sub_part : '');
71 // Main search form has been submitted, get results
72 if (isset($_POST['submit_search'])) {
73 $response->addHTML($db_search->getSearchResults());
76 // If we are in an Ajax request, we need to exit after displaying all the HTML
77 if ($response->isAjax() && empty($_REQUEST['ajax_page_request'])) {
81 // Display the search form
82 $response->addHTML($db_search->getMainHtml());