コード例 #1
0
ファイル: LdapManager.php プロジェクト: stopfstedt/ilios
 /**
  * Get an instance of the LDAP object
  *
  * @return LDAP
  */
 protected function getLdap()
 {
     $now = time();
     if ($this->connectionLastUsed && $this->ldap && $now - $this->connectionLastUsed > self::RESET_TIMEOUT) {
         $this->ldap->close();
         $this->ldap = null;
     }
     $this->connectionLastUsed = $now;
     if (!empty($this->ldap)) {
         return $this->ldap;
     }
     $this->ldap = new Ldap($this->ldapUrl);
     $this->ldap->setOption(Ldap::OPT_NETWORK_TIMEOUT, 10);
     $this->ldap->bind($this->ldapBindUser, $this->ldapBindPassword);
     return $this->ldap;
 }