diff options
| author | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-02-26 11:43:19 +0000 |
|---|---|---|
| committer | alec <alec@208e9e7b-5314-0410-a742-e7e81cd9613c> | 2010-02-26 11:43:19 +0000 |
| commit | e44de9f794a500344da44b233489e22f0ed31259 (patch) | |
| tree | 77ae8da5f851ac86dcab579334dc388be7c500b9 /roundcubemail/program | |
| parent | 1bd5ba05f08cf8dd42e2b61e06eefd991a48e060 (diff) | |
- Support arrays in get_input_value() (#1486277)
git-svn-id: https://svn.roundcube.net/trunk@3294 208e9e7b-5314-0410-a742-e7e81cd9613c
Diffstat (limited to 'roundcubemail/program')
| -rw-r--r-- | roundcubemail/program/include/main.inc | 25 |
1 files changed, 23 insertions, 2 deletions
diff --git a/roundcubemail/program/include/main.inc b/roundcubemail/program/include/main.inc index f81e95bf8..207614885 100644 --- a/roundcubemail/program/include/main.inc +++ b/roundcubemail/program/include/main.inc @@ -596,7 +596,6 @@ function JQ($str) */ function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL) { - global $OUTPUT; $value = NULL; if ($source==RCUBE_INPUT_GET && isset($_GET[$fname])) @@ -613,9 +612,31 @@ function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL) $value = $_COOKIE[$fname]; } + return parse_input_value($value, $allow_html, $charset); +} + +/** + * Parse/validate input value. See get_input_value() + * Performs stripslashes() and charset conversion if necessary + * + * @param string Input value + * @param boolean Allow HTML tags in field value + * @param string Charset to convert into + * @return string Parsed value + */ +function parse_input_value($value, $allow_html=FALSE, $charset=NULL) +{ + global $OUTPUT; + if (empty($value)) return $value; + if (is_array($value)) { + foreach ($value as $idx => $val) + $value[$idx] = parse_input_value($val, $allow_html, $charset); + return $value; + } + // strip single quotes if magic_quotes_sybase is enabled if (ini_get('magic_quotes_sybase')) $value = str_replace("''", "'", $value); @@ -628,7 +649,7 @@ function get_input_value($fname, $source, $allow_html=FALSE, $charset=NULL) $value = strip_tags($value); // convert to internal charset - if (is_object($OUTPUT)) + if (is_object($OUTPUT) && $charset) return rcube_charset_convert($value, $OUTPUT->get_charset(), $charset); else return $value; |
