You are here

function _ldapdata_init in LDAP integration 6

Initiates the LDAPInterfase class.

Parameters

$sid: A server ID or user object.

6 calls to _ldapdata_init()
ldapdata_admin_edit_submit in ./ldapdata.admin.inc
Submit hook for the settings form.
ldapdata_node_update in ./ldapdata.module
Drupal 7 hook_node_update. Handles the case of content profile updates being written back to ldap if needed.
_ldapdata_ajax_test in ./ldapdata.admin.inc
Implements the AJAX server test.
_ldapdata_user_load in ./ldapdata.module
Implements hook_user() load operation.
_ldapdata_user_submit in ./ldapdata.module
Implements hook_user() submit operation.

... See full list

File

./ldapdata.module, line 817
ldapdata provides data maping against ldap server.

Code

function _ldapdata_init($sid) {
  global $_ldapdata_ldap;
  if (!($sid = is_object($sid) ? isset($sid->ldap_config) ? $sid->ldap_config : NULL : $sid)) {
    return;
  }

  // Other modules can invoke user load from hook_init() before ldapdata.
  // so get include files if we need them.
  if (!function_exists("ldapauth_server_load")) {
    module_load_include('inc', 'ldapauth', 'includes/ldap.core');
    module_load_include('inc', 'ldapauth', 'includes/LDAPInterface');
  }
  $server = ldapauth_server_load($sid);
  if (!empty($server)) {
    $_ldapdata_ldap = new LDAPInterface();
    $_ldapdata_ldap
      ->setOption('sid', $sid);
    $_ldapdata_ldap
      ->setOption('name', $server->name);
    $_ldapdata_ldap
      ->setOption('machine_name', $server->machine_name);
    $_ldapdata_ldap
      ->setOption('server', $server->server);
    $_ldapdata_ldap
      ->setOption('port', $server->port);
    $_ldapdata_ldap
      ->setOption('tls', $server->tls);
    $_ldapdata_ldap
      ->setOption('enc_type', $server->enc_type);
    $_ldapdata_ldap
      ->setOption('basedn', $server->basedn);
    $_ldapdata_ldap
      ->setOption('user_attr', $server->user_attr);
    $_ldapdata_ldap
      ->setOption('mail_attr', $server->mail_attr);
    $_ldapdata_ldap
      ->setOption('puid_attr', $server->puid_attr);
    $_ldapdata_ldap
      ->setOption('binary_puid', $server->binary_puid);
    $_ldapdata_ldap
      ->setOption('attr_filter', '_ldapdata_attribute_filter');
    return $_ldapdata_ldap;
  }
  return FALSE;
}