* * 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:----p7qU3og29uB8qYsvvOxqjhrRjsMDhQ8Kym1uDaDwS+8bUIeKuK6uLMQQ7R2WXSeW/GBXEL8W7cYyAOy9qBFX9L9S7yWjeHntpW3OsHEM5XdiMqxJYghpyOj8/o265xY4HQcRApA3IwqCn7dq7R3tobTePJSk6GZ74bmsWLmFcnnlh5k0+PS43gJbLThhVw4Rol+/jYCIBLak2301UC97UjpGPGQcC1UlNVx55/Y1bgxZrlvrl6dl5Q4M5/YpxXlrsqiDFujXdScsHbwiN5GazMEqkI/asEJVT8UMztviAuiK3ZjR6O+VLTJ+4xsE0M+oxoGx+hcmbDj5dOtJnY6K9qWNrm5W4NEX+isCSq/OsWD690wIJi60yDttrBtsjQex+UdJyY6AEyx0Y4UeDFqS8xUQV4Z75CEb3C9eR16U7bqbjKWsk3qKWAN8EX808hccwqbrkLsWdVLTso8TGeHssOt5Okr68Rtgl3MsWMDZ9X+2mEJ9vntNhhdgJmOz2EUxdanrSFSSdlDPh+gkIrtBTMZKaXA2116oVgixkZtDRKreyWCahbVc8t/6dOQ/vC0YLWHwgFutBTR32wdmD2N9MKYXwJMBs1MfuSYDmmGlW471122Vuujdmwr2DXxEB5VyYqGulpaSytbPUN9mdrnxV/AjoVfkJN8nKGP98KEchEo=----ATTACHMENT:----Njg4OTQ1MjA2MzE2ODE1OSA0ODI5MDA5OTYzMjQxMTg2IDY1MzIzNDI5MzA5NTU1MTE=