Translated using Weblate (German)
[phpmyadmin.git] / db_search.php
blob56777e7a6b4b3e796378bc1cabb95635ba474a1c
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 */
10 declare(strict_types=1);
12 use PhpMyAdmin\Database\Search;
13 use PhpMyAdmin\Response;
14 use PhpMyAdmin\Util;
16 /**
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']) {
32 Util::mysqlDie(
33 __('Access denied!'),
34 '',
35 false,
36 $err_url
38 } // end if
39 $url_query .= '&amp;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()) {
47 list(
48 $tables,
49 $num_tables,
50 $total_num_tables,
51 $sub_part,
52 $is_show_stats,
53 $db_is_system_schema,
54 $tooltip_truename,
55 $tooltip_aliasname,
56 $pos
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'])) {
67 exit;
70 // Display the search form
71 $response->addHTML($db_search->getMainHtml());