Use the router for the database QBE page

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-08-07 23:43:44 -03:00
parent 18a9d4f9db
commit c3c58e6cd4
8 changed files with 17 additions and 15 deletions

View File

@ -50,6 +50,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
$routes->addRoute(['GET', 'POST'], '/operations', function () {
require_once ROOT_PATH . 'libraries/entry_points/database/operations.php';
});
$routes->addRoute(['GET', 'POST'], '/qbe', function () {
require_once ROOT_PATH . 'libraries/entry_points/database/qbe.php';
});
$routes->addRoute(['GET', 'POST'], '/routines', function () {
require_once ROOT_PATH . 'libraries/entry_points/database/routines.php';
});

View File

@ -10,7 +10,7 @@
*/
/**
* Ajax event handlers here for db_qbe.php
* Ajax event handlers here for /database/qbe
*
* Actions Ajaxified here:
* Select saved search

View File

@ -28,7 +28,6 @@ class Core
public static $goto_whitelist = [
'db_export.php',
'db_importdocsql.php',
'db_qbe.php',
'db_import.php',
'export.php',
'import.php',

View File

@ -1763,7 +1763,7 @@ class Qbe
*/
public function getSelectionForm()
{
$html_output = '<form action="db_qbe.php" method="post" id="formQBE" '
$html_output = '<form action="' . Url::getFromRoute('/database/qbe') . '" method="post" id="formQBE" '
. 'class="lock-page">';
$html_output .= '<div class="width100">';
$html_output .= '<fieldset>';
@ -1798,7 +1798,7 @@ class Qbe
// get tables select list
$html_output .= $this->_getTablesList();
$html_output .= '</form>';
$html_output .= '<form action="db_qbe.php" method="post" class="lock-page">';
$html_output .= '<form action="' . Url::getFromRoute('/database/qbe') . '" method="post" class="lock-page">';
$html_output .= Url::getHiddenInputs(['db' => $this->_db]);
// get SQL query
$html_output .= '<div class="floatleft desktop50">';

View File

@ -476,8 +476,9 @@ class Menu
$tabs['query']['text'] = __('Query');
$tabs['query']['icon'] = 's_db';
$tabs['query']['link'] = Url::getFromRoute('/database/multi_table_query');
$tabs['query']['active'] = basename($GLOBALS['PMA_PHP_SELF']) === 'db_qbe.php'
|| (isset($_REQUEST['route']) && $_REQUEST['route'] === '/database/multi_table_query');
$tabs['query']['active'] = isset($_REQUEST['route'])
&& ($_REQUEST['route'] === '/database/multi_table_query'
|| $_REQUEST['route'] === '/database/qbe');
if ($num_tables == 0) {
$tabs['query']['warning'] = __('Database seems to be empty!');

View File

@ -18,14 +18,12 @@ use PhpMyAdmin\Template;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
if (! defined('PHPMYADMIN')) {
exit;
}
global $containerBuilder, $db, $pmaThemeImage, $url_query;
require_once ROOT_PATH . 'libraries/common.inc.php';
/** @var Response $response */
$response = $containerBuilder->get(Response::class);
@ -127,8 +125,9 @@ if (isset($_POST['submit_sql']) && ! empty($sql_query)) {
$sub_part = '_qbe';
require ROOT_PATH . 'libraries/db_common.inc.php';
$url_query .= '&amp;goto=db_qbe.php';
$url_params['goto'] = 'db_qbe.php';
$url_params['goto'] = Url::getFromRoute('/database/qbe');
$url_query .= Url::getCommon($url_params, '&');
list(
$tables,
@ -159,7 +158,7 @@ $secondaryTabs = [
'text' => __('Multi-table query'),
],
'qbe' => [
'link' => 'db_qbe.php',
'link' => Url::getFromRoute('/database/qbe'),
'text' => __('Query by example'),
],
];

View File

@ -1127,7 +1127,7 @@ var designerConfig = {{ designer_config|raw }};
</div>
<a class="trigger" href="#">{% trans 'Active options' %}</a>
<div id="box">
<form method="post" action="db_qbe.php" id="vqb_form">
<form method="post" action="{{ url('/database/qbe') }}" id="vqb_form">
<textarea cols="80" name="sql_query" id="textSqlquery" rows="15"></textarea>
<input type="hidden" name="submit_sql" value="true">
{{ get_hidden_inputs(get_db) }}

View File

@ -8,7 +8,7 @@
'text': 'Multi-table query'|trans
},
{
'link': 'db_qbe.php',
'link': url('/database/qbe'),
'text': 'Query by example'|trans
}
]