- Timestamp:
- 06/17/08 14:41:55 (16 years ago)
- Location:
- trunk/contactcenter/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/contactcenter/inc/class.bo_global_ldap_catalog.inc.php
r285 r314 133 133 $filter = $this->process_restrictions($rules, $trans_f); 134 134 135 if(strstr($this->src_info['context'], "ldap://")) { 136 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $this->src_info['context'])); 137 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $this->src_info['context']); 138 $this->src_info['host'] = $host; 139 } 140 141 if($refer_context || "ou" === strtolower(substr($this->src_info['context'], 0, 2))) 142 { 143 $followReferral = false; 144 } 145 elseif(trim($rules[4]['value']) != "inetOrgPerson") 135 if("ou" === strtolower(substr($this->src_info['context'], 0, 2)) || 136 (trim($rules[4]['value']) != "inetOrgPerson")) 146 137 { 147 $followReferral = true; 138 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], true); 139 $result_r = ldap_search($ldap , $this->src_info['context'], $filter, $fields, 0); 148 140 } 149 141 else … … 152 144 } 153 145 154 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], $followReferral);155 $result_r = ldap_search($ldap ,($refer_context ? $refer_context : $this->src_info['context']), $filter, $fields, 0);156 146 157 147 if (!$result_r) … … 570 560 } 571 561 572 $resource = ldap_read($ldap, $id_contact, 'objectClass='.$this->src_info['obj']);573 $n_entries = ldap_count_entries($ldap, $resource);562 $resource = @ldap_read($ldap, $id_contact, 'objectClass='.$this->src_info['obj']); 563 $n_entries = @ldap_count_entries($ldap, $resource); 574 564 if ( $n_entries > 1 or $n_entries < 1) 575 565 { -
trunk/contactcenter/inc/class.bo_ldap_manager.inc.php
r285 r314 249 249 } 250 250 251 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], false);251 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], true); 252 252 if (!$ldap) 253 253 { … … 410 410 else 411 411 return false; 412 413 412 414 } 413 415 … … 447 449 function get_ldap_tree_level($id_source, $resource, $context, $objectClass, $branch_dn, $external = 0) 448 450 { 449 if(strstr($context, "ldap://")){ 450 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $context)); 451 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $context); 452 $resource = ldap_connect($host); 453 ldap_bind($resource); 454 } 455 451 456 452 /* 457 453 * TODO: Search timeouts 458 454 */ 459 460 $dn_parts = ldap_explode_dn( ($refer_context ? $refer_context : $context),1);455 456 $dn_parts = ldap_explode_dn($context,1); 461 457 //$filter = '(!(objectClass='.$objectClass.'))'; 462 458 // Don't show OU's whith phpgwAccountVisible equal to '-1' … … 472 468 $filter = '(&(!(objectClass='.$objectClass.')) (!(phpgwAccountVisible=-1)))'; 473 469 } 474 $result_res = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, array(), 0, 0);470 $result_res = @ldap_list($resource, $context, $filter, array(), 0, 0); 475 471 @ldap_sort($resource, $result_res, 'ou'); 476 472 477 473 // Timeouts commented out 478 474 /* … … 484 480 485 481 $count = ldap_count_entries($resource,$result_res); 486 482 487 483 if ( $count == 0 ) 488 484 { 489 485 $filter = '(objectClass='.$objectClass.')'; 490 486 // Get only one attribute of the source's objectClass 491 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1);487 $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 492 488 $entries_count = ldap_count_entries($resource, $result_res2); 493 489 … … 513 509 } 514 510 } 515 511 516 512 $sub_branch_found = false; 517 513 $i = 0; … … 531 527 'name' => $this->translate_accentuation($dn_parts_1[0]), 532 528 'type' => 'unknown', 533 'value' => ($refer_context ? $host."/" : "").$dn,529 'value' => $dn, 534 530 'sub_branch' => false 535 531 ); … … 538 534 $i++; 539 535 } 540 541 if(! $refer_context) { 542 $array_referral = $this -> get_ldap_sub_branches_referrals($resource, $context,'(objectClass=organizationalUnit)'); 543 for($z = 0; $z < count($array_referral); $z++) { 544 $tree['sub_branch'][$i++] = $array_referral[$z]; 545 } 546 } 547 536 548 537 $filter = 'objectClass='.$objectClass; 549 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1);538 $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 550 539 $entries_count = ldap_count_entries($resource, $result_res2); 551 540
Note: See TracChangeset
for help on using the changeset viewer.