alecpl
2011-05-20 3253b296c21c54df228de39ff3e4775974df81d5
program/include/rcube_ldap.php
@@ -127,8 +127,9 @@
        if (!function_exists('ldap_connect'))
            raise_error(array('code' => 100, 'type' => 'ldap',
            'file' => __FILE__, 'line' => __LINE__,
            'message' => "No ldap support in this installation of PHP"), true);
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "No ldap support in this installation of PHP"),
                true, true);
        if (is_resource($this->conn))
            return true;
@@ -251,11 +252,10 @@
        }
        if (!function_exists('ldap_sasl_bind')) {
            raise_error(array(
                'code' => 100, 'type' => 'ldap',
            raise_error(array('code' => 100, 'type' => 'ldap',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Unable to bind: ldap_sasl_bind() not exists"),
            true, true);
                true, true);
        }
        if (!empty($authz)) {
@@ -310,11 +310,11 @@
        $this->_debug("S: ".ldap_error($this->conn));
        $error =  array(
                'code' => ldap_errno($this->conn), 'type' => 'ldap',
                'file' => __FILE__, 'line' => __LINE__,
                'message' => "Bind failed for dn=$dn: ".ldap_error($this->conn));
        raise_error($error,true);
        raise_error(array(
            'code' => ldap_errno($this->conn), 'type' => 'ldap',
            'file' => __FILE__, 'line' => __LINE__,
            'message' => "Bind failed for dn=$dn: ".ldap_error($this->conn)),
            true);
        return false;
    }
@@ -610,6 +610,26 @@
    /**
     * Check the given data before saving.
     * If input not valid, the message to display can be fetched using get_error()
     *
     * @param array Assoziative array with data to save
     * @return boolean True if input is valid, False if not.
     */
    public function validate($save_data)
    {
        // check for name input
        if (empty($save_data['name'])) {
            $this->set_error('warning', 'nonamewarning');
            return false;
        }
        // validate e-mail addresses
        return parent::validate($save_data);
    }
    /**
    * Create a new contact record
    *
    * @param array    Hash array with save data