/** * Creates the initial ldap-object * * Static function that returns either an error object or the new Net_LDAP * object. Something like a factory. Takes a config array with the needed * parameters. * * @param array $config Configuration array * * @access public * @return Net_LDAP_Error|Net_LDAP Net_LDAP_Error or Net_LDAP object */ function &connect($config = array()) { $ldap_check = Net_LDAP::checkLDAPExtension(); if (Net_LDAP::iserror($ldap_check)) { return $ldap_check; } @($obj =& new Net_LDAP($config)); // todo? better errorhandling for setConfig()? // connect and bind with credentials in config $err = $obj->bind(); if (Net_LDAP::isError($err)) { return $err; } return $obj; }
/** * Creates the initial ldap-object * * Static function that returns either an error object or the new Net_LDAP * object. Something like a factory. Takes a config array with the needed * parameters. * * @access public * @param array $config Configuration array * @return Net_LDAP_Error|Net_LDAP Net_LDAP_Error or Net_LDAP object */ function &connect($config = array()) { $ldap_check = Net_LDAP::checkLDAPExtension(); if (Net_LDAP::iserror($ldap_check)) { return $ldap_check; } @($obj =& new Net_LDAP($config)); $err = $obj->bind(); if (Net_LDAP::isError($err)) { return $err; } return $obj; }