phpLDAPadmin
[ class tree: phpLDAPadmin ] [ index: phpLDAPadmin ] [ all elements ]

Procedural File: functions.php

Source Location: /lib/functions.php



Page Details:

A collection of common generic functions used throughout the application.



Tags:

filesource:  Source Code for this file
author:  The phpLDAPadmin development team







CONFDIR [line 13]

CONFDIR = sprintf('%s/',realpath(LIBDIR.'../config'))

[ Top ]



CSSDIR [line 17]

CSSDIR = 'css/'

[ Top ]



DOCDIR [line 15]

DOCDIR = sprintf('%s/',realpath(LIBDIR.'../doc/'))

[ Top ]



HOOKSDIR [line 16]

HOOKSDIR = sprintf('%s/',realpath(LIBDIR.'../hooks/'))

[ Top ]



HTDOCDIR [line 11]

HTDOCDIR = sprintf('%s/',realpath(LIBDIR.'../htdocs/'))
A collection of common generic functions used throughout the application.



Tags:

author:  The phpLDAPadmin development team

[ Top ]



JSDIR [line 18]

JSDIR = 'js/'

[ Top ]



LANGDIR [line 12]

LANGDIR = sprintf('%s/',realpath(LIBDIR.'../locale/'))

[ Top ]



TMPLDIR [line 14]

TMPLDIR = sprintf('%s/',realpath(LIBDIR.'../templates/'))

[ Top ]




arrayLower [line 2543]

array arrayLower( array $array)

Reads an array and returns the array values back in lower case



Tags:

return:  Array with values converted to lowercase.


Parameters

array   $array   The array to convert the values to lowercase.
[ Top ]



array_stripslashes [line 2563]

void array_stripslashes( &$array, Array $array)

Strips all slashes from the specified array in place (pass by ref).



Parameters

Array   $array   The array to strip slashes from, typically one of $_GET, $_POST, or $_COOKIE.
   &$array  
[ Top ]



array_to_query_string [line 2419]

string array_to_query_string( array $array, [array $exclude_vars = array()], [bool $url_encode_ampersands = true])

Converts an array to a query-string with the option to exclude certain variables from the returned query string. This is convenient if callers want to convert the current GET query string or POST array into a string and replace certain variables with their own.



Tags:

return:  The string created from the array.


Parameters

array   $array   The associate array to convert whose form is such that the keys are the names of the variables and the values are said variables' values like this:
  1.              Array
  2.                 (
  3.                    [server_id0,
  4.                    [dn"dc=example,dc=com",
  5.                    [attr"sn"
  6.                  )
This will produce a string like this: "server_id=0&dn=dc=example,dc=com&attr=sn"
array   $exclude_vars   (optional) An array of variables to exclude in the resulting string
bool   $url_encode_ampersands   (optional) By default, this function encodes all ampersand-separators as & but callers may dislabe this by specifying false here. For example, URLs on HTML pages should encode the ampersands but URLs in header( "Location: http://example.com" ) should not be encoded.
[ Top ]



attrcmp [line 2534]

void attrcmp( $a1, $a2)

Compare the names of two Atrribute objects



Parameters

   $a1  
   $a2  
[ Top ]



auto_lang [line 118]

void auto_lang( $lang)

This function will convert the browser two character language into the default 5 character language, where the country portion should NOT be assumed to be upper case characters of the first two characters.



Parameters

   $lang  
[ Top ]



a_array_rand [line 3182]

string a_array_rand( array $input, integer, $num_req)

This function returns an array of $num_req values randomly picked from the $input array



Tags:

return:  the padded string


Parameters

array   $input   of values
integer,   $num_req   number of values in returned array
[ Top ]



binSIDtoText [line 2972]

void binSIDtoText( $binsid)



Parameters

   $binsid  
[ Top ]



check_config [line 130]

void check_config( $config_file)

Makes sure that the config file is properly setup and that your install of PHP can handle LDAP stuff.



Parameters

   $config_file  
[ Top ]



clean_search_vals [line 2865]

string clean_search_vals( string $val)

This function will clean up the values use during a search - namely, values that have brackets as that messes up the search filter.



Tags:

return:  String that is ready for the search filter.


Parameters

string   $val   String that will be used in the search filter.
[ Top ]



cmd_control_pane [line 276]

array cmd_control_pane( )

Commands available in the control_panel of the page



[ Top ]



debug_dump [line 299]

void debug_dump( string|array $variable, [boolean $die = false], [ $onlydebugaddr = false])

This function dumps the $variable for debugging purposes



Parameters

string|array   $variable   Variable to dump
boolean   $die   Whether to stop execution or not.
   $onlydebugaddr  
[ Top ]



debug_log [line 345]

void debug_log( string $msg, [int $level = 0])

Debug Logging to Syslog

The global debug level is turned on in your configuration file by setting:

  1.     $config->custom->debug['level'255;
together with atleast one output direction (currently file and syslog are supported).
  1.     $config->custom->debug['file''/tmp/pla_debug.log';
  2.     $config->custom->debug['syslog'true;

The debug level is turned into binary, then if the message levels bit is on the message will be sent to the debug log. (Thus setting your debug level to 255, all bits on, will results in all messages being printed.)

The message level bits are defined here. 0( 1) = Entry/Return results from function calls. 1( 2) = Configuration Processing 2( 4) = Template Processing 3( 8) = Schema Processing 4( 16) = LDAP Server Communication 5( 32) = Tree Processing 7( 64) = Other non generic messages 8(128) = Page Processing




Tags:

see:  syslog.php


Parameters

string   $msg   Message to send to syslog
int   $level   Log bit number for this message.
[ Top ]



del_cached_item [line 670]

void del_cached_item( $server_id, $item, [ $subitem = 'null'])

Deletes the cache for a specified $item for the specified $server_id



Parameters

   $server_id  
   $item  
   $subitem  
[ Top ]



dn_escape [line 2313]

void dn_escape( $dn)

Parse a DN and escape any special characters



Parameters

   $dn  
[ Top ]



dn_unescape [line 2331]

void dn_unescape( $dn)

Parse a DN and unescape any special characters



Parameters

   $dn  
[ Top ]



draw_chooser_link [line 2227]

void draw_chooser_link( string $form_element, [bool $include_choose_text = true], [ $rdn = "none"])

Draws an HTML browse button which, when clicked, pops up a DN chooser dialog.



Parameters

string   $form_element   The name of the form element to which this chooser dialog will publish the user's choice. The form element must be a member of a form with the "name" or "id" attribute set in the form tag, and the element must also define "name" or "id" for JavaScript to uniquely identify it. Example $form_element values may include "creation_form.container" or "edit_form.member_uid". See /templates/modification/default.php for example usage.
bool   $include_choose_text   (optional) If true, the function draws the localized text "choose" to the right of the button.
   $rdn  
[ Top ]



draw_date_selector_link [line 3216]

void draw_date_selector_link( string $attr)

Draws an HTML date selector button which, when clicked, pops up a date selector dialog.



Parameters

string   $attr   The name of the date type attribute
[ Top ]



draw_formatted_dn [line 2756]

void draw_formatted_dn( $ldapserver, $entry)

Gets a DN string using the user-configured tree_display_format string to format it.



Parameters

   $ldapserver  
   $entry  
[ Top ]



draw_jpeg_photos [line 1828]

void draw_jpeg_photos( $ldapserver, string $dn, [string $attr_name = 'jpegPhoto'], [bool $draw_delete_buttons = false], [bool $draw_bytes_and_size = true], [string $table_html_attrs = 'align="left"'], [ $img_html_attrs = ''], int $server_id)

Draw the jpegPhoto image(s) for an entry wrapped in HTML. Many options are available to specify how the images are to be displayed.

Usage Examples:

  1.     draw_jpeg_photos0"cn=Bob,ou=People,dc=example,dc=com""jpegPhoto" truefalse"border: 1px; width: 150px" );
  2.     draw_jpeg_photos1"cn=Fred,ou=People,dc=example,dc=com" );




Parameters

int   $server_id   The ID of the server of interest.
string   $dn   The DN of the entry that contains the jpeg attribute you want to draw.
string   $attr_name   The name of the attribute containing the jpeg data (usually 'jpegPhoto').
bool   $draw_delete_buttons   If true, draws a button beneath the image titled 'Delete' allowing the user to delete the jpeg attribute by calling JavaScript function deleteAttribute() provided in the default modification template.
bool   $draw_bytes_and_size   If true, draw text below the image indicating the byte size and dimensions.
string   $table_html_attrs   Specifies optional CSS style attributes for the table tag.
   $ldapserver  
   $img_html_attrs  
[ Top ]



enc_type_select_list [line 2944]

void enc_type_select_list( $enc_type)



Parameters

   $enc_type  
[ Top ]



error [line 423]

void error( $msg, [ $type = 'note'], [ $fatal = false], [ $backtrace = false])

Display an error message in the system message panel of the page.



Parameters

   $msg  
   $type  
   $fatal  
   $backtrace  
[ Top ]



expand_dn_with_base [line 1381]

string|null expand_dn_with_base( string $base, string $sub_dn)

Appends a servers base to a "sub" dn or returns the base.



Tags:

return:  Returns null if both base is null and sub_dn is null or empty


Parameters

string   $base   The baseDN to be added if the DN is relative
string   $sub_dn   The DN to be made absolute
[ Top ]



full_str_pad [line 2728]

string full_str_pad( string $input, integer $pad_length, [string $pad_string = ''], [integer $pad_type = 0])

String padding



Tags:

return:  the padded string


Parameters

string   $input   input string
integer   $pad_length   length of the result
string   $pad_string   the filling string
integer   $pad_type   padding mode
[ Top ]



get_cached_item [line 610]

Returns get_cached_item( $server_id, $item, [ $subitem = 'null'])

Returns the cached array of LDAP resources.

Note that internally, this function utilizes a two-layer cache, one in memory using a static variable for multiple calls within the same page load, and one in a session for multiple calls within the same user session (spanning multiple page loads).




Tags:

return:  the cached attributed requested, or null if there is nothing cached..


Parameters

   $server_id  
   $item  
   $subitem  
[ Top ]



get_cleaned_up_predefined_search [line 1405]

array get_cleaned_up_predefined_search( int $query_id)

Reads the query, checks all values and sets defaults.



Tags:

return:  The fixed query or null on error


Parameters

int   $query_id   The ID of the predefined query.
[ Top ]



get_container [line 1509]

string get_container( string $dn, [boolean $lower = true])

Given a DN string, this returns the parent container portion of the string.

For example. given 'cn=Manager,dc=example,dc=com', this function returns 'dc=example,dc=com'.




Tags:

return:  The container
see:  get_rdn()


Parameters

string   $dn   The DN whose container string to return.
boolean   $lower   The DN returned will be in lower case.
[ Top ]



get_custom_file [line 873]

string get_custom_file( int $server_id, string $filename, $path)

Get a customized file for a server We don't need any caching, because it's done by PHP



Tags:

return:  The customized filename, if exists, or the standard one


Parameters

int   $server_id   The ID of the server
string   $filename   The requested filename
   $path  
[ Top ]



get_default_hash [line 2210]

String get_default_hash( int $server_id)

Gets the default enc_type configured in config.php for the server indicated by $server_id;



Tags:

return:  The enc_type, like 'sha', 'md5', 'ssha', 'md5crypt', for example.


Parameters

int   $server_id   The ID of the server of interest.
[ Top ]



get_enc_type [line 2172]

string get_enc_type( string $user_password)

Detects password encryption type

Returns crypto string listed in braces. If it is 'crypt' password, returns crypto detected in password hash. Function should detect md5crypt, blowfish and extended DES crypt. If function fails to detect encryption type, it returns NULL.




Parameters

string   $user_password   hashed password
[ Top ]



get_href [line 2351]

string get_href( string $type, [ $extra_info = ''])

Fetches the URL for the specified item. This is a convenience function for fetching project HREFs (like bugs)



Tags:

return:  The URL to the requested item.


Parameters

string   $type   One of "open_bugs", "add_bug", "donate", or "add_rfe" (rfe = request for enhancement)
   $extra_info  
[ Top ]



get_icon [line 1197]

string get_icon( $ldapserver, string $dn, int $server_id)

Given a DN and server ID, this function reads the DN's objectClasses and

determines which icon best represents the entry. The results of this query are cached in a session variable so it is not run every time the tree browser changes, just when exposing new DNs that were not displayed previously. That means we can afford a little bit of inefficiency here in favor of coolness. :)

This function returns a string like "country.png". All icon files are assumed to be contained in the /images/ directory of phpLDAPadmin.

Developers are encouraged to add new icons to the images directory and modify this function as needed to suit their types of LDAP entries. If the modifications are general to an LDAP audience, the phpLDAPadmin team will gladly accept them as a patch.




Parameters

int   $server_id   The ID of the LDAP server housing the DN of interest.
string   $dn   The DN of the entry whose icon you wish to fetch.
   $ldapserver  
[ Top ]



get_next_number [line 1019]

int get_next_number( &$ldapserver, [ $startbase = ''], [ $type = 'uid'], [ $increment = false], [ $filter = false], object $ldapserver)

For hosts who have 'enable_auto_uid_numbers' set to true, this function will

get the next available uidNumber using the host's preferred mechanism (uidpool or search). The uidpool mechanism uses a user-configured entry in the LDAP server to store the last used uidNumber. This mechanism simply fetches and increments and returns that value. The search mechanism is more complicated and slow. It searches all entries that have uidNumber set, finds the smalles and "fills in the gaps" by incrementing the smallest uidNumber until an unused value is found. Both mechanisms do NOT prevent race conditions or toe-stomping, so care must be taken when actually creating the entry to check that the uidNumber returned here has not been used in the mean time. Note that the two different mechanisms may (will!) return different values as they use different algorithms to arrive at their result. Do not be alarmed if (when!) this is the case.

Also note that both algorithms are susceptible to a race condition. If two admins are adding users simultaneously, the users may get identical uidNumbers with this function.

See config.php.example for more notes on the two auto uidNumber mechanisms.




Tags:

todo:  Must turn off auto_uid|gid in template if config is disabled.


Parameters

object   $ldapserver   The LDAP Server Object of interest.
   &$ldapserver  
   $startbase  
   $type  
   $increment  
   $filter  
[ Top ]



get_rdn [line 1479]

string get_rdn( string $dn, [bool $include_attrs = 0], [ $decode = false])

Given a DN string, this returns the 'RDN' portion of the string.

For example. given 'cn=Manager,dc=example,dc=com', this function returns 'cn=Manager' (it is really the exact opposite of get_container()).




Tags:

return:  The RDN
see:  get_container()


Parameters

string   $dn   The DN whose RDN to return.
bool   $include_attrs   If true, include attributes in the RDN string. See http://php.net/ldap_explode_dn for details
   $decode  
[ Top ]



get_request [line 450]

void get_request( $attr, [ $type = null], [ $die = false], [ $default = null])

Return the result of a form variable, with optional default



Parameters

   $attr  
   $type  
   $die  
   $default  
[ Top ]



get_user_agent_string [line 2580]

string|false get_user_agent_string( )

Gets the USER_AGENT string from the $_SERVER array, all in lower case in an E_NOTICE safe manner.



Tags:

return:  The user agent string as reported by the browser.


[ Top ]



htmlid [line 3241]

string htmlid( $sid, string $dn)

Returns a HTML id that can be used in the URL after the #.



Parameters

string   $dn   The DN to pretty-print.
   $sid  
[ Top ]



in_array_ignore_case [line 2666]

bool in_array_ignore_case( string $needle, array $haystack)

Checks if a string exists in an array, ignoring case.



Tags:

return:  True if its there, false if its not.


Parameters

string   $needle   What you are looking for
array   $haystack   The array that you think it is in.
[ Top ]



is_browser_os_mac [line 2646]

boolean is_browser_os_mac( )

Determines whether the browser's operating system is Macintosh.



Tags:

return:  True if the brower's OS is mac, false otherwise.


[ Top ]



is_browser_os_unix [line 2596]

boolean is_browser_os_unix( )

Determines whether the browser's operating system is UNIX (or something like UNIX).



Tags:

return:  True if the brower's OS is UNIX, false otherwise.


[ Top ]



is_browser_os_windows [line 2624]

boolean is_browser_os_windows( )

Determines whether the browser's operating system is Windows.



Tags:

return:  True if the brower's OS is Windows, false otherwise.


[ Top ]



is_dn_string [line 795]

bool is_dn_string( $str, string $attr)

Given a string, this function returns true if the string has the format of a DN (ie, looks like "cn=Foo,dc=example,dc=com"). Returns false otherwise.

The purpose of this function is so that developers can examine a string and know if it looks like a DN, and draw a hyperlink as needed.

(See unit_test.php for test cases)




Tags:

see:  unit_test.php


Parameters

string   $attr   The attribute to examine for "DNness"
   $str  
[ Top ]



is_mail_string [line 833]

bool is_mail_string( string $str)

Get whether a string looks like an email address (user@example.com).



Tags:

return:  Returns true if the specified string looks like an email address or false otherwise.


Parameters

string   $str   The string to analyze.
[ Top ]



is_url_string [line 852]

bool is_url_string( string $str)

Get whether a string looks like a web URL (http://www.example.com/)



Tags:

return:  Returns true if the specified string looks like a web URL or false otherwise.


Parameters

string   $str   The string to analyze.
[ Top ]



littleEndian [line 2960]

void littleEndian( $hex)



Parameters

   $hex  
[ Top ]



masort [line 2999]

void masort( &$data, string $sortby, [bool $rev = 0], array $data)

Sort a multi dimensional array.



Parameters

array   $data   Multi demension array passed by reference
string   $sortby   Comma delimited string of sort keys.
bool   $rev   Whether to reverse sort.
   &$data  
[ Top ]



obfuscate_password_display [line 734]

bool obfuscate_password_display( [string $enc = null])

Fetches whether the user has configured phpLDAPadmin to obfuscate passwords with "*********" when displaying them.

This is configured in config.php thus:

  1.   $obfuscate_password_display true;




Parameters

string   $enc   Password encoding type
[ Top ]



password_check [line 2030]

Boolean password_check( $cryptedpassword, $plainpassword, String $hash, String $clear)

Given a clear-text password and a hash, this function determines if the clear-text password is the password that was used to generate the hash. This is handy to verify a user's password when all that is given is the hash and a "guess".



Tags:

return:  True if the clear password matches the hash, and false otherwise.


Parameters

String   $hash   The hash.
String   $clear   The password in clear text to test.
   $cryptedpassword  
   $plainpassword  
[ Top ]



password_generate [line 3104]

void password_generate( )

This function returns a string automatically generated

based on the criteria defined in the array $criteria in config.php




[ Top ]



password_hash [line 1937]

string password_hash( string $password_clear, string $enc_type)

Hashes a password and returns the hash based on the specified enc_type.



Tags:

return:  The hashed password.


Parameters

string   $password_clear   The password to hash in clear text.
string   $enc_type   Standard LDAP encryption type which must be one of crypt, ext_des, md5crypt, blowfish, md5, sha, smd5, ssha, or clear.
[ Top ]



pla_blowfish_decrypt [line 563]

string pla_blowfish_decrypt( string $encdata, [string $secret = null])

Decryption using blowfish algorithm



Tags:

return:  original data
author:  lem9 (taken from the phpMyAdmin source)
access:  public


Parameters

string   $encdata   encrypted data
string   $secret   the secret
[ Top ]



pla_blowfish_encrypt [line 519]

string pla_blowfish_encrypt( string $data, [string $secret = null])

Encryption using blowfish algorithm



Tags:

return:  the encrypted result
author:  lem9 (taken from the phpMyAdmin source)
access:  public


Parameters

string   $data   original data
string   $secret   the secret
[ Top ]



pla_compare_dns [line 919]

int pla_compare_dns( string $dn1, string $dn2)

Compares 2 DNs. If they are equivelant, returns 0, otherwise, returns their sorting order (similar to strcmp()): Returns < 0 if dn1 is less than dn2.

Returns > 0 if dn1 is greater than dn2.

The comparison is performed starting with the top-most element of the DN. Thus, the following list:

  1.        ou=people,dc=example,dc=com
  2.        cn=Admin,ou=People,dc=example,dc=com
  3.        cn=Joe,ou=people,dc=example,dc=com
  4.        dc=example,dc=com
  5.        cn=Fred,ou=people,dc=example,dc=org
  6.        cn=Dave,ou=people,dc=example,dc=org
Will be sorted thus using usort( $list, "pla_compare_dns" ):
  1.        dc=com
  2.        dc=example,dc=com
  3.        ou=people,dc=example,dc=com
  4.        cn=Admin,ou=People,dc=example,dc=com
  5.        cn=Joe,ou=people,dc=example,dc=com
  6.        cn=Dave,ou=people,dc=example,dc=org
  7.        cn=Fred,ou=people,dc=example,dc=org




Parameters

string   $dn1   The first of two DNs to compare
string   $dn2   The second of two DNs to compare
[ Top ]



pla_error [line 1634]

void pla_error( string $msg, [string $ldap_err_msg = null], [string $ldap_err_no = -1], [bool $fatal = true], [ $backtrace = null])

Prints an HTML-formatted error string. If you specify the optional parameters $ldap_err_msg and $ldap_err_no, this function will lookup the error number and display a verbose message in addition to the message you pass it.



Tags:

see:  pla_verbose_error()
see:  ldap_errno
see:  die


Parameters

string   $msg   The error message to display.
string   $ldap_err_msg   (optional) The error message supplied by the LDAP server
string   $ldap_err_no   (optional) The hexadecimal error number string supplied by the LDAP server
bool   $fatal   (optional) If true, phpLDAPadmin will terminate execution with the PHP die() function.
   $backtrace  
[ Top ]



pla_error_handler [line 1745]

void pla_error_handler( int $errno, string $errstr, string $file, int $lineno)

phpLDAPadmin's custom error handling function. When a PHP error occurs, PHP will call this function rather than printing the typical PHP error string.

This provides phpLDAPadmin the ability to format an error message more "pretty" and provide a link for users to submit a bug report. This function is not to be called by users. It is exclusively for the use of PHP internally. If this function is called by PHP from within a context where error handling has been disabled (ie, from within a function called with "@" prepended), then this function does nothing.




Tags:



Parameters

int   $errno   The PHP error number that occurred (ie, E_ERROR, E_WARNING, E_PARSE, etc).
string   $errstr   The PHP error string provided (ie, "Warning index "foo" is undefined)
string   $file   The file in which the PHP error ocurred.
int   $lineno   The line number on which the PHP error ocurred
[ Top ]



pla_explode_dn [line 2264]

array pla_explode_dn( string $dn, [ $with_attributes = 0], int $with_attriutes)

Explode a DN into an array of its RDN parts.



Tags:

return:  

An array of RDN parts of this format:

  1.   Array
  2.     (
  3.        [0=> uid=ppratt
  4.        [1=> ou=People
  5.        [2=> dc=example
  6.        [3=> dc=com
  7.     )

NOTE: When a multivalue RDN is passed to ldap_explode_dn, the results returns with 'value + value';



Parameters

string   $dn   The DN to explode.
int   $with_attriutes   (optional) Whether to include attribute names (see http://php.net/ldap_explode_dn for details)
   $with_attributes  
[ Top ]



pla_reverse_dn [line 2471]

string pla_reverse_dn( string $dn)

Reverses a DN such that the top-level RDN is first and the bottom-level RDN is last

For example:

  1.    cn=Brigham,ou=People,dc=example,dc=com
Becomes:
  1.    dc=com,dc=example,ou=People,cn=Brigham
This makes it possible to sort lists of DNs such that they are grouped by container.




Tags:

return:  The reversed DN
see:  pla_explode_dns
see:  pla_compare_dns()


Parameters

string   $dn   The DN to reverse
[ Top ]



pla_set_cookie [line 694]

bool pla_set_cookie( string $name, string $val, [int $expire = null], [string $dir = null])

Utility wrapper for setting cookies, which takes into consideration phpLDAPadmin configuration values. On success, true is returned. On failure, false is returned.



Tags:

see:  setcookie


Parameters

string   $name   The name of the cookie to set.
string   $val   The value of the cookie to set.
int   $expire   (optional) The duration in seconds of this cookie. If unspecified, $cookie_time is used from config.php
string   $dir   (optional) The directory value of this cookie (see php.net/setcookie)
[ Top ]



pla_verbose_error [line 1546]

array pla_verbose_error( string $err_no)

Given an LDAP error number, returns a verbose description of the error.

This function parses ldap_error_codes.txt and looks up the specified ldap error number, and returns the verbose message defined in that file.




Tags:

return:  An associative array contianing the error title and description like so:
  1.   Array
  2.     (
  3.        [title=> "Invalid Credentials"
  4.        [description=> "An invalid username and/or password was supplied to the LDAP server."
  5.     )


Parameters

string   $err_no   The hex error number (ie, "0x42") of the LDAP error of interest.
[ Top ]



pla_version [line 78]

string pla_version( )

Returns the phpLDAPadmin version currently running. The version is read from the file named VERSION.



Tags:

return:  The current version as read from the VERSION file.


[ Top ]



pretty_print_dn [line 761]

string pretty_print_dn( string $dn)

Returns an HTML-beautified version of a DN.

Internally, this function makes use of pla_explode_dn() to break the the DN into its components. It then glues them back together with "pretty" HTML. The returned HTML is NOT to be used as a real DN, but simply displayed.




Parameters

string   $dn   The DN to pretty-print.
[ Top ]



random_junk [line 3230]

void random_junk( )

This is for Opera. By putting "random junk" in the query string, it thinks

that it does not have a cached version of the page, and will thus fetch the page rather than display the cached version




[ Top ]



random_salt [line 1444]

string random_salt( int $length)

Used to generate a random salt for crypt-style passwords. Salt strings are used to make pre-built hash cracking dictionaries difficult to use as the hash algorithm uses not only the user's password but also a randomly generated string. The string is stored as the first N characters of the hash for reference of hashing algorithms later.

--- added 20021125 by bayu irawan <bayuir@divnet.telkom.co.id> --- --- ammended 20030625 by S C Rigler <srigler@houston.rr.com> ---




Tags:

return:  The generated salt string.


Parameters

int   $length   The length of the salt string to generate.
[ Top ]



real_attr_name [line 986]

string real_attr_name( string $attr_name)

Prunes off anything after the ";" in an attr name. This is useful for attributes that may have ";binary" appended to their names. With real_attr_name(), you can more easily fetch these attributes' schema with their "real" attribute name.



Parameters

string   $attr_name   The name of the attribute to examine.
[ Top ]



return_ldap_hash [line 3066]

array return_ldap_hash( object $ldapserver, string $base_dn, string $filter, string $key, array $attrs, [bool $sort = true])

Query LDAP and return a hash.



Tags:

return:  Array of values keyed by $key.


Parameters

object   $ldapserver   The LDAPServer object of the server which the user hsa logged in.
string   $base_dn   The base DN to use.
string   $filter   LDAP Query filter.
string   $key   LDAP attribute to use as key.
array   $attrs   LDAP attributes to use as values.
bool   $sort   Specify false to not sort results by DN or true to have the returned array sorted by DN (uses ksort) or an array of attribute names to sort by attribute values
[ Top ]



server_info_list [line 2921]

void server_info_list( [ $visible = false])



Parameters

   $visible  
[ Top ]



server_select_list [line 2883]

void server_select_list( [ $select_id = null], [ $only_logged_on = true], [ $select_name = 'server_id'], [ $js_script = null])

Server html select list



Parameters

   $select_id  
   $only_logged_on  
   $select_name  
   $js_script  
[ Top ]



set_cached_item [line 648]

void set_cached_item( $server_id, $item, [ $subitem = 'null'], $data)

Caches the specified $item for the specified $server_id.

Returns true on success of false on failure.




Parameters

   $server_id  
   $item  
   $subitem  
   $data  
[ Top ]



shadow_date [line 2808]

void shadow_date( $attrs $attrs, $attr $attr)

Takes a shadow* attribute and returns the date as an integer.



Parameters

$attrs   $attrs   array of Attribute objects
$attr   $attr   a shadow attribute name
[ Top ]



sortAttrs [line 2481]

void sortAttrs( $a, $b)



Parameters

   $a  
   $b  
[ Top ]



string_in_array_value [line 2698]

bool string_in_array_value( string $needle, array $haystack)

Checks if a string exists in part in an array value, ignoring case.



Tags:

return:  True if its there, false if its not.


Parameters

string   $needle   What you are looking for
array   $haystack   The array that you think it is in.
[ Top ]



support_oid_to_text [line 1582]

void support_oid_to_text( $oid_id)



Parameters

   $oid_id  
[ Top ]



system_message [line 488]

void system_message( $msg, [ $redirect = null])

Record a system message.

This function can be used as an alternative to generate a system message, if page hasnt yet been defined.




Parameters

   $msg