Changeset 0131ec9 in github
- Timestamp:
- Aug 29, 2009 1:10:53 PM (4 years ago)
- Branches:
- master, HEAD, courier-fix, dev-browser-capabilities, pdo, release-0.6, release-0.7, release-0.8
- Children:
- e83f035
- Parents:
- 6855ce6
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/rcube_ldap.php (modified) (15 diffs)
Legend:
- Unmodified
- Added
- Removed
-
CHANGELOG
r6855ce6 r0131ec9 2 2 =========================== 3 3 4 - Fix LDAP attributes case senitivity problems (#1485830) 4 5 - Fix LDAP addressbook browsing when only one directory is used (#1486022) 5 6 - Fix endless loop on error response for APPEND command (#1486060) -
program/include/rcube_ldap.php
r6855ce6 r0131ec9 56 56 foreach ($p as $prop => $value) 57 57 if (preg_match('/^(.+)_field$/', $prop, $matches)) 58 $this->fieldmap[$matches[1]] = $value;59 60 $this->sort_col = $p[ "sort"];58 $this->fieldmap[$matches[1]] = strtolower($value); 59 60 $this->sort_col = $p['sort']; 61 61 62 62 $this->connect(); … … 103 103 104 104 // User specific access, generate the proper values to use. 105 if ($this->prop[ "user_specific"]) {105 if ($this->prop['user_specific']) { 106 106 // No password set, use the session password 107 107 if (empty($this->prop['bind_pass'])) { … … 167 167 if ($this->conn) 168 168 { 169 @ldap_unbind($this->conn);169 ldap_unbind($this->conn); 170 170 $this->conn = null; 171 171 } … … 252 252 // count contacts for this user 253 253 $this->result = $this->count(); 254 254 255 255 // we have a search result resource 256 256 if ($this->ldap_result && $this->result->count > 0) 257 257 { 258 if ($this->sort_col && $this->prop['scope'] !== "base")259 @ldap_sort($this->conn, $this->ldap_result, $this->sort_col);258 if ($this->sort_col && $this->prop['scope'] !== 'base') 259 ldap_sort($this->conn, $this->ldap_result, $this->sort_col); 260 260 261 261 $start_row = $subset < 0 ? $this->result->first + $this->page_size + $subset : $this->result->first; … … 382 382 if ($this->conn && $dn) 383 383 { 384 $this->ldap_result = @ldap_read($this->conn, base64_decode($dn), "(objectclass=*)", array_values($this->fieldmap));384 $this->ldap_result = ldap_read($this->conn, base64_decode($dn), "(objectclass=*)", array_values($this->fieldmap)); 385 385 $entry = @ldap_first_entry($this->conn, $this->ldap_result); 386 386 387 387 if ($entry && ($rec = ldap_get_attributes($this->conn, $entry))) 388 388 { 389 $rec = array_change_key_case($rec, CASE_LOWER); 390 389 391 // Add in the dn for the entry. 390 $rec[ "dn"] = base64_decode($dn);392 $rec['dn'] = base64_decode($dn); 391 393 $res = $this->_ldap2result($rec); 392 394 $this->result = new rcube_result_set(1); … … 409 411 // Map out the column names to their LDAP ones to build the new entry. 410 412 $newentry = array(); 411 $newentry[ "objectClass"] = $this->prop["LDAP_Object_Classes"];413 $newentry['objectClass'] = $this->prop['LDAP_Object_Classes']; 412 414 foreach ($save_cols as $col => $val) { 413 $fld = "";414 415 $fld = $this->_map_field($col); 415 if ($fld != "") {416 if ($fld != '') { 416 417 // The field does exist, add it to the entry. 417 418 $newentry[$fld] = $val; … … 422 423 // We know that the email address is required as a default of rcube, so 423 424 // we will default its value into any unfilled required fields. 424 foreach ($this->prop[ "required_fields"] as $fld) {425 foreach ($this->prop['required_fields'] as $fld) { 425 426 if (!isset($newentry[$fld])) { 426 $newentry[$fld] = $newentry[$this->_map_field( "email")];427 $newentry[$fld] = $newentry[$this->_map_field('email')]; 427 428 } // end if 428 429 } // end foreach 429 430 430 431 // Build the new entries DN. 431 $dn = $this->prop[ "LDAP_rdn"]."=".$newentry[$this->prop["LDAP_rdn"]].",".$this->prop['base_dn'];432 $res = @ldap_add($this->conn, $dn, $newentry);432 $dn = $this->prop['LDAP_rdn'].'='.$newentry[$this->prop['LDAP_rdn']].','.$this->prop['base_dn']; 433 $res = ldap_add($this->conn, $dn, $newentry); 433 434 if ($res === FALSE) { 434 435 return false; … … 456 457 $deletedata = array(); 457 458 foreach ($save_cols as $col => $val) { 458 $fld = "";459 459 $fld = $this->_map_field($col); 460 if ($fld != "") {460 if ($fld != '') { 461 461 // The field does exist compare it to the ldap record. 462 462 if ($record[$col] != $val) { … … 466 466 $newdata[$fld] = $val; 467 467 } // end if 468 elseif ($val == "") {468 elseif ($val == '') { 469 469 // Field supplied is empty, verify that it is not required. 470 if (!in_array($fld, $this->prop[ "required_fields"])) {470 if (!in_array($fld, $this->prop['required_fields'])) { 471 471 // It is not, safe to clear. 472 472 $deletedata[$fld] = $record[$col]; … … 485 485 if (!empty($deletedata)) { 486 486 // Delete the fields. 487 $res = @ldap_mod_del($this->conn, $dn, $deletedata);487 $res = ldap_mod_del($this->conn, $dn, $deletedata); 488 488 if ($res === FALSE) { 489 489 return false; … … 493 493 if (!empty($replacedata)) { 494 494 // Replace the fields. 495 $res = @ldap_mod_replace($this->conn, $dn, $replacedata);495 $res = ldap_mod_replace($this->conn, $dn, $replacedata); 496 496 if ($res === FALSE) { 497 497 return false; … … 501 501 if (!empty($newdata)) { 502 502 // Add the fields. 503 $res = @ldap_mod_add($this->conn, $dn, $newdata);503 $res = ldap_mod_add($this->conn, $dn, $newdata); 504 504 if ($res === FALSE) { 505 505 return false; … … 521 521 if (!is_array($ids)) { 522 522 // Not an array, break apart the encoded DNs. 523 $dns = explode( ",", $ids);523 $dns = explode(',', $ids); 524 524 } // end if 525 525 … … 527 527 $dn = base64_decode($id); 528 528 // Delete the record. 529 $res = @ldap_delete($this->conn, $dn);529 $res = ldap_delete($this->conn, $dn); 530 530 if ($res === FALSE) { 531 531 return false; … … 592 592 } 593 593 594 595 594 } 596 595 597 596 ?>
Note: See TracChangeset
for help on using the changeset viewer.
