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?
12 * Gets some core libraries
14 require_once 'libraries/common.inc.php';
15 require_once 'libraries/DbSearch.class.php';
17 $response = PMA_Response
::getInstance();
18 $header = $response->getHeader();
19 $scripts = $header->getScripts();
20 $scripts->addFile('db_search.js');
21 $scripts->addFile('sql.js');
22 $scripts->addFile('makegrid.js');
23 $scripts->addFile('jquery/jquery-ui-timepicker-addon.js');
25 require 'libraries/db_common.inc.php';
27 // If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
28 if (! $GLOBALS['cfg']['UseDbSearch']) {
30 __('Access denied!'), '', false, $err_url
33 $url_query .= '&goto=db_search.php';
34 $url_params['goto'] = 'db_search.php';
36 // Create a database search instance
37 $db_search = new PMA_DbSearch($GLOBALS['db']);
39 // Display top links if we are not in an Ajax request
40 if ($GLOBALS['is_ajax_request'] != true) {
51 ) = PMA_Util
::getDbInfo($db, isset($sub_part) ?
$sub_part : '');
54 // Main search form has been submitted, get results
55 if (isset($_REQUEST['submit_search'])) {
56 $response->addHTML($db_search->getSearchResults());
58 $response->addHTML('<div id="searchresults"></div>');
61 // If we are in an Ajax request, we need to exit after displaying all the HTML
62 if ($GLOBALS['is_ajax_request'] == true && empty($_REQUEST['ajax_page_request'])) {
66 // Display the search form
68 '<div id="togglesearchresultsdiv"><a id="togglesearchresultlink"></a></div>'
69 . '<br class="clearfloat" />'
71 $response->addHTML($db_search->getSelectionForm());
72 $response->addHTML($db_search->getResultDivs());