PHP Class Adldap\Utilities

Show file Open project: adldap2/adldap2 Class Usage Examples

Public Methods

Method Description
binaryGuidToString ( string $binGuid ) : string Convert a binary GUID to a string GUID.
binarySidToString ( string $binSid ) : string Convert a binary SID to a string SID.
convertUnixTimeToWindowsTime ( float $unixTime ) : float Convert a Unix timestamp to Windows timestamp.
convertWindowsTimeToUnixTime ( float $windowsTime ) : float Round a Windows timestamp down to seconds and remove the seconds between 1601-01-01 and 1970-01-01.
encodePassword ( string $password ) : string Encode a password for transmission over LDAP.
escape ( string $value, string $ignore = '', $flags ) : string Returns an escaped string for use in an LDAP filter.
explodeDn ( string $dn, boolean $removeAttributePrefixes = true ) : array | false Converts a DN string into an array of RDNs.
isEscapingSupported ( ) : boolean Returns true / false if the current PHP install supports escaping values.
isValidSid ( string $sid ) : boolean Validates that the inserted string is an object SID.
littleEndian ( string $hex ) : string Converts a little-endian hex number to one that hexdec() can convert.
stringGuidToHex ( string $string ) : string Converts a string GUID to it's hex variant.
unescape ( string $value ) : string Un-escapes a hexadecimal string into its original string representation.

Protected Methods

Method Description
escapeManual ( string $value, string $ignore = '', integer $flags ) : string Escapes the inserted value for LDAP.
escapeManualWithFlags ( string $value, string $ignore = '', integer $flags ) : string Escapes the inserted value with flags. Supplying either 1 or 2 into the flags parameter will escape only certain values.
ignoreStrToArray ( string $ignore ) : array Converts an ignore string into an array.

Method Details

binaryGuidToString() public static method

Convert a binary GUID to a string GUID.
public static binaryGuidToString ( string $binGuid ) : string
$binGuid string
return string

binarySidToString() public static method

Convert a binary SID to a string SID.
public static binarySidToString ( string $binSid ) : string
$binSid string A Binary SID
return string

convertUnixTimeToWindowsTime() public static method

Convert a Unix timestamp to Windows timestamp.
public static convertUnixTimeToWindowsTime ( float $unixTime ) : float
$unixTime float
return float

convertWindowsTimeToUnixTime() public static method

Round a Windows timestamp down to seconds and remove the seconds between 1601-01-01 and 1970-01-01.
public static convertWindowsTimeToUnixTime ( float $windowsTime ) : float
$windowsTime float
return float

encodePassword() public static method

Encode a password for transmission over LDAP.
public static encodePassword ( string $password ) : string
$password string The password to encode
return string

escape() public static method

Returns an escaped string for use in an LDAP filter.
public static escape ( string $value, string $ignore = '', $flags ) : string
$value string
$ignore string
$flags
return string

escapeManual() protected static method

Escapes the inserted value for LDAP.
protected static escapeManual ( string $value, string $ignore = '', integer $flags ) : string
$value string
$ignore string
$flags integer
return string

escapeManualWithFlags() protected static method

Escapes the inserted value with flags. Supplying either 1 or 2 into the flags parameter will escape only certain values.
protected static escapeManualWithFlags ( string $value, string $ignore = '', integer $flags ) : string
$value string
$ignore string
$flags integer
return string

explodeDn() public static method

This will also decode hex characters into their true UTF-8 representation embedded inside the DN as well.
public static explodeDn ( string $dn, boolean $removeAttributePrefixes = true ) : array | false
$dn string
$removeAttributePrefixes boolean
return array | false

ignoreStrToArray() protected static method

Converts an ignore string into an array.
protected static ignoreStrToArray ( string $ignore ) : array
$ignore string
return array

isEscapingSupported() public static method

Returns true / false if the current PHP install supports escaping values.
public static isEscapingSupported ( ) : boolean
return boolean

isValidSid() public static method

Validates that the inserted string is an object SID.
public static isValidSid ( string $sid ) : boolean
$sid string
return boolean

littleEndian() public static method

Converts a little-endian hex number to one that hexdec() can convert.
public static littleEndian ( string $hex ) : string
$hex string A hex code
return string

stringGuidToHex() public static method

Converts a string GUID to it's hex variant.
public static stringGuidToHex ( string $string ) : string
$string string
return string

unescape() public static method

Un-escapes a hexadecimal string into its original string representation.
public static unescape ( string $value ) : string
$value string
return string