Changeset 1900 for trunk/jabberit_messenger/inc/class.ldap_im.inc.php
- Timestamp:
- 12/28/09 15:59:20 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jabberit_messenger/inc/class.ldap_im.inc.php
r1881 r1900 20 20 class ldap_im 21 21 { 22 private $attr _org;22 private $attribute; 23 23 private $common; 24 24 private $hostsJabber; … … 38 38 $this->ldap_pass = $_SESSION['phpgw_info']['jabberit_messenger']['password_ldap_jabberit']; 39 39 40 // Attributes org ldap;41 $this->attr_org = explode(",", $_SESSION['phpgw_info']['jabberit_messenger']['attributes_org_ldap_jabberit']);42 43 40 // Hosts Jabber 44 41 $this->hostsJabber = unserialize($_SESSION['phpgw_info']['jabberit_messenger']['map_org_realm_jabberit']); … … 47 44 $this->max_result = 30; 48 45 46 if ( file_exists('inc/attributeLdap.php') ) 47 { 48 require_once('attributeLdap.php'); 49 $this->attribute = trim($attributeTypeName); 50 } 49 51 } 50 52 … … 333 335 { 334 336 $filter = ( $uid ) ? "(&(phpgwaccounttype=u)(|".$uid.")(".$search ."))" : "(&(phpgwaccounttype=u)(".$search ."))"; 335 $justthese = array( "uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto");337 $justthese = array( $this->attribute ,"uidNumber" ,"cn" ,"mail" ,"phpgwAccountVisible" ,"dn" ,"jpegPhoto" ); 336 338 $searchRoot = ( $this->ldap_org != "*" ) ? "ou=".$this->ldap_org.",".$this->ldap_context : $this->ldap_context; 337 339 $search1 = @ldap_search($this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1); … … 358 360 $searchRoot = ( $ous ) ? $ous.",".$this->ldap_context : $this->ldap_context ; 359 361 $filter = "(&(phpgwaccounttype=u)(|".$uidnumber.")(".$search ."))"; 360 $justthese = array( "uid","uidNumber","cn","mail","phpgwAccountVisible","dn","jpegPhoto");362 $justthese = array( $this->attribute, "uidNumber", "cn", "mail", "phpgwAccountVisible", "dn", "jpegPhoto" ); 361 363 $search = ldap_search( $this->ldap, $searchRoot, $filter, $justthese, 0, $this->max_result + 1); 362 364 $entry = ldap_get_entries( $this->ldap, $search ); … … 369 371 private final function resultArray($pArray, $pConn, $pOrg = false) 370 372 { 371 $entry 372 $result 373 374 $j = 0;375 for( $i = 0 ; $i < $entry['count']; $i++)373 $entry = $pArray; 374 $result = array(); 375 $j = 0; 376 377 for( $i = 0 ; $i < $entry['count']; $i++ ) 376 378 { 377 379 if ( $entry[$i]['phpgwaccountvisible'][0] != '-1' ) 378 380 { 379 $result[$j]['uidnumber'] = $entry[$i]['uidnumber'][0]; 380 $result[$j]['mail'] = $entry[$i]['mail'][0]; 381 $result[$j]['uid'] = $entry[$i]['uid'][0]; 382 $result[$j]['jid'] = $entry[$i]['uid'][0]; 381 $result[$j]['uidnumber'] = $entry[$i]['uidnumber'][0]; 382 $result[$j]['mail'] = $entry[$i]['mail'][0]; 383 $result[$j]['uid'] = $entry[$i][$this->attribute][0]; 384 $result[$j]['jid'] = $entry[$i][$this->attribute][0]; 385 383 386 $ou = explode("dc=", $entry[$i]['dn']); 384 387 $ou = explode("ou=",$ou[0]); 385 388 $ou = array_pop($ou); 386 389 $result[$j]['ou'] = strtoupper(substr($ou,0,strlen($ou)-1)); 390 387 391 if( $pOrg === "*" ) 388 392 $result[$j]['ouAll'] = "*"; … … 404 408 405 409 $organization = $this->attr_org; 406 407 if(is_array($organization)) 408 { 409 foreach($organization as $attr) 410 { 411 $tmp = explode(";",$attr); 412 if( strtolower(trim($tmp[0])) == strtolower(trim($result[$i]['dn'])) ) 413 { 414 switch(strtolower(trim($tmp[1]))) 415 { 416 case "mail" : 417 $uid = $result[$i]['mail']; 418 $uid = substr($uid,0,strpos($uid,"@")); 419 $result[$i]['uid'] = $uid; 420 break; 421 422 case "description" : 423 // SERPRO 424 // parte antes do arroba; 425 $result[$i]['uid'] = $result[$i]['description']; 426 break; 427 } 428 } 429 } 430 } 431 } 410 } 411 432 412 return $result; 433 413 }
Note: See TracChangeset
for help on using the changeset viewer.