Add route parameter to index.php links

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-08-26 17:37:53 -03:00
parent d01e1c26b9
commit dd95a34b3a
19 changed files with 31 additions and 32 deletions

View File

@ -613,7 +613,7 @@ Functions.displayGitRevision = function () {
$('#is_git_revision').remove();
$('#li_pma_version_git').remove();
$.get(
'index.php',
'index.php?route=/',
{
'server': CommonParams.get('server'),
'git_revision': true,
@ -972,7 +972,7 @@ AJAX.registerOnload('functions.js', function () {
idleSecondsCounter++;
}
function UpdateIdleTime () {
var href = 'index.php';
var href = 'index.php?route=/';
var guid = 'default';
if (isStorageSupported('sessionStorage')) {
guid = window.sessionStorage.guid;
@ -2404,8 +2404,8 @@ Functions.checkReservedWordColumns = function ($form) {
var isConfirmed = true;
$.ajax({
type: 'POST',
url: 'index.php',
data: $form.serialize() + CommonParams.get('arg_separator') + 'reserved_word_check=1' + CommonParams.get('arg_separator') + 'route=/table/structure',
url: 'index.php?route=/table/structure',
data: $form.serialize() + CommonParams.get('arg_separator') + 'reserved_word_check=1',
success: function (data) {
if (typeof data.success !== 'undefined' && data.success === true) {
isConfirmed = confirm(data.message);

View File

@ -3335,7 +3335,7 @@ class Results
'db' => $this->__get('db'),
'table' => $this->__get('table'),
'sql_query' => $url_sql_query,
'goto' => 'index.php',
'goto' => Url::getFromRoute('/'),
];
$lnk_goto = Url::getFromRoute('/sql', $_url_params);

View File

@ -156,7 +156,7 @@ class Operations
$this_url_params = [
'sql_query' => $this_sql_query,
'back' => Url::getFromRoute('/database/operations'),
'goto' => 'index.php',
'goto' => Url::getFromRoute('/'),
'reload' => '1',
'purge' => '1',
'message_to_show' => sprintf(

View File

@ -500,7 +500,7 @@ class AuthenticationCookie extends AuthenticationPlugin
->disable();
Core::sendHeaderLocation(
'./index.php' . Url::getCommonRaw($url_params),
'./index.php?route=/' . Url::getCommonRaw($url_params, '&'),
true
);
if (! defined('TESTSUITE')) {

View File

@ -208,6 +208,6 @@ class AuthenticationHttp extends AuthenticationPlugin
*/
public function getLoginFormURL()
{
return './index.php?old_usr=' . $this->user;
return './index.php?route=/&old_usr=' . $this->user;
}
}

View File

@ -159,7 +159,7 @@ abstract class AuthenticationPlugin
/* Redirect to other autenticated server */
$_SESSION['partial_logout'] = true;
Core::sendHeaderLocation(
'./index.php' . Url::getCommonRaw(['server' => $server])
'./index.php?route=/' . Url::getCommonRaw(['server' => $server], '&')
);
}
}
@ -171,7 +171,7 @@ abstract class AuthenticationPlugin
*/
public function getLoginFormURL()
{
return './index.php';
return './index.php?route=/';
}
/**

View File

@ -365,13 +365,12 @@ class RecentFavoriteTable
*/
public static function getHtmlUpdateRecentTables()
{
$params = [
$retval = '<a class="hide" id="update_recent_tables" href="';
$retval .= Url::getFromRoute('/', [
'ajax_request' => true,
'recent_table' => true,
];
$url = 'index.php' . Url::getCommon($params);
$retval = '<a class="hide" id="update_recent_tables"';
$retval .= ' href="' . $url . '"></a>';
]);
$retval .= '"></a>';
return $retval;
}

View File

@ -336,7 +336,7 @@ class ThemeManager
if ($form) {
$select_box .= '<form name="setTheme" method="post"';
$select_box .= ' action="index.php" class="disableAjax">';
$select_box .= ' action="index.php?route=/" class="disableAjax">';
$select_box .= Url::getHiddenInputs();
}

View File

@ -278,7 +278,7 @@ class UserPassword
$sql_query,
'success'
);
echo '<a href="index.php' , Url::getCommon()
echo '<a href="' , Url::getFromRoute('/')
, ' target="_parent">' , "\n"
, '<strong>' , __('Back') , '</strong></a>';
exit;

View File

@ -37,7 +37,7 @@ $operations = new Operations($dbi, $relation);
/**
* Defines the urls to return to in case of error in a sql statement
*/
$err_url_0 = 'index.php' . Url::getCommon();
$err_url_0 = Url::getFromRoute('/');
$err_url = Util::getScriptNameForOption(
$cfg['DefaultTabDatabase'],
@ -67,7 +67,7 @@ if (! isset($is_db) || ! $is_db) {
if (isset($message)) {
$params['message'] = $message;
}
$uri = './index.php' . Url::getCommonRaw($params);
$uri = './index.php?route=/' . Url::getCommonRaw($params, '&');
if (strlen($db) === 0 || ! $is_db) {
$response = Response::getInstance();
if ($response->isAjax()) {

View File

@ -48,8 +48,8 @@ if (empty($is_db)) {
$url_params['show_as_php'] = $show_as_php;
}
Core::sendHeaderLocation(
'./index.php'
. Url::getCommonRaw($url_params)
'./index.php?route=/'
. Url::getCommonRaw($url_params, '&')
);
}
exit;

View File

@ -36,13 +36,13 @@ if (isset($_POST['set_theme'])) {
'set_theme' => $_POST['set_theme'],
]);
header('Location: index.php' . Url::getCommonRaw());
header('Location: index.php?route=/' . Url::getCommonRaw([], '&'));
} elseif (isset($_POST['collation_connection'])) {
$controller->setCollationConnection([
'collation_connection' => $_POST['collation_connection'],
]);
header('Location: index.php' . Url::getCommonRaw());
header('Location: index.php?route=/' . Url::getCommonRaw([], '&'));
} elseif ($response->isAjax() && ! empty($_REQUEST['recent_table'])) {
$response->addJSON($controller->reloadRecentTablesList());
} elseif ($GLOBALS['PMA_Config']->isGitRevision()

View File

@ -17,7 +17,7 @@ if (! defined('PHPMYADMIN')) {
global $auth_plugin, $token_mismatch;
if ($_SERVER['REQUEST_METHOD'] != 'POST' || $token_mismatch) {
Core::sendHeaderLocation('./index.php');
Core::sendHeaderLocation('./index.php?route=/');
} else {
/** @var AuthenticationPlugin $auth_plugin */
$auth_plugin->logOut();

View File

@ -39,7 +39,7 @@
{{ change_password is not empty ? change_password|raw }}
<li id="li_select_mysql_collation" class="no_bullets">
<form class="disableAjax" method="post" action="index.php">
<form class="disableAjax" method="post" action="{{ url('/') }}">
{{ get_hidden_inputs(null, null, 4, 'collation_connection') }}
<label for="select_collation_connection">
{{ get_image('s_asci') }}

View File

@ -4,7 +4,7 @@
{{ list_navigator|raw }}
<div id="pma_navigation_db_select">
<form action="index.php">
<form action="{{ url('/') }}">
{{ get_hidden_fields({'server': server}) }}
<select name="db" class="hide" id="navi_db_select">

View File

@ -1,4 +1,4 @@
<form method="get" action="index.php" class="disableAjax">
<form method="get" action="{{ url('/') }}" class="disableAjax">
{{ get_hidden_inputs(_form_params) }}
{% if use_fieldset %}

View File

@ -3,7 +3,7 @@
{{ name }} ({{ version }})
</h2>
<p>
<a class="take_theme" name="{{ id }}" href="index.php{{ get_common(url_params) }}">
<a class="take_theme" name="{{ id }}" href="{{ url('/', url_params) }}">
{% if screen is not empty %}
<img src="{{ screen }}" alt="{{ name }}" title="{{ name }}">
<br>

View File

@ -377,7 +377,7 @@ class AuthenticationCookieTest extends PmaTestCase
$_COOKIE['pmaAuth-2'] = '';
$this->mockResponse('Location: /phpmyadmin/index.php?server=2&lang=en');
$this->mockResponse('Location: /phpmyadmin/index.php?route=/&server=2&lang=en');
$this->object->logOut();
}
@ -411,7 +411,7 @@ class AuthenticationCookieTest extends PmaTestCase
*/
public function testLogoutDelete()
{
$this->mockResponse('Location: /phpmyadmin/index.php');
$this->mockResponse('Location: /phpmyadmin/index.php?route=/');
$GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';
$GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';
@ -436,7 +436,7 @@ class AuthenticationCookieTest extends PmaTestCase
*/
public function testLogout()
{
$this->mockResponse('Location: /phpmyadmin/index.php');
$this->mockResponse('Location: /phpmyadmin/index.php?route=/');
$GLOBALS['cfg']['CaptchaLoginPrivateKey'] = '';
$GLOBALS['cfg']['CaptchaLoginPublicKey'] = '';

View File

@ -251,7 +251,7 @@ class ThemeTest extends PmaTestCase
$this->object->getPrintPreview()
);
$this->assertStringContainsString(
'name="" href="index.php?set_theme=&amp;server=99&amp;lang=en">',
'name="" href="index.php?route=/&amp;set_theme=&amp;server=99&amp;lang=en">',
$this->object->getPrintPreview()
);
$this->assertStringContainsString(