Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added function get_first_string to better handle multi-valued attributes

  • Loading branch information...
commit 14d62a551a02a5f0ebe07ade46aa545b677647a4 1 parent 7ec4912
exe-cutor authored
Showing with 18 additions and 4 deletions.
  1. +18 −4 auth/shibboleth/lib.php
View
22 auth/shibboleth/lib.php
@@ -1,7 +1,11 @@
<?PHP // $Id$
//CHANGELOG:
-//28.10.2004 SHIBBOLETH Authentication functions v.0.1
-//Distributed under GPL (c)Markus Hagman 2004-
+//10.2004 SHIBBOLETH Authentication functions v.0.1
+//05.2005 Various extensions and fixes by Lukas Haemmerle
+//10.2005 Added better error messags
+//05.2006 Added better handling of mutli-valued attributes
+//
+//Distributed under GPL (c)Markus Hagman 2004-2006
function auth_user_login($username, $password) {
global $CFG;
@@ -41,9 +45,9 @@ function auth_get_userinfo($username) {
foreach ($attrmap as $key=>$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;
+
+}
?>
Please sign in to comment.
Something went wrong with that request. Please try again.