| | |
| | | <?php |
| | | |
| | | /* |
| | | /** |
| | | +-----------------------------------------------------------------------+ |
| | | | This file is part of the Roundcube Webmail client | |
| | | | Copyright (C) 2006-2013, The Roundcube Dev Team | |
| | |
| | | $this->_connect(); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Establish a connection to the LDAP server |
| | | */ |
| | | * Establish a connection to the LDAP server |
| | | */ |
| | | private function _connect() |
| | | { |
| | | $rcube = rcube::get_instance(); |
| | |
| | | return $this->ready; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Close connection to LDAP server |
| | | */ |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Returns address book name |
| | | * |
| | |
| | | { |
| | | return $this->prop['name']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal list page |
| | |
| | | $this->ldap->set_vlv_page($this->list_page, $this->page_size); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Set internal sort settings |
| | | * |
| | |
| | | $this->sort_col = $this->coltypes[$sort_col]['attributes'][0]; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Save a search string for future listings |
| | | * |
| | |
| | | { |
| | | $this->filter = $filter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Getter for saved search properties |
| | |
| | | return $this->filter; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Reset all saved results and search parameters |
| | | */ |
| | |
| | | $this->filter = ''; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * List the current set of contact records |
| | | * |
| | | * @param array List of cols to show |
| | | * @param int Only return this number of records |
| | | * @param array List of cols to show |
| | | * @param int Only return this number of records |
| | | * |
| | | * @return array Indexed list of contact records, each a hash array |
| | | * @return array Indexed list of contact records, each a hash array |
| | | */ |
| | | function list_records($cols=null, $subset=0) |
| | | { |
| | |
| | | return strcmp($a[$this->sort_col][0], $b[$this->sort_col][0]); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Search contacts |
| | | * |
| | |
| | | return $this->result; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Count number of available contacts in database |
| | | * |
| | |
| | | |
| | | return new rcube_result_set($count, ($this->list_page-1) * $this->page_size); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return the last result set |
| | |
| | | |
| | | return $err; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Check the given data before saving. |
| | |
| | | return true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Create a new contact record |
| | | * |
| | |
| | | |
| | | return $dn; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Update a specific contact record |
| | |
| | | return $newdn ? $newdn : true; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Mark one or more contact records as deleted |
| | | * |
| | |
| | | |
| | | return count($ids); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Remove all contact records |
| | |
| | | } |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Converts LDAP entry into an array |
| | | */ |
| | |
| | | return $out; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Return LDAP attribute(s) for the given field |
| | | */ |
| | |
| | | { |
| | | return (array)$this->coltypes[$field]['attributes']; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * Convert a record data set into LDAP field attributes |
| | |
| | | return $default; |
| | | } |
| | | |
| | | |
| | | /** |
| | | * HTML-safe DN string encoding |
| | | * |
| | |
| | | $str = str_pad(strtr($str, '-_', '+/'), strlen($str) % 4, '=', STR_PAD_RIGHT); |
| | | return base64_decode($str); |
| | | } |
| | | |
| | | } |