Retrieve parameters from $_POST in navigation
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
7237caf545
commit
5e88a8873c
@ -519,12 +519,13 @@ $(function () {
|
||||
/** Hide navigation tree item */
|
||||
$(document).on('click', 'a.hideNavItem.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var argSep = PMA_commonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true' + argSep + 'server=' + PMA_commonParams.get('server');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
data: {
|
||||
server: PMA_commonParams.get('server'),
|
||||
},
|
||||
url: $(this).attr('href') + PMA_commonParams.get('arg_separator') + 'ajax_request=true',
|
||||
data: params,
|
||||
url: $(this).attr('href'),
|
||||
success: function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_reloadNavigation();
|
||||
@ -539,7 +540,10 @@ $(function () {
|
||||
$(document).on('click', 'a.showUnhide.ajax', function (event) {
|
||||
event.preventDefault();
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
$.get($(this).attr('href') + PMA_commonParams.get('arg_separator') + 'ajax_request=1', function (data) {
|
||||
var argSep = PMA_commonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true';
|
||||
$.post($(this).attr('href'), params, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
var buttonOptions = {};
|
||||
@ -570,12 +574,13 @@ $(function () {
|
||||
event.preventDefault();
|
||||
var $tr = $(this).parents('tr');
|
||||
var $msg = PMA_ajaxShowMessage();
|
||||
var argSep = PMA_commonParams.get('arg_separator');
|
||||
var params = $(this).getPostData();
|
||||
params += argSep + 'ajax_request=true' + argSep + 'server=' + PMA_commonParams.get('server');
|
||||
$.ajax({
|
||||
type: 'POST',
|
||||
data: {
|
||||
server: PMA_commonParams.get('server'),
|
||||
},
|
||||
url: $(this).attr('href') + PMA_commonParams.get('arg_separator') + 'ajax_request=true',
|
||||
data: params,
|
||||
url: $(this).attr('href'),
|
||||
success: function (data) {
|
||||
PMA_ajaxRemoveMessage($msg);
|
||||
if (typeof data !== 'undefined' && data.success === true) {
|
||||
|
||||
@ -51,8 +51,8 @@ class Navigation
|
||||
}
|
||||
$tree = new NavigationTree();
|
||||
if (! $response->isAjax()
|
||||
|| ! empty($_REQUEST['full'])
|
||||
|| ! empty($_REQUEST['reload'])
|
||||
|| ! empty($_POST['full'])
|
||||
|| ! empty($_POST['reload'])
|
||||
) {
|
||||
if ($GLOBALS['cfg']['ShowDatabasesNavigationAsTree']) {
|
||||
// provide database tree in navigation
|
||||
@ -230,8 +230,8 @@ class Navigation
|
||||
|
||||
$html .= '<tr>';
|
||||
$html .= '<td>' . htmlspecialchars($hiddenItem) . '</td>';
|
||||
$html .= '<td style="width:80px"><a href="navigation.php'
|
||||
. Url::getCommon($params) . '"'
|
||||
$html .= '<td style="width:80px"><a href="navigation.php" data-post="'
|
||||
. Url::getCommon($params, '') . '"'
|
||||
. ' class="unhideNavItem ajax">'
|
||||
. Util::getIcon('show', __('Show'))
|
||||
. '</a></td>';
|
||||
|
||||
@ -93,8 +93,10 @@ class NavigationTree
|
||||
public function __construct()
|
||||
{
|
||||
// Save the position at which we are in the database list
|
||||
if (isset($_REQUEST['pos'])) {
|
||||
$this->_pos = (int)$_REQUEST['pos'];
|
||||
if (isset($_POST['pos'])) {
|
||||
$this->_pos = (int) $_POST['pos'];
|
||||
} elseif (isset($_GET['pos'])) {
|
||||
$this->_pos = (int) $_GET['pos'];
|
||||
}
|
||||
if (!isset($this->_pos)) {
|
||||
$this->_pos = $this->_getNavigationDbPos();
|
||||
@ -109,19 +111,19 @@ class NavigationTree
|
||||
$this->_pos3_value[0] = $_REQUEST['pos3_value'];
|
||||
}
|
||||
} else {
|
||||
if (isset($_REQUEST['n0_aPath'])) {
|
||||
if (isset($_POST['n0_aPath'])) {
|
||||
$count = 0;
|
||||
while (isset($_REQUEST['n' . $count . '_aPath'])) {
|
||||
while (isset($_POST['n' . $count . '_aPath'])) {
|
||||
$this->_aPath[$count] = $this->_parsePath(
|
||||
$_REQUEST['n' . $count . '_aPath']
|
||||
$_POST['n' . $count . '_aPath']
|
||||
);
|
||||
$index = 'n' . $count . '_pos2_';
|
||||
$this->_pos2_name[$count] = $_REQUEST[$index . 'name'];
|
||||
$this->_pos2_value[$count] = $_REQUEST[$index . 'value'];
|
||||
$this->_pos2_name[$count] = $_POST[$index . 'name'];
|
||||
$this->_pos2_value[$count] = $_POST[$index . 'value'];
|
||||
$index = 'n' . $count . '_pos3_';
|
||||
if (isset($_REQUEST[$index])) {
|
||||
$this->_pos3_name[$count] = $_REQUEST[$index . 'name'];
|
||||
$this->_pos3_value[$count] = $_REQUEST[$index . 'value'];
|
||||
if (isset($_POST[$index])) {
|
||||
$this->_pos3_name[$count] = $_POST[$index . 'name'];
|
||||
$this->_pos3_value[$count] = $_POST[$index . 'value'];
|
||||
}
|
||||
$count++;
|
||||
}
|
||||
@ -130,11 +132,11 @@ class NavigationTree
|
||||
if (isset($_REQUEST['vPath'])) {
|
||||
$this->_vPath[0] = $this->_parsePath($_REQUEST['vPath']);
|
||||
} else {
|
||||
if (isset($_REQUEST['n0_vPath'])) {
|
||||
if (isset($_POST['n0_vPath'])) {
|
||||
$count = 0;
|
||||
while (isset($_REQUEST['n' . $count . '_vPath'])) {
|
||||
while (isset($_POST['n' . $count . '_vPath'])) {
|
||||
$this->_vPath[$count] = $this->_parsePath(
|
||||
$_REQUEST['n' . $count . '_vPath']
|
||||
$_POST['n' . $count . '_vPath']
|
||||
);
|
||||
$count++;
|
||||
}
|
||||
|
||||
@ -677,8 +677,8 @@ class NodeDatabase extends Node
|
||||
'dbName' => $this->real_name,
|
||||
);
|
||||
$ret = '<span class="dbItemControls">'
|
||||
. '<a href="navigation.php'
|
||||
. Url::getCommon($params) . '"'
|
||||
. '<a href="navigation.php" data-post="'
|
||||
. Url::getCommon($params, '') . '"'
|
||||
. ' class="showUnhide ajax">'
|
||||
. Util::getImage(
|
||||
'show',
|
||||
|
||||
@ -48,8 +48,8 @@ abstract class NodeDatabaseChild extends Node
|
||||
);
|
||||
|
||||
$ret = '<span class="navItemControls">'
|
||||
. '<a href="navigation.php'
|
||||
. Url::getCommon($params) . '"'
|
||||
. '<a href="navigation.php" data-post="'
|
||||
. Url::getCommon($params, '') . '"'
|
||||
. ' class="hideNavItem ajax">'
|
||||
. Util::getImage('hide', __('Hide'))
|
||||
. '</a></span>';
|
||||
|
||||
@ -26,7 +26,7 @@ if (! $response->isAjax()) {
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['getNaviSettings']) && $_REQUEST['getNaviSettings']) {
|
||||
if (isset($_POST['getNaviSettings']) && $_POST['getNaviSettings']) {
|
||||
$response->addJSON('message', PageSettings::getNaviSettings());
|
||||
exit();
|
||||
}
|
||||
@ -34,41 +34,41 @@ if (isset($_REQUEST['getNaviSettings']) && $_REQUEST['getNaviSettings']) {
|
||||
$relation = new Relation();
|
||||
$cfgRelation = $relation->getRelationsParam();
|
||||
if ($cfgRelation['navwork']) {
|
||||
if (isset($_REQUEST['hideNavItem'])) {
|
||||
if (! empty($_REQUEST['itemName'])
|
||||
&& ! empty($_REQUEST['itemType'])
|
||||
&& ! empty($_REQUEST['dbName'])
|
||||
if (isset($_POST['hideNavItem'])) {
|
||||
if (! empty($_POST['itemName'])
|
||||
&& ! empty($_POST['itemType'])
|
||||
&& ! empty($_POST['dbName'])
|
||||
) {
|
||||
$navigation->hideNavigationItem(
|
||||
$_REQUEST['itemName'],
|
||||
$_REQUEST['itemType'],
|
||||
$_REQUEST['dbName'],
|
||||
(! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
|
||||
$_POST['itemName'],
|
||||
$_POST['itemType'],
|
||||
$_POST['dbName'],
|
||||
(! empty($_POST['tableName']) ? $_POST['tableName'] : null)
|
||||
);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['unhideNavItem'])) {
|
||||
if (! empty($_REQUEST['itemName'])
|
||||
&& ! empty($_REQUEST['itemType'])
|
||||
&& ! empty($_REQUEST['dbName'])
|
||||
if (isset($_POST['unhideNavItem'])) {
|
||||
if (! empty($_POST['itemName'])
|
||||
&& ! empty($_POST['itemType'])
|
||||
&& ! empty($_POST['dbName'])
|
||||
) {
|
||||
$navigation->unhideNavigationItem(
|
||||
$_REQUEST['itemName'],
|
||||
$_REQUEST['itemType'],
|
||||
$_REQUEST['dbName'],
|
||||
(! empty($_REQUEST['tableName']) ? $_REQUEST['tableName'] : null)
|
||||
$_POST['itemName'],
|
||||
$_POST['itemType'],
|
||||
$_POST['dbName'],
|
||||
(! empty($_POST['tableName']) ? $_POST['tableName'] : null)
|
||||
);
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['showUnhideDialog'])) {
|
||||
if (! empty($_REQUEST['dbName'])) {
|
||||
if (isset($_POST['showUnhideDialog'])) {
|
||||
if (! empty($_POST['dbName'])) {
|
||||
$response->addJSON(
|
||||
'message',
|
||||
$navigation->getItemUnhideDialog($_REQUEST['dbName'])
|
||||
$navigation->getItemUnhideDialog($_POST['dbName'])
|
||||
);
|
||||
}
|
||||
exit;
|
||||
|
||||
@ -151,7 +151,7 @@ class NavigationTest extends PmaTestCase
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<a href="navigation.php?'
|
||||
'<a href="navigation.php" data-post="'
|
||||
. 'unhideNavItem=1&itemType=table&'
|
||||
. 'itemName=tableName&dbName=db&lang=en"'
|
||||
. ' class="unhideNavItem ajax">',
|
||||
|
||||
@ -78,7 +78,7 @@ class NodeDatabaseChildTest extends PmaTestCase
|
||||
$html
|
||||
);
|
||||
$this->assertContains(
|
||||
'<a href="navigation.php?'
|
||||
'<a href="navigation.php" data-post="'
|
||||
. 'hideNavItem=1&itemType=itemType&itemName=child'
|
||||
. '&dbName=parent&lang=en" class="hideNavItem ajax">',
|
||||
$html
|
||||
|
||||
Loading…
Reference in New Issue
Block a user