Retrieve parameters from $_POST in tbl_addfield
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
c1cdaac2f4
commit
1edf1aced6
@ -60,10 +60,10 @@ if ($action == 'tbl_create.php') {
|
||||
if ($action == 'tbl_addfield.php') {
|
||||
$form_params = array_merge(
|
||||
$form_params, array(
|
||||
'field_where' => Util::getValueByKey($_REQUEST, 'field_where'))
|
||||
'field_where' => Util::getValueByKey($_POST, 'field_where'))
|
||||
);
|
||||
if (isset($_REQUEST['field_where'])) {
|
||||
$form_params['after_field'] = $_REQUEST['after_field'];
|
||||
if (isset($_POST['field_where'])) {
|
||||
$form_params['after_field'] = $_POST['after_field'];
|
||||
}
|
||||
}
|
||||
$form_params['table'] = $table;
|
||||
@ -76,8 +76,8 @@ if (isset($num_fields)) {
|
||||
$form_params = array_merge(
|
||||
$form_params,
|
||||
array(
|
||||
'orig_field_where' => Util::getValueByKey($_REQUEST, 'field_where'),
|
||||
'orig_after_field' => Util::getValueByKey($_REQUEST, 'after_field'),
|
||||
'orig_field_where' => Util::getValueByKey($_POST, 'field_where'),
|
||||
'orig_after_field' => Util::getValueByKey($_POST, 'after_field'),
|
||||
)
|
||||
);
|
||||
|
||||
@ -114,8 +114,8 @@ if (isset($field_fulltext) && is_array($field_fulltext)) {
|
||||
$submit_fulltext[$fulltext_indexkey] = $fulltext_indexkey;
|
||||
}
|
||||
}
|
||||
if (isset($_REQUEST['submit_num_fields'])
|
||||
|| isset($_REQUEST['submit_partition_change'])
|
||||
if (isset($_POST['submit_num_fields'])
|
||||
|| isset($_POST['submit_partition_change'])
|
||||
) {
|
||||
//if adding new fields, set regenerate to keep the original values
|
||||
$regenerate = 1;
|
||||
@ -143,38 +143,38 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
|
||||
$columnMeta,
|
||||
array(
|
||||
'Field' => Util::getValueByKey(
|
||||
$_REQUEST, "field_name.${columnNumber}", false
|
||||
$_POST, "field_name.${columnNumber}", false
|
||||
),
|
||||
'Type' => Util::getValueByKey(
|
||||
$_REQUEST, "field_type.${columnNumber}", false
|
||||
$_POST, "field_type.${columnNumber}", false
|
||||
),
|
||||
'Collation' => Util::getValueByKey(
|
||||
$_REQUEST, "field_collation.${columnNumber}", ''
|
||||
$_POST, "field_collation.${columnNumber}", ''
|
||||
),
|
||||
'Null' => Util::getValueByKey(
|
||||
$_REQUEST, "field_null.${columnNumber}", ''
|
||||
$_POST, "field_null.${columnNumber}", ''
|
||||
),
|
||||
'DefaultType' => Util::getValueByKey(
|
||||
$_REQUEST, "field_default_type.${columnNumber}", 'NONE'
|
||||
$_POST, "field_default_type.${columnNumber}", 'NONE'
|
||||
),
|
||||
'DefaultValue' => Util::getValueByKey(
|
||||
$_REQUEST, "field_default_value.${columnNumber}", ''
|
||||
$_POST, "field_default_value.${columnNumber}", ''
|
||||
),
|
||||
'Extra' => Util::getValueByKey(
|
||||
$_REQUEST, "field_extra.${columnNumber}", false
|
||||
$_POST, "field_extra.${columnNumber}", false
|
||||
),
|
||||
'Virtuality' => Util::getValueByKey(
|
||||
$_REQUEST, "field_virtuality.${columnNumber}", ''
|
||||
$_POST, "field_virtuality.${columnNumber}", ''
|
||||
),
|
||||
'Expression' => Util::getValueByKey(
|
||||
$_REQUEST, "field_expression.${columnNumber}", ''
|
||||
$_POST, "field_expression.${columnNumber}", ''
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
$columnMeta['Key'] = '';
|
||||
$parts = explode(
|
||||
'_', Util::getValueByKey($_REQUEST, "field_key.${columnNumber}", ''), 2
|
||||
'_', Util::getValueByKey($_POST, "field_key.${columnNumber}", ''), 2
|
||||
);
|
||||
if (count($parts) == 2 && $parts[1] == $columnNumber) {
|
||||
$columnMeta['Key'] = Util::getValueByKey(
|
||||
@ -208,23 +208,23 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
|
||||
break;
|
||||
}
|
||||
|
||||
$length = Util::getValueByKey($_REQUEST, "field_length.${columnNumber}", $length);
|
||||
$length = Util::getValueByKey($_POST, "field_length.${columnNumber}", $length);
|
||||
$submit_attribute = Util::getValueByKey(
|
||||
$_REQUEST, "field_attribute.${columnNumber}", false
|
||||
$_POST, "field_attribute.${columnNumber}", false
|
||||
);
|
||||
$comments_map[$columnMeta['Field']] = Util::getValueByKey(
|
||||
$_REQUEST, "field_comments.${columnNumber}"
|
||||
$_POST, "field_comments.${columnNumber}"
|
||||
);
|
||||
|
||||
$mime_map[$columnMeta['Field']] = array_merge(
|
||||
$mime_map[$columnMeta['Field']],
|
||||
array(
|
||||
'mimetype' => Util::getValueByKey($_REQUEST, "field_mimetype.${$columnNumber}"),
|
||||
'mimetype' => Util::getValueByKey($_POST, "field_mimetype.${$columnNumber}"),
|
||||
'transformation' => Util::getValueByKey(
|
||||
$_REQUEST, "field_transformation.${$columnNumber}"
|
||||
$_POST, "field_transformation.${$columnNumber}"
|
||||
),
|
||||
'transformation_options' => Util::getValueByKey(
|
||||
$_REQUEST, "field_transformation_options.${$columnNumber}"
|
||||
$_POST, "field_transformation_options.${$columnNumber}"
|
||||
),
|
||||
)
|
||||
);
|
||||
@ -405,17 +405,17 @@ $html = Template::get('columns_definitions/column_definitions_form')->render([
|
||||
'form_params' => $form_params,
|
||||
'content_cells' => $content_cells,
|
||||
'partition_details' => $partitionDetails,
|
||||
'primary_indexes' => isset($_REQUEST['primary_indexes']) ? $_REQUEST['primary_indexes'] : null,
|
||||
'unique_indexes' => isset($_REQUEST['unique_indexes']) ? $_REQUEST['unique_indexes'] : null,
|
||||
'indexes' => isset($_REQUEST['indexes']) ? $_REQUEST['indexes'] : null,
|
||||
'fulltext_indexes' => isset($_REQUEST['fulltext_indexes']) ? $_REQUEST['fulltext_indexes'] : null,
|
||||
'spatial_indexes' => isset($_REQUEST['spatial_indexes']) ? $_REQUEST['spatial_indexes'] : null,
|
||||
'table' => isset($_REQUEST['table']) ? $_REQUEST['table'] : null,
|
||||
'comment' => isset($_REQUEST['comment']) ? $_REQUEST['comment'] : null,
|
||||
'tbl_collation' => isset($_REQUEST['tbl_collation']) ? $_REQUEST['tbl_collation'] : null,
|
||||
'tbl_storage_engine' => isset($_REQUEST['tbl_storage_engine']) ? $_REQUEST['tbl_storage_engine'] : null,
|
||||
'connection' => isset($_REQUEST['connection']) ? $_REQUEST['connection'] : null,
|
||||
'change_column' => isset($_REQUEST['change_column']) ? $_REQUEST['change_column'] : null,
|
||||
'primary_indexes' => isset($_POST['primary_indexes']) ? $_POST['primary_indexes'] : null,
|
||||
'unique_indexes' => isset($_POST['unique_indexes']) ? $_POST['unique_indexes'] : null,
|
||||
'indexes' => isset($_POST['indexes']) ? $_POST['indexes'] : null,
|
||||
'fulltext_indexes' => isset($_POST['fulltext_indexes']) ? $_POST['fulltext_indexes'] : null,
|
||||
'spatial_indexes' => isset($_POST['spatial_indexes']) ? $_POST['spatial_indexes'] : null,
|
||||
'table' => isset($_POST['table']) ? $_POST['table'] : null,
|
||||
'comment' => isset($_POST['comment']) ? $_POST['comment'] : null,
|
||||
'tbl_collation' => isset($_POST['tbl_collation']) ? $_POST['tbl_collation'] : null,
|
||||
'tbl_storage_engine' => isset($_POST['tbl_storage_engine']) ? $_POST['tbl_storage_engine'] : null,
|
||||
'connection' => isset($_POST['connection']) ? $_POST['connection'] : null,
|
||||
'change_column' => isset($_POST['change_column']) ? $_POST['change_column'] : null,
|
||||
'is_virtual_columns_supported' => Util::isVirtualColumnsSupported(),
|
||||
'browse_mime' => isset($GLOBALS['cfg']['BrowseMIME']) ? $GLOBALS['cfg']['BrowseMIME'] : null,
|
||||
'server_type' => Util::getServerType(),
|
||||
|
||||
@ -41,28 +41,28 @@ $err_url = 'tbl_sql.php' . Url::getCommon(
|
||||
$abort = false;
|
||||
|
||||
// check number of fields to be created
|
||||
if (isset($_REQUEST['submit_num_fields'])) {
|
||||
if (isset($_REQUEST['orig_after_field'])) {
|
||||
$_REQUEST['after_field'] = $_REQUEST['orig_after_field'];
|
||||
if (isset($_POST['submit_num_fields'])) {
|
||||
if (isset($_POST['orig_after_field'])) {
|
||||
$_POST['after_field'] = $_POST['orig_after_field'];
|
||||
}
|
||||
if (isset($_REQUEST['orig_field_where'])) {
|
||||
$_REQUEST['field_where'] = $_REQUEST['orig_field_where'];
|
||||
if (isset($_POST['orig_field_where'])) {
|
||||
$_POST['field_where'] = $_POST['orig_field_where'];
|
||||
}
|
||||
$num_fields = min(
|
||||
intval($_REQUEST['orig_num_fields']) + intval($_REQUEST['added_fields']),
|
||||
intval($_POST['orig_num_fields']) + intval($_POST['added_fields']),
|
||||
4096
|
||||
);
|
||||
$regenerate = true;
|
||||
} elseif (isset($_REQUEST['num_fields']) && intval($_REQUEST['num_fields']) > 0) {
|
||||
$num_fields = min(4096, intval($_REQUEST['num_fields']));
|
||||
} elseif (isset($_POST['num_fields']) && intval($_POST['num_fields']) > 0) {
|
||||
$num_fields = min(4096, intval($_POST['num_fields']));
|
||||
} else {
|
||||
$num_fields = 1;
|
||||
}
|
||||
|
||||
if (isset($_REQUEST['do_save_data'])) {
|
||||
if (isset($_POST['do_save_data'])) {
|
||||
//avoid an incorrect calling of PMA_updateColumns() via
|
||||
//tbl_structure.php below
|
||||
unset($_REQUEST['do_save_data']);
|
||||
unset($_POST['do_save_data']);
|
||||
|
||||
$createAddField = new CreateAddField($GLOBALS['dbi']);
|
||||
|
||||
@ -70,22 +70,22 @@ if (isset($_REQUEST['do_save_data'])) {
|
||||
|
||||
if ($result === true) {
|
||||
// Update comment table for mime types [MIME]
|
||||
if (isset($_REQUEST['field_mimetype'])
|
||||
&& is_array($_REQUEST['field_mimetype'])
|
||||
if (isset($_POST['field_mimetype'])
|
||||
&& is_array($_POST['field_mimetype'])
|
||||
&& $cfg['BrowseMIME']
|
||||
) {
|
||||
foreach ($_REQUEST['field_mimetype'] as $fieldindex => $mimetype) {
|
||||
if (isset($_REQUEST['field_name'][$fieldindex])
|
||||
&& strlen($_REQUEST['field_name'][$fieldindex]) > 0
|
||||
foreach ($_POST['field_mimetype'] as $fieldindex => $mimetype) {
|
||||
if (isset($_POST['field_name'][$fieldindex])
|
||||
&& strlen($_POST['field_name'][$fieldindex]) > 0
|
||||
) {
|
||||
Transformations::setMIME(
|
||||
$db, $table,
|
||||
$_REQUEST['field_name'][$fieldindex],
|
||||
$_POST['field_name'][$fieldindex],
|
||||
$mimetype,
|
||||
$_REQUEST['field_transformation'][$fieldindex],
|
||||
$_REQUEST['field_transformation_options'][$fieldindex],
|
||||
$_REQUEST['field_input_transformation'][$fieldindex],
|
||||
$_REQUEST['field_input_transformation_options'][$fieldindex]
|
||||
$_POST['field_transformation'][$fieldindex],
|
||||
$_POST['field_transformation_options'][$fieldindex],
|
||||
$_POST['field_input_transformation'][$fieldindex],
|
||||
$_POST['field_input_transformation_options'][$fieldindex]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user