clean up of prior commit
[openemr.git] / phpmyadmin / db_search.php
blob3789ed9e78fc2e26bd2c4751369c94299751e8ef
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * searches the entire database
6 * @todo make use of UNION when searching multiple tables
7 * @todo display executed query, optional?
8 * @package PhpMyAdmin
9 */
11 /**
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']) {
29 PMA_Util::mysqlDie(
30 __('Access denied!'), '', false, $err_url
32 } // end if
33 $url_query .= '&amp;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) {
41 list(
42 $tables,
43 $num_tables,
44 $total_num_tables,
45 $sub_part,
46 $is_show_stats,
47 $db_is_system_schema,
48 $tooltip_truename,
49 $tooltip_aliasname,
50 $pos
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());
57 } else {
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'])) {
63 exit;
66 // Display the search form
67 $response->addHTML(
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());