Add GETPOSTISARRAY
This commit is contained in:
parent
75d7c439dd
commit
16968b08f9
@ -2131,8 +2131,7 @@ class ExtraFields
|
|||||||
}
|
}
|
||||||
} elseif ($key_type == 'select') {
|
} elseif ($key_type == 'select') {
|
||||||
// to detect if we are in search context
|
// to detect if we are in search context
|
||||||
$value_arr_test = GETPOST($keysuffix."options_".$key.$keyprefix, 'none');
|
if (GETPOSTISARRAY($keysuffix."options_".$key.$keyprefix)) {
|
||||||
if (is_array($value_arr_test)) {
|
|
||||||
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix, 'array:aZ09');
|
$value_arr = GETPOST($keysuffix."options_".$key.$keyprefix, 'array:aZ09');
|
||||||
// Make sure we get an array even if there's only one selected
|
// Make sure we get an array even if there's only one selected
|
||||||
$value_arr = (array) $value_arr;
|
$value_arr = (array) $value_arr;
|
||||||
|
|||||||
@ -370,6 +370,32 @@ function GETPOSTISSET($paramname)
|
|||||||
return $isset;
|
return $isset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return true if the parameter $paramname is submit from a POST OR GET as an array.
|
||||||
|
* Can be used before GETPOST to know if the $check param of GETPOST need to check an array or a string
|
||||||
|
*
|
||||||
|
* @param string $paramname Name or parameter to test
|
||||||
|
* @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get)
|
||||||
|
* @return bool True if we have just submit a POST or GET request with the parameter provided (even if param is empty)
|
||||||
|
*/
|
||||||
|
function GETPOSTISARRAY($paramname, $method = 0)
|
||||||
|
{
|
||||||
|
// for $method test need return the same $val as GETPOST
|
||||||
|
if (empty($method)) {
|
||||||
|
$val = isset($_GET[$paramname]) ? $_GET[$paramname] : (isset($_POST[$paramname]) ? $_POST[$paramname] : '');
|
||||||
|
} elseif ($method == 1) {
|
||||||
|
$val = isset($_GET[$paramname]) ? $_GET[$paramname] : '';
|
||||||
|
} elseif ($method == 2) {
|
||||||
|
$val = isset($_POST[$paramname]) ? $_POST[$paramname] : '';
|
||||||
|
} elseif ($method == 3) {
|
||||||
|
$val = isset($_POST[$paramname]) ? $_POST[$paramname] : (isset($_GET[$paramname]) ? $_GET[$paramname] : '');
|
||||||
|
} else {
|
||||||
|
$val = 'BadFirstParameterForGETPOST';
|
||||||
|
}
|
||||||
|
|
||||||
|
return is_array($val);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return value of a param into GET or POST supervariable.
|
* Return value of a param into GET or POST supervariable.
|
||||||
* Use the property $user->default_values[path]['createform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
* Use the property $user->default_values[path]['createform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder']
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user