Use the router for the sql pages

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-08-03 21:25:27 -03:00
parent 07f3a152cc
commit 208b0e25e1
64 changed files with 265 additions and 277 deletions

View File

@ -100,7 +100,7 @@ if (isset($_POST['submit_sql']) && ! empty($sql_query)) {
if (0 !== stripos($sql_query, "SELECT")) {
$message_to_display = true;
} else {
$goto = 'db_sql.php';
$goto = Url::getFromRoute('/database/sql');
$sql = new Sql();
$sql->executeQueryAndSendQueryResponse(
null, // analyzed_sql_results

View File

@ -295,7 +295,7 @@ if ($import_type == 'table') {
} elseif (strlen($db) > 0) {
$goto = Url::getFromRoute('/database/structure');
} else {
$goto = 'server_sql.php';
$goto = Url::getFromRoute('/server/sql');
}
}
$err_url = $goto . Url::getCommon($urlparams);

View File

@ -32,6 +32,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
$routes->addRoute(['GET', 'POST'], '/search', function () {
require_once ROOT_PATH . 'libraries/entry_points/database/search.php';
});
$routes->addRoute(['GET', 'POST'], '/sql', function () {
require_once ROOT_PATH . 'db_sql.php';
});
$routes->addRoute(['GET', 'POST'], '/structure', function () {
require_once ROOT_PATH . 'libraries/entry_points/database/structure.php';
});
@ -55,6 +58,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
$routes->addRoute(['GET', 'POST'], '/privileges', function () {
require_once ROOT_PATH . 'libraries/entry_points/server/privileges.php';
});
$routes->addRoute(['GET', 'POST'], '/sql', function () {
require_once ROOT_PATH . 'server_sql.php';
});
$routes->addGroup('/status', function (RouteCollector $routes) {
$routes->addRoute('GET', '', function () {
require_once ROOT_PATH . 'libraries/entry_points/server/status.php';
@ -67,6 +73,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
require_once ROOT_PATH . 'libraries/entry_points/server/variables.php';
});
});
$routes->addRoute(['GET', 'POST'], '/sql', function () {
require_once ROOT_PATH . 'sql.php';
});
$routes->addGroup('/table', function (RouteCollector $routes) {
$routes->addRoute(['GET', 'POST'], '/change', function () {
require_once ROOT_PATH . 'libraries/entry_points/table/change.php';
@ -74,6 +83,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
$routes->addRoute(['GET', 'POST'], '/search', function () {
require_once ROOT_PATH . 'libraries/entry_points/table/select.php';
});
$routes->addRoute(['GET', 'POST'], '/sql', function () {
require_once ROOT_PATH . 'tbl_sql.php';
});
$routes->addRoute(['GET', 'POST'], '/structure', function () {
require_once ROOT_PATH . 'libraries/entry_points/table/structure.php';
});

View File

@ -543,9 +543,9 @@ var AJAX = {
var source = data.selflink.split('?')[0];
// Check for faulty links
var $selflinkReplace = {
'import.php': 'tbl_sql.php',
'tbl_chart.php': 'sql.php',
'tbl_gis_visualization.php': 'sql.php'
'import.php': 'index.php?route=/table/sql',
'tbl_chart.php': 'index.php?route=/sql',
'tbl_gis_visualization.php': 'index.php?route=/sql'
};
if ($selflinkReplace[source]) {
var replacement = $selflinkReplace[source];

View File

@ -564,7 +564,7 @@ DesignerMove.addOtherDbTables = function () {
var $selectTable = $('<select id="add_table"></select>');
$selectTable.append('<option value="">None</option>');
$.post('sql.php', {
$.post('index.php?route=/sql', {
'ajax_request' : true,
'sql_query' : 'SHOW databases;',
'server': CommonParams.get('server')
@ -594,7 +594,7 @@ DesignerMove.addOtherDbTables = function () {
if ($(this).val()) {
var dbName = $(this).val();
var sqlQuery = 'SHOW tables;';
$.post('sql.php', {
$.post('index.php?route=/sql', {
'ajax_request' : true,
'sql_query': sqlQuery,
'db' : dbName,

View File

@ -1733,7 +1733,7 @@ Functions.loadForeignKeyCheckbox = function () {
'server': CommonParams.get('server'),
'get_default_fk_check_value': true
};
$.get('sql.php', params, function (data) {
$.get('index.php?route=/sql', params, function (data) {
var html = '<input type="hidden" name="fk_checks" value="0">' +
'<input type="checkbox" name="fk_checks" id="fk_checks"' +
(data.default_fk_check_value ? ' checked="checked"' : '') + '>' +

View File

@ -392,7 +392,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
if (g.colVisib.length > 0) {
$.extend(postParams, { 'col_visib': g.colVisib.toString() });
}
$.post('sql.php', postParams, function (data) {
$.post('index.php?route=/sql', postParams, function (data) {
if (data.success !== true) {
var $tempDiv = $(document.createElement('div'));
$tempDiv.html(data.error);
@ -889,7 +889,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
'relation_key_or_display_column' : relationKeyOrDisplayColumn
};
g.lastXHR = $.post('sql.php', postParams, function (data) {
g.lastXHR = $.post('index.php?route=/sql', postParams, function (data) {
g.lastXHR = null;
$editArea.removeClass('edit_area_loading');
if ($(data.dropdown).is('select')) {
@ -933,7 +933,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
'column' : fieldName,
'curr_value' : currValue
};
g.lastXHR = $.post('sql.php', postParams, function (data) {
g.lastXHR = $.post('index.php?route=/sql', postParams, function (data) {
g.lastXHR = null;
$editArea.removeClass('edit_area_loading');
$editArea.append(data.dropdown);
@ -973,7 +973,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
};
}
g.lastXHR = $.post('sql.php', postParams, function (data) {
g.lastXHR = $.post('index.php?route=/sql', postParams, function (data) {
g.lastXHR = null;
$editArea.removeClass('edit_area_loading');
$editArea.append(data.select);
@ -1012,7 +1012,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
var sqlQuery = 'SELECT `' + fieldName + '` FROM `' + g.table + '` WHERE ' + whereClause;
// Make the Ajax call and get the data, wrap it and insert it
g.lastXHR = $.post('sql.php', {
g.lastXHR = $.post('index.php?route=/sql', {
'server' : g.server,
'db' : g.db,
'ajax_request' : true,
@ -1310,7 +1310,7 @@ var makeGrid = function (t, enableResize, enableReorder, enableVisib, enableGrid
'do_transformations' : transformationFields,
'transform_fields_list' : transformFieldsList,
'relational_display' : relationalDisplay,
'goto' : 'sql.php',
'goto' : encodeURIComponent('index.php?route=/sql'),
'submit_type' : 'save'
};

View File

@ -11,7 +11,7 @@ function captureURL (url) {
var newUrl = '' + url;
var URL = {};
// Exclude the url part till HTTP
newUrl = newUrl.substr(newUrl.search('sql.php'), newUrl.length);
newUrl = newUrl.substr(newUrl.search('index.php?route=/sql'), newUrl.length);
// The url part between ORDER BY and &session_max_rows needs to be replaced.
URL.head = newUrl.substr(0, newUrl.indexOf('ORDER+BY') + 9);
URL.tail = newUrl.substr(newUrl.indexOf('&session_max_rows'), newUrl.length);
@ -67,7 +67,7 @@ AJAX.registerOnload('keyhandler.js', function () {
AJAX.source = $(this);
Functions.ajaxShowMessage();
params += argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
$.post('sql.php', params, AJAX.responseHandler);
$.post('index.php?route=/sql', params, AJAX.responseHandler);
}
} else if (event.shiftKey) {
event.preventDefault();
@ -75,7 +75,7 @@ AJAX.registerOnload('keyhandler.js', function () {
Functions.ajaxShowMessage();
params = url.substring(url.indexOf('?') + 1);
params += argsep + 'ajax_request=true' + argsep + 'ajax_page_request=true';
$.post('sql.php', params, AJAX.responseHandler);
$.post('index.php?route=/sql', params, AJAX.responseHandler);
}
});
});

View File

@ -553,7 +553,7 @@ AJAX.registerOnload('normalization.js', function () {
$.post('tbl_addfield.php', datastring, function (data) {
if (data.success) {
$.post(
'sql.php',
'index.php?route=/sql',
{
'ajax_request': true,
'db': CommonParams.get('db'),
@ -640,7 +640,7 @@ AJAX.registerOnload('normalization.js', function () {
});
dropQuery = dropQuery.slice(0, -2);
$.post(
'sql.php',
'index.php?route=/sql',
{
'ajax_request': true,
'db': CommonParams.get('db'),

View File

@ -629,12 +629,12 @@ AJAX.registerOnload('sql.js', function () {
var url;
if (data.db) {
if (data.table) {
url = 'table_sql.php';
url = 'index.php?route=/table/sql';
} else {
url = 'db_sql.php';
url = 'index.php?route=/database/sql';
}
} else {
url = 'server_sql.php';
url = 'index.php?route=/server/sql';
}
CommonActions.refreshMain(url, function () {
$('#sqlqueryresultsouter')

View File

@ -62,7 +62,7 @@ AJAX.registerOnload('table/operations.js', function () {
if (typeof data !== 'undefined' && data.success === true) {
CommonParams.set('db', data.params.db);
CommonParams.set('table', data.params.table);
CommonActions.refreshMain('tbl_sql.php', function () {
CommonActions.refreshMain('index.php?route=/table/sql', function () {
Functions.ajaxShowMessage(data.message);
});
// Refresh navigation when the table is copied

View File

@ -222,7 +222,7 @@ AJAX.registerOnload('table/structure.js', function () {
if (data.tableStat) {
$('#tablestatistics').html(data.tableStat);
}
// refresh the list of indexes (comes from sql.php)
// refresh the list of indexes (comes from /sql)
$('.index_info').replaceWith(data.indexes_list);
Navigation.reload();
} else {

View File

@ -375,8 +375,7 @@ AJAX.registerOnload('table/zoom_plot_jqplot.js', function () {
sqlQuery = sqlQuery.substring(0, sqlQuery.length - 2);
sqlQuery += ' WHERE ' + Sql.urlDecode(searchedData[searchedDataKey].where_clause);
// Post SQL query to sql.php
$.post('sql.php', {
$.post('index.php?route=/sql', {
'server' : CommonParams.get('server'),
'db' : CommonParams.get('db'),
'ajax_request' : true,

View File

@ -869,36 +869,6 @@ class Config
$cfg = array_intersect_key($cfg, array_flip($matched_keys));
/**
* Backward compatibility code
*/
if (! empty($cfg['DefaultTabTable'])) {
$cfg['DefaultTabTable'] = str_replace(
[
'tbl_properties.php',
'_properties',
],
[
'tbl_sql.php',
'',
],
$cfg['DefaultTabTable']
);
}
if (! empty($cfg['DefaultTabDatabase'])) {
$cfg['DefaultTabDatabase'] = str_replace(
[
'db_details.php',
'_details',
],
[
'db_sql.php',
'',
],
$cfg['DefaultTabDatabase']
);
}
$this->settings = array_replace_recursive($this->settings, $cfg);
return true;

View File

@ -10,6 +10,7 @@ namespace PhpMyAdmin\Controllers\Database;
use PhpMyAdmin\Config\PageSettings;
use PhpMyAdmin\SqlQueryForm;
use PhpMyAdmin\Url;
/**
* Database SQL executor
@ -35,8 +36,8 @@ class SqlController extends AbstractController
* After a syntax error, we return to this script
* with the typed query in the textarea.
*/
$goto = 'db_sql.php';
$back = 'db_sql.php';
$goto = Url::getFromRoute('/database/sql');
$back = $goto;
return $sqlQueryForm->getHtml(
true,

View File

@ -318,7 +318,7 @@ class StructureController extends AbstractController
$err_url = Url::getFromRoute('/database/structure', ['db' => $this->db]);
// see bug #2794840; in this case, code path is:
// /database/structure -> libraries/mult_submits.inc.php -> sql.php
// /database/structure -> libraries/mult_submits.inc.php -> /sql
// -> /database/structure and if we got an error on the multi submit,
// we must display it here and not call again mult_submits.inc.php
if (! isset($_POST['error']) || false === $_POST['error']) {

View File

@ -16,6 +16,7 @@ use PhpMyAdmin\SqlParser\Components\Limit;
use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\Statements\SelectStatement;
use PhpMyAdmin\Template;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
/**
@ -125,7 +126,7 @@ class ChartController extends AbstractController
$this->cfg['DefaultTabTable'],
'table'
);
$url_params['back'] = 'tbl_sql.php';
$url_params['back'] = Url::getFromRoute('/table/sql');
include ROOT_PATH . 'libraries/tbl_common.inc.php';
$this->dbi->selectDb($GLOBALS['db']);
} elseif (strlen($this->db) > 0) {
@ -133,14 +134,14 @@ class ChartController extends AbstractController
$this->cfg['DefaultTabDatabase'],
'database'
);
$url_params['back'] = 'sql.php';
$url_params['back'] = Url::getFromRoute('/sql');
include ROOT_PATH . 'libraries/db_common.inc.php';
} else {
$url_params['goto'] = Util::getScriptNameForOption(
$this->cfg['DefaultTabServer'],
'server'
);
$url_params['back'] = 'sql.php';
$url_params['back'] = Url::getFromRoute('/sql');
include ROOT_PATH . 'libraries/server_common.inc.php';
}

View File

@ -132,7 +132,7 @@ class IndexesController extends AbstractController
/**
* Process the data from the edit/create index form,
* run the query to build the new index
* and moves back to "tbl_sql.php"
* and moves back to /table/sql
*
* @return void
*/

View File

@ -11,6 +11,7 @@ namespace PhpMyAdmin\Controllers\Table;
use PhpMyAdmin\Config\PageSettings;
use PhpMyAdmin\SqlQueryForm;
use PhpMyAdmin\Url;
/**
* Table SQL executor
@ -32,15 +33,18 @@ class SqlController extends AbstractController
require ROOT_PATH . 'libraries/tbl_common.inc.php';
$url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';
$err_url = 'tbl_sql.php' . $err_url;
$err_url = Url::getFromRoute('/table/sql') . $err_url;
/**
* After a syntax error, we return to this script
* with the typed query in the textarea.
*/
$goto = 'tbl_sql.php';
$back = 'tbl_sql.php';
$goto = Url::getFromRoute('/table/sql');
$back = Url::getFromRoute('/table/sql');
$url_query .= Url::getCommon([
'goto' => $goto,
'back' => $back,
], '&');
return $sqlQueryForm->getHtml(
$params['sql_query'] ?? true,

View File

@ -323,8 +323,8 @@ class StructureController extends AbstractController
if (isset($_POST['add_key'])
|| isset($_POST['partition_maintenance'])
) {
//todo: set some variables for sql.php include, to be eliminated
//after refactoring sql.php
//todo: set some variables for /sql include, to be eliminated
//after refactoring /sql
$db = $this->db;
$table = $this->table;
$sql_query = $GLOBALS['sql_query'];
@ -835,7 +835,7 @@ class StructureController extends AbstractController
*/
protected function displayTableBrowseForSelectedColumns($goto, $pmaThemeImage)
{
$GLOBALS['active_page'] = 'sql.php';
$GLOBALS['active_page'] = Url::getFromRoute('/sql');
$fields = [];
foreach ($_POST['selected_fld'] as $sval) {
$fields[] = Util::backquote($sval);

View File

@ -27,7 +27,6 @@ class Core
*/
public static $goto_whitelist = [
'db_datadict.php',
'db_sql.php',
'db_events.php',
'db_export.php',
'db_importdocsql.php',
@ -43,16 +42,13 @@ class Core
'server_binlog.php',
'server_export.php',
'server_import.php',
'server_sql.php',
'server_status_advisor.php',
'server_status_monitor.php',
'server_status_variables.php',
'sql.php',
'tbl_addfield.php',
'tbl_create.php',
'tbl_import.php',
'tbl_indexes.php',
'tbl_sql.php',
'tbl_export.php',
'tbl_operations.php',
'tbl_relation.php',

View File

@ -418,8 +418,6 @@ class Results
* @param boolean $is_browse_dist whether browsing distinct values
*
* @return void
*
* @see sql.php
*/
public function setProperties(
$unlim_num_rows,
@ -1607,7 +1605,7 @@ class Results
$tmp_image = '<img class="fulltext" src="' . $tmp_image_file . '" alt="'
. $tmp_txt . '" title="' . $tmp_txt . '">';
$tmp_url = 'sql.php' . Url::getCommon($url_params_full_text);
$tmp_url = Url::getFromRoute('/sql', $url_params_full_text);
return Util::linkOrButton($tmp_url, $tmp_image);
}
@ -1725,8 +1723,8 @@ class Results
'session_max_rows' => $session_max_rows,
'is_browse_distinct' => $this->__get('is_browse_distinct'),
];
$single_order_url = 'sql.php' . Url::getCommon($_single_url_params);
$multi_order_url = 'sql.php' . Url::getCommon($_multi_url_params);
$single_order_url = Url::getFromRoute('/sql', $_single_url_params);
$multi_order_url = Url::getFromRoute('/sql', $_multi_url_params);
// Displays the sorting URL
// enable sort order swapping for image
@ -3235,7 +3233,7 @@ class Results
'where_clause' => $where_clause,
'clause_is_unique' => $clause_is_unique,
'sql_query' => $url_sql_query,
'goto' => 'sql.php',
'goto' => Url::getFromRoute('/sql'),
];
$edit_url = Url::getFromRoute(
@ -3304,10 +3302,10 @@ class Results
'table' => $this->__get('table'),
'sql_query' => $url_sql_query,
'message_to_show' => __('The row has been deleted.'),
'goto' => empty($goto) ? 'tbl_sql.php' : $goto,
'goto' => empty($goto) ? Url::getFromRoute('/table/sql') : $goto,
];
$lnk_goto = 'sql.php' . Url::getCommonRaw($_url_params);
$lnk_goto = Url::getFromRoute('/sql', $_url_params);
$del_query = 'DELETE FROM '
. Util::backquote($this->__get('table'))
@ -3321,7 +3319,7 @@ class Results
'message_to_show' => __('The row has been deleted.'),
'goto' => $lnk_goto,
];
$del_url = 'sql.php' . Url::getCommon($_url_params);
$del_url = Url::getFromRoute('/sql', $_url_params);
$js_conf = 'DELETE FROM ' . Sanitize::jsFormat($this->__get('table'))
. ' WHERE ' . Sanitize::jsFormat($where_clause, false)
@ -3336,7 +3334,7 @@ class Results
'goto' => 'index.php',
];
$lnk_goto = 'sql.php' . Url::getCommonRaw($_url_params);
$lnk_goto = Url::getFromRoute('/sql', $_url_params);
$kill = $GLOBALS['dbi']->getKillQuery($row[0]);
@ -3346,8 +3344,8 @@ class Results
'goto' => $lnk_goto,
];
$del_url = 'sql.php' . Url::getCommon($_url_params);
$js_conf = $kill;
$del_url = Url::getFromRoute('/sql', $_url_params);
$js_conf = $kill;
$del_str = Util::getIcon(
'b_drop',
__('Kill')
@ -3937,8 +3935,6 @@ class Results
* @return void
*
* @access public
*
* @see sql.php file
*/
public function setConfigParamsForDisplayTable()
{
@ -4097,8 +4093,6 @@ class Results
* @return string Generated HTML content for resulted table
*
* @access public
*
* @see sql.php file
*/
public function getTable(
&$dt_result,
@ -5338,7 +5332,7 @@ class Results
$tag_params['class'] = 'ajax';
}
$result .= Util::linkOrButton(
'sql.php' . Url::getCommon($_url_params),
Url::getFromRoute('/sql', $_url_params),
$message,
$tag_params
);

View File

@ -269,7 +269,7 @@ class Import
$sql_query .= $import_run_buffer['full'];
}
}
// check length of query unless we decided to pass it to sql.php
// check length of query unless we decided to pass it to /sql
// (if $run_query is false, we are just displaying so show
// the complete query in the textarea)
if (! $go_sql && $run_query && ! empty($sql_query)) {
@ -1269,7 +1269,7 @@ class Import
'db' => $db_name,
'table' => (string) $table[self::TBL_NAME],
];
$tbl_url = 'sql.php' . Url::getCommon($params);
$tbl_url = Url::getFromRoute('/sql', $params);
$tbl_struct_url = Url::getFromRoute('/table/structure', $params);
$tbl_ops_url = 'tbl_operations.php' . Url::getCommon($params);
@ -1449,7 +1449,7 @@ class Import
'db' => $GLOBALS['db'],
'sql_query' => $matched_row_query,
];
$matched_rows_url = 'sql.php' . Url::getCommon($_url_params);
$matched_rows_url = Url::getFromRoute('/sql', $_url_params);
return [
'sql_query' => Util::formatSql($analyzed_sql_results['query']),

View File

@ -764,7 +764,7 @@ class Index
$r .= '<input type="hidden" class="drop_primary_key_index_msg"'
. ' value="' . $js_msg . '">';
$r .= Util::linkOrButton(
'sql.php' . Url::getCommon($this_params),
Url::getFromRoute('/sql', $this_params),
Util::getIcon('b_drop', __('Drop')),
['class' => 'drop_primary_key_index_anchor ajax']
);

View File

@ -294,7 +294,7 @@ class InsertEdit
break;
}
$params['goto'] = 'sql.php';
$params['goto'] = Url::getFromRoute('/sql');
$this_url_params = array_merge($url_params, $params);
if (! $is_show) {
@ -2484,8 +2484,7 @@ class InsertEdit
. ' WHERE ' . Util::backquote($foreigner['foreign_field'])
. $where_comparison,
];
$output = '<a href="sql.php'
. Url::getCommon($_url_params) . '"' . $title . '>';
$output = '<a href="' . Url::getFromRoute('/sql', $_url_params) . '"' . $title . '>';
if ('D' == $_SESSION['tmpval']['relational_display']) {
// user chose "relational display field" in the

View File

@ -341,7 +341,7 @@ class Menu
$tabs['browse']['icon'] = 'b_browse';
$tabs['browse']['text'] = __('Browse');
$tabs['browse']['link'] = 'sql.php';
$tabs['browse']['link'] = Url::getFromRoute('/sql');
$tabs['browse']['args']['pos'] = 0;
$tabs['structure']['icon'] = 'b_props';
@ -351,7 +351,7 @@ class Menu
(isset($_REQUEST['route']) && in_array($_REQUEST['route'], ['/table/structure']));
$tabs['sql']['icon'] = 'b_sql';
$tabs['sql']['link'] = 'tbl_sql.php';
$tabs['sql']['link'] = Url::getFromRoute('/table/sql');
$tabs['sql']['text'] = __('SQL');
$tabs['search']['icon'] = 'b_search';
@ -458,7 +458,7 @@ class Menu
$tabs['structure']['icon'] = 'b_props';
$tabs['structure']['active'] = isset($_REQUEST['route']) && $_REQUEST['route'] === '/database/structure';
$tabs['sql']['link'] = 'db_sql.php';
$tabs['sql']['link'] = Url::getFromRoute('/database/sql');
$tabs['sql']['text'] = __('SQL');
$tabs['sql']['icon'] = 'b_sql';
@ -579,7 +579,7 @@ class Menu
$tabs['databases']['text'] = __('Databases');
$tabs['sql']['icon'] = 'b_sql';
$tabs['sql']['link'] = 'server_sql.php';
$tabs['sql']['link'] = Url::getFromRoute('/server/sql');
$tabs['sql']['text'] = __('SQL');
$tabs['status']['icon'] = 's_status';

View File

@ -302,10 +302,10 @@ class NodeTable extends NodeDatabaseChild
case Url::getFromRoute('/table/change'):
$this->icon[] = Util::getImage('b_insrow', __('Insert'));
break;
case 'tbl_sql.php':
case Url::getFromRoute('/table/sql'):
$this->icon[] = Util::getImage('b_sql', __('SQL'));
break;
case 'sql.php':
case Url::getFromRoute('/sql'):
$this->icon[] = Util::getImage('b_browse', __('Browse'));
break;
}

View File

@ -31,12 +31,12 @@ class NodeView extends NodeDatabaseChild
{
parent::__construct($name, $type, $isGroup);
$this->icon = Util::getImage('b_props', __('View'));
$iconLink = Url::getFromRoute('/table/structure');
$this->links = [
'text' => 'sql.php?server=' . $GLOBALS['server']
'text' => Url::getFromRoute('/sql')
. '&amp;server=' . $GLOBALS['server']
. '&amp;db=%2$s&amp;table=%1$s&amp;pos=0',
'icon' => $iconLink . (strpos($iconLink, '?') === false ? '?' : '&')
. 'server=' . $GLOBALS['server']
'icon' => Url::getFromRoute('/table/structure')
. '&amp;server=' . $GLOBALS['server']
. '&amp;db=%2$s&amp;table=%1$s',
];
$this->classes = 'view';

View File

@ -1593,7 +1593,7 @@ class Operations
{
return '<li>'
. Util::linkOrButton(
'sql.php' . Url::getCommon(array_merge($url_params, $params)),
Url::getFromRoute('/sql', array_merge($url_params, $params)),
$action_message,
['class' => 'maintain_action ajax']
)
@ -1653,7 +1653,7 @@ class Operations
public function getDeleteDataOrTablelink(array $url_params, $syntax, $link, $htmlId)
{
return '<li>' . Util::linkOrButton(
'sql.php' . Url::getCommon($url_params),
Url::getFromRoute('/sql', $url_params),
$link,
[
'id' => $htmlId,
@ -1742,8 +1742,7 @@ class Operations
);
$html_output .= '<div class="clearfloat"><br>';
$html_output .= '<a href="sql.php'
. Url::getCommon($this_url_params) . '">'
$html_output .= '<a href="' . Url::getFromRoute('/sql', $this_url_params) . '">'
. __('Remove partitioning') . '</a>';
$html_output .= '</fieldset>'
@ -1811,9 +1810,7 @@ class Operations
);
$html_output .= '<li>'
. '<a href="sql.php'
. Url::getCommon($this_url_params)
. '">'
. '<a href="' . Url::getFromRoute('/sql', $this_url_params) . '">'
. $master . '&nbsp;->&nbsp;' . $arr['foreign_db'] . '.'
. $arr['foreign_table'] . '.' . $arr['foreign_field']
. '</a></li>' . "\n";

View File

@ -10,6 +10,7 @@ declare(strict_types=1);
namespace PhpMyAdmin\Rte;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
/**
@ -107,7 +108,7 @@ class Footer
*/
public function events()
{
global $db, $url_query;
global $db, $table, $url_query;
/**
* For events, we show the usual 'Add event' form and also
@ -144,7 +145,11 @@ class Footer
$retval .= " <div class='wrap'>\n";
// show the toggle button
$retval .= Util::toggleButton(
"sql.php$url_query&amp;goto=db_events.php" . urlencode("?db=$db"),
Url::getFromRoute('/sql', [
'db' => $db,
'table' => $table,
'goto' => 'db_events.php?db=' . $db,
]),
'sql_query',
$options,
'Functions.slidingMessage(data.sql_query);'

View File

@ -348,7 +348,7 @@ class RteList
$retval .= " </td>\n";
$retval .= " <td>\n";
$retval .= Util::linkOrButton(
'sql.php' . $url_query . '&amp;sql_query=' . urlencode($sql_drop) . '&amp;goto=db_routines.php' . urlencode("?db={$db}"),
Url::getFromRoute('/sql') . $url_query . '&amp;sql_query=' . urlencode($sql_drop) . '&amp;goto=db_routines.php' . urlencode("?db={$db}"),
$titles['Drop'],
['class' => 'ajax drop_anchor']
);
@ -422,7 +422,10 @@ class RteList
$retval .= " <td>\n";
if (Util::currentUserHasPrivilege('TRIGGER', $db)) {
$retval .= Util::linkOrButton(
'sql.php' . $url_query . '&amp;sql_query=' . urlencode($trigger['drop']) . '&amp;goto=db_triggers.php' . urlencode("?db={$db}"),
Url::getFromRoute('/sql', [
'sql_query' => $trigger['drop'],
'goto' => 'db_triggers.php?db=' . $db,
]) . $url_query,
$titles['Drop'],
['class' => 'ajax drop_anchor']
);
@ -500,7 +503,10 @@ class RteList
$retval .= " <td>\n";
if (Util::currentUserHasPrivilege('EVENT', $db)) {
$retval .= Util::linkOrButton(
'sql.php' . $url_query . '&amp;sql_query=' . urlencode($sql_drop) . '&amp;goto=db_events.php' . urlencode("?db={$db}"),
Url::getFromRoute('/sql', [
'sql_query' => $sql_drop,
'goto' => 'db_events.php?db=' . $db,
]) . $url_query,
$titles['Drop'],
['class' => 'ajax drop_anchor']
);

View File

@ -37,9 +37,6 @@ class Sanitize
'./doc/html/',
// possible return values from Util::getScriptNameForOption
'./index.php?',
'./db_sql.php?',
'./tbl_sql.php?',
'./sql.php?',
// Hardcoded options in \PhpMyAdmin\Config\SpecialSchemaLinks
'./db_events.php?',
'./db_routines.php?',

View File

@ -150,7 +150,7 @@ class Data
'params' => Url::getCommon(['flush' => 'TABLES'], ''),
];
$links['table'][__('Show open tables')] = [
'url' => 'sql.php',
'url' => Url::getFromRoute('/sql'),
'params' => Url::getCommon([
'sql_query' => 'SHOW OPEN TABLES',
'goto' => $this->selfUrl,
@ -159,7 +159,7 @@ class Data
if ($GLOBALS['replication_info']['master']['status']) {
$links['repl'][__('Show slave hosts')] = [
'url' => 'sql.php',
'url' => Url::getFromRoute('/sql'),
'params' => Url::getCommon([
'sql_query' => 'SHOW SLAVE HOSTS',
'goto' => $this->selfUrl,

View File

@ -495,7 +495,7 @@ class Sql
) {
return $this->template->render('sql/bookmark', [
'db' => $db,
'goto' => 'sql.php' . Url::getCommon([
'goto' => Url::getFromRoute('/sql', [
'db' => $db,
'table' => $table,
'sql_query' => $sql_query,
@ -713,7 +713,7 @@ class Sql
}
exit;
} else {
// go back to sql.php to redisplay query; do not use &amp; in this case:
// go back to /sql to redisplay query; do not use &amp; in this case:
/**
* @todo In which scenario does this happen?
*/
@ -1324,7 +1324,7 @@ class Sql
// Ok, here is an explanation for the !$is_select.
// The form generated by PhpMyAdmin\SqlQueryForm
// and db_sql.php has many submit buttons
// and /database/sql has many submit buttons
// on the same form, and some confusion arises from the
// fact that $message_to_show is sent for every case.
// The $message_to_show containing a success message and sent with

View File

@ -3,9 +3,9 @@
/**
* functions for displaying the sql query form
*
* @usedby server_sql.php
* @usedby db_sql.php
* @usedby tbl_sql.php
* @usedby /server/sql
* @usedby /database/sql
* @usedby /table/sql
* @usedby /table/structure
* @usedby /table/tracking
* @package PhpMyAdmin
@ -33,9 +33,9 @@ class SqlQueryForm
*
* @return string
*
* @usedby server_sql.php
* @usedby db_sql.php
* @usedby tbl_sql.php
* @usedby /server/sql
* @usedby /database/sql
* @usedby /table/sql
* @usedby /table/structure
* @usedby /table/tracking
*/
@ -60,22 +60,19 @@ class SqlQueryForm
$enctype = '';
}
$table = '';
$db = '';
$table = '';
$db = '';
if (strlen($GLOBALS['db']) === 0) {
// prepare for server related
$goto = empty($GLOBALS['goto']) ?
'server_sql.php' : $GLOBALS['goto'];
$goto = empty($GLOBALS['goto']) ? Url::getFromRoute('/server/sql') : $GLOBALS['goto'];
} elseif (strlen($GLOBALS['table']) === 0) {
// prepare for db related
$db = $GLOBALS['db'];
$goto = empty($GLOBALS['goto']) ?
'db_sql.php' : $GLOBALS['goto'];
$db = $GLOBALS['db'];
$goto = empty($GLOBALS['goto']) ? Url::getFromRoute('/database/sql') : $GLOBALS['goto'];
} else {
$table = $GLOBALS['table'];
$db = $GLOBALS['db'];
$goto = empty($GLOBALS['goto']) ?
'tbl_sql.php' : $GLOBALS['goto'];
$table = $GLOBALS['table'];
$db = $GLOBALS['db'];
$goto = empty($GLOBALS['goto']) ? Url::getFromRoute('/table/sql') : $GLOBALS['goto'];
}
// start output

View File

@ -624,15 +624,12 @@ class Util
if (strlen($table) > 0) {
$_url_params['db'] = $db;
$_url_params['table'] = $table;
$doedit_goto = '<a href="tbl_sql.php'
. Url::getCommon($_url_params) . '">';
$doedit_goto = '<a href="' . Url::getFromRoute('/table/sql', $_url_params) . '">';
} elseif (strlen($db) > 0) {
$_url_params['db'] = $db;
$doedit_goto = '<a href="db_sql.php'
. Url::getCommon($_url_params) . '">';
$doedit_goto = '<a href="' . Url::getFromRoute('/database/sql', $_url_params) . '">';
} else {
$doedit_goto = '<a href="server_sql.php'
. Url::getCommon($_url_params) . '">';
$doedit_goto = '<a href="' . Url::getFromRoute('/server/sql', $_url_params) . '">';
}
$error_msg .= $doedit_goto
@ -1068,12 +1065,12 @@ class Util
$url_params['db'] = $GLOBALS['db'];
if (strlen($GLOBALS['table']) > 0) {
$url_params['table'] = $GLOBALS['table'];
$edit_link = 'tbl_sql.php';
$edit_link = Url::getFromRoute('/table/sql');
} else {
$edit_link = 'db_sql.php';
$edit_link = Url::getFromRoute('/database/sql');
}
} else {
$edit_link = 'server_sql.php';
$edit_link = Url::getFromRoute('/server/sql');
}
// Want to have the query explained
@ -1178,7 +1175,7 @@ class Util
$retval .= '</div>';
$retval .= '<div class="tools print_ignore">';
$retval .= '<form action="sql.php" method="post">';
$retval .= '<form action="' . Url::getFromRoute('/sql') . '" method="post">';
$retval .= Url::getHiddenInputs($GLOBALS['db'], $GLOBALS['table']);
$retval .= '<input type="hidden" name="sql_query" value="'
. htmlspecialchars($sql_query) . '">';
@ -3191,7 +3188,7 @@ class Util
case 'structure':
return Url::getFromRoute('/database/structure');
case 'sql':
return 'db_sql.php';
return Url::getFromRoute('/database/sql');
case 'search':
return Url::getFromRoute('/database/search');
case 'operations':
@ -3205,13 +3202,13 @@ class Util
case 'structure':
return Url::getFromRoute('/table/structure');
case 'sql':
return 'tbl_sql.php';
return Url::getFromRoute('/table/sql');
case 'search':
return Url::getFromRoute('/table/search');
case 'insert':
return Url::getFromRoute('/table/change');
case 'browse':
return 'sql.php';
return Url::getFromRoute('/sql');
}
}

View File

@ -61,7 +61,7 @@ if (empty($is_table)
&& ! defined('PMA_SUBMIT_MULT')
&& ! defined('TABLE_MAY_BE_ABSENT')
) {
// Not a valid table name -> back to the db_sql.php
// Not a valid table name -> back to the /database/sql
if (strlen($table) > 0) {
$is_table = $GLOBALS['dbi']->getCachedTableContent([$db, $table], false);

View File

@ -60,15 +60,17 @@ if (! empty($unsaved_values) && count($rows) < count($unsaved_values)) {
if (empty($GLOBALS['goto'])) {
if (strlen($table) > 0) {
// avoid a problem (see bug #2202709)
$GLOBALS['goto'] = 'tbl_sql.php';
$GLOBALS['goto'] = Url::getFromRoute('/table/sql');
} else {
$GLOBALS['goto'] = 'db_sql.php';
$GLOBALS['goto'] = Url::getFromRoute('/database/sql');
}
}
$_url_params = $insertEdit->getUrlParameters($db, $table);
$err_url = $GLOBALS['goto'] . Url::getCommon($_url_params);
$err_url = $GLOBALS['goto'] . Url::getCommon(
$_url_params,
mb_strpos($GLOBALS['goto'], '?') === false ? '?' : '&'
);
unset($_url_params);
$comments_map = $insertEdit->getCommentsMap($db, $table);

View File

@ -13,6 +13,7 @@ use PhpMyAdmin\MultSubmits;
use PhpMyAdmin\Response;
use PhpMyAdmin\Sql;
use PhpMyAdmin\Template;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
if (! defined('PHPMYADMIN')) {
@ -170,7 +171,10 @@ if (! empty($submit_mult) && ! empty($what)) {
if (strlen($table) > 0) {
include ROOT_PATH . 'libraries/tbl_common.inc.php';
$url_query .= '&amp;goto=tbl_sql.php&amp;back=tbl_sql.php';
$url_query .= Url::getCommon([
'goto' => Url::getFromRoute('/table/sql'),
'back' => Url::getFromRoute('/table/sql'),
], '&');
} elseif (strlen($db) > 0) {
include ROOT_PATH . 'libraries/db_common.inc.php';

18
sql.php
View File

@ -3,7 +3,7 @@
/**
* SQL executor
*
* @todo we must handle the case if sql.php is called directly with a query
* @todo we must handle the case if /sql is called directly with a query
* that returns 0 rows - to prevent cyclic redirects or includes
* @package PhpMyAdmin
*/
@ -212,16 +212,14 @@ if (isset($_POST['store_bkm'])) {
/**
* Sets or modifies the $goto variable if required
*/
if ($goto == 'sql.php') {
if ($goto === Url::getFromRoute('/sql')) {
$is_gotofile = false;
$goto = 'sql.php' . Url::getCommon(
[
'db' => $db,
'table' => $table,
'sql_query' => $sql_query,
]
);
} // end if
$goto = Url::getFromRoute('/sql', [
'db' => $db,
'table' => $table,
'sql_query' => $sql_query,
]);
}
$sql->executeQueryAndSendQueryResponse(
$analyzed_sql_results, // analyzed_sql_results

View File

@ -53,12 +53,10 @@ $cfg = $config->settings;
/**
* Defines the url to return to in case of error in a sql statement
*/
$err_url = 'tbl_sql.php' . Url::getCommon(
[
'db' => $db,
'table' => $table,
]
);
$err_url = Url::getFromRoute('/table/sql', [
'db' => $db,
'table' => $table,
]);
/**
* The form used to define the field to add has been submitted

View File

@ -8,6 +8,7 @@
declare(strict_types=1);
use PhpMyAdmin\Controllers\Table\GisVisualizationController;
use PhpMyAdmin\Url;
use PhpMyAdmin\Util;
use PhpMyAdmin\Core;
use Symfony\Component\DependencyInjection\Definition;
@ -38,7 +39,7 @@ $dependency_definitions = [
$GLOBALS['cfg']['DefaultTabDatabase'],
'database'
),
'back' => 'sql.php',
'back' => Url::getFromRoute('/sql'),
'visualizationSettings' => [],
];

View File

@ -131,10 +131,9 @@ if (! empty($submit_mult)) {
}
include ROOT_PATH . 'libraries/mult_submits.inc.php';
$_url_params = $GLOBALS['url_params'];
$_url_params['goto'] = 'tbl_sql.php';
$_url_params['goto'] = Url::getFromRoute('/table/sql');
$url_query = Url::getCommon($_url_params);
/**
* Show result of multi submit operation
*/
@ -154,7 +153,7 @@ if (! empty($submit_mult)) {
$url_query = $original_url_query;
}
$active_page = 'sql.php';
$active_page = Url::getFromRoute('/sql');
$sql = new Sql();
$sql->executeQueryAndSendQueryResponse(
null, // analyzed_sql_results

View File

@ -21,14 +21,14 @@
{% set url_params = {
'db': db,
'table': row.table,
'goto': 'db_sql.php',
'goto': url('/database/sql'),
'pos': 0,
'is_js_confirmed': 0
} %}
<td>
<a name="browse_search"
class="ajax browse_results"
href="sql.php{{ get_common(url_params) }}"
href="{{ url('/sql', url_params) }}"
data-browse-sql="{{ row.new_search_sqls.select_columns }}"
data-table-name="{{ row.table }}">
{% trans 'Browse' %}
@ -37,7 +37,7 @@
<td>
<a name="delete_search"
class="ajax delete_results"
href="sql.php{{ get_common(url_params) }}"
href="{{ url('/sql', url_params) }}"
data-delete-sql="{{ row.new_search_sqls.delete }}"
data-table-name="{{ row.table }}">
{% trans 'Delete' %}

View File

@ -7,7 +7,7 @@
id="checkbox_tbl_{{ curr }}">
</td>
<th>
<a href="sql.php{{ get_common(table_url_params|merge({'pos': 0})) }}" title="{{ browse_table_label_title }}">
<a href="{{ url('/sql', table_url_params|merge({'pos': 0})) }}" title="{{ browse_table_label_title }}">
{{ browse_table_label_truename }}
</a>
{{ tracking_icon|raw }}
@ -40,7 +40,7 @@
{% endif %}
<td class="center print_ignore">
<a href="sql.php{{ get_common(table_url_params|merge({'pos': 0})) }}">
<a href="{{ url('/sql', table_url_params|merge({'pos': 0})) }}">
{{ browse_table_title|raw }}
</a>
@ -69,7 +69,7 @@
</td>
{% else %}
<td class="center print_ignore">
<a class="truncate_table_anchor ajax" href="sql.php" data-post="{{ get_common(table_url_params|merge({
<a class="truncate_table_anchor ajax" href="{{ url('/sql') }}" data-post="{{ get_common(table_url_params|merge({
'sql_query': empty_table_sql_query,
'message_to_show': empty_table_message_to_show
}), '') }}">
@ -79,7 +79,7 @@
{% endif %}
<td class="center print_ignore">
<a class="ajax drop_table_anchor
{{- table_is_view or current_table['ENGINE'] == null ? ' view' }}" href="sql.php" data-post="
{{- table_is_view or current_table['ENGINE'] == null ? ' view' }}" href="{{ url('/sql') }}" data-post="
{{- get_common(table_url_params|merge({
'reload': 1,
'purge': 1,

View File

@ -1,4 +1,4 @@
<form method="post" action="sql.php" name="displayOptionsForm" class="ajax print_ignore">
<form method="post" action="{{ url('/sql') }}" name="displayOptionsForm" class="ajax print_ignore">
{{ get_hidden_inputs({
'db': db,
'table': table,

View File

@ -1,5 +1,5 @@
<td>
<form action="sql.php" method="post">
<form action="{{ url('/sql') }}" method="post">
{{ get_hidden_inputs(url_params) }}
{{ page_selector|raw }}
</form>

View File

@ -1,4 +1,4 @@
<form action="sql.php" method="post" class="print_ignore">
<form action="{{ url('/sql') }}" method="post" class="print_ignore">
{{ get_hidden_fields(hidden_fields) }}
{% trans 'Sort by key:' %}
<select name="sql_query" class="autosubmit">

View File

@ -9,7 +9,7 @@
{% if delete_link == delete_row or delete_link == kill_process %}
<form method="post" action="tbl_row_action.php" name="resultsForm" id="resultsForm_{{ unique_id }}" class="ajax">
{{ get_hidden_inputs(db, table, 1) }}
<input type="hidden" name="goto" value="sql.php">
<input type="hidden" name="goto" value="{{ url('/sql') }}">
{% endif %}
<div class="responsivetable">

View File

@ -9,7 +9,7 @@
{% endif %}
{% if has_show_all %}
<td>
<form action="sql.php" method="post">
<form action="{{ url('/sql') }}" method="post">
{{ get_hidden_fields(hidden_fields|merge({
'session_max_rows': session_max_rows,
'pos': '0'
@ -38,7 +38,7 @@
{# of $cfg['MaxExactCountViews']; in this case, avoid passing #}
{# the 5th parameter to Functions.checkFormElementInRange() #}
{# (this means we can't validate the upper limit) #}
<form action="sql.php" method="post" onsubmit="return (Functions.checkFormElementInRange(this, 'session_max_rows', '
<form action="{{ url('/sql') }}" method="post" onsubmit="return (Functions.checkFormElementInRange(this, 'session_max_rows', '
{{- '%d is not valid row number.'|trans|replace({'\'': '\\\''}) -}}
', 1) && Functions.checkFormElementInRange(this, 'pos', '
{{- '%d is not valid row number.'|trans|replace({'\'': '\\\''}) -}}

View File

@ -1,5 +1,5 @@
<td>
<form action="sql.php" method="post"{{ onsubmit|raw }}>
<form action="{{ url('/sql') }}" method="post"{{ onsubmit|raw }}>
{{ get_hidden_inputs(db, table) }}
<input type="hidden" name="sql_query" value="{{ sql_query|raw }}">
<input type="hidden" name="pos" value="{{ pos }}">

View File

@ -1,4 +1,4 @@
<form action="sql.php" method="post" class="bookmarkQueryForm print_ignore"
<form action="{{ url('/sql') }}" method="post" class="bookmarkQueryForm print_ignore"
onsubmit="return ! Functions.emptyCheckTheField(this, 'bkm_fields[bkm_label]');">
{{ get_hidden_inputs() }}
<input type="hidden" name="db" value="{{ db }}">

View File

@ -22,7 +22,7 @@
{% if one_key['constraint'] is defined %}
<input type="hidden" class="drop_foreign_key_msg" value="
{{- js_msg }}">
{% set drop_url = 'sql.php' ~ get_common(this_params) %}
{% set drop_url = url('/sql', this_params) %}
{% set drop_str = get_icon('b_drop', 'Drop'|trans) %}
{{ link_or_button(drop_url, drop_str, {'class': 'drop_foreign_key_anchor ajax'}) }}
{% endif %}

View File

@ -107,7 +107,7 @@
</a>
</td>
<td class="drop center print_ignore">
<a class="drop_column_anchor ajax" href="sql.php" data-post="{{ url_query }}&amp;sql_query=
<a class="drop_column_anchor ajax" href="{{ url('/sql') }}" data-post="{{ url_query }}&amp;sql_query=
{{- ('ALTER TABLE ' ~ backquote(table)
~ ' DROP ' ~ backquote(row['Field']) ~ ';')|url_encode -}}
&amp;dropped_column={{ row['Field']|url_encode }}&amp;purge=1&amp;message_to_show=
@ -232,7 +232,7 @@
{# Distinct value action #}
<li class="browse nowrap">
<a href="sql.php" data-post="{{ url_query|raw }}&amp;sql_query=
<a href="{{ url('/sql') }}" data-post="{{ url_query|raw }}&amp;sql_query=
{{- ('SELECT COUNT(*) AS ' ~ backquote('Rows'|trans)
~ ', ' ~ backquote(row['Field'])
~ ' FROM ' ~ backquote(table)
@ -384,7 +384,7 @@
{% if not tbl_is_view and not db_is_system_schema %}
{# Only display propose table structure for MySQL < 8.0 #}
{% if mysql_int_version < 80000 or is_mariadb %}
<a href="sql.php" data-post="{{ url_query|raw }}&amp;session_max_rows=all&amp;sql_query=
<a href="{{ url('/sql') }}" data-post="{{ url_query|raw }}&amp;session_max_rows=all&amp;sql_query=
{{- ('SELECT * FROM ' ~ backquote(table) ~ ' PROCEDURE ANALYSE()')|url_encode -}}
" style="margin-right: 0;">
{{ get_icon(
@ -483,7 +483,7 @@
} only %}
{% set remove_sql = 'ALTER TABLE ' ~ backquote(table) ~ ' REMOVE PARTITIONING' %}
{% set remove_url = 'sql.php' ~ url_query ~ '&sql_query=' ~ remove_sql|url_encode %}
{% set remove_url = url('/sql') ~ url_query ~ '&sql_query=' ~ remove_sql|url_encode %}
{% include 'table/structure/display_partitions.twig' with {
'db': db,

View File

@ -57,7 +57,7 @@
or (tbl_storage_engine == 'INNODB' and innodb_file_per_table == true) %}
<tr class="tblFooters print_ignore">
<td colspan="3" class="center">
<a href="sql.php" data-post="{{ url_query }}&amp;pos=0&amp;sql_query=
<a href="{{ url('/sql') }}" data-post="{{ url_query }}&amp;pos=0&amp;sql_query=
{{- ('OPTIMIZE TABLE ' ~ backquote(table))|url_encode }}">
{{ get_icon('b_tbloptimize', 'Optimize table'|trans) }}
</a>

View File

@ -24,7 +24,6 @@ class CoreTest extends PmaTestCase
{
protected $goto_whitelist = [
'db_datadict.php',
'db_sql.php',
'db_export.php',
'export.php',
'import.php',
@ -32,7 +31,6 @@ class CoreTest extends PmaTestCase
'pdf_pages.php',
'pdf_schema.php',
'server_binlog.php',
'sql.php',
'transformation_overview.php',
'transformation_wrapper.php',
'user_password.php',

View File

@ -142,7 +142,11 @@ class ResultsTest extends PmaTestCase
);
$this->assertStringContainsString(
'<form action="sql.php" method="post">',
'<form action="index.php?route=/sql',
$actual
);
$this->assertStringContainsString(
'" method="post">',
$actual
);
$this->assertStringContainsString(
@ -344,12 +348,11 @@ class ResultsTest extends PmaTestCase
{
return [
[
'sql.php?db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60'
'index.php?route=/sql&amp;db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60'
. '.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&amp;message_to_show='
. 'The+row+has+been+deleted&amp;goto=sql.php%3Fdb%3Ddata%26table%3D'
. 'The+row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26db%3Ddata%26table%3D'
. 'new%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message'
. '_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_'
. 'structure.php',
. '_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dindex.php%253Froute%253D%252Ftable%252Fstructure',
[
'edit_lnk' => 'ur',
'del_lnk' => 'dr',
@ -429,7 +432,7 @@ class ResultsTest extends PmaTestCase
[
'index.php?route=/table/change&db=Data&amp;table=customer&amp;where_clause=%60'
. 'customer%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query='
. 'SELECT+%2A+FROM+%60customer%60&amp;goto=sql.php&amp;default_'
. 'SELECT+%2A+FROM+%60customer%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_'
. 'action=update',
'klass edit_row_anchor',
'<span class="nowrap"><img src="themes/dot.gif" title="Edit" alt='
@ -440,7 +443,7 @@ class ResultsTest extends PmaTestCase
. '<span class="nowrap">'
. '<a href="index.php" data-post="route=/table/change&db=Data&amp;table=customer&amp;where_'
. 'clause=%60customer%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;'
. 'sql_query=SELECT+%2A+FROM+%60customer%60&amp;goto=sql.php&amp;'
. 'sql_query=SELECT+%2A+FROM+%60customer%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;'
. 'default_action=update"'
. '><span class="nowrap"><img src="themes/dot.gif" title="Edit" '
. 'alt="Edit" class="icon ic_b_edit"> Edit</span></a>'
@ -501,7 +504,7 @@ class ResultsTest extends PmaTestCase
[
'index.php?route=/table/change&db=Data&amp;table=customer&amp;where_clause=%60cust'
. 'omer%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query='
. 'SELECT+%2A+FROM+%60customer%60&amp;goto=sql.php&amp;default_'
. 'SELECT+%2A+FROM+%60customer%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_'
. 'action=insert',
'<span class="nowrap"><img src="themes/dot.gif" title="Copy" alt'
. '="Copy" class="icon ic_b_insrow"> Copy</span>',
@ -512,7 +515,7 @@ class ResultsTest extends PmaTestCase
. '"nowrap">'
. '<a href="index.php" data-post="route=/table/change&db=Data&amp;table=customer&amp;where_'
. 'clause=%60customer%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;'
. 'sql_query=SELECT+%2A+FROM+%60customer%60&amp;goto=sql.php&amp;'
. 'sql_query=SELECT+%2A+FROM+%60customer%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;'
. 'default_action=insert"'
. '><span class="nowrap"><img src="themes/dot.gif" title="Copy" '
. 'alt="Copy" class="icon ic_b_insrow"> Copy</span></a>'
@ -571,9 +574,9 @@ class ResultsTest extends PmaTestCase
{
return [
[
'sql.php?db=Data&amp;table=customer&amp;sql_query=DELETE+FROM+%60'
'index.php?route=/sql&amp;db=Data&amp;table=customer&amp;sql_query=DELETE+FROM+%60'
. 'Data%60.%60customer%60+WHERE+%60customer%60.%60id%60+%3D+1&amp;'
. 'message_to_show=The+row+has+been+deleted&amp;goto=sql.php%3Fdb'
. 'message_to_show=The+row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26db'
. '%3DData%26table%3Dcustomer%26sql_query%3DSELECT%2B%252A%2BFROM'
. '%2B%2560customer%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen'
. '%2Bdeleted%26goto%3Dindex.php%253Froute%253D%252Ftable%252Fstructure',
@ -582,10 +585,10 @@ class ResultsTest extends PmaTestCase
'DELETE FROM `Data`.`customer` WHERE `customer`.`id` = 1',
'klass',
'<td class="klass center print_ignore">'
. '<a href="sql.php" data-post="db=Data&amp;table=customer&amp;sql_query=DELETE'
. '<a href="index.php" data-post="route=/sql&amp;db=Data&amp;table=customer&amp;sql_query=DELETE'
. '+FROM+%60Data%60.%60customer%60+WHERE+%60customer%60.%60id%60+%3D'
. '+1&amp;message_to_show=The+row+has+been+deleted&amp;goto=sql.php'
. '%3Fdb%3DData%26table%3Dcustomer%26sql_query%3DSELECT%2B%252A%2B'
. '+1&amp;message_to_show=The+row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql'
. '%26db%3DData%26table%3Dcustomer%26sql_query%3DSELECT%2B%252A%2B'
. 'FROM%2B%2560customer%2560%26message_to_show%3DThe%2Brow%2Bhas%2B'
. 'been%2Bdeleted%26goto%3Dindex.php%253Froute%253D%252Ftable%252Fstructure" '
. 'class="delete_row requireConfirm"><span class="nowrap"><img src="themes/dot.'
@ -644,9 +647,9 @@ class ResultsTest extends PmaTestCase
return [
[
DisplayResults::POSITION_LEFT,
'sql.php?db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data'
'index.php?route=/sql&amp;db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data'
. '%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&amp;message_to_show='
. 'The+row+has+been+deleted&amp;goto=sql.php%3Fdb%3Ddata%26table%3D'
. 'The+row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26db%3Ddata%26table%3D'
. 'new%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26'
. 'message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3D'
. 'index.php%253Froute%253D%252Ftable%252Fstructure',
@ -667,10 +670,10 @@ class ResultsTest extends PmaTestCase
],
'index.php?route=/table/change&db=data&amp;table=new&amp;where_clause=%60new%60.'
. '%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+'
. 'FROM+%60new%60&amp;goto=sql.php&amp;default_action=update',
. 'FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=update',
'index.php?route=/table/change&db=data&amp;table=new&amp;where_clause=%60new%60.'
. '%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+'
. 'FROM+%60new%60&amp;goto=sql.php&amp;default_action=insert',
. 'FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=insert',
'edit_row_anchor',
'<span class="nowrap"><img src="themes/dot.gif" title="Edit" '
. 'alt="Edit" class="icon ic_b_edit"> Edit</span>',
@ -687,7 +690,7 @@ class ResultsTest extends PmaTestCase
. '"nowrap">'
. '<a href="index.php" data-post="route=/table/change&db=data&amp;table=new&amp;where_'
. 'clause=%60new%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;'
. 'sql_query=SELECT+%2A+FROM+%60new%60&amp;goto=sql.php&amp;default'
. 'sql_query=SELECT+%2A+FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default'
. '_action=update">'
. '<span class="nowrap"><img src="themes/dot.gif" title="Edit" '
. 'alt="Edit" class="icon ic_b_edit"> Edit</span></a>'
@ -696,15 +699,15 @@ class ResultsTest extends PmaTestCase
. '="nowrap">'
. '<a href="index.php" data-post="route=/table/change&db=data&amp;table=new&amp;where_clause'
. '=%60new%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query='
. 'SELECT+%2A+FROM+%60new%60&amp;goto=sql.php&amp;default_action='
. 'SELECT+%2A+FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action='
. 'insert"><span class'
. '="nowrap"><img src="themes/dot.gif" title="Copy" alt="Copy" '
. 'class="icon ic_b_insrow"> Copy</span></a>'
. '<input type="hidden" class="where_clause" value="%60new%60.%60id'
. '%60+%3D+1"></span></td><td class="center print_ignore">'
. '<a href="sql.php" data-post="db=data&amp;table=new&amp;sql_query=DELETE+'
. '<a href="index.php" data-post="route=/sql&amp;db=data&amp;table=new&amp;sql_query=DELETE+'
. 'FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&amp;'
. 'message_to_show=The+row+has+been+deleted&amp;goto=sql.php%3F'
. 'message_to_show=The+row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26'
. 'db%3Ddata%26table%3Dnew%26sql_query%3DSELECT%2B%252A%2BFROM%2B'
. '%2560new%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2B'
. 'deleted%26goto%3Dindex.php%253Froute%253D%252Ftable%252Fstructure" '
@ -716,9 +719,9 @@ class ResultsTest extends PmaTestCase
],
[
DisplayResults::POSITION_RIGHT,
'sql.php?db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60'
'index.php?route=/sql&amp;db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60'
. '.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&amp;message_to_show='
. 'The+row+has+been+deleted&amp;goto=sql.php%3Fdb%3Ddata%26table%3D'
. 'The+row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26db%3Ddata%26table%3D'
. 'new%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message'
. '_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3D'
. 'index.php%253Froute%253D%252Ftable%252Fstructure',
@ -739,10 +742,10 @@ class ResultsTest extends PmaTestCase
],
'index.php?route=/table/change&amp;db=data&amp;table=new&amp;where_clause=%60new%60.'
. '%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+'
. 'FROM+%60new%60&amp;goto=sql.php&amp;default_action=update',
. 'FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=update',
'index.php?route=/table/change&amp;db=data&amp;table=new&amp;where_clause=%60new%60.'
. '%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+'
. 'FROM+%60new%60&amp;goto=sql.php&amp;default_action=insert',
. 'FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=insert',
'edit_row_anchor',
'<span class="nowrap"><img src="themes/dot.gif" title="Edit" '
. 'alt="Edit" class="icon ic_b_edit"> Edit</span>',
@ -752,9 +755,9 @@ class ResultsTest extends PmaTestCase
. 'alt="Delete" class="icon ic_b_drop"> Delete</span>',
'DELETE FROM `data`.`new` WHERE `new`.`id` = 1',
'<td class="center print_ignore">'
. '<a href="sql.php" data-post="db=data&amp;table=new&amp;sql_query=DELETE+'
. '<a href="index.php" data-post="route=/sql&amp;db=data&amp;table=new&amp;sql_query=DELETE+'
. 'FROM+%60data%60.%60new%60+WHERE+%60new%60.%60id%60+%3D+1&amp;'
. 'message_to_show=The+row+has+been+deleted&amp;goto=sql.php%3Fdb'
. 'message_to_show=The+row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26db'
. '%3Ddata%26table%3Dnew%26sql_query%3DSELECT%2B%252A%2BFROM%2B%25'
. '60new%2560%26message_to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted'
. '%26goto%3Dindex.php%253Froute%253D%252Ftable%252Fstructure" class="delete'
@ -764,7 +767,7 @@ class ResultsTest extends PmaTestCase
. '`id` = 1</div></td><td class="center print_ignore"><span class="nowrap">'
. '<a href="index.php" data-post="route=/table/change&amp;db=data&amp;table=new&amp;where_'
. 'clause=%60new%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_'
. 'query=SELECT+%2A+FROM+%60new%60&amp;goto=sql.php&amp;default_'
. 'query=SELECT+%2A+FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_'
. 'action=insert"><span '
. 'class="nowrap"><img src="themes/dot.gif" title="Copy" alt="Copy" '
. 'class="icon ic_b_insrow"> Copy</span></a>'
@ -773,7 +776,7 @@ class ResultsTest extends PmaTestCase
. '<span class="nowrap">'
. '<a href="index.php" data-post="route=/table/change&amp;db=data&amp;table=new&amp;where_clause'
. '=%60new%60.%60id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query='
. 'SELECT+%2A+FROM+%60new%60&amp;goto=sql.php&amp;default_action='
. 'SELECT+%2A+FROM+%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action='
. 'update"><span class='
. '"nowrap"><img src="themes/dot.gif" title="Edit" alt="Edit" class'
. '="icon ic_b_edit"> Edit</span></a>'
@ -786,12 +789,11 @@ class ResultsTest extends PmaTestCase
],
[
DisplayResults::POSITION_NONE,
'sql.php?db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60.'
'index.php?route=/sql&amp;db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60.'
. '%60new%60+WHERE+%60new%60.%60id%60+%3D+1&amp;message_to_show=The+'
. 'row+has+been+deleted&amp;goto=sql.php%3Fdb%3Ddata%26table%3Dnew'
. 'row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26db%3Ddata%26table%3Dnew'
. '%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message_'
. 'to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure'
. '.php',
. 'to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dindex.php%253Froute%253D%252Ftable%252Fstructure',
[
'edit_lnk' => 'ur',
'del_lnk' => 'dr',
@ -809,10 +811,10 @@ class ResultsTest extends PmaTestCase
],
'index.php?route=/table/change&db=data&amp;table=new&amp;where_clause=%60new%60.%60'
. 'id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+FROM+'
. '%60new%60&amp;goto=sql.php&amp;default_action=update',
. '%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=update',
'index.php?route=/table/change&db=data&amp;table=new&amp;where_clause=%60new%60.%60'
. 'id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+FROM+'
. '%60new%60&amp;goto=sql.php&amp;default_action=insert',
. '%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=insert',
'edit_row_anchor',
'<span class="nowrap"><img src="themes/dot.gif" title="Edit" '
. 'alt="Edit" class="icon ic_b_edit"> Edit</span>',
@ -905,9 +907,9 @@ class ResultsTest extends PmaTestCase
return [
[
DisplayResults::POSITION_NONE,
'sql.php?db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60.'
'index.php?route=/sql&amp;db=data&amp;table=new&amp;sql_query=DELETE+FROM+%60data%60.'
. '%60new%60+WHERE+%60new%60.%60id%60+%3D+1&amp;message_to_show=The+'
. 'row+has+been+deleted&amp;goto=sql.php%3Fdb%3Ddata%26table%3Dnew'
. 'row+has+been+deleted&amp;goto=index.php%3Froute%3D%2Fsql%26db%3Ddata%26table%3Dnew'
. '%26sql_query%3DSELECT%2B%252A%2BFROM%2B%2560new%2560%26message_'
. 'to_show%3DThe%2Brow%2Bhas%2Bbeen%2Bdeleted%26goto%3Dtbl_structure'
. '.php',
@ -928,10 +930,10 @@ class ResultsTest extends PmaTestCase
],
'index.php?route=/table/change&db=data&amp;table=new&amp;where_clause=%60new%60.%60'
. 'id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+FROM+'
. '%60new%60&amp;goto=sql.php&amp;default_action=update',
. '%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=update',
'/index.php?route=/table/change&db=data&amp;table=new&amp;where_clause=%60new%60.%60'
. 'id%60+%3D+1&amp;clause_is_unique=1&amp;sql_query=SELECT+%2A+FROM+'
. '%60new%60&amp;goto=sql.php&amp;default_action=insert',
. '%60new%60&amp;goto=index.php%3Froute%3D%2Fsql&amp;default_action=insert',
'edit_row_anchor',
'<span class="nowrap"><img src="themes/dot.gif" title="Edit" '
. 'alt="Edit" class="icon ic_b_edit"> Edit</span>',

View File

@ -182,7 +182,7 @@ class ErrorReportTest extends TestCase
'context' => $context,
],
],
'url' => 'http://pma.7.3.local/tbl_sql.php?db=aaaaa&table=a&server=14',
'url' => 'http://pma.7.3.local/index.php?route=/table/sql&db=aaaaa&table=a&server=14',
];
$_POST['microhistory'] = '';
$_POST['description'] = 'description';
@ -197,7 +197,7 @@ class ErrorReportTest extends TestCase
'locale' => $_COOKIE['pma_lang'],
'configuration_storage' => 'disabled',
'php_version' => phpversion(),
'script_name' => 'tbl_sql.php',
'script_name' => 'index.php',
'exception_type' => 'js',
'exception' => [
'mode' => 'stack',
@ -213,7 +213,7 @@ class ErrorReportTest extends TestCase
'scriptname' => 'js/vendor/codemirror/addon/hint/show-hint.js',
],
],
'uri' => 'tbl_sql.php?',
'uri' => 'index.php?route=%2Ftable%2Fsql',
],
'microhistory' => $_POST['microhistory'],
'steps' => $_POST['description'],

View File

@ -552,7 +552,7 @@ class ImportTest extends TestCase
'db' => 'PMA',
'sql_query' => $simulated_query,
];
$matched_rows_url = 'sql.php' . Url::getCommon($_url_params);
$matched_rows_url = Url::getFromRoute('/sql', $_url_params);
$this->assertEquals(
[

View File

@ -365,7 +365,7 @@ class InsertEditTest extends TestCase
$result
);
$this->assertStringContainsString(
'ShowFunctionFields=1&amp;ShowFieldTypesInDataEditView=1&amp;goto=sql.php',
'ShowFunctionFields=1&amp;ShowFieldTypesInDataEditView=1&amp;goto=index.php%3Froute%3D%2Fsql',
$result
);
$this->assertStringContainsString(
@ -381,7 +381,7 @@ class InsertEditTest extends TestCase
$result
);
$this->assertStringContainsString(
'ShowFunctionFields=0&amp;ShowFieldTypesInDataEditView=1&amp;goto=sql.php',
'ShowFunctionFields=0&amp;ShowFieldTypesInDataEditView=1&amp;goto=index.php%3Froute%3D%2Fsql',
$result
);
$this->assertStringContainsString(
@ -397,7 +397,7 @@ class InsertEditTest extends TestCase
$result
);
$this->assertStringContainsString(
'ShowFunctionFields=1&amp;ShowFieldTypesInDataEditView=1&amp;goto=sql.php',
'ShowFunctionFields=1&amp;ShowFieldTypesInDataEditView=1&amp;goto=index.php%3Froute%3D%2Fsql',
$result
);
$this->assertStringContainsString(
@ -413,7 +413,7 @@ class InsertEditTest extends TestCase
$result
);
$this->assertStringContainsString(
'ShowFunctionFields=1&amp;ShowFieldTypesInDataEditView=0&amp;goto=sql.php',
'ShowFunctionFields=1&amp;ShowFieldTypesInDataEditView=0&amp;goto=index.php%3Froute%3D%2Fsql',
$result
);
$this->assertStringContainsString(
@ -2954,7 +2954,7 @@ class InsertEditTest extends TestCase
$result = $this->insertEdit->getLinkForRelationalDisplayField($map, 'f', "=1", "a>", "b<");
$this->assertEquals(
'<a href="sql.php?db=information_schema&amp;table=TABLES&amp;pos=0&amp;'
'<a href="index.php?route=/sql&amp;db=information_schema&amp;table=TABLES&amp;pos=0&amp;'
. 'sql_query=SELECT+%2A+FROM+%60information_schema%60.%60TABLES%60+WHERE'
. '+%60f%60%3D1&amp;lang=en" title="a&gt;">b&lt;</a>',
$result
@ -2964,7 +2964,7 @@ class InsertEditTest extends TestCase
$result = $this->insertEdit->getLinkForRelationalDisplayField($map, 'f', "=1", "a>", "b<");
$this->assertEquals(
'<a href="sql.php?db=information_schema&amp;table=TABLES&amp;pos=0&amp;'
'<a href="index.php?route=/sql&amp;db=information_schema&amp;table=TABLES&amp;pos=0&amp;'
. 'sql_query=SELECT+%2A+FROM+%60information_schema%60.%60TABLES%60+WHERE'
. '+%60f%60%3D1&amp;lang=en" title="b&lt;">a&gt;</a>',
$result

View File

@ -52,7 +52,7 @@ class NodeTableTest extends PmaTestCase
$parent->links
);
$this->assertStringContainsString(
'sql.php',
'index.php?route=/sql',
$parent->links['text']
);
$this->assertStringContainsString('table', $parent->classes);

View File

@ -43,7 +43,7 @@ class NodeViewTest extends PmaTestCase
$parent->links
);
$this->assertStringContainsString(
'sql.php',
'index.php?route=/sql',
$parent->links['text']
);
$this->assertStringContainsString('b_props', $parent->icon);

View File

@ -190,9 +190,16 @@ class OperationsTest extends TestCase
[],
'doclink',
]);
$this->assertRegExp(
'/.*href="sql.php.*post.*/',
$this->assertStringContainsString(
'href="index.php?route=/sql&amp;name=foo&amp;value=bar',
$result
);
$this->assertStringContainsString(
'post',
$result
);
$this->assertStringContainsString(
'Documentation',
$result
);
}
@ -262,22 +269,26 @@ class OperationsTest extends TestCase
*/
public function testGetHtmlForReferentialIntegrityCheck()
{
$this->assertRegExp(
'/.*Check referential integrity.*href="sql.php(.|[\n])*/m',
$this->operations->getHtmlForReferentialIntegrityCheck(
$actual = $this->operations->getHtmlForReferentialIntegrityCheck(
[
[
[
'foreign_db' => 'db1',
'foreign_table' => "foreign1",
'foreign_field' => "foreign2",
],
'foreign_db' => 'db1',
'foreign_table' => "foreign1",
'foreign_field' => "foreign2",
],
[
"param1" => 'a',
"param2" => 'b',
]
)
],
[
"param1" => 'a',
"param2" => 'b',
]
);
$this->assertStringContainsString(
'Check referential integrity',
$actual
);
$this->assertStringContainsString(
'href="index.php?route=/sql',
$actual
);
}
}

View File

@ -212,7 +212,7 @@ class SqlQueryFormTest extends TestCase
);
//validate 5: $goto
$goto = empty($GLOBALS['goto']) ? 'tbl_sql.php' : $GLOBALS['goto'];
$goto = empty($GLOBALS['goto']) ? Url::getFromRoute('/table/sql') : $GLOBALS['goto'];
$this->assertStringContainsString(
htmlspecialchars($goto),
$html