Retrieve parameters from $_POST in tbl_indexes.php
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
e523a1eb09
commit
9884a650da
@ -3797,7 +3797,7 @@ function indexEditorDialog (url, title, callback_success, callback_failure) {
|
||||
$(this).dialog('close');
|
||||
};
|
||||
var $msgbox = PMA_ajaxShowMessage();
|
||||
$.get('tbl_indexes.php', url, function (data) {
|
||||
$.post('tbl_indexes.php', url, function (data) {
|
||||
if (typeof data !== 'undefined' && data.success === false) {
|
||||
// in the case of an error, show the error message returned.
|
||||
PMA_ajaxShowMessage(data.error, false);
|
||||
|
||||
@ -660,10 +660,7 @@ AJAX.registerOnload('indexes.js', function () {
|
||||
title = PMA_messages.strAddIndex;
|
||||
} else {
|
||||
// Edit index
|
||||
url = $(this).find('a').attr('href');
|
||||
if (url.substring(0, 16) === 'tbl_indexes.php?') {
|
||||
url = url.substring(16, url.length);
|
||||
}
|
||||
url = $(this).find('a').getPostData();
|
||||
title = PMA_messages.strEditIndex;
|
||||
}
|
||||
url += PMA_commonParams.get('arg_separator') + 'ajax_request=true';
|
||||
|
||||
@ -50,7 +50,7 @@ class TableIndexesController extends TableController
|
||||
*/
|
||||
public function indexAction()
|
||||
{
|
||||
if (isset($_REQUEST['do_save_data'])) {
|
||||
if (isset($_POST['do_save_data'])) {
|
||||
$this->doSaveDataAction();
|
||||
return;
|
||||
} // end builds the new index
|
||||
@ -67,24 +67,24 @@ class TableIndexesController extends TableController
|
||||
{
|
||||
$GLOBALS['dbi']->selectDb($GLOBALS['db']);
|
||||
$add_fields = 0;
|
||||
if (isset($_REQUEST['index']) && is_array($_REQUEST['index'])) {
|
||||
if (isset($_POST['index']) && is_array($_POST['index'])) {
|
||||
// coming already from form
|
||||
if (isset($_REQUEST['index']['columns']['names'])) {
|
||||
$add_fields = count($_REQUEST['index']['columns']['names'])
|
||||
if (isset($_POST['index']['columns']['names'])) {
|
||||
$add_fields = count($_POST['index']['columns']['names'])
|
||||
- $this->index->getColumnCount();
|
||||
}
|
||||
if (isset($_REQUEST['add_fields'])) {
|
||||
$add_fields += $_REQUEST['added_fields'];
|
||||
if (isset($_POST['add_fields'])) {
|
||||
$add_fields += $_POST['added_fields'];
|
||||
}
|
||||
} elseif (isset($_REQUEST['create_index'])) {
|
||||
$add_fields = $_REQUEST['added_fields'];
|
||||
} elseif (isset($_POST['create_index'])) {
|
||||
$add_fields = $_POST['added_fields'];
|
||||
} // end preparing form values
|
||||
|
||||
// Get fields and stores their name/type
|
||||
if (isset($_REQUEST['create_edit_table'])) {
|
||||
$fields = json_decode($_REQUEST['columns'], true);
|
||||
if (isset($_POST['create_edit_table'])) {
|
||||
$fields = json_decode($_POST['columns'], true);
|
||||
$index_params = array(
|
||||
'Non_unique' => ($_REQUEST['index']['Index_choice'] == 'UNIQUE')
|
||||
'Non_unique' => ($_POST['index']['Index_choice'] == 'UNIQUE')
|
||||
? '0' : '1',
|
||||
);
|
||||
$this->index->set($index_params);
|
||||
@ -99,12 +99,12 @@ class TableIndexesController extends TableController
|
||||
'table' => $this->table,
|
||||
);
|
||||
|
||||
if (isset($_REQUEST['create_index'])) {
|
||||
if (isset($_POST['create_index'])) {
|
||||
$form_params['create_index'] = 1;
|
||||
} elseif (isset($_REQUEST['old_index'])) {
|
||||
$form_params['old_index'] = $_REQUEST['old_index'];
|
||||
} elseif (isset($_REQUEST['index'])) {
|
||||
$form_params['old_index'] = $_REQUEST['index'];
|
||||
} elseif (isset($_POST['old_index'])) {
|
||||
$form_params['old_index'] = $_POST['old_index'];
|
||||
} elseif (isset($_POST['index'])) {
|
||||
$form_params['old_index'] = $_POST['index'];
|
||||
}
|
||||
|
||||
$this->response->getHeader()->getScripts()->addFile('indexes.js');
|
||||
@ -116,7 +116,7 @@ class TableIndexesController extends TableController
|
||||
'index' => $this->index,
|
||||
'form_params' => $form_params,
|
||||
'add_fields' => $add_fields,
|
||||
'create_edit_table' => isset($_REQUEST['create_edit_table'])
|
||||
'create_edit_table' => isset($_POST['create_edit_table'])
|
||||
)
|
||||
)
|
||||
);
|
||||
@ -137,7 +137,7 @@ class TableIndexesController extends TableController
|
||||
->getSqlQueryForIndexCreateOrEdit($this->index, $error);
|
||||
|
||||
// If there is a request for SQL previewing.
|
||||
if (isset($_REQUEST['preview_sql'])) {
|
||||
if (isset($_POST['preview_sql'])) {
|
||||
|
||||
$this->response->addJSON(
|
||||
'sql_data',
|
||||
|
||||
@ -741,7 +741,7 @@ class Index
|
||||
$r .= '" ' . $row_span . '>'
|
||||
. ' <a class="';
|
||||
$r .= 'ajax';
|
||||
$r .= '" href="tbl_indexes.php' . Url::getCommon($this_params)
|
||||
$r .= '" href="tbl_indexes.php" data-post="' . Url::getCommon($this_params, '')
|
||||
. '">' . Util::getIcon('b_edit', __('Edit')) . '</a>'
|
||||
. '</td>' . "\n";
|
||||
$this_params = $GLOBALS['url_params'];
|
||||
|
||||
@ -27,15 +27,15 @@ $db = $container->get('db');
|
||||
$table = $container->get('table');
|
||||
$dbi = $container->get('dbi');
|
||||
|
||||
if (!isset($_REQUEST['create_edit_table'])) {
|
||||
if (!isset($_POST['create_edit_table'])) {
|
||||
include_once 'libraries/tbl_common.inc.php';
|
||||
}
|
||||
if (isset($_REQUEST['index'])) {
|
||||
if (is_array($_REQUEST['index'])) {
|
||||
if (isset($_POST['index'])) {
|
||||
if (is_array($_POST['index'])) {
|
||||
// coming already from form
|
||||
$index = new Index($_REQUEST['index']);
|
||||
$index = new Index($_POST['index']);
|
||||
} else {
|
||||
$index = $dbi->getTable($db, $table)->getIndex($_REQUEST['index']);
|
||||
$index = $dbi->getTable($db, $table)->getIndex($_POST['index']);
|
||||
}
|
||||
} else {
|
||||
$index = new Index;
|
||||
|
||||
@ -111,7 +111,7 @@ class TableIndexesControllerTest extends PmaTestCase
|
||||
);
|
||||
|
||||
// Preview SQL
|
||||
$_REQUEST['preview_sql'] = true;
|
||||
$_POST['preview_sql'] = true;
|
||||
$ctrl->doSaveDataAction();
|
||||
$jsonArray = $response->getJSONResult();
|
||||
$this->assertArrayHasKey('sql_data', $jsonArray);
|
||||
@ -123,7 +123,7 @@ class TableIndexesControllerTest extends PmaTestCase
|
||||
// Alter success
|
||||
$response->clear();
|
||||
Response::getInstance()->setAjax(true);
|
||||
unset($_REQUEST['preview_sql']);
|
||||
unset($_POST['preview_sql']);
|
||||
$ctrl->doSaveDataAction();
|
||||
$jsonArray = $response->getJSONResult();
|
||||
$this->assertArrayHasKey('index_table', $jsonArray);
|
||||
@ -169,8 +169,8 @@ class TableIndexesControllerTest extends PmaTestCase
|
||||
$index
|
||||
);
|
||||
|
||||
$_REQUEST['create_index'] = true;
|
||||
$_REQUEST['added_fields'] = 3;
|
||||
$_POST['create_index'] = true;
|
||||
$_POST['added_fields'] = 3;
|
||||
$ctrl->displayFormAction();
|
||||
$html = $response->getHTMLResult();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user