- Timestamp:
- 12/13/11 13:05:05 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/2.3/expressoMail1_2/inc/class.ldap_functions.inc.php
r4906 r5246 171 171 172 172 // New search only on user sector 173 if ($ count_entries > $this->max_result)173 if ($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['cloud_ldap'] || $count_entries > $this->max_result) 174 174 { 175 175 // Close old ldap conection … … 190 190 return $return; 191 191 } 192 else 193 { 194 $quickSearch_only_in_userSector = true; 192 elseif($count_entries < 1){ 193 $return = array(); 194 return $return; 195 196 }else 197 { 198 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['cloud_ldap']) 199 $quickSearch_cloud = true; 200 else 201 $quickSearch_only_in_userSector = true; 195 202 } 196 203 } … … 226 233 for ($i=0; $i<$info["count"]; $i++) 227 234 { 228 if ($quickSearch_only_in_userSector )235 if ($quickSearch_only_in_userSector || $quickSearch_cloud) 229 236 { 230 237 $tmp[$info[$i]["mail"][0] . '%' . $info[$i]["telephonenumber"][0] . '%'. $info[$i]["mobile"][0] . '%' . $info[$i]["uid"][0] . '%' . $info[$i]["jpegphoto"]['count'] . '%' . $info[$i]["employeenumber"][0] . '%' . $info[$i]["ou"][0]] = utf8_decode($info[$i]["cn"][0]); … … 260 267 } 261 268 $contacts_result['quickSearch_only_in_userSector'] = $quickSearch_only_in_userSector; 269 $contacts_result['quickSearch_cloud'] = $quickSearch_cloud; 262 270 } 263 271 else … … 303 311 return $return; 304 312 } 313 } 314 if ($quickSearch_cloud) 315 { 316 $head_option = 317 '<tr class="quicksearchcontacts_unselected">' . 318 '<td colspan="2" width="100%" align="center">' . 319 $this->functions->getLang('Showing only the results found in your organization') . '.'. 320 '<input id="QuickSearchUser_button_search" type="button" onclick="QuickSearchUser.close_window();openListUsers(\'1\');" value="busca avançada">'. 321 '</td>' . 322 '</tr>'; 323 324 325 326 $contacts_result = $head_option . $options_users_from_user_org . $options; 327 305 328 } 306 329 else … … 414 437 $organizations = array(); 415 438 $params['referral']?$referral = $params['referral']:$referral = false; 439 $params['organization']?$org = "ou=".$params['organization'].",":$org = ""; 416 440 $cat = $params['catalog']; 417 418 $this->ldapConnect($referral,$cat); 419 420 if($this->branch != '') { 421 $filter="(&(".$this->branch."=*)(!(phpgwAccountVisible=-1)))"; 422 $justthese = array("$this->branch"); 423 $sr = ldap_list($this->ds, $this->ldap_context, $filter, $justthese); 424 $info = ldap_get_entries($this->ds, $sr); 425 426 if($info["count"] == 0) 427 { 428 $organizations[0]['ou'] = $this->ldap_context; 429 } 430 431 for ($i=0; $i<$info["count"]; $i++) 432 $organizations[$i] = $info[$i]["ou"][0]; 433 434 ldap_close($this->ds); 435 sort($organizations); 436 return $organizations; 437 }else{ 441 // primeiro nível de ou 442 $this->ldapConnect($referral,$cat); 443 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['cloud_ldap'] && $cat == 0) 444 { 445 $fistOu = substr($_SESSION['phpgw_info']['expressomail']['user']['account_dn'],strripos($_SESSION['phpgw_info']['expressomail']['user']['account_dn'], "ou=")); 446 } 447 else 448 { 449 $fistOu = $this->ldap_context; 450 } 451 if($this->branch != '') { 452 $filter="(&(".$this->branch."=*)(!(phpgwAccountVisible=-1)))"; 453 $justthese = array("$this->branch"); 454 $sr = ldap_list($this->ds, $org.$fistOu, $filter, $justthese); 455 $info = ldap_get_entries($this->ds, $sr); 456 if($info["count"] == 0) 457 { 458 return null; 459 } 460 for ($i=0; $i<$info["count"]; $i++) 461 $organizations[$i] = $info[$i]["ou"][0]; 462 ldap_close($this->ds); 463 sort($organizations); 464 return $organizations; 465 }else{ 438 466 return null; 439 467 } 440 468 } 441 469 function get_organizations2($params){ … … 540 568 $this->ldapConnect(true,$catalog); 541 569 542 $params['organization'] == 'all' ? $user_context = $this->ldap_context :$user_context = $this->branch."=".$params['organization'].",".$this->ldap_context; 543 570 if($_SESSION['phpgw_info']['user']['preferences']['expressoMail']['cloud_ldap'] && $catalog == 0) 571 $fistOu = substr($_SESSION['phpgw_info']['expressomail']['user']['account_dn'],strripos($_SESSION['phpgw_info']['expressomail']['user']['account_dn'], "ou=")); 572 else 573 $fistOu = $this->ldap_context; 574 575 if($params['organization_sub'] =="") 576 $params['organization_sub'] =="all"; 577 578 $params['organization'] == 'all' ? $user_context = $fistOu :$user_context = $this->branch."=".$params['organization'].",".$fistOu; 579 $params['organization_sub'] == 'all' ? $user_context = $user_context :$user_context = $this->branch."=".$params['organization_sub'].",".$user_context; 544 580 if ($this->ds) { 545 581 if ($catalog == 0){
Note: See TracChangeset
for help on using the changeset viewer.