diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2003-11-04 21:54:40 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2003-11-04 21:54:40 +0000 |
| commit | 88f814a5c57246250a82ad53d43f8f90da5afb60 (patch) | |
| tree | 7c108ff983f2ed3bd057c2b4473344b4a862f6af /phpBB/includes/functions.php | |
| parent | 472026b8e327a3e2d3bf5baeee29735b20164f4e (diff) | |
| download | forums-88f814a5c57246250a82ad53d43f8f90da5afb60.tar forums-88f814a5c57246250a82ad53d43f8f90da5afb60.tar.gz forums-88f814a5c57246250a82ad53d43f8f90da5afb60.tar.bz2 forums-88f814a5c57246250a82ad53d43f8f90da5afb60.tar.xz forums-88f814a5c57246250a82ad53d43f8f90da5afb60.zip | |
request_var update to support 2-dimensional arrays.
git-svn-id: file:///svn/phpbb/trunk@4636 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/includes/functions.php')
| -rw-r--r-- | phpBB/includes/functions.php | 44 |
1 files changed, 25 insertions, 19 deletions
diff --git a/phpBB/includes/functions.php b/phpBB/includes/functions.php index 70d6f014f0..a1e5ee4e8d 100644 --- a/phpBB/includes/functions.php +++ b/phpBB/includes/functions.php @@ -12,6 +12,23 @@ // ------------------------------------------------------------- +function set_var(&$result, $var, $type) +{ + settype($var, $type); + $result = $var; + + if ($type == 'string') + { + // Prevent use of , excess spaces or other html entity forms in profile strings, + // not generally applicable elsewhere + $result = htmlspecialchars(trim(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $result))); + if (STRIP) + { + $result = stripslashes($result); + } + } +} + function request_var($var_name, $default) { if (!isset($_REQUEST[$var_name])) @@ -27,33 +44,22 @@ function request_var($var_name, $default) { foreach ($var as $k => $v) { - settype($v, $type); - $var[$k] = $v; - - if ($type == 'string') + if (is_array($v)) { - $var[$k] = htmlspecialchars(trim(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $var[$k]))); - if (STRIP) + foreach ($v as $_k => $_v) { - $var[$k] = stripslashes($var[$k]); + set_var($var[$k][$_k], $_v, $type); } } + else + { + set_var($var[$k], $v, $type); + } } } else { - settype($var, $type); - - // Prevent use of , excess spaces or other html entity forms in profile strings, - // not generally applicable elsewhere - if ($type == 'string') - { - $var = htmlspecialchars(trim(preg_replace(array("#[ \xFF]{2,}#s", "#[\r\n]{2,}#s"), array(' ', "\n"), $var))); - if (STRIP) - { - $var = stripslashes($var); - } - } + set_var($var, $var, $type); } return $var; |
