Skip to content
Permalink
Browse files

Retrieve parameters from $_POST in browse foreigners

Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
  • Loading branch information...
mauriciofauth committed Aug 29, 2018
1 parent 88e162b commit e7e7d56c759366c61824b67f48ec0ba4d5507105
@@ -14,16 +14,16 @@
require_once 'libraries/common.inc.php';
/**
* Sets globals from $_REQUEST
* Sets globals from $_POST
*/
$request_params = array(
'data',
'field'
);
foreach ($request_params as $one_request_param) {
if (isset($_REQUEST[$one_request_param])) {
$GLOBALS[$one_request_param] = $_REQUEST[$one_request_param];
if (isset($_POST[$one_request_param])) {
$GLOBALS[$one_request_param] = $_POST[$one_request_param];
}
}
@@ -49,13 +49,13 @@
$GLOBALS['pmaThemeImage']
);
$foreign_limit = $browseForeigners->getForeignLimit(
isset($_REQUEST['foreign_showAll']) ? $_REQUEST['foreign_showAll'] : null
isset($_POST['foreign_showAll']) ? $_POST['foreign_showAll'] : null
);
$foreignData = $relation->getForeignData(
$foreigners, $_REQUEST['field'], true,
isset($_REQUEST['foreign_filter'])
? $_REQUEST['foreign_filter']
$foreigners, $_POST['field'], true,
isset($_POST['foreign_filter'])
? $_POST['foreign_filter']
: '',
isset($foreign_limit) ? $foreign_limit : null,
true // for getting value in $foreignData['the_total']
@@ -65,7 +65,7 @@
$html = $browseForeigners->getHtmlForRelationalFieldSelection(
$db,
$table,
$_REQUEST['field'],
$_POST['field'],
$foreignData,
isset($fieldkey) ? $fieldkey : null,
isset($data) ? $data : null
@@ -792,7 +792,10 @@ function browseForeignDialog ($this_a) {
var tableId = '#browse_foreign_table';
var filterId = '#input_foreign_filter';
var $dialog = null;
$.get($this_a.attr('href'), { 'ajax_request': true }, function (data) {
var argSep = PMA_commonParams.get('arg_separator');
var params = $this_a.getPostData();
params += argSep + 'ajax_request=true';
$.post($this_a.attr('href'), params, function (data) {
// Creates browse foreign value dialog
$dialog = $('<div>').append(data.message).dialog({
title: PMA_messages.strBrowseForeignValues,
@@ -182,12 +182,12 @@ public function getHtmlForRelationalFieldSelection(
. '<input type="hidden" name="fieldkey" value="'
. (isset($fieldkey) ? htmlspecialchars($fieldkey) : '') . '" />';
if (isset($_REQUEST['rownumber'])) {
if (isset($_POST['rownumber'])) {
$output .= '<input type="hidden" name="rownumber" value="'
. htmlspecialchars($_REQUEST['rownumber']) . '" />';
. htmlspecialchars($_POST['rownumber']) . '" />';
}
$filter_value = (isset($_REQUEST['foreign_filter'])
? htmlspecialchars($_REQUEST['foreign_filter'])
$filter_value = (isset($_POST['foreign_filter'])
? htmlspecialchars($_POST['foreign_filter'])
: '');
$output .= '<span class="formelement">'
. '<label for="input_foreign_filter">' . __('Search:') . '</label>'
@@ -302,7 +302,7 @@ private function getDescriptionAndTitle($description)
private function getHtmlForGotoPage($foreignData)
{
$gotopage = '';
isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0;
isset($_POST['pos']) ? $pos = $_POST['pos'] : $pos = 0;
if (!is_array($foreignData['disp_row'])) {
return $gotopage;
}
@@ -340,7 +340,7 @@ public function getForeignLimit($foreignShowAll)
if (isset($foreignShowAll) && $foreignShowAll == __('Show all')) {
return null;
}
isset($_REQUEST['pos']) ? $pos = $_REQUEST['pos'] : $pos = 0;
isset($_POST['pos']) ? $pos = $_POST['pos'] : $pos = 0;
return 'LIMIT ' . $pos . ', ' . $this->maxRows . ' ';
}
}
@@ -849,15 +849,16 @@ private function getForeignLink(
. 'id="field_' . ($idindex) . '_3" '
. 'value="' . htmlspecialchars($data) . '" />';
$html_output .= '<a class="ajax browse_foreign" href="browse_foreigners.php'
$html_output .= '<a class="ajax browse_foreign" href="browse_foreigners.php" data-post="'
. Url::getCommon(
array(
'db' => $db,
'table' => $table,
'field' => $column['Field'],
'rownumber' => $rownumber,
'data' => $data
)
),
''
) . '">'
. str_replace("'", "\'", $titles['Browse']) . '</a>';
return $html_output;
@@ -221,8 +221,8 @@ private function getHtmlForRelationalColumnDropdown($db, $table, $column, $curr_
$dropdown = '<span class="curr_value">'
. htmlspecialchars($_POST['curr_value'])
. '</span>'
. '<a href="browse_foreigners.php'
. Url::getCommon($_url_params) . '"'
. '<a href="browse_foreigners.php" data-post="'
. Url::getCommon($_url_params, '') . '"'
. 'class="ajax browse_foreign" ' . '>'
. __('Browse foreign values')
. '</a>';
@@ -20,11 +20,10 @@
{% if criteria_values[column_index] is defined %}
value="{{ criteria_values[column_index] }}"
{% endif %} />
<a class="ajax browse_foreign"
href="browse_foreigners.php
{{- Url_getCommon({'db': db, 'table': table}) -}}
&amp;field={{ column_name|url_encode }}&amp;fieldkey=
{{- column_index }}&amp;fromsearch=1">
<a class="ajax browse_foreign" href="browse_foreigners.php" data-post="
{{- Url_getCommon({'db': db, 'table': table}, '') -}}
&amp;field={{ column_name|url_encode }}&amp;fieldkey=
{{- column_index }}&amp;fromsearch=1">
{{ titles['Browse']|replace({"'": "\\'"})|raw }}
</a>
{% endif %}
@@ -66,7 +66,7 @@ function testGetForeignLimit()
$this->browseForeigners->getForeignLimit(null)
);
$_REQUEST['pos'] = 10;
$_POST['pos'] = 10;
$this->assertEquals(
'LIMIT 10, 25 ',
@@ -107,7 +107,7 @@ function testGetHtmlForGotoPage()
)
);
$_REQUEST['pos'] = 15;
$_POST['pos'] = 15;
$foreignData = array();
$foreignData['disp_row'] = array();
$foreignData['the_total'] = 5;
@@ -196,8 +196,8 @@ function testGetHtmlForRelationalFieldSelection()
$foreignData['disp_row'] = '';
$fieldkey = 'bar';
$current_value = '';
$_REQUEST['rownumber'] = 1;
$_REQUEST['foreign_filter'] = '5';
$_POST['rownumber'] = 1;
$_POST['foreign_filter'] = '5';
$result = $this->browseForeigners->getHtmlForRelationalFieldSelection(
$db,
$table,
@@ -798,7 +798,7 @@ public function testGetForeignLink()
$this->assertContains(
'<a class="ajax browse_foreign" href="browse_'
. 'foreigners.php?db=db&amp;table=tbl&amp;field=f&amp;rownumber=8'
. 'foreigners.php" data-post="db=db&amp;table=tbl&amp;field=f&amp;rownumber=8'
. '&amp;data=abc&amp;server=1&amp;lang=en">',
$result
);

0 comments on commit e7e7d56

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