lib/ldap.inc
Properties
Description
ldap.inc provides basic functions to connect to the OpenLDAP server.
Functions
convertHex2bin(
string
$value,
)
:
\binary
Description
Converts a HEX string to a binary valueArguments
Name |
Type |
Description |
Default |
$value |
string |
HEX string |
|
Return value
Type |
Description |
\binary |
result binary |
Classes
Ldap
Properties
No
No
Description
Ldap manages connection to LDAP and includes several helper functions.
Methods
__construct,
__sleep,
__wakeup,
close,
connect,
decrypt,
decrypt_login,
destroy,
encrypt,
encrypt_login,
server,
__construct(
object
$config,
)
:
n/a
Description
Creates a new LDAP object.Arguments
Name |
Type |
Description |
Default |
$config |
object |
an object of class Config |
|
Return value
__sleep(
)
:
n/a
Description
Closes connection to LDAP server before serializationReturn value
__wakeup(
)
:
n/a
Description
Reconnects to LDAP server when deserializedReturn value
close(
)
:
n/a
Description
Closes connection to serverReturn value
connect(
string
$user,
string
$passwd,
boolean
$allowAnonymous
= false,
)
:
mixed
Description
Connects to the server using the given username and passwordArguments
Name |
Type |
Description |
Default |
$user |
string |
user name |
|
$passwd |
string |
password |
|
$allowAnonymous |
boolean |
specifies if anonymous binds are allowed |
false |
Return value
Type |
Description |
mixed |
if connect succeeds the server handle is returned, else false |
decrypt(
object
$data,
string
$prefix
= '',
)
:
string
Description
Decrypts a stringArguments
Name |
Type |
Description |
Default |
$data |
object |
string to decrypt |
|
$prefix |
string |
prefix for cookie names |
'' |
Return value
Type |
Description |
string |
decrypted string |
decrypt_login(
)
:
array
Description
Decrypts username and passwordReturn value
Type |
Description |
array |
array(user name, password) |
destroy(
)
:
n/a
Description
Closes connection to LDAP server and deletes encrypted username/passwordReturn value
encrypt(
string
$data,
string
$prefix
= '',
)
:
object
Description
Encrypts a stringArguments
Name |
Type |
Description |
Default |
$data |
string |
string to encrypt |
|
$prefix |
string |
prefix for cookie names |
'' |
Return value
Type |
Description |
object |
encrypted string |
encrypt_login(
string
$username,
string
$password,
)
:
n/a
Description
Encrypts username and passwordArguments
Name |
Type |
Description |
Default |
$username |
string |
LDAP user name |
|
$password |
string |
LDAP password |
|
Return value
server(
)
:
object
Description
Returns the LDAP connection handleReturn value
Type |
Description |
object |
connection handle |
Properties
$conf,
$is_connected,
$password,
$server,
$username,
private
$conf
=
Object of Config to access preferences
private
$is_connected
=
false
LDAP connection established
private
$password
=
LDAP password used for bind
private
$server
=
Server handle
private
$username
=
LDAP username used for bind