Changeset 205 for trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
- Timestamp:
- 03/10/08 09:18:37 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/expressoMail1_2/inc/class.ldap_functions.inc.php
r176 r205 27 27 @ldap_bind($this->ds, $_SESSION['phpgw_info']['expressomail']['ldap_server']['acc'],$_SESSION['phpgw_info']['expressomail']['ldap_server']['pw']); 28 28 } 29 30 //Teste jakjr retornando o DS 31 function ldapConnect2($refer = false){ 32 $ds = ldap_connect($_SESSION['phpgw_info']['expressomail']['ldap_server']['host']); 33 34 if (!$ds) 35 return false; 36 37 ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3); 38 ldap_set_option($ds, LDAP_OPT_REFERRALS, $refer); 39 if ($refer) 40 ldap_set_rebind_proc($ds, ldapRebind); 41 @ldap_bind($ds, $_SESSION['phpgw_info']['expressomail']['ldap_server']['acc'],$_SESSION['phpgw_info']['expressomail']['ldap_server']['pw']); 42 43 return $ds; 44 } 45 29 46 30 47 // usa o host e context do setup. … … 439 456 } 440 457 441 function getUserByEmail($params){ 458 function getUserByEmail($params) 459 { 460 $filter="(&(phpgwAccountType=u)(mail=" . $params['email'] . "))"; 461 $ldap_context = $_SESSION['phpgw_info']['expressomail']['ldap_server']['dn']; 462 $justthese = array("cn","uid","telephoneNumber","jpegPhoto","mobile"); 463 442 464 // Follow the referral 443 $email = $params['email']; 444 $this->ldapConnect(true); 445 if ($this->ds) 446 { 447 $filter="(&(phpgwAccountType=u)(mail=$email))"; 448 $justthese = array("cn","uid","telephoneNumber","jpegPhoto","mobile"); 449 $sr=ldap_search($this->ds, $this->ldap_context, $filter, $justthese); 450 $entry = ldap_first_entry($this->ds, $sr); 465 $ds = $this->ldapConnect2(true); 466 if ($ds) 467 { 468 $sr=ldap_search($ds, $ldap_context, $filter, $justthese); 469 470 if (!$sr) 471 return null; 472 473 $entry = ldap_first_entry($ds, $sr); 474 451 475 if($entry) { 452 $obj = array("cn" => @ldap_get_values($this->ds, $entry, "cn"),453 "email" => $ email,454 "uid" => @ldap_get_values($this->ds, $entry, "uid"),476 $obj = array("cn" => ldap_get_values($ds, $entry, "cn"), 477 "email" => $params['email'], 478 "uid" => ldap_get_values($ds, $entry, "uid"), 455 479 "type" => "global", 456 "mobile" => @ldap_get_values($this->ds, $entry, "mobile"), 457 "telefone" => @ldap_get_values($this->ds, $entry, "telephonenumber")); 458 459 $_SESSION['phpgw_info']['expressomail']['contact_photo'] = @ldap_get_values_len($this->ds, $entry, "jpegphoto"); 460 ldap_close($this->ds); 480 "mobile" => @ldap_get_values($ds, $entry, "mobile"), 481 "telefone" => @ldap_get_values($ds, $entry, "telephonenumber") 482 ); 483 484 $_SESSION['phpgw_info']['expressomail']['contact_photo'] = ldap_get_values_len($ds, $entry, "jpegphoto"); 485 ldap_close($ds); 461 486 return $obj; 462 } 487 } 463 488 } 464 489 return null;
Note: See TracChangeset
for help on using the changeset viewer.