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?
11 use PhpMyAdmin\Database\Search
;
12 use PhpMyAdmin\Response
;
16 * Gets some core libraries
18 require_once 'libraries/common.inc.php';
20 $response = Response
::getInstance();
21 $header = $response->getHeader();
22 $scripts = $header->getScripts();
23 $scripts->addFile('db_search.js');
24 $scripts->addFile('sql.js');
25 $scripts->addFile('makegrid.js');
27 require 'libraries/db_common.inc.php';
29 // If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
30 if (! $GLOBALS['cfg']['UseDbSearch']) {
32 __('Access denied!'), '', false, $err_url
35 $url_query .= '&goto=db_search.php';
36 $url_params['goto'] = 'db_search.php';
38 // Create a database search instance
39 $db_search = new Search($GLOBALS['db']);
41 // Display top links if we are not in an Ajax request
42 if (! $response->isAjax()) {
53 ) = Util
::getDbInfo($db, isset($sub_part) ?
$sub_part : '');
56 // Main search form has been submitted, get results
57 if (isset($_POST['submit_search'])) {
58 $response->addHTML($db_search->getSearchResults());
61 // If we are in an Ajax request, we need to exit after displaying all the HTML
62 if ($response->isAjax() && empty($_REQUEST['ajax_page_request'])) {
66 // Display the search form
67 $response->addHTML($db_search->getSelectionForm());
68 $response->addHTML('<div id="searchresults"></div>');
70 '<div id="togglesearchresultsdiv"><a id="togglesearchresultlink"></a></div>'
72 $response->addHTML('<br class="clearfloat" />');
73 $response->addHTML($db_search->getResultDivs());