- Timestamp:
- 05/10/11 15:20:49 (13 years ago)
- Location:
- branches/2.2/contactcenter/inc
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.2/contactcenter/inc/class.bo_global_ldap_catalog.inc.php
r4205 r4313 151 151 // Find objects where 'mail' attribute is not null. 152 152 $filter = "(&".$filter."(mail=*))"; 153 154 if(strstr($this->src_info['context'], "ldap://")) { 155 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $this->src_info['context'])); 156 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $this->src_info['context']); 157 $this->src_info['host'] = $host; 158 } 159 if($refer_context || "ou" === strtolower(substr($this->src_info['context'], 0, 2))) 160 { 161 $followReferral = false; 162 } 163 elseif(trim($rules[4]['value']) != "inetOrgPerson") 164 { 165 $followReferral = true; 166 } 167 else 168 { 169 return false; 170 } 171 172 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], $followReferral); 173 $result_r = $recursive ? ldap_search($ldap ,($refer_context ? $refer_context : $this->src_info['context']), $filter, $fields, 0, $this->src_info['max_results']) : 174 ldap_list($ldap , ($refer_context ? $refer_context : $this->src_info['context']), $filter, $fields, 0, $this->src_info['max_results']); 153 154 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->src_info['host'], $this->src_info['acc'], $this->src_info['pw'], true); 155 $result_r = $recursive ? ldap_search($ldap , $this->src_info['context'], $filter, $fields, 0, $this->src_info['max_results']) : 156 ldap_list($ldap , $this->src_info['context'], $filter, $fields, 0, $this->src_info['max_results']); 175 157 176 158 if (!$result_r) -
branches/2.2/contactcenter/inc/class.bo_ldap_manager.inc.php
r4241 r4313 269 269 } 270 270 271 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], false);271 $ldap = $GLOBALS['phpgw']->common->ldapConnect($this->srcs[$id_source]['host'], $this->srcs[$id_source]['acc'],$this->srcs[$id_source]['pw'], true); 272 272 if (!$ldap) 273 273 { … … 467 467 function get_ldap_tree_level($id_source, $resource, $context, $objectClass, $branch_dn, $external = 0) 468 468 { 469 if(strstr($context, "ldap://")){470 $refer_context = str_replace("??base","",preg_replace('!^(ldap://[^/]+)/(.*$)!', '\\2', $context));471 $host = preg_replace('!^(ldap://[^/]+)/.*$!', '\\1', $context);472 $resource = ldap_connect($host);473 ldap_bind($resource);474 }475 476 469 /* 477 470 * TODO: Search timeouts 478 471 */ 479 472 480 $dn_parts = ldap_explode_dn( ($refer_context ? $refer_context : $context),1);473 $dn_parts = ldap_explode_dn($context,1); 481 474 //$filter = '(!(objectClass='.$objectClass.'))'; 482 475 // Don't show OU's whith phpgwAccountVisible equal to '-1' … … 491 484 // and whose attribute phpgwAccountVisible value is different from -1 492 485 $filter = '(&(!(objectClass='.$objectClass.')) (!(phpgwAccountVisible=-1)))'; 493 } 494 $result_res = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, array(), 0, 0); 486 $context = preg_replace("/dc=(.*)/i",$this->srcs[$id_source]['dn'],$context); 487 } 488 $result_res = @ldap_list($resource, $context, $filter, array(), 0, 0); 495 489 @ldap_sort($resource, $result_res, 'ou'); 496 490 … … 509 503 $filter = '(objectClass='.$objectClass.')'; 510 504 // Get only one attribute of the source's objectClass 511 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1);505 $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 512 506 $entries_count = ldap_count_entries($resource, $result_res2); 513 507 … … 551 545 'name' => $this->translate_accentuation($dn_parts_1[0]), 552 546 'type' => 'unknown', 553 'value' => ($refer_context ? $host."/" : "").$dn,547 'value' => $dn, 554 548 'sub_branch' => false 555 549 ); … … 558 552 $i++; 559 553 } 560 561 if(! $refer_context) {562 $array_referral = $this -> get_ldap_sub_branches_referrals($resource, $context,'(objectClass=organizationalUnit)');563 for($z = 0; $z < count($array_referral); $z++) {564 $tree['sub_branch'][$i++] = $array_referral[$z];565 }566 }567 568 554 $filter = 'objectClass='.$objectClass; 569 $result_res2 = @ldap_list($resource, ($refer_context ? $refer_context : $context), $filter, Array('cn'), 0, 1);555 $result_res2 = @ldap_list($resource, $context, $filter, Array('cn'), 0, 1); 570 556 $entries_count = ldap_count_entries($resource, $result_res2); 571 557
Note: See TracChangeset
for help on using the changeset viewer.