Translated using Weblate (Russian)
[phpmyadmin.git] / db_search.php
blob44cc1818ac789c939f6716d4bd396f9a6e1e21bd
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\DatabaseInterface;
14 use PhpMyAdmin\Response;
15 use PhpMyAdmin\Template;
16 use PhpMyAdmin\Util;
18 if (! defined('ROOT_PATH')) {
19 define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
22 global $db, $url_query;
24 require_once ROOT_PATH . 'libraries/common.inc.php';
26 /** @var Response $response */
27 $response = $containerBuilder->get(Response::class);
29 /** @var DatabaseInterface $dbi */
30 $dbi = $containerBuilder->get(DatabaseInterface::class);
32 /** @var Template $template */
33 $template = $containerBuilder->get('template');
35 $header = $response->getHeader();
36 $scripts = $header->getScripts();
37 $scripts->addFile('database/search.js');
38 $scripts->addFile('sql.js');
39 $scripts->addFile('makegrid.js');
41 require ROOT_PATH . 'libraries/db_common.inc.php';
43 // If config variable $GLOBALS['cfg']['UseDbSearch'] is on false : exit.
44 if (! $GLOBALS['cfg']['UseDbSearch']) {
45 Util::mysqlDie(
46 __('Access denied!'),
47 '',
48 false,
49 $err_url
51 } // end if
52 $url_query .= '&amp;goto=db_search.php';
53 $url_params['goto'] = 'db_search.php';
55 // Create a database search instance
56 $db_search = new Search($dbi, $db, $template);
58 // Display top links if we are not in an Ajax request
59 if (! $response->isAjax()) {
60 list(
61 $tables,
62 $num_tables,
63 $total_num_tables,
64 $sub_part,
65 $is_show_stats,
66 $db_is_system_schema,
67 $tooltip_truename,
68 $tooltip_aliasname,
69 $pos
70 ) = Util::getDbInfo($db, isset($sub_part) ? $sub_part : '');
73 // Main search form has been submitted, get results
74 if (isset($_POST['submit_search'])) {
75 $response->addHTML($db_search->getSearchResults());
78 // If we are in an Ajax request, we need to exit after displaying all the HTML
79 if ($response->isAjax() && empty($_REQUEST['ajax_page_request'])) {
80 exit;
83 // Display the search form
84 $response->addHTML($db_search->getMainHtml());