From 14d62a551a02a5f0ebe07ade46aa545b677647a4 Mon Sep 17 00:00:00 2001 From: exe-cutor Date: Mon, 15 May 2006 06:55:08 +0000 Subject: [PATCH] Added function get_first_string to better handle multi-valued attributes --- auth/shibboleth/lib.php | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) 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; + +} ?> -- 2.39.5