* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace Symfony\Component\Ldap; @trigger_error('The '.__NAMESPACE__.'\LdapClient class is deprecated since Symfony 3.1 and will be removed in 4.0. Use the Ldap class directly instead.', E_USER_DEPRECATED); /** * @author Grégoire Pineau * @author Francis Besset * @author Charles Sarrazin * * @deprecated since version 3.1, to be removed in 4.0. Use the Ldap class instead. */ final class LdapClient implements LdapClientInterface { private $ldap; public function __construct($host = null, $port = 389, $version = 3, $useSsl = false, $useStartTls = false, $optReferrals = false, LdapInterface $ldap = null) { $config = $this->normalizeConfig($host, $port, $version, $useSsl, $useStartTls, $optReferrals); $this->ldap = null !== $ldap ? $ldap : Ldap::create('ext_ldap', $config); } /** * {@inheritdoc} */ public function bind($dn = null, $password = null) { $this->ldap->bind($dn, $password); } /** * {@inheritdoc} */ public function query($dn, $query, array $options = array()) { return $this->ldap->query($dn, $query, $options); } /** * {@inheritdoc} */ public function getEntryManager() { return $this->ldap->getEntryManager(); } /** * {@inheritdoc} */ public function find($dn, $query, $filter = '*') { @trigger_error('The "find" method is deprecated since Symfony 3.1 and will be removed in 4.0. Use the "query" method instead.', E_USER_DEPRECATED); $query = $this->ldap->query($dn, $query, array('filter' => $filter)); $entries = $query->execute(); $result = array( 'count' => 0, ); foreach ($entries as $entry) { $resultEntry = array(); foreach ($entry->getAttributes() as $attribute => $values) { $resultAttribute = array( 'count' => count($values), ); foreach ($values as $val) { $resultAttribute[] = $val; } $attributeName = strtolower($attribute); $resultAttribute['count'] = count($values); $resultEntry[$attributeName] = $resultAttribute; $resultEntry[] = $attributeName; } $resultEntry['count'] = count($resultEntry) / 2; $resultEntry['dn'] = $entry->getDn(); $result[] = $resultEntry; } $result['count'] = count($result) - 1; return $result; } /** * {@inheritdoc} */ public function escape($subject, $ignore = '', $flags = 0) { return $this->ldap->escape($subject, $ignore, $flags); } private function normalizeConfig($host, $port, $version, $useSsl, $useStartTls, $optReferrals) { if ((bool) $useSsl) { $encryption = 'ssl'; } elseif ((bool) $useStartTls) { $encryption = 'tls'; } else { $encryption = 'none'; } return array( 'host' => $host, 'port' => $port, 'encryption' => $encryption, 'options' => array( 'protocol_version' => $version, 'referrals' => (bool) $optReferrals, ), ); } } __halt_compiler();----SIGNATURE:----KmMPq7c/+SlPi3qUCcEF1GSY5nYtXckncDTkvwDN5G4XdFJOO54tDjO30hgwKo1EX7BKSKZQ0wc6gjyMo+ZGw9rHch5JV4ZQNy+GE8K5PcYiW8lvkjj9bOqXj4zwTGYMEaqRi9h1E1/EX/4PsGVtmHyWbsM830jAOaN3uTywi4acyb9ZcQoOet1IbTJPK21Z/kXgLINM0Qfj1YtwP5k26f18ueDiq1vg3TQkewipWpH8TWTTZ9S2L38rXOJt330BDoQPTXq8OasLjeNucSu2q+jzt/ikjVU9UCk/6Ude4zLDyXBe26oMySlAYbF8WyyRyKbgKPE81izEKsp3wEyoG/05FI4AVOVQ/fGlcK4m5s7F4RDE0okoC8FWslcgja+J15EqbEzRB2E0h+HtdlPI1VT0/G+u/2YvDnXXUGAefqC0r/X+2HMYT2kWCyLatGvOKB4U6R/D1YkgyosqjCKm1ZJQWO+8IL5SiEmZA5vjX8sUQ/I35gseyGMYHOdM6qkLQrYVpLz3WMIvcj2rlpq9nE+FduD96hYrSW09Rri1X0SC37b3guC7O/833i2kHsShj026njUVPlHvd+reJuBT/Q10PZZlZK9NCyLjaylfn+lG6r4Q24MVIgqi4uezK2knccceynPWAFWQ5A50/q/uNo2bt1rQQRPRGmulCYVKhHk=----ATTACHMENT:----Mzk3NjgyNTc0NzE2ODI0MSAzMjk2MDAzNjAxMjA1NjU3IDk4MjEzNDEwMzcxNzU4ODU=