You are here

public static function SimpleLdap::ldap_set_option in Simple LDAP 7.2

Same name and namespace in other branches
  1. 7 SimpleLdap.class.php \SimpleLdap::ldap_set_option()

Wrapper function for ldap_set_option().

@throw SimpleLdapException

Parameters

resource $link_identifier: An LDAP link identifier.

int $option: The parameter option. @see http://us2.php.net/manual/en/function.ldap-set-option.php

mixed $newval: The new value for the specified option.

Return value

boolean TRUE on success.

2 calls to SimpleLdap::ldap_set_option()
SimpleLdapServer::connect in ./SimpleLdapServer.class.php
Connect to the LDAP server.
SimpleLdapServer::__set in ./SimpleLdapServer.class.php
Magic __set() function, handles changing server settings.

File

./SimpleLdap.class.php, line 1205
Class defining base Simple LDAP functionallity.

Class

SimpleLdap
Simple LDAP class.

Code

public static function ldap_set_option($link_identifier, $option, $newval) {

  // Devel debugging.
  if (variable_get('simple_ldap_devel', FALSE)) {
    dpm(__FUNCTION__);
    dpm(array(
      '$option' => $option,
      '$newval' => $newval,
    ));
  }

  // Wrapped function call.
  $return = @ldap_set_option($link_identifier, $option, $newval);

  // Debugging.
  if (variable_get('simple_ldap_debug', FALSE)) {
    $message = __FUNCTION__ . '($link_identifier = @link_identifier, $option = @option, $newval = @newval) returns @return';
    $variables = array(
      '@link_identifier' => print_r($link_identifier, TRUE),
      '@option' => print_r($option, TRUE),
      '@newval' => print_r($newval, TRUE),
      '@return' => print_r($return, TRUE),
    );
    watchdog('simple_ldap', $message, $variables, WATCHDOG_DEBUG);
  }

  // Error handling.
  if (!$return) {
    throw new SimpleLdapException($link_identifier);
  }
  return $return;
}