Skip to content

Commit

Permalink
Remove PmaAbsoluteUri from redirects
Browse files Browse the repository at this point in the history
This is no longer needed as per RFC 7231.

Issue #11412

Signed-off-by: Michal Čihař <michal@cihar.com>
  • Loading branch information
nijel committed Feb 3, 2016
1 parent 513e450 commit 2a9fb73
Show file tree
Hide file tree
Showing 12 changed files with 15 additions and 18 deletions.
4 changes: 2 additions & 2 deletions db_operations.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,8 @@
)
);
$message->addParam(
'<a href="' . $cfg['PmaAbsoluteUri']
. 'chk_rel.php' . $url_query . '">',
'<a href="'
. './chk_rel.php' . $url_query . '">',
false
);
$message->addParam('</a>', false);
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -573,7 +573,7 @@
}
$msg = PMA\libraries\Message::notice($msg_text);
$msg->addParam(
'<a href="' . $cfg['PmaAbsoluteUri'] . 'chk_rel.php'
'<a href="./chk_rel.php'
. $common_url_query . '">',
false
);
Expand Down
2 changes: 1 addition & 1 deletion libraries/db_common.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
$is_db = false;
}
// Not a valid db name -> back to the welcome page
$uri = $cfg['PmaAbsoluteUri'] . 'index.php'
$uri = './index.php'
. PMA_URL_getCommon(array(), 'text')
. (isset($message) ? '&message=' . urlencode($message) : '') . '&reload=1';
if (!mb_strlen($db) || ! $is_db) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/db_table_exists.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
$url_params['show_as_php'] = $show_as_php;
}
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . 'index.php'
'./index.php'
. PMA_URL_getCommon($url_params, 'text')
);
}
Expand Down
2 changes: 1 addition & 1 deletion libraries/plugins/auth/AuthenticationCookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -559,7 +559,7 @@ public function storeUserCredentials()
}

// URL where to go:
$redirect_url = $cfg['PmaAbsoluteUri'] . 'index.php';
$redirect_url = './index.php';

// any parameters to pass?
$url_params = array();
Expand Down
3 changes: 1 addition & 2 deletions libraries/relation.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -1997,8 +1997,7 @@ function PMA_getHtmlFixPMATables($allTables, $createDb = false)
);
}
$message->addParam(
'<a href="' . $GLOBALS['cfg']['PmaAbsoluteUri']
. 'chk_rel.php' . $url_query . '">',
'<a href="./chk_rel.php' . $url_query . '">',
false
);
$message->addParam('</a>', false);
Expand Down
2 changes: 1 addition & 1 deletion libraries/replication_gui.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ function PMA_handleControlRequest()
);
} else {
PMA_sendHeaderLocation(
$GLOBALS['cfg']['PmaAbsoluteUri'] . 'server_replication.php'
'./server_replication.php'
. PMA_URL_getCommon($GLOBALS['url_params'], 'text')
);
}
Expand Down
7 changes: 3 additions & 4 deletions libraries/sql.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -763,12 +763,11 @@ function PMA_setColumnOrderOrVisibility($table, $db)
/**
* Function to add a bookmark
*
* @param String $pmaAbsoluteUri absolute URI
* @param String $goto goto page URL
* @param String $goto goto page URL
*
* @return void
*/
function PMA_addBookmark($pmaAbsoluteUri, $goto)
function PMA_addBookmark($goto)
{
$result = PMA_Bookmark_save(
$_POST['bkm_fields'],
Expand All @@ -794,7 +793,7 @@ function PMA_addBookmark($pmaAbsoluteUri, $goto)
* @todo In which scenario does this happen?
*/
PMA_sendHeaderLocation(
$pmaAbsoluteUri . $goto
'./' . $goto
. '&label=' . $_POST['bkm_fields']['bkm_label']
);
}
Expand Down
3 changes: 1 addition & 2 deletions libraries/user_preferences.lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -255,8 +255,7 @@ function PMA_userprefsRedirect($file_name,
if ($hash) {
$hash = '#' . urlencode($hash);
}
PMA_sendHeaderLocation(
$GLOBALS['cfg']['PmaAbsoluteUri'] . $file_name
PMA_sendHeaderLocation('./' . $file_name
. PMA_URL_getCommon($url_params, '&') . $hash
);
}
Expand Down
2 changes: 1 addition & 1 deletion prefs_forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
// redirect
$url_params = array('form' => $form_param);
PMA_sendHeaderLocation(
$cfg['PmaAbsoluteUri'] . 'prefs_forms.php'
'./prefs_forms.php'
. PMA_URL_getCommon($url_params, 'text')
);
exit;
Expand Down
2 changes: 1 addition & 1 deletion sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
* Bookmark add
*/
if (isset($_POST['store_bkm'])) {
PMA_addBookmark($cfg['PmaAbsoluteUri'], $goto);
PMA_addBookmark($goto);
// script has exited at this point
} // end if

Expand Down
2 changes: 1 addition & 1 deletion url.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
|| ! preg_match('/^https?:\/\/[^\n\r]*$/', $_REQUEST['url'])
|| ! PMA_isAllowedDomain($_REQUEST['url'])
) {
header('Location: ' . $cfg['PmaAbsoluteUri']);
header('Location: ./');
} else {
// JavaScript redirection is necessary. Because if header() is used
// then web browser sometimes does not change the HTTP_REFERER
Expand Down

0 comments on commit 2a9fb73

Please sign in to comment.