Commit 30de6abc authored by Francois Marier's avatar Francois Marier Committed by Gerrit Code Review
Browse files

Merge "Fix whitespace issues with param_... functions"

parents 8abbdbd7 79810c3d
...@@ -1016,6 +1016,8 @@ function param_integer($name) { ...@@ -1016,6 +1016,8 @@ function param_integer($name) {
list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args); list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args);
$value = trim($value);
if ($defaultused) { if ($defaultused) {
return $value; return $value;
} }
...@@ -1047,11 +1049,13 @@ function param_signed_integer($name) { ...@@ -1047,11 +1049,13 @@ function param_signed_integer($name) {
list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args); list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args);
$value = trim($value);
if ($defaultused) { if ($defaultused) {
return $value; return $value;
} }
if (preg_match('#[+-]?[0-9]+#', $value)) { if (preg_match('/^[+-]?[0-9]+$/', $value)) {
return (int)$value; return (int)$value;
} }
else if ($value == '' && isset($args[1])) { else if ($value == '' && isset($args[1])) {
...@@ -1080,6 +1084,8 @@ function param_alpha($name) { ...@@ -1080,6 +1084,8 @@ function param_alpha($name) {
list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args); list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args);
$value = trim($value);
if ($defaultused) { if ($defaultused) {
return $value; return $value;
} }
...@@ -1110,6 +1116,8 @@ function param_alphanum($name) { ...@@ -1110,6 +1116,8 @@ function param_alphanum($name) {
list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args); list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args);
$value = trim($value);
if ($defaultused) { if ($defaultused) {
return $value; return $value;
} }
...@@ -1140,6 +1148,8 @@ function param_alphanumext($name) { ...@@ -1140,6 +1148,8 @@ function param_alphanumext($name) {
list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args); list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args);
$value = trim($value);
if ($defaultused) { if ($defaultused) {
return $value; return $value;
} }
...@@ -1171,6 +1181,8 @@ function param_integer_list($name) { ...@@ -1171,6 +1181,8 @@ function param_integer_list($name) {
list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args); list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args);
$value = trim($value);
if ($defaultused) { if ($defaultused) {
return $value; return $value;
} }
...@@ -1179,7 +1191,7 @@ function param_integer_list($name) { ...@@ -1179,7 +1191,7 @@ function param_integer_list($name) {
return array(); return array();
} }
if (preg_match('/^(\d+(,\d+)*)$/',$value)) { if (preg_match('/^(\d+(\s*,\s*\d+)*)$/',$value)) {
return array_map('intval', explode(',', $value)); return array_map('intval', explode(',', $value));
} }
...@@ -1198,6 +1210,8 @@ function param_boolean($name) { ...@@ -1198,6 +1210,8 @@ function param_boolean($name) {
list ($value) = _param_retrieve($name, false); list ($value) = _param_retrieve($name, false);
$value = trim($value);
if (empty($value) || $value == 'off' || $value == 'no' || $value == 'false') { if (empty($value) || $value == 'off' || $value == 'no' || $value == 'false') {
return false; return false;
} }
...@@ -1221,6 +1235,8 @@ function param_imagesize($name) { ...@@ -1221,6 +1235,8 @@ function param_imagesize($name) {
list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args); list ($value, $defaultused) = call_user_func_array('_param_retrieve', $args);
$value = trim($value);
if ($defaultused) { if ($defaultused) {
return $value; return $value;
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment