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\Response
;
15 use PhpMyAdmin\Template
;
18 if (! defined('ROOT_PATH')) {
19 define('ROOT_PATH', __DIR__
. DIRECTORY_SEPARATOR
);
22 global $db, $url_query;
24 require_once ROOT_PATH
. 'libraries/common.inc.php';
26 /** @var Response $response */
27 $response = $containerBuilder->get(Response
::class);
29 /** @var DatabaseInterface $dbi */
30 $dbi = $containerBuilder->get(DatabaseInterface
::class);
32 /** @var Template $template */
33 $template = $containerBuilder->get('template');
35 $header = $response->getHeader();
36 $scripts = $header->getScripts();
37 $scripts->addFile('database/search.js');
38 $scripts->addFile('vendor/stickyfill.min.js');
39 $scripts->addFile('sql.js');
40 $scripts->addFile('makegrid.js');
42 require ROOT_PATH
. 'libraries/db_common.inc.php';
44 // If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
45 if (! $GLOBALS['cfg']['UseDbSearch']) {
53 $url_query .= '&goto=db_search.php';
54 $url_params['goto'] = 'db_search.php';
56 // Create a database search instance
57 $db_search = new Search($dbi, $db, $template);
59 // Display top links if we are not in an Ajax request
60 if (! $response->isAjax()) {
71 ) = Util
::getDbInfo($db, isset($sub_part) ?
$sub_part : '');
74 // Main search form has been submitted, get results
75 if (isset($_POST['submit_search'])) {
76 $response->addHTML($db_search->getSearchResults());
79 // If we are in an Ajax request, we need to exit after displaying all the HTML
80 if ($response->isAjax() && empty($_REQUEST['ajax_page_request'])) {
84 // Display the search form
85 $response->addHTML($db_search->getMainHtml());