From 765df4191840b58a7776fb030793315a48ef85ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fr=C3=A9d=C3=A9ric=20FRANCE?= Date: Mon, 30 Nov 2020 15:44:29 +0100 Subject: [PATCH] introduce GETPOSTINT --- htdocs/core/lib/functions.lib.php | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/htdocs/core/lib/functions.lib.php b/htdocs/core/lib/functions.lib.php index 61360d66f51..f594cdd052c 100644 --- a/htdocs/core/lib/functions.lib.php +++ b/htdocs/core/lib/functions.lib.php @@ -604,6 +604,22 @@ function GETPOST($paramname, $check = 'alphanohtml', $method = 0, $filter = null return $out; } +/** + * Return value of a param into GET or POST supervariable. + * Use the property $user->default_values[path]['creatform'] and/or $user->default_values[path]['filters'] and/or $user->default_values[path]['sortorder'] + * Note: The property $user->default_values is loaded by main.php when loading the user. + * + * @param string $paramname Name of parameter to found + * @param int $method Type of method (0 = get then post, 1 = only get, 2 = only post, 3 = post then get) + * @param int $filter Filter to apply when $check is set to 'custom'. (See http://php.net/manual/en/filter.filters.php for détails) + * @param mixed $options Options to pass to filter_var when $check is set to 'custom' + * @param string $noreplace Force disable of replacement of __xxx__ strings. + * @return int Value found (int) + */ +function GETPOSTINT($paramname, $method = 0, $filter = null, $options = null, $noreplace = 0) +{ + return (int) GETPOST($paramname, 'int', $method, $filter, $options, $noreplace); +} /** * Return a value after checking on a rule.