]> git.wh0rd.org Git - tt-rss.git/commitdiff
ldap auth: support LDAP extra attributes (closes #363)
authorAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 23 Aug 2011 08:03:11 +0000 (12:03 +0400)
committerAndrew Dolgov <fox@madoka.volgo-balt.ru>
Tue, 23 Aug 2011 08:03:11 +0000 (12:03 +0400)
functions.php

index 73898f6978759c122192969c67d4e31030f16252..694f5bef973e467de69686fc245e9f5e9ae64218 100644 (file)
                                // LemonLDAP can send user informations via HTTP HEADER
                                if (defined('AUTO_CREATE_USER') && AUTO_CREATE_USER){
                                        // update user name
-                                       if ($_SERVER['HTTP_USER_NAME']){
-                                               $fullname = db_escape_string($_SERVER['HTTP_USER_NAME']);
+                                       $fullname = $_SERVER['HTTP_USER_NAME'] ? $_SERVER['HTTP_USER_NAME'] : $_SERVER['AUTHENTICATE_CN'];
+                                       if ($fullname){
+                                               $fullname = db_escape_string($fullname);
                                                db_query($link, "UPDATE ttrss_users SET full_name = '$fullname' WHERE id = " .
                                                        $_SESSION["uid"]);
                                        }
                                        // update user mail
-                                       if ($_SERVER['HTTP_USER_MAIL']){
-                                               $email = db_escape_string($_SERVER['HTTP_USER_MAIL']);
+                                       $email = $_SERVER['HTTP_USER_MAIL'] ? $_SERVER['HTTP_USER_MAIL'] : $_SERVER['AUTHENTICATE_MAIL'];
+                                       if ($email){
+                                               $email = db_escape_string($email);
                                                db_query($link, "UPDATE ttrss_users SET email = '$email' WHERE id = " .
                                                        $_SESSION["uid"]);
                                        }