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('sql.js');
39 $scripts->addFile('makegrid.js');
41 require ROOT_PATH
. 'libraries/db_common.inc.php';
43 // If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
44 if (! $GLOBALS['cfg']['UseDbSearch']) {
52 $url_query .= '&goto=db_search.php';
53 $url_params['goto'] = 'db_search.php';
55 // Create a database search instance
56 $db_search = new Search($dbi, $db, $template);
58 // Display top links if we are not in an Ajax request
59 if (! $response->isAjax()) {
70 ) = Util
::getDbInfo($db, isset($sub_part) ?
$sub_part : '');
73 // Main search form has been submitted, get results
74 if (isset($_POST['submit_search'])) {
75 $response->addHTML($db_search->getSearchResults());
78 // If we are in an Ajax request, we need to exit after displaying all the HTML
79 if ($response->isAjax() && empty($_REQUEST['ajax_page_request'])) {
83 // Display the search form
84 $response->addHTML($db_search->getMainHtml());