From: exe-cutor Date: Mon, 15 May 2006 06:55:08 +0000 (+0000) Subject: Added function get_first_string to better handle multi-valued attributes X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=14d62a551a02a5f0ebe07ade46aa545b677647a4;p=moodle.git Added function get_first_string to better handle multi-valued attributes --- diff --git a/auth/shibboleth/lib.php b/auth/shibboleth/lib.php index 37f04b9e0f..62d9bd02c2 100755 --- a/auth/shibboleth/lib.php +++ b/auth/shibboleth/lib.php @@ -1,7 +1,11 @@ $value) { if (!empty($CFG->unicodedb)) { - $result[$key]=$_SERVER[$value]; + $result[$key]= get_first_string($_SERVER[$value]); } else { - $result[$key]=utf8_decode($_SERVER[$value]); + $result[$key]=get_first_string(utf8_decode($_SERVER[$value])); } } @@ -84,4 +88,14 @@ function auth_shib_attributes(){ return $moodleattributes; } + +function get_first_string($string){ +// Cleans and returns first of potential many values (multi-valued attributes) + + $list = split( ';', $string); + $clean_string = rtrim($list[0]); + + return $clean_string; + +} ?>