| | |
| | | |
| | | // initialize ldap wrapper object |
| | | $this->ldap = new rcube_ldap_generic($this->prop); |
| | | $this->ldap->set_cache($this->cache); |
| | | $this->ldap->set_debug($this->debug); |
| | | $this->ldap->config_set(array('cache' => $this->cache, 'debug' => $this->debug)); |
| | | |
| | | $this->_connect(); |
| | | } |
| | |
| | | // we need to use a separate LDAP connection |
| | | if (!empty($this->prop['vlv'])) { |
| | | $ldap = new rcube_ldap_generic($this->prop); |
| | | $ldap->set_debug($this->debug); |
| | | $ldap->set_cache($this->cache); |
| | | $ldap->config_set(array('cache' => $this->cache, 'debug' => $this->debug)); |
| | | if (!$ldap->connect($host)) { |
| | | continue; |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | if (!$this->ldap->add($dn, $newentry)) { |
| | | if (!$this->ldap->add_entry($dn, $newentry)) { |
| | | $this->set_error(self::ERROR_SAVING, 'errorsaving'); |
| | | return false; |
| | | } |
| | |
| | | 'objectClass' => (array) $this->prop['sub_fields'][$xidx], |
| | | ); |
| | | |
| | | $this->ldap->add($xdn, $xf); |
| | | $this->ldap->add_entry($xdn, $xf); |
| | | } |
| | | |
| | | $dn = self::dn_encode($dn); |
| | |
| | | if (!empty($subdeldata)) { |
| | | foreach ($subdeldata as $fld => $val) { |
| | | $subdn = $fld.'='.rcube_ldap_generic::quote_string($val).','.$dn; |
| | | if (!$this->ldap->delete($subdn)) { |
| | | if (!$this->ldap->delete_entry($subdn)) { |
| | | return false; |
| | | } |
| | | } |
| | |
| | | $fld => $val, |
| | | 'objectClass' => (array) $this->prop['sub_fields'][$fld], |
| | | ); |
| | | $this->ldap->add($subdn, $xf); |
| | | $this->ldap->add_entry($subdn, $xf); |
| | | } |
| | | } |
| | | |
| | |
| | | if ($this->sub_filter) { |
| | | if ($entries = $this->ldap->list_entries($dn, $this->sub_filter)) { |
| | | foreach ($entries as $entry) { |
| | | if (!$this->ldap->delete($entry['dn'])) { |
| | | if (!$this->ldap->delete_entry($entry['dn'])) { |
| | | $this->set_error(self::ERROR_SAVING, 'errorsaving'); |
| | | return false; |
| | | } |
| | |
| | | } |
| | | |
| | | // Delete the record. |
| | | if (!$this->ldap->delete($dn)) { |
| | | if (!$this->ldap->delete_entry($dn)) { |
| | | $this->set_error(self::ERROR_SAVING, 'errorsaving'); |
| | | return false; |
| | | } |
| | | |
| | | // remove contact from all groups where he was member |
| | | // remove contact from all groups where he was a member |
| | | if ($this->groups) { |
| | | $dn = self::dn_encode($dn); |
| | | $group_ids = $this->get_record_groups($dn); |
| | |
| | | |
| | | if ($with_groups && $this->groups && ($groups = $this->_fetch_groups()) && count($groups)) { |
| | | foreach ($groups as $group) { |
| | | $this->ldap->delete($group['dn']); |
| | | $this->ldap->delete_entry($group['dn']); |
| | | } |
| | | |
| | | if ($this->cache) { |
| | |
| | | $this->debug = $dbg; |
| | | |
| | | if ($this->ldap) { |
| | | $this->ldap->set_debug($dbg); |
| | | $this->ldap->config_set('debug', $dbg); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | $ldap = clone $this->ldap; |
| | | $ldap->set_config($this->prop['groups']); |
| | | $ldap->config_set($this->prop['groups']); |
| | | $ldap->set_vlv_page($vlv_page+1, $page_size); |
| | | } |
| | | |
| | |
| | | $member_attr => '', |
| | | ); |
| | | |
| | | if (!$this->ldap->add($new_dn, $new_entry)) { |
| | | if (!$this->ldap->add_entry($new_dn, $new_entry)) { |
| | | $this->set_error(self::ERROR_SAVING, 'errorsaving'); |
| | | return false; |
| | | } |
| | |
| | | $group_cache = $this->_fetch_groups(); |
| | | $del_dn = $group_cache[$group_id]['dn']; |
| | | |
| | | if (!$this->ldap->delete($del_dn)) { |
| | | if (!$this->ldap->delete_entry($del_dn)) { |
| | | $this->set_error(self::ERROR_SAVING, 'errorsaving'); |
| | | return false; |
| | | } |