idx
int64
0
60.3k
question
stringlengths
101
6.21k
target
stringlengths
7
803
34,400
public function validateRequired ( ) { parent :: validateRequired ( ) ; if ( ! is_array ( $ this -> getAttribute ( 'container' ) ) ) { $ message = 'Container attribute must be an array.' ; throw new AdldapException ( $ message ) ; } return true ; }
Validate the required attributes .
34,401
public function all ( $ fields = [ ] , $ sorted = true , $ sortBy = 'cn' , $ sortByDirection = 'asc' ) { $ search = $ this -> adldap -> search ( ) -> select ( $ fields ) -> where ( 'objectClass' , '=' , $ this -> objectClass ) ; if ( $ sorted ) { $ search -> sortBy ( $ sortBy , $ sortByDirection ) ; } return $ search -...
Returns all entries with the current object class .
34,402
public function find ( $ name , $ fields = [ ] ) { $ results = $ this -> adldap -> search ( ) -> select ( $ fields ) -> where ( 'objectClass' , '=' , $ this -> objectClass ) -> where ( 'anr' , '=' , $ name ) -> first ( ) ; if ( count ( $ results ) > 0 ) { return $ results ; } return false ; }
Finds a single entry using the objects current class and the specified common name . If fields are specified then only those fields are returned in the result array .
34,403
public function dn ( $ name ) { $ info = $ this -> find ( $ name ) ; if ( is_array ( $ info ) && array_key_exists ( 'dn' , $ info ) ) { return $ info [ 'dn' ] ; } return false ; }
Returns the DN of the current object class .
34,404
public function delete ( $ dn ) { $ this -> adldap -> utilities ( ) -> validateNotNullOrEmpty ( 'Distinguished Name [dn]' , $ dn ) ; return $ this -> connection -> delete ( $ dn ) ; }
Delete a distinguished name from Active Directory .
34,405
private function applyAttributes ( $ attributes ) { if ( array_key_exists ( 'count' , $ attributes ) && $ attributes [ 'count' ] > 0 ) { $ keys = array_keys ( $ attributes ) ; foreach ( $ keys as $ key ) { if ( is_array ( $ attributes [ $ key ] ) && array_key_exists ( 0 , $ attributes [ $ key ] ) ) { if ( array_key_exi...
Applies the proper object attributes if they exist .
34,406
private function applyExtraAttributes ( ) { if ( $ this -> hasAttribute ( 'distinguishedname' ) ) { $ dn = $ this -> getAttribute ( 'distinguishedname' ) ; $ this -> setAttribute ( 'dn' , $ dn ) ; $ this -> setAttribute ( 'dn_array' , $ this -> connection -> explodeDn ( $ dn , true ) ) ; } if ( $ this -> hasAttribute (...
Applies extra attributes to the returned array .
34,407
public function create ( array $ attributes ) { $ contact = new Contact ( $ attributes ) ; $ contact -> validateRequired ( ) ; $ add = $ this -> adldap -> ldapSchema ( $ attributes ) ; $ add [ 'cn' ] [ 0 ] = $ contact -> { 'display_name' } ; $ add [ 'objectclass' ] [ 0 ] = 'top' ; $ add [ 'objectclass' ] [ 1 ] = 'perso...
Create a contact .
34,408
public function modify ( $ contactName , $ attributes ) { $ contactDn = $ this -> dn ( $ contactName ) ; if ( $ contactDn ) { $ mod = $ this -> adldap -> ldapSchema ( $ attributes ) ; if ( ! $ mod ) { return false ; } return $ this -> connection -> modify ( $ contactDn , $ mod ) ; } return false ; }
Modify a contact . Note if you set the enabled attribute you must not specify any other attributes .
34,409
public function contactMailEnable ( $ contactName , $ emailAddress , $ mailNickname = null ) { $ contactDn = $ this -> dn ( $ contactName ) ; if ( $ contactDn ) { return $ this -> adldap -> exchange ( ) -> contactMailEnable ( $ contactDn , $ emailAddress , $ mailNickname ) ; } return false ; }
Mail enable a contact . Allows email to be sent to them through Exchange .
34,410
public function toLdapArray ( ) { return [ 'exchange_homemdb' => $ this -> container . ',' . $ this -> baseDn , 'exchange_proxyaddress' => 'SMTP:' . $ this -> emailAddress , 'exchange_mailnickname' => $ this -> mailNickname , 'exchange_usedefaults' => $ this -> mdbUseDefaults , ] ; }
Returns the Mailboxes attributes to an LDAP compatible array .
34,411
public function validateRequired ( $ only = [ ] ) { if ( count ( $ only ) > 0 ) { return $ this -> validateSpecific ( $ only ) ; } foreach ( $ this -> required as $ required ) { if ( $ this -> getAttribute ( $ required ) === null ) { throw new AdldapException ( sprintf ( $ this -> messages [ 'required' ] , $ required )...
Validates the required attributes for preventing null keys .
34,412
public function validateSpecific ( array $ required = [ ] ) { foreach ( $ required as $ field ) { if ( in_array ( $ field , $ this -> required ) && $ this -> getAttribute ( $ field ) === null ) { throw new AdldapException ( sprintf ( $ this -> messages [ 'required' ] , $ field ) ) ; } } return true ; }
Validates the specified attributes inside the required array .
34,413
public function get ( ) { if ( ! empty ( $ this -> query ) ) { return $ this -> query ; } $ this -> assembleQuery ( ) ; return $ this -> query ; }
Returns the current query .
34,414
public function orWhere ( $ field , $ operator = null , $ value = null ) { $ this -> addOrWhere ( $ field , $ operator , $ value ) ; return $ this ; }
Adds an or where clause to the current query .
34,415
public function getQuery ( ) { if ( ! empty ( $ this -> query ) ) { return $ this -> query ; } $ this -> assembleQuery ( ) ; return $ this -> query ; }
Returns the current query string .
34,416
private function addWhere ( $ field , $ operator , $ value = null ) { $ this -> wheres [ ] = [ 'field' => $ field , 'operator' => $ this -> getOperator ( $ operator ) , 'value' => $ this -> connection -> escape ( $ value ) , ] ; }
Adds the inserted field operator and value to the wheres property array .
34,417
private function addOrWhere ( $ field , $ operator , $ value = null ) { $ this -> orWheres [ ] = [ 'field' => $ field , 'operator' => $ this -> getOperator ( $ operator ) , 'value' => $ this -> connection -> escape ( $ value ) , ] ; }
Adds the inserted field operator and value to the orWheres property array .
34,418
private function buildDoesNotEqual ( $ field , $ value ) { return $ this :: $ open . Operator :: $ doesNotEqual . $ this -> buildEquals ( $ field , $ value ) . $ this :: $ close ; }
Returns a query string for does not equal .
34,419
private function buildEquals ( $ field , $ value ) { return $ this :: $ open . $ field . Operator :: $ equals . $ value . $ this :: $ close ; }
Returns a query string for equals .
34,420
private function buildGreaterThanOrEquals ( $ field , $ value ) { return $ this :: $ open . $ field . Operator :: $ greaterThanOrEqual . $ value . $ this :: $ close ; }
Returns a query string for greater than or equals .
34,421
private function buildLessThanOrEquals ( $ field , $ value ) { return $ this :: $ open . $ field . Operator :: $ lessThanOrEqual . $ value . $ this :: $ close ; }
Returns a query string for less than or equals .
34,422
private function buildApproximatelyEquals ( $ field , $ value ) { return $ this :: $ open . $ field . Operator :: $ approximateEqual . $ value . $ this :: $ close ; }
Returns a query string for approximately equals .
34,423
private function buildWildcard ( $ field ) { return $ this :: $ open . $ field . Operator :: $ equals . Operator :: $ wildcard . $ this :: $ close ; }
Returns a query string for a wildcard .
34,424
private function getOperator ( $ operator ) { $ operators = $ this -> getOperators ( ) ; $ key = array_search ( strtolower ( $ operator ) , $ operators ) ; if ( $ key !== false && array_key_exists ( $ key , $ operators ) ) { return $ operators [ $ key ] ; } $ operators = implode ( ', ' , $ operators ) ; $ message = "Op...
Retrieves an operator from the available operators .
34,425
private function getOperators ( ) { return [ Operator :: $ wildcard , Operator :: $ equals , Operator :: $ doesNotEqual , Operator :: $ greaterThanOrEqual , Operator :: $ lessThanOrEqual , Operator :: $ approximateEqual , Operator :: $ startsWith , Operator :: $ endsWith , Operator :: $ contains , Operator :: $ and , ]...
Returns an array of available operators .
34,426
private function assembleQuery ( ) { $ this -> assembleWheres ( ) ; $ this -> assembleOrWheres ( ) ; if ( count ( $ this -> getWheres ( ) ) > 1 || count ( $ this -> getOrWheres ( ) ) > 0 ) { $ this -> setQuery ( $ this -> buildAnd ( $ this -> getQuery ( ) ) ) ; } }
Returns an assembled query using the current object parameters .
34,427
public function toCreateSchema ( ) { $ this -> validateRequired ( ) ; if ( ! is_array ( $ this -> getAttribute ( 'container' ) ) ) { throw new AdldapException ( 'Container attribute must be an array' ) ; } if ( $ this -> getAttribute ( 'display_name' ) === null ) { $ displayName = $ this -> getAttribute ( 'firstname' )...
Checks the attributes for existence and returns the attributes array .
34,428
public function toModifySchema ( ) { $ this -> validateRequired ( [ 'username' ] ) ; if ( $ this -> hasAttribute ( 'container' ) ) { if ( ! is_array ( $ this -> getAttribute ( 'container' ) ) ) { throw new AdldapException ( 'Container attribute must be an array' ) ; } } return $ this -> getAttributes ( ) ; }
Checks the username attribute for existence and returns the attributes array .
34,429
public function search ( $ sAMAaccountType = Adldap :: ADLDAP_SECURITY_GLOBAL_GROUP , $ select = [ ] , $ sorted = true ) { $ search = $ this -> adldap -> search ( ) -> select ( $ select ) -> where ( 'objectCategory' , '=' , 'group' ) ; if ( $ sAMAaccountType !== null ) { $ search -> where ( 'samaccounttype' , '=' , $ s...
Returns a complete list of the groups in AD based on a SAM Account Type .
34,430
public function addGroup ( $ parent , $ child ) { $ parentDn = $ this -> dn ( $ parent ) ; $ childDn = $ this -> dn ( $ child ) ; if ( $ parentDn && $ childDn ) { $ add [ 'member' ] = $ childDn ; return $ this -> connection -> modAdd ( $ parentDn , $ add ) ; } return false ; }
Add a group to a group .
34,431
public function addUser ( $ groupName , $ username ) { $ groupDn = $ this -> dn ( $ groupName ) ; $ userDn = $ this -> adldap -> user ( ) -> dn ( $ username ) ; if ( $ groupDn && $ userDn ) { $ add [ 'member' ] = $ userDn ; return $ this -> connection -> modAdd ( $ groupDn , $ add ) ; } return false ; }
Add a user to a group .
34,432
public function addContact ( $ groupName , $ contactDn ) { $ groupDn = $ this -> dn ( $ groupName ) ; if ( $ groupDn && $ contactDn ) { $ add = [ ] ; $ add [ 'member' ] = $ contactDn ; return $ this -> connection -> modAdd ( $ groupDn , $ add ) ; } return false ; }
Add a contact to a group .
34,433
public function rename ( $ groupName , $ newName , $ container ) { $ groupDn = $ this -> dn ( $ groupName ) ; if ( $ groupDn ) { $ newRDN = 'CN=' . $ newName ; $ container = array_reverse ( $ container ) ; $ container = 'OU=' . implode ( ', OU=' , $ container ) ; $ dn = $ container . ', ' . $ this -> adldap -> getBaseD...
Rename a group .
34,434
public function removeGroup ( $ parentName , $ childName ) { $ parentDn = $ this -> dn ( $ parentName ) ; $ childDn = $ this -> dn ( $ childName ) ; if ( is_string ( $ parentDn ) && is_string ( $ childDn ) ) { $ del = [ ] ; $ del [ 'member' ] = $ childDn ; return $ this -> connection -> modDelete ( $ parentDn , $ del )...
Remove a group from a group .
34,435
public function removeUser ( $ groupName , $ username ) { $ groupDn = $ this -> dn ( $ groupName ) ; $ userDn = $ this -> adldap -> user ( ) -> dn ( $ username ) ; if ( is_string ( $ groupDn ) && is_string ( $ userDn ) ) { $ del = [ ] ; $ del [ 'member' ] = $ userDn ; return $ this -> connection -> modDelete ( $ groupD...
Remove a user from a group .
34,436
public function removeContact ( $ group , $ contactName ) { $ groupDn = $ this -> dn ( $ group ) ; $ contactDn = $ this -> adldap -> contact ( ) -> dn ( $ contactName ) ; if ( is_string ( $ groupDn ) && is_string ( $ contactDn ) ) { $ del = [ ] ; $ del [ 'member' ] = $ contactDn ; return $ this -> connection -> modDele...
Remove a contact from a group .
34,437
public function members ( $ group , $ fields = [ ] ) { $ group = $ this -> find ( $ group ) ; if ( is_array ( $ group ) && array_key_exists ( 'member' , $ group ) ) { $ members = [ ] ; foreach ( $ group [ 'member' ] as $ member ) { $ members [ ] = $ this -> adldap -> search ( ) -> setDn ( $ member ) -> select ( $ field...
Return a list of members in a group .
34,438
public function recursiveGroups ( $ groupName ) { $ groups = [ ] ; $ info = $ this -> find ( $ groupName ) ; if ( is_array ( $ info ) && array_key_exists ( 'cn' , $ info ) ) { $ groups [ ] = $ info [ 'cn' ] ; if ( array_key_exists ( 'memberof' , $ info ) ) { if ( is_array ( $ info [ 'memberof' ] ) ) { foreach ( $ info ...
Return a complete list of groups in groups .
34,439
public function allSecurity ( $ includeDescription = false , $ search = '*' , $ sorted = true ) { return $ this -> search ( Adldap :: ADLDAP_SECURITY_GLOBAL_GROUP , $ includeDescription , $ search , $ sorted ) ; }
Returns a complete list of security groups in AD .
34,440
public function allDistribution ( $ includeDescription = false , $ search = '*' , $ sorted = true ) { return $ this -> search ( Adldap :: ADLDAP_DISTRIBUTION_GROUP , $ includeDescription , $ search , $ sorted ) ; }
Returns a complete list of distribution lists in AD .
34,441
public function groups ( $ computerName , $ recursive = null ) { if ( $ recursive === null ) { $ recursive = $ this -> adldap -> getRecursiveGroups ( ) ; } $ info = $ this -> find ( $ computerName ) ; if ( is_array ( $ info ) && array_key_exists ( 'memberof' , $ info ) ) { $ groups = $ this -> adldap -> utilities ( ) -...
Get the groups a computer is in .
34,442
public function orWhere ( $ field , $ operator = null , $ value = null ) { $ this -> query -> orWhere ( $ field , $ operator , $ value ) ; return $ this ; }
Adds an orWhere clause to the current query .
34,443
public function setDn ( $ dn ) { if ( $ dn === null ) { $ this -> dn = null ; } else { $ this -> dn = ( string ) $ dn ; } return $ this ; }
Sets the complete distinguished name to search on .
34,444
public function getDn ( ) { if ( $ this -> dn === null ) { return $ this -> dn ; } elseif ( empty ( $ this -> dn ) ) { return $ this -> adldap -> getBaseDn ( ) ; } return $ this -> dn ; }
Returns the current distinguished name .
34,445
public function recursive ( $ recursive = true ) { $ this -> recursive = true ; if ( $ recursive === false ) { $ this -> recursive = false ; } return $ this ; }
Sets the recursive property to tell the search whether or not to search recursively .
34,446
public function read ( $ read = false ) { $ this -> read = true ; if ( $ read === false ) { $ this -> read = false ; } return $ this ; }
Sets the recursive property to tell the search whether or not to search on the base scope and return a single entry .
34,447
public function newPaginator ( $ entries , $ perPage , $ currentPage , $ totalPages ) { return new Paginator ( $ entries , $ perPage , $ currentPage , $ totalPages ) ; }
Returns a new Paginator instance .
34,448
private function processResults ( $ results ) { $ entries = $ this -> connection -> getEntries ( $ results ) ; $ objects = [ ] ; if ( array_key_exists ( 'count' , $ entries ) ) { for ( $ i = 0 ; $ i < $ entries [ 'count' ] ; $ i ++ ) { $ entry = $ this -> newLdapEntry ( $ entries [ $ i ] , $ this -> connection ) ; $ ob...
Processes LDAP search results into a nice array .
34,449
private function processSortBy ( $ objects ) { if ( count ( $ objects ) > 0 ) { foreach ( $ objects as $ key => $ row ) { if ( array_key_exists ( $ this -> sortByField , $ row ) ) { $ sort [ $ key ] = $ row [ $ this -> sortByField ] ; } } array_multisort ( $ sort , $ this -> sortByDirection , $ objects ) ; } return $ o...
Processes the array of specified object results and sorts them by the field and direction search property .
34,450
public function all ( $ fields = [ ] , $ sorted = true , $ sortBy = 'cn' , $ sortByDirection = 'asc' ) { $ namingContext = $ this -> getConfigurationNamingContext ( ) ; if ( $ namingContext ) { $ search = $ this -> adldap -> search ( ) -> setDn ( $ namingContext ) -> select ( $ fields ) -> where ( 'objectCategory' , '=...
Returns all exchange servers .
34,451
public function find ( $ name , $ fields = [ ] ) { $ namingContext = $ this -> getConfigurationNamingContext ( ) ; if ( $ namingContext ) { return $ this -> adldap -> search ( ) -> setDn ( $ namingContext ) -> select ( $ fields ) -> where ( 'objectCategory' , '=' , $ this -> serverObjectCategory ) -> where ( 'anr' , '=...
Finds an exchange server .
34,452
public function createMailbox ( $ username , $ storageGroup , $ emailAddress , $ mailNickname = null , $ useDefaults = true , $ baseDn = null , $ isGUID = false ) { $ mailbox = new Mailbox ( [ 'username' => $ username , 'storageGroup' => $ storageGroup , 'emailAddress' => $ emailAddress , 'mailNickname' => $ mailNickna...
Create an Exchange account .
34,453
public function deleteAddress ( $ username , $ emailAddress , $ isGUID = false ) { $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Username' , $ username ) ; $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Email Address' , $ emailAddress ) ; $ user = $ this -> adldap -> user ( ) -> info ( $ username , [...
Remove an address to Exchange . If you remove a default address the account will no longer have a default we recommend changing the default address first .
34,454
public function primaryAddress ( $ username , $ emailAddress , $ isGUID = false ) { $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Username' , $ username ) ; $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Email Address' , $ emailAddress ) ; $ user = $ this -> adldap -> user ( ) -> info ( $ username , ...
Change the default address .
34,455
public function contactMailEnable ( $ distinguishedName , $ emailAddress , $ mailNickname = null ) { $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Distinguished Name [dn]' , $ distinguishedName ) ; $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Email Address' , $ emailAddress ) ; if ( $ mailNickname ...
Mail enable a contact Allows email to be sent to them through Exchange .
34,456
public function storageGroups ( $ exchangeServer , $ attributes = [ 'cn' , 'distinguishedname' ] , $ recursive = null ) { $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Exchange Server' , $ exchangeServer ) ; $ this -> adldap -> utilities ( ) -> validateLdapIsBound ( ) ; if ( $ recursive === null ) { $ recursi...
Returns a list of Storage Groups in Exchange for a given mail server .
34,457
public function storageDatabases ( $ storageGroup , $ attributes = [ 'cn' , 'distinguishedname' , 'displayname' ] ) { $ this -> adldap -> utilities ( ) -> validateNotNull ( 'Storage Group' , $ storageGroup ) ; $ this -> adldap -> utilities ( ) -> validateLdapIsBound ( ) ; $ filter = '(&(objectCategory=msExchPrivateMDB)...
Returns a list of Databases within any given storage group in Exchange for a given mail server .
34,458
private function getConfigurationNamingContext ( ) { $ result = $ this -> adldap -> getRootDse ( [ 'configurationnamingcontext' ] ) ; if ( is_array ( $ result ) && array_key_exists ( 'configurationnamingcontext' , $ result ) ) { return $ result [ 'configurationnamingcontext' ] ; } return false ; }
Returns the current configuration naming context of the current domain .
34,459
public function create ( array $ attributes ) { $ folder = new Folder ( $ attributes ) ; $ folder -> validateRequired ( ) ; $ folder -> setAttribute ( 'container' , array_reverse ( $ folder -> getAttribute ( 'container' ) ) ) ; $ add = [ ] ; $ add [ 'objectClass' ] = 'organizationalUnit' ; $ add [ 'OU' ] = $ folder -> ...
Create an organizational unit .
34,460
public function strGuidToHex ( $ strGUID ) { $ strGUID = str_replace ( '-' , '' , $ strGUID ) ; $ octet_str = '\\' . substr ( $ strGUID , 6 , 2 ) ; $ octet_str .= '\\' . substr ( $ strGUID , 4 , 2 ) ; $ octet_str .= '\\' . substr ( $ strGUID , 2 , 2 ) ; $ octet_str .= '\\' . substr ( $ strGUID , 0 , 2 ) ; $ octet_str ....
Converts a string GUID to a hexdecimal value so it can be queried .
34,461
public function getTextSID ( $ binsid ) { $ hex_sid = bin2hex ( $ binsid ) ; $ rev = hexdec ( substr ( $ hex_sid , 0 , 2 ) ) ; $ subcount = hexdec ( substr ( $ hex_sid , 2 , 2 ) ) ; $ auth = hexdec ( substr ( $ hex_sid , 4 , 12 ) ) ; $ result = "$rev-$auth" ; $ subauth = [ ] ; for ( $ x = 0 ; $ x < $ subcount ; $ x ++ ...
Convert a binary SID to a text SID .
34,462
public function binaryToText ( $ bin ) { $ hex_guid = bin2hex ( $ bin ) ; $ hex_guid_to_guid_str = '' ; for ( $ k = 1 ; $ k <= 4 ; ++ $ k ) { $ hex_guid_to_guid_str .= substr ( $ hex_guid , 8 - 2 * $ k , 2 ) ; } $ hex_guid_to_guid_str .= '-' ; for ( $ k = 1 ; $ k <= 2 ; ++ $ k ) { $ hex_guid_to_guid_str .= substr ( $ h...
Converts a binary attribute to a string .
34,463
public function decodeGuid ( $ binaryGuid ) { $ this -> validateNotNull ( 'Binary GUID' , $ binaryGuid ) ; $ strGUID = $ this -> binaryToText ( $ binaryGuid ) ; return $ strGUID ; }
Converts a binary GUID to a string GUID .
34,464
public function dnStrToArr ( $ dnStr , $ excludeBaseDn = true , $ includeAttributes = false ) { if ( $ excludeBaseDn ) { return ldap_explode_dn ( $ dnStr , ( $ includeAttributes ? 0 : 1 ) ) ; } else { return ldap_explode_dn ( $ this -> adldap -> getBaseDn ( ) . $ dnStr , ( $ includeAttributes ? 0 : 1 ) ) ; } }
Convert DN string to array .
34,465
public function validateNotNullOrEmpty ( $ parameter , $ value ) { $ this -> validateNotNull ( $ parameter , $ value ) ; $ this -> validateNotEmpty ( $ parameter , $ value ) ; return true ; }
Validates that the inserted value is not null or empty . This will throw an AdldapException otherwise .
34,466
public function validateNotNull ( $ parameter , $ value ) { if ( $ value !== null ) { return true ; } $ message = sprintf ( 'Parameter: %s cannot be null.' , $ parameter ) ; throw new AdldapException ( $ message ) ; }
Validates that the inserted value of the specified parameter is not null . This will throw an AdldapException otherwise .
34,467
public function validateNotEmpty ( $ parameter , $ value ) { if ( ! empty ( $ value ) ) { return true ; } $ message = sprintf ( 'Parameter: %s cannot be empty.' , $ parameter ) ; throw new AdldapException ( $ message ) ; }
Validates that the inserted value of the specified parameter is not empty . This will throw an AdldapException otherwise .
34,468
public function getEntries ( $ searchResults ) { if ( $ this -> suppressErrors ) { return @ ldap_get_entries ( $ this -> getConnection ( ) , $ searchResults ) ; } else { return ldap_get_entries ( $ this -> getConnection ( ) , $ searchResults ) ; } }
Retrieves and returns the results of an LDAP search into an array format .
34,469
public function getFirstEntry ( $ searchResults ) { if ( $ this -> suppressErrors ) { return @ ldap_first_entry ( $ this -> getConnection ( ) , $ searchResults ) ; } return ldap_first_entry ( $ this -> getConnection ( ) , $ searchResults ) ; }
Returns the first entry from the specified search results .
34,470
public function countEntries ( $ searchResults ) { if ( $ this -> suppressErrors ) { return @ ldap_count_entries ( $ this -> getConnection ( ) , $ searchResults ) ; } return ldap_count_entries ( $ this -> getConnection ( ) , $ searchResults ) ; }
Returns the count of the returned entries from the specified search results .
34,471
public function getValuesLen ( $ entry , $ attribute ) { if ( $ this -> suppressErrors ) { return @ ldap_get_values_len ( $ this -> getConnection ( ) , $ entry , $ attribute ) ; } return ldap_get_values_len ( $ this -> getConnection ( ) , $ entry , $ attribute ) ; }
Get all binary values from the specified result entry .
34,472
public function setOption ( $ option , $ value ) { if ( $ this -> suppressErrors ) { return @ ldap_set_option ( $ this -> getConnection ( ) , $ option , $ value ) ; } return ldap_set_option ( $ this -> getConnection ( ) , $ option , $ value ) ; }
Sets an option and value on the current LDAP connection .
34,473
public function connect ( $ hostname , $ port = '389' ) { $ protocol = $ this :: PROTOCOL ; if ( $ this -> isUsingSSL ( ) ) { $ protocol = $ this :: PROTOCOL_SSL ; } return $ this -> connection = ldap_connect ( $ protocol . $ hostname , $ port ) ; }
Connects to the specified hostname using the PHP ldap protocol .
34,474
public function search ( $ dn , $ filter , array $ fields ) { if ( $ this -> suppressErrors ) { return @ ldap_search ( $ this -> getConnection ( ) , $ dn , $ filter , $ fields ) ; } return ldap_search ( $ this -> getConnection ( ) , $ dn , $ filter , $ fields ) ; }
Performs a search on the current connection with the specified distinguished name filter and fields .
34,475
public function listing ( $ dn , $ filter , array $ attributes ) { if ( $ this -> suppressErrors ) { return @ ldap_list ( $ this -> getConnection ( ) , $ dn , $ filter , $ attributes ) ; } return ldap_list ( $ this -> getConnection ( ) , $ dn , $ filter , $ attributes ) ; }
Performs a single level search on the current connection .
34,476
public function read ( $ dn , $ filter , array $ fields ) { if ( $ this -> suppressErrors ) { return @ ldap_read ( $ this -> getConnection ( ) , $ dn , $ filter , $ fields ) ; } return ldap_read ( $ this -> getConnection ( ) , $ dn , $ filter , $ fields ) ; }
Reads an entry on the current LDAP connection .
34,477
public function bind ( $ username , $ password , $ sasl = false ) { if ( $ sasl ) { if ( $ this -> suppressErrors ) { return $ this -> bound = @ ldap_sasl_bind ( $ this -> getConnection ( ) , null , null , 'GSSAPI' ) ; } return $ this -> bound = ldap_sasl_bind ( $ this -> getConnection ( ) , null , null , 'GSSAPI' ) ; ...
Binds to the current LDAP connection . If SASL is true we ll set up a SASL bind instead .
34,478
public function add ( $ dn , array $ entry ) { if ( $ this -> suppressErrors ) { return @ ldap_add ( $ this -> getConnection ( ) , $ dn , $ entry ) ; } return ldap_add ( $ this -> getConnection ( ) , $ dn , $ entry ) ; }
Adds entries to the current LDAP directory .
34,479
public function delete ( $ dn ) { if ( $ this -> suppressErrors ) { return @ ldap_delete ( $ this -> getConnection ( ) , $ dn ) ; } return ldap_delete ( $ this -> getConnection ( ) , $ dn ) ; }
Deletes an entry on the current LDAP directory .
34,480
public function rename ( $ dn , $ newRdn , $ newParent , $ deleteOldRdn = false ) { if ( $ this -> suppressErrors ) { return @ ldap_rename ( $ this -> getConnection ( ) , $ dn , $ newRdn , $ newParent , $ deleteOldRdn ) ; } return ldap_rename ( $ this -> getConnection ( ) , $ dn , $ newRdn , $ newParent , $ deleteOldRd...
Modify the name of an LDAP entry .
34,481
public function modify ( $ dn , array $ entry ) { if ( $ this -> suppressErrors ) { return @ ldap_modify ( $ this -> getConnection ( ) , $ dn , $ entry ) ; } return ldap_modify ( $ this -> getConnection ( ) , $ dn , $ entry ) ; }
Modifies the specified LDAP entry .
34,482
public function modifyBatch ( $ dn , array $ entry ) { if ( $ this -> suppressErrors ) { return @ ldap_modify_batch ( $ this -> getConnection ( ) , $ dn , $ entry ) ; } return ldap_modify_batch ( $ this -> getConnection ( ) , $ dn , $ entry ) ; }
Batch modifies the specified LDAP entry .
34,483
public function modAdd ( $ dn , array $ entry ) { if ( $ this -> suppressErrors ) { return @ ldap_mod_add ( $ this -> getConnection ( ) , $ dn , $ entry ) ; } return ldap_mod_add ( $ this -> getConnection ( ) , $ dn , $ entry ) ; }
Add attribute values to current attributes .
34,484
public function modReplace ( $ dn , array $ entry ) { if ( $ this -> suppressErrors ) { return @ ldap_mod_replace ( $ this -> getConnection ( ) , $ dn , $ entry ) ; } return ldap_mod_replace ( $ this -> getConnection ( ) , $ dn , $ entry ) ; }
Replaces attribute values with new ones .
34,485
public function modDelete ( $ dn , array $ entry ) { if ( $ this -> suppressErrors ) { return @ ldap_mod_del ( $ this -> getConnection ( ) , $ dn , $ entry ) ; } return ldap_mod_del ( $ this -> getConnection ( ) , $ dn , $ entry ) ; }
Delete attribute values from current attributes .
34,486
public function controlPagedResult ( $ pageSize = 1000 , $ isCritical = false , $ cookie = '' ) { if ( $ this -> isPagingSupported ( ) ) { if ( $ this -> suppressErrors ) { return @ ldap_control_paged_result ( $ this -> getConnection ( ) , $ pageSize , $ isCritical , $ cookie ) ; } return ldap_control_paged_result ( $ ...
Send LDAP pagination control .
34,487
public function controlPagedResultResponse ( $ result , & $ cookie ) { if ( $ this -> isPagingSupported ( ) ) { if ( $ this -> suppressErrors ) { return @ ldap_control_paged_result_response ( $ this -> getConnection ( ) , $ result , $ cookie ) ; } return ldap_control_paged_result_response ( $ this -> getConnection ( ) ...
Retrieve a paginated result response .
34,488
public function escape ( $ value , $ ignore = '' , $ flags = 0 ) { if ( ! $ this -> isEscapingSupported ( ) ) { return $ this -> escapeManual ( $ value , $ ignore , $ flags ) ; } return ldap_escape ( $ value , $ ignore , $ flags ) ; }
Returns an escaped string for use in an LDAP filter .
34,489
protected function escapeManual ( $ value , $ ignore = '' , $ flags = 0 ) { if ( $ flags ) { return $ this -> escapeManualWithFlags ( $ value , $ ignore , $ flags ) ; } $ ignores = str_split ( $ ignore ) ; $ hex = bin2hex ( $ value ) ; $ value = chunk_split ( $ hex , 2 , '\\' ) ; $ value = '\\' . substr ( $ value , 0 ,...
Escapes the inserted value for LDAP .
34,490
protected function escapeManualWithFlags ( $ value , $ ignore = '' , $ flags = 0 ) { $ ignores = str_split ( $ ignore ) ; $ escapeFilter = [ '\\' , '*' , '(' , ')' ] ; $ escapeDn = [ '\\' , ',' , '=' , '+' , '<' , '>' , ';' , '"' , '#' ] ; switch ( $ flags ) { case 1 : $ escapes = $ escapeFilter ; break ; case 2 : $ es...
Escapes the inserted value with flags . Supplying either 1 or 2 into the flags parameter will escape only certain values .
34,491
public function unescape ( $ value ) { $ callback = function ( $ matches ) { return chr ( hexdec ( $ matches [ 1 ] ) ) ; } ; return preg_replace_callback ( '/\\\([0-9A-Fa-f]{2})/' , $ callback , $ value ) ; }
Un - escapes a hexadecimal string into its original string representation .
34,492
public function compare ( Money $ a , Money $ b ) : int { $ aCurrencyCode = $ a -> getCurrency ( ) -> getCurrencyCode ( ) ; $ bCurrencyCode = $ b -> getCurrency ( ) -> getCurrencyCode ( ) ; if ( $ aCurrencyCode === $ bCurrencyCode ) { return $ a -> compareTo ( $ b ) ; } $ aAmount = $ a -> getAmount ( ) ; $ bAmount = $ ...
Compares the given monies .
34,493
public function min ( Money $ money , Money ... $ monies ) : Money { $ min = $ money ; foreach ( $ monies as $ money ) { if ( $ this -> isGreater ( $ min , $ money ) ) { $ min = $ money ; } } return $ min ; }
Returns the smallest of the given monies .
34,494
public function max ( Money $ money , Money ... $ monies ) : Money { $ max = $ money ; foreach ( $ monies as $ money ) { if ( $ this -> isLess ( $ max , $ money ) ) { $ max = $ money ; } } return $ max ; }
Returns the largest of the given monies .
34,495
public function convert ( MoneyContainer $ moneyContainer , $ currency , int $ roundingMode = RoundingMode :: UNNECESSARY ) : Money { if ( ! $ currency instanceof Currency ) { $ currency = Currency :: of ( $ currency ) ; } $ currencyCode = $ currency -> getCurrencyCode ( ) ; $ total = BigRational :: zero ( ) ; foreach ...
Converts the given money to the given currency .
34,496
public function addExchangeRateProvider ( ExchangeRateProvider $ provider ) : self { $ hash = spl_object_hash ( $ provider ) ; $ this -> providers [ $ hash ] = $ provider ; return $ this ; }
Adds an exchange rate provider to the chain .
34,497
public function removeExchangeRateProvider ( ExchangeRateProvider $ provider ) : self { $ hash = spl_object_hash ( $ provider ) ; unset ( $ this -> providers [ $ hash ] ) ; return $ this ; }
Removes an exchange rate provider from the chain .
34,498
public function getAmount ( $ currency ) : BigRational { $ currencyCode = ( string ) $ currency ; return isset ( $ this -> amounts [ $ currencyCode ] ) ? $ this -> amounts [ $ currencyCode ] : BigRational :: zero ( ) ; }
Returns the amount in the given currency contained in the bag as a rational number .
34,499
public function add ( MoneyContainer $ money ) : MoneyBag { foreach ( $ money -> getAmounts ( ) as $ currencyCode => $ amount ) { $ this -> amounts [ $ currencyCode ] = $ this -> getAmount ( $ currencyCode ) -> plus ( $ amount ) ; } return $ this ; }
Adds money to this bag .