roundcubemail/plugins/acl/acl.php
private function init_ldap()
    {
        if ($this->ldap) {
            return $this->ldap->ready;
        }

        // get LDAP config
        $config = $this->rc->config->get('acl_users_source');

        if (empty($config)) {
            return false;
        }

        // not an array, use configured ldap_public source
        if (!is_array($config)) {
            $ldap_config = (array) $this->rc->config->get('ldap_public');
            $config      = $ldap_config[$config];
        }

        $uid_field = $this->rc->config->get('acl_users_field', 'mail');
        $filter    = $this->rc->config->get('acl_users_filter');

        if (empty($uid_field) || empty($config)) {
            return false;
        }

        // get name attribute
        if (!empty($config['fieldmap'])) {
            $name_field = $config['fieldmap']['name'];
        }
        // ... no fieldmap, use the old method
        if (empty($name_field)) {
            $name_field = $config['name_field'];
        }

        // add UID field to fieldmap, so it will be returned in a record with name
        $config['fieldmap']['name'] = $name_field;
        $config['fieldmap']['uid']  = $uid_field;

        // search in UID and name fields
        // $name_field can be in a form of <field>:<modifier> (#1490591)
        $name_field = preg_replace('/:.*$/', '', $name_field);
        $search     = array_unique(array($name_field, $uid_field));

        $config['search_fields']   = $search;
        $config['required_fields'] = array($uid_field);

        // set search filter
        if ($filter) {
            $config['filter'] = $filter;
        }

        // disable vlv
        $config['vlv'] = false;

        // Initialize LDAP connection
        $this->ldap = new rcube_ldap($config,
            $this->rc->config->get('ldap_debug'),
            $this->rc->config->mail_domain($_SESSION['imap_host']));

        return $this->ldap->ready;
    }
private function init_ldap()
    {
        if ($this->ldap) {
            return $this->ldap->ready;
        }

        // get LDAP config
        $config = $this->rc->config->get('acl_users_source');

        if (empty($config)) {
            return false;
        }

        // not an array, use configured ldap_public source
        if (!is_array($config)) {
            $ldap_config = (array) $this->rc->config->get('ldap_public');
            $config      = $ldap_config[$config];
        }

        $uid_field = $this->rc->config->get('acl_users_field', 'mail');
        $filter    = $this->rc->config->get('acl_users_filter');

        if (empty($uid_field) || empty($config)) {
            return false;
        }

        // get name attribute
        if (!empty($config['fieldmap'])) {
            $name_field = $config['fieldmap']['name'];
        }
        // ... no fieldmap, use the old method
        if (empty($name_field)) {
            $name_field = $config['name_field'];
        }

        // add UID field to fieldmap, so it will be returned in a record with name
        $config['fieldmap']['name'] = $name_field;
        $config['fieldmap']['uid']  = $uid_field;

        // search in UID and name fields
        // $name_field can be in a form of <field>:<modifier> (#1490591)
        $name_field = preg_replace('/:.*$/', '', $name_field);
        $search     = array_unique(array($name_field, $uid_field));

        $config['search_fields']   = $search;
        $config['required_fields'] = array($uid_field);

        // set search filter
        if ($filter) {
            $config['filter'] = $filter;
        }

        // disable vlv
        $config['vlv'] = false;

        // Initialize LDAP connection
        $this->ldap = new rcube_ldap($config,
            $this->rc->config->get('ldap_debug'),
            $this->rc->config->mail_domain($_SESSION['imap_host']));

        return $this->ldap->ready;
    }
private function init_ldap ( ) { if ( $ this -> ldap ) { return $ this -> ldap -> ready ; } // get LDAP config $ config = $ this -> rc -> config -> get ( 'acl_users_source' ) ; if ( empty ( $ config ) ) { return false ; } // not an array, use configured ldap_public source if ( ! is_array ( $ config ) ) { $ ldap_config = ( array ) $ this -> rc -> config -> get ( 'ldap_public' ) ; $ config = $ ldap_config [ $ config ] ; } $ uid_field = $ this -> rc -> config -> get ( 'acl_users_field' , 'mail' ) ; $ filter = $ this -> rc -> config -> get ( 'acl_users_filter' ) ; if ( empty ( $ uid_field ) || empty ( $ config ) ) { return false ; } // get name attribute if ( ! empty ( $ config [ 'fieldmap' ] ) ) { $ name_field = $ config [ 'fieldmap' ] [ 'name' ] ; } // ... no fieldmap, use the old method if ( empty ( $ name_field ) ) { $ name_field = $ config [ 'name_field' ] ; } // add UID field to fieldmap, so it will be returned in a record with name $ config [ 'fieldmap' ] [ 'name' ] = $ name_field ; $ config [ 'fieldmap' ] [ 'uid' ] = $ uid_field ; // search in UID and name fields // $name_field can be in a form of <field>:<modifier> (#1490591) $ name_field = preg_replace ( '/:.*$/' , '' , $ name_field ) ; $ search = array_unique ( array ( $ name_field , $ uid_field ) ) ; $ config [ 'search_fields' ] = $ search ; $ config [ 'required_fields' ] = array ( $ uid_field ) ; // set search filter if ( $ filter ) { $ config [ 'filter' ] = $ filter ; } // disable vlv $ config [ 'vlv' ] = false ; // Initialize LDAP connection $ this -> ldap = new rcube_ldap ( $ config , $ this -> rc -> config -> get ( 'ldap_debug' ) , $ this -> rc -> config -> mail_domain ( $ _SESSION [ 'imap_host' ] ) ) ; return $ this -> ldap -> ready ; }
Initializes autocomplete LDAP backend
Initializes autocomplete LDAP backend