Fixed small bug that sometimes gave users a blank name
Signed-off-by: Edouard Poitras <edouard@eclipse.org>
diff --git a/thankyou.php b/thankyou.php
index 48f0c4d..cf57554 100644
--- a/thankyou.php
+++ b/thankyou.php
@@ -176,13 +176,9 @@
$ldapuid = getLDAPUIDFromEmail($_POST['login']);
$friend_id = $check_friends->selectFriendID("uid", $ldapuid);
if (!$friend_id) { // If no friend_id found, create the friend based on ldap information
- // Should move this to using LDAP attributes instead
- $sql = "SELECT userid, realname FROM profiles WHERE login_name = " . $App->returnQuotedString($_POST['login']);
- $result = $App->bugzilla_sql($sql);
- $values = mysql_fetch_array($result);
- $name = explode(' ', $values['realname']);
- $firstname = $name[0];
- $lastname = $name[1];
+ $dn = $LDAP->getDNFromMail($_POST['login']);
+ $firstname = $LDAP->getLDAPAttribute($dn, 'givenName');
+ $lastname = $LDAP->getLDAPAttribute($dn, 'sn');
$anon_friend->setFirstName($firstname);
$anon_friend->setLastName($lastname);
$anon_friend->setEmail($_POST['login']);