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\Response
;
17 * Gets some core libraries
19 require_once 'libraries/common.inc.php';
21 $response = Response
::getInstance();
22 $header = $response->getHeader();
23 $scripts = $header->getScripts();
24 $scripts->addFile('db_search.js');
25 $scripts->addFile('sql.js');
26 $scripts->addFile('makegrid.js');
28 require 'libraries/db_common.inc.php';
30 // If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
31 if (! $GLOBALS['cfg']['UseDbSearch']) {
39 $url_query .= '&goto=db_search.php';
40 $url_params['goto'] = 'db_search.php';
42 // Create a database search instance
43 $db_search = new Search($GLOBALS['dbi'], $GLOBALS['db']);
45 // Display top links if we are not in an Ajax request
46 if (! $response->isAjax()) {
57 ) = Util
::getDbInfo($db, isset($sub_part) ?
$sub_part : '');
60 // Main search form has been submitted, get results
61 if (isset($_REQUEST['submit_search'])) {
62 $response->addHTML($db_search->getSearchResults());
65 // If we are in an Ajax request, we need to exit after displaying all the HTML
66 if ($response->isAjax() && empty($_REQUEST['ajax_page_request'])) {
70 // Display the search form
71 $response->addHTML($db_search->getMainHtml());