Skip to content
Permalink
Browse files

Retrieve parameters from $_POST in table relation

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
  • Loading branch information...
mauriciofauth committed Nov 3, 2018
1 parent d01ece6 commit d1d90b59b28ab8be332e442df55864cb858e40dd
@@ -72,7 +72,7 @@ function getDropdownValues ($dropdown) {
var $msgbox = PMA_ajaxShowMessage();
var $form = $dropdown.parents('form');
var argsep = PMA_commonParams.get('arg_separator');
var url = 'tbl_relation.php?getDropdownValues=true' + argsep + 'ajax_request=true' +
var params = 'getDropdownValues=true' + argsep + 'ajax_request=true' +
argsep + 'db=' + $form.find('input[name="db"]').val() +
argsep + 'table=' + $form.find('input[name="table"]').val() +
argsep + 'foreign=' + (foreign !== '') +
@@ -82,11 +82,13 @@ function getDropdownValues ($dropdown) {
);
var $server = $form.find('input[name="server"]');
if ($server.length > 0) {
url += argsep + 'server=' + $form.find('input[name="server"]').val();
params += argsep + 'server=' + $form.find('input[name="server"]').val();
}
$.ajax({
url: url,
datatype: 'json',
type: 'POST',
url: 'tbl_relation.php',
data: params,
dataType: 'json',
success: function (data) {
PMA_ajaxRemoveMessage($msgbox);
if (typeof data !== 'undefined' && data.success) {
@@ -100,11 +100,11 @@ public function indexAction()
{
// Send table of column names to populate corresponding dropdowns depending
// on the current selection
if (isset($_REQUEST['getDropdownValues'])
&& $_REQUEST['getDropdownValues'] === 'true'
if (isset($_POST['getDropdownValues'])
&& $_POST['getDropdownValues'] === 'true'
) {
// if both db and table are selected
if (isset($_REQUEST['foreignTable'])) {
if (isset($_POST['foreignTable'])) {
$this->getDropdownValueForTableAction();
} else { // if only the db is selected
$this->getDropdownValueForDbAction();
@@ -241,8 +241,8 @@ public function updateForDisplayField()
*/
public function updateForForeignKeysAction()
{
$multi_edit_columns_name = isset($_REQUEST['foreign_key_fields_name'])
? $_REQUEST['foreign_key_fields_name']
$multi_edit_columns_name = isset($_POST['foreign_key_fields_name'])
? $_POST['foreign_key_fields_name']
: null;
// (for now, one index name only; we keep the definitions if the
@@ -260,7 +260,7 @@ public function updateForForeignKeysAction()
$this->response->addHTML($html);
// If there is a request for SQL previewing.
if (isset($_REQUEST['preview_sql'])) {
if (isset($_POST['preview_sql'])) {
Core::previewSQL($preview_sql_data);
}
@@ -282,8 +282,8 @@ public function updateForForeignKeysAction()
*/
public function updateForInternalRelationAction()
{
$multi_edit_columns_name = isset($_REQUEST['fields_name'])
? $_REQUEST['fields_name']
$multi_edit_columns_name = isset($_POST['fields_name'])
? $_POST['fields_name']
: null;
if ($this->upd_query->updateInternalRelations(
@@ -312,8 +312,8 @@ public function updateForInternalRelationAction()
*/
public function getDropdownValueForTableAction()
{
$foreignTable = $_REQUEST['foreignTable'];
$table_obj = $this->dbi->getTable($_REQUEST['foreignDb'], $foreignTable);
$foreignTable = $_POST['foreignTable'];
$table_obj = $this->dbi->getTable($_POST['foreignDb'], $foreignTable);
// Since views do not have keys defined on them provide the full list of
// columns
if ($table_obj->isView()) {
@@ -331,7 +331,7 @@ public function getDropdownValueForTableAction()
$this->response->addJSON('columns', $columns);
// @todo should be: $server->db($db)->table($table)->primary()
$primary = Index::getPrimary($foreignTable, $_REQUEST['foreignDb']);
$primary = Index::getPrimary($foreignTable, $_POST['foreignDb']);
if (false === $primary) {
return;
}
@@ -348,11 +348,11 @@ public function getDropdownValueForTableAction()
public function getDropdownValueForDbAction()
{
$tables = array();
$foreign = isset($_REQUEST['foreign']) && $_REQUEST['foreign'] === 'true';
$foreign = isset($_POST['foreign']) && $_POST['foreign'] === 'true';
if ($foreign) {
$query = 'SHOW TABLE STATUS FROM '
. Util::backquote($_REQUEST['foreignDb']);
. Util::backquote($_POST['foreignDb']);
$tables_rs = $this->dbi->query(
$query,
DatabaseInterface::CONNECT_USER,
@@ -368,7 +368,7 @@ public function getDropdownValueForDbAction()
}
} else {
$query = 'SHOW TABLES FROM '
. Util::backquote($_REQUEST['foreignDb']);
. Util::backquote($_POST['foreignDb']);
$tables_rs = $this->dbi->query(
$query,
DatabaseInterface::CONNECT_USER,
@@ -36,8 +36,8 @@ protected function setUp()
$GLOBALS['PMA_PHP_SELF'] = 'index.php';
//$_SESSION
$_REQUEST['foreignDb'] = 'db';
$_REQUEST['foreignTable'] = 'table';
$_POST['foreignDb'] = 'db';
$_POST['foreignTable'] = 'table';
$GLOBALS['dblist'] = new DataBasePMAMockForTblRelation();
$GLOBALS['dblist']->databases = new DataBaseMockForTblRelation();
@@ -202,7 +202,7 @@ function () {
array('tbl_storage_engine' => 'INNODB')
);
$_REQUEST['foreign'] = 'true';
$_POST['foreign'] = 'true';
$ctrl->getDropdownValueForDbAction();
$json = $this->_response->getJSONResult();
$this->assertEquals(
@@ -248,7 +248,7 @@ function () {
array('tbl_storage_engine' => 'INNODB',)
);
$_REQUEST['foreign'] = 'false';
$_POST['foreign'] = 'false';
$ctrl->getDropdownValueForDbAction();
$json = $this->_response->getJSONResult();
$this->assertEquals(

0 comments on commit d1d90b5

Please sign in to comment.
You can’t perform that action at this time.