From: hickert Date: Mon, 26 Jul 2010 09:44:08 +0000 (+0000) Subject: Updated get_post to support arrays in _POST X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=b67e508585629b61ce7b1029fea14b256073824b;p=gosa.git Updated get_post to support arrays in _POST git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19102 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/functions.inc b/gosa-core/include/functions.inc index 68b17919b..c0af25616 100644 --- a/gosa-core/include/functions.inc +++ b/gosa-core/include/functions.inc @@ -2896,16 +2896,29 @@ function get_languages($languages_in_own_language = FALSE,$strip_region_tag = FA * */ function get_post($name) { - if(!isset($_POST[$name])){ - trigger_error("Requested POST value (".$name.") does not exists, you should add a check to prevent this message."); - return(FALSE); - } + if(!isset($_POST[$name])){ + trigger_error("Requested POST value (".$name.") does not exists, you should add a check to prevent this message."); + return(FALSE); + } - if(get_magic_quotes_gpc()){ - $val = stripcslashes($_POST[$name]); - }else{ - $val = $_POST[$name]; - } + // Handle Posted Arrays + $tmp = array(); + if(is_array($_POST[$name]) && !is_string($_POST[$name])){ + foreach($_POST[$name] as $key => $val){ + if(get_magic_quotes_gpc()){ + $val = stripcslashes($val); + } + $tmp[$key] = $val; + } + return($tmp); + }else{ + + if(get_magic_quotes_gpc()){ + $val = stripcslashes($_POST[$name]); + }else{ + $val = $_POST[$name]; + } + } return($val); }