Retrieve parameters from $_POST in normalization

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
Maurício Meneghini Fauth 2018-08-19 16:42:14 -03:00
parent bf3e6c3a77
commit 827e4dcf2c
3 changed files with 26 additions and 26 deletions

View File

@ -152,7 +152,7 @@ class Normalization
'fields_meta' => null,
'mimework' => $cfgRelation['mimework'],
'content_cells' => $contentCells,
'change_column' => $_REQUEST['change_column'],
'change_column' => $_POST['change_column'],
'is_virtual_columns_supported' => Util::isVirtualColumnsSupported(),
'browse_mime' => $GLOBALS['cfg']['BrowseMIME'],
'server_type' => Util::getServerType(),

View File

@ -15,7 +15,7 @@ require_once 'libraries/common.inc.php';
$normalization = new Normalization($GLOBALS['dbi']);
if (isset($_REQUEST['getColumns'])) {
if (isset($_POST['getColumns'])) {
$html = '<option selected disabled>' . __('Select one…') . '</option>'
. '<option value="no_such_col">' . __('No such column') . '</option>';
//get column whose datatype falls under string category
@ -27,14 +27,14 @@ if (isset($_REQUEST['getColumns'])) {
echo $html;
exit;
}
if (isset($_REQUEST['splitColumn'])) {
$num_fields = min(4096, intval($_REQUEST['numFields']));
if (isset($_POST['splitColumn'])) {
$num_fields = min(4096, intval($_POST['numFields']));
$html = $normalization->getHtmlForCreateNewColumn($num_fields, $db, $table);
$html .= Url::getHiddenInputs($db, $table);
echo $html;
exit;
}
if (isset($_REQUEST['addNewPrimary'])) {
if (isset($_POST['addNewPrimary'])) {
$num_fields = 1;
$columnMeta = array('Field'=>$table . "_id", 'Extra'=>'auto_increment');
$html = $normalization->getHtmlForCreateNewColumn(
@ -44,14 +44,14 @@ if (isset($_REQUEST['addNewPrimary'])) {
echo $html;
exit;
}
if (isset($_REQUEST['findPdl'])) {
if (isset($_POST['findPdl'])) {
$html = $normalization->findPartialDependencies($table, $db);
echo $html;
exit;
}
if (isset($_REQUEST['getNewTables2NF'])) {
$partialDependencies = json_decode($_REQUEST['pd']);
if (isset($_POST['getNewTables2NF'])) {
$partialDependencies = json_decode($_POST['pd']);
$html = $normalization->getHtmlForNewTables2NF($partialDependencies, $table);
echo $html;
exit;
@ -59,9 +59,9 @@ if (isset($_REQUEST['getNewTables2NF'])) {
$response = Response::getInstance();
if (isset($_REQUEST['getNewTables3NF'])) {
$dependencies = json_decode($_REQUEST['pd']);
$tables = json_decode($_REQUEST['tables']);
if (isset($_POST['getNewTables3NF'])) {
$dependencies = json_decode($_POST['pd']);
$tables = json_decode($_POST['tables']);
$newTables = $normalization->getHtmlForNewTables3NF($dependencies, $tables, $db);
$response->disable();
Core::headerJSON();
@ -74,18 +74,18 @@ $scripts = $header->getScripts();
$scripts->addFile('normalization.js');
$scripts->addFile('vendor/jquery/jquery.uitablefilter.js');
$normalForm = '1nf';
if (Core::isValid($_REQUEST['normalizeTo'], array('1nf', '2nf', '3nf'))) {
$normalForm = $_REQUEST['normalizeTo'];
if (Core::isValid($_POST['normalizeTo'], array('1nf', '2nf', '3nf'))) {
$normalForm = $_POST['normalizeTo'];
}
if (isset($_REQUEST['createNewTables2NF'])) {
$partialDependencies = json_decode($_REQUEST['pd']);
$tablesName = json_decode($_REQUEST['newTablesName']);
if (isset($_POST['createNewTables2NF'])) {
$partialDependencies = json_decode($_POST['pd']);
$tablesName = json_decode($_POST['newTablesName']);
$res = $normalization->createNewTablesFor2NF($partialDependencies, $tablesName, $table, $db);
$response->addJSON($res);
exit;
}
if (isset($_REQUEST['createNewTables3NF'])) {
$newtables = json_decode($_REQUEST['newTables']);
if (isset($_POST['createNewTables3NF'])) {
$newtables = json_decode($_POST['newTables']);
$res = $normalization->createNewTablesFor3NF($newtables, $db);
$response->addJSON($res);
exit;
@ -101,23 +101,23 @@ if (isset($_POST['repeatingColumns'])) {
$response->addJSON($res);
exit;
}
if (isset($_REQUEST['step1'])) {
if (isset($_POST['step1'])) {
$html = $normalization->getHtmlFor1NFStep1($db, $table, $normalForm);
$response->addHTML($html);
} elseif (isset($_REQUEST['step2'])) {
} elseif (isset($_POST['step2'])) {
$res = $normalization->getHtmlContentsFor1NFStep2($db, $table);
$response->addJSON($res);
} elseif (isset($_REQUEST['step3'])) {
} elseif (isset($_POST['step3'])) {
$res = $normalization->getHtmlContentsFor1NFStep3($db, $table);
$response->addJSON($res);
} elseif (isset($_REQUEST['step4'])) {
} elseif (isset($_POST['step4'])) {
$res = $normalization->getHtmlContentsFor1NFStep4($db, $table);
$response->addJSON($res);
} elseif (isset($_REQUEST['step']) && $_REQUEST['step'] == '2.1') {
} elseif (isset($_POST['step']) && $_POST['step'] == '2.1') {
$res = $normalization->getHtmlFor2NFstep1($db, $table);
$response->addJSON($res);
} elseif (isset($_REQUEST['step']) && $_REQUEST['step'] == '3.1') {
$tables = $_REQUEST['tables'];
} elseif (isset($_POST['step']) && $_POST['step'] == '3.1') {
$tables = $_POST['tables'];
$res = $normalization->getHtmlFor3NFstep1($db, $tables);
$response->addJSON($res);
} else {

View File

@ -41,7 +41,7 @@ class NormalizationTest extends TestCase
$GLOBALS['table'] = 'PMA_table';
$GLOBALS['server'] = 1;
$GLOBALS['cfg']['Server']['DisableIS'] = false;
$_REQUEST['change_column'] = null;
$_POST['change_column'] = null;
//$_SESSION