FusionDirectory
|
Go to the source code of this file.
Functions | |
fusiondirectory_autoload ($class_name) | |
Does autoloading for classes used in FusionDirectory. More... | |
class_available ($name) | |
Checks if a class is available. More... | |
plugin_available ($plugin) | |
Check if plugin is available. More... | |
DEBUG ($level, $line, $function, $file, $data, $info='') | |
Debug level action. More... | |
copynotice () | |
Return HTML safe copyright notice. | |
get_template_path ($filename='', $plugin=FALSE, $path='') | |
Return themed path for specified base file. More... | |
array_remove_entries (array $needles, array $haystack) | |
array_remove_entries_ics (array $needles, array $haystack) | |
array_merge_unique (array $ar1, array $ar2) | |
fusiondirectory_log ($message) | |
Generate a system log info. More... | |
& | get_userinfo () |
Return the current userinfo object. More... | |
& | get_smarty () |
Get global smarty object. More... | |
convert_department_dn ($dn, $base=NULL) | |
Convert a department DN to a sub-directory style list. More... | |
get_ou ($name) | |
Get the OU of a certain RDN. More... | |
get_people_ou () | |
Get the OU for users. More... | |
get_base_from_people ($dn) | |
Return a base from a given user DN. More... | |
strict_uid_mode () | |
Check if strict naming rules are configured. More... | |
to_string ($value) | |
Return a string/HTML representation of an array. More... | |
rewrite ($s) | |
Function to rewrite some problematic characters. More... | |
dn2base ($dn, $ou=NULL) | |
Return the base of a given DN. More... | |
check_command ($cmdline) | |
Check if a given command exists and is executable. More... | |
normalize_netmask ($netmask) | |
Put netmask in n.n.n.n format. More... | |
netmask_to_bits ($netmask) | |
Return the number of set bits in the netmask. More... | |
to_byte ($value) | |
Convert various data sizes to bytes. More... | |
humanReadableSize ($bytes, $precision=2) | |
Convert a size in bytes to a human readable version. More... | |
in_array_ics ($value, array $items) | |
Check if a value exists in an array (case-insensitive) More... | |
validate ($string) | |
Removes malicious characters from a (POST) string. More... | |
rmdirRecursive ($path, $followLinks=FALSE) | |
Recursively delete a path in the file system. More... | |
scan_directory ($path, $sort_desc=FALSE) | |
Get directory content information. More... | |
clean_smarty_compile_dir ($directory) | |
Clean the smarty compile dir. More... | |
create_revision ($revision_file, $revision) | |
Create the revision file. More... | |
compare_revision ($revision_file, $revision) | |
Compare the revision file. More... | |
array_key_ics ($ikey, array $items) | |
Lookup a key in an array case-insensitive. More... | |
array_differs (array $src, array $dst) | |
array_differs_recursive ($src, $dst) | |
array_cmp_recursive ($src, $dst) | |
normalizeLdap ($input) | |
Escape all LDAP filter relevant characters. More... | |
check_schema (array $cfg) | |
Check if LDAP schema matches the requirements. More... | |
get_post ($name) | |
Returns contents of the given POST variable and check magic quotes settings. More... | |
get_correct_class_name ($cls) | |
Return class name in correct case. | |
change_password ($dn, $password, $hash="") | |
Change the password of a given DN. More... | |
getEntryCSN (string $dn) | |
Get the Change Sequence Number of a certain DN. More... | |
send_binary_content ($data, $name, $type="application/octet-stream") | |
Initialize a file download with given content, name and data type. More... | |
xmlentities ($str) | |
Encode special string characters. More... | |
get_random_char () | |
Returns a random char. | |
cred_decrypt ($input, $password) | |
Decrypt a string with RIJNDAEL_128. More... | |
isIpInNet ($ip, $net, $mask) | |
Test if an ip is the network range. More... | |
expandIPv6 ($ip) | |
Expands an IP v6. | |
Common functions and named definitions.
Definition in file functions.inc.
array_cmp_recursive | ( | $src, | |
$dst | |||
) |
Determine if two arrays are different using recursion for sublevels
mixed | $src | The source |
mixed | $dst | The destination |
Definition at line 1099 of file functions.inc.
Referenced by array_differs_recursive().
array_differs | ( | array | $src, |
array | $dst | ||
) |
Determine if two arrays are different
array<int|string|bool|null|float|double|object> | $src The source |
array<int|string|bool|null|float|double|object> | $dst The destination |
Definition at line 1066 of file functions.inc.
Referenced by simplePlugin\cleanup().
array_differs_recursive | ( | $src, | |
$dst | |||
) |
Determine if two arrays are different using recursion for sublevels
mixed | $src | The source |
mixed | $dst | The destination |
Definition at line 1085 of file functions.inc.
References array_cmp_recursive().
array_key_ics | ( | $ikey, | |
array | $items | ||
) |
Lookup a key in an array case-insensitive.
Given an associative array this can lookup the value of a certain key, regardless of the case.
string | $ikey | needle |
array | $items | haystack |
Definition at line 1045 of file functions.inc.
array_merge_unique | ( | array | $ar1, |
array | $ar2 | ||
) |
Merge to array but remove duplicate entries (case-insensitive)
Merges two arrays and removes duplicate entries. Triggers an error if first or second parametre is not an array.
array<int|string|bool|null|float|double|object> | $ar1 first array |
array<int|string|bool|null|float|double|object> | $ar2 second array |
Definition at line 275 of file functions.inc.
Referenced by ObjectClassBooleanAttribute\__construct(), and simplePlugin\mergeObjectClasses().
array_remove_entries | ( | array | $needles, |
array | $haystack | ||
) |
Remove multiple entries from an array
Removes every element that is in $needles from the array given as $haystack
array | $needles | array of the entries to remove |
array | $haystack | original array to remove the entries from |
Definition at line 239 of file functions.inc.
Referenced by ObjectClassBooleanAttribute\__construct().
array_remove_entries_ics | ( | array | $needles, |
array | $haystack | ||
) |
Remove multiple entries from an array (case-insensitive)
Removes every element that is in $needles from the array given as $haystack but case insensitive
array<int|string|bool|null|float|double|object> | $needles array of the entries to remove |
array<int|string|bool|null|float|double|object> | $haystack original array to remove the entries from |
Definition at line 257 of file functions.inc.
Referenced by simplePlugin\remove().
change_password | ( | $dn, | |
$password, | |||
$hash = "" |
|||
) |
Change the password of a given DN.
Change the password of a given DN with the specified hash.
string | $dn | the DN whose password shall be changed |
string | $password | the password |
string | $hash | which hash to use to encrypt it, default is empty for reusing existing hash method for this password (or use the default one). |
Definition at line 1302 of file functions.inc.
References objects\open().
check_command | ( | $cmdline | ) |
Check if a given command exists and is executable.
Test if a given cmdline contains an executable command. Strips arguments from the given cmdline.
string | $cmdline | the cmdline to check |
Definition at line 640 of file functions.inc.
check_schema | ( | array | $cfg | ) |
Check if LDAP schema matches the requirements.
string | $cfg | A config object |
Definition at line 1138 of file functions.inc.
References class_available(), and htmlescape().
Referenced by LoginMethod\runSchemaCheck().
class_available | ( | $name | ) |
Checks if a class is available.
string | $name | The subject of the test |
Definition at line 92 of file functions.inc.
Referenced by check_schema(), LDAP\connect(), LDAP\get_objectclasses(), simplePlugin\getAuditAttributesListFromConf(), LoginPost\getLabel(), templateHandling\parseString(), and config\snapshotEnabled().
clean_smarty_compile_dir | ( | $directory | ) |
Clean the smarty compile dir.
string | $directory | smarty compile dir |
Definition at line 905 of file functions.inc.
References compare_revision(), create_revision(), FD_VERSION, htmlescape(), and scan_directory().
compare_revision | ( | $revision_file, | |
$revision | |||
) |
Compare the revision file.
Create the revision file in FusionDirectory spool dir
string | $revision_file | the name of the revision file |
string | $revision | the version of FusionDirectory |
Definition at line 996 of file functions.inc.
Referenced by clean_smarty_compile_dir().
convert_department_dn | ( | $dn, | |
$base = NULL |
|||
) |
Convert a department DN to a sub-directory style list.
This function returns a DN in a sub-directory style list. Examples:
If the specified DN contains a basedn which either matches the specified base or $config->current['BASE'] it is stripped.
string | $dn | the subject for the conversion |
string | $base | the base dn, default: $config->current['BASE'] |
Definition at line 349 of file functions.inc.
Referenced by config\storeDepartmentList().
create_revision | ( | $revision_file, | |
$revision | |||
) |
Create the revision file.
Create the revision file in FusionDirectory spool dir
string | $revision_file | the name of the revision file |
string | $revision | the version of FusionDirectory |
Definition at line 954 of file functions.inc.
Referenced by clean_smarty_compile_dir().
cred_decrypt | ( | $input, | |
$password | |||
) |
Decrypt a string with RIJNDAEL_128.
string | $input | The string to decrypt. |
String | $password | The password used |
Definition at line 1431 of file functions.inc.
Referenced by config\get_credentials().
DEBUG | ( | $level, | |
$line, | |||
$function, | |||
$file, | |||
$data, | |||
$info = '' |
|||
) |
Debug level action.
Print a DEBUG level if specified debug level of the level matches the the configured debug level.
int | $level | The log level of the message (should use the constants, defined in functions.in (DEBUG_TRACE, DEBUG_LDAP, etc.) |
int | $line | Define the line of the logged action (using LINE is common) |
string | $function | Define the function where the logged action happened in (using FUNCTION is common) |
string | $file | Define the file where the logged action happend in (using FILE is common) |
mixed | $data | The data to log. Can be a message or an array, which is printed with print_a |
string | $info | Optional: Additional information |
Definition at line 141 of file functions.inc.
References logging\debug().
dn2base | ( | $dn, | |
$ou = NULL |
|||
) |
Return the base of a given DN.
string | $dn | a DN |
string | $ou | an ou to remove from the base |
Definition at line 614 of file functions.inc.
References get_ou(), and get_people_ou().
Referenced by BaseSelectorAttribute\__construct(), Attribute\check(), and template\reset().
fusiondirectory_autoload | ( | $class_name | ) |
Does autoloading for classes used in FusionDirectory.
Takes the list generated by 'fusiondirectory-configuration-manager' and loads the file containing the requested class.
array | $class_name | list of class name |
Definition at line 44 of file functions.inc.
fusiondirectory_log | ( | $message | ) |
Generate a system log info.
Creates a syslog message, containing user information.
string | $message | the message to log |
Definition at line 288 of file functions.inc.
Referenced by logging\check().
get_base_from_people | ( | $dn | ) |
Return a base from a given user DN.
string | $dn |
Definition at line 500 of file functions.inc.
References get_people_ou().
get_ou | ( | $name | ) |
Get the OU of a certain RDN.
Given a certain RDN name (ogroupRDN, applicationRDN etc.) this function returns either a configured OU or the default for the given RDN.
Example:
$name | the rdn of the ou you are trying to find |
Definition at line 391 of file functions.inc.
Referenced by Lock\add(), LoginMethod\checkForLockingBranch(), Lock\deleteByObject(), Lock\deleteByUser(), dn2base(), Lock\get(), and get_people_ou().
get_people_ou | ( | ) |
Get the OU for users.
Function for getting the userRDN
Definition at line 484 of file functions.inc.
References get_ou().
Referenced by dn2base(), and get_base_from_people().
get_post | ( | $name | ) |
Returns contents of the given POST variable and check magic quotes settings.
Depending on the magic quotes settings this returns a stripclashed'ed version of a certain POST variable.
string | $name | the POST var to return ($_POST[$name]) |
Definition at line 1261 of file functions.inc.
References validate().
& get_smarty | ( | ) |
Get global smarty object.
Definition at line 324 of file functions.inc.
get_template_path | ( | $filename = '' , |
|
$plugin = FALSE , |
|||
$path = '' |
|||
) |
Return themed path for specified base file.
Depending on its parameters, this function returns the full path of a template file. First match wins while searching in this order:
string | $filename | The base file name |
boolean | $plugin | Flag to take the plugin directory as search base |
string | $path | User specified path to take as search base |
Definition at line 174 of file functions.inc.
Referenced by pluglist\show_iconmenu().
& get_userinfo | ( | ) |
Return the current userinfo object.
Definition at line 312 of file functions.inc.
Referenced by BaseSelectorAttribute\__construct(), simplePlugin\aclGetPermissions(), simplePlugin\callHook(), Language\detect(), managementListing\refreshBasesList(), CopyPasteHandler\update(), and managementListing\updateBase().
getEntryCSN | ( | string | $dn | ) |
Get the Change Sequence Number of a certain DN.
To verify if a given object has been changed outside of FusionDirectory in the meanwhile, this function can be used to get the entryCSN from the LDAP directory. It uses the attribute as configured in modificationDetectionAttribute
string | $dn | The dn you want to check |
Definition at line 1334 of file functions.inc.
Referenced by simplePlugin\__construct().
humanReadableSize | ( | $bytes, | |
$precision = 2 |
|||
) |
Convert a size in bytes to a human readable version.
float | $bytes | size in bytes |
int | $precision | number of digits after comma, default is 2 |
Definition at line 780 of file functions.inc.
in_array_ics | ( | $value, | |
array | $items | ||
) |
Check if a value exists in an array (case-insensitive)
This is just as http://php.net/in_array except that the comparison is case-insensitive.
string | $value | needle |
array | $items | haystack |
Definition at line 814 of file functions.inc.
Referenced by simplePlugin\__construct(), acl\extractMembers(), managementListing\getBase(), tests\is_email(), and managementListing\refreshBasesList().
isIpInNet | ( | $ip, | |
$net, | |||
$mask | |||
) |
Test if an ip is the network range.
string | $ip | The ip address to test. |
string | $net | The network to test |
string | $mask | The netmask of the network |
Definition at line 1465 of file functions.inc.
netmask_to_bits | ( | $netmask | ) |
Return the number of set bits in the netmask.
For a given subnetmask (for example 255.255.255.0) this returns the number of set bits.
Example:
Be aware of the fact that the function does not check if the given subnet mask is actually valid. For example: Bad examples:
$netmask | given netmask |
Definition at line 714 of file functions.inc.
normalize_netmask | ( | $netmask | ) |
Put netmask in n.n.n.n format.
string | $netmask | The netmask |
Definition at line 664 of file functions.inc.
normalizeLdap | ( | $input | ) |
Escape all LDAP filter relevant characters.
string | $input | string where we should add \ before special caracters |
Definition at line 1127 of file functions.inc.
plugin_available | ( | $plugin | ) |
Check if plugin is available.
Checks if a given plugin is available and readable.
string | $plugin | the subject of the check |
Definition at line 108 of file functions.inc.
Referenced by simpleTabs\__construct(), simpleTabs\addSpecialTabs(), pluglist\gen_menu(), and pluglist\show_iconmenu().
rewrite | ( | $s | ) |
Function to rewrite some problematic characters.
This function takes a string and replaces all possibly characters in it with less problematic characters, as defined in $REWRITE.
string | $s | the string to rewrite |
Definition at line 572 of file functions.inc.
rmdirRecursive | ( | $path, | |
$followLinks = FALSE |
|||
) |
Recursively delete a path in the file system.
Will delete the given path and all its files recursively. Can also follow links if told so.
string | $path | |
boolean | $followLinks | TRUE to follow links, FALSE (default) for not following links |
Definition at line 842 of file functions.inc.
scan_directory | ( | $path, | |
$sort_desc = FALSE |
|||
) |
Get directory content information.
Returns the content of a directory as an array in an ascending sorted manner.
string | $path | |
boolean | $sort_desc | weither to sort the content descending. |
Definition at line 869 of file functions.inc.
Referenced by clean_smarty_compile_dir().
send_binary_content | ( | $data, | |
$name, | |||
$type = "application/octet-stream" |
|||
) |
Initialize a file download with given content, name and data type.
string | $data | The content to send. |
string | $name | The name of the file. |
string | $type | The content identifier, default value is "application/octet-stream"; |
Definition at line 1363 of file functions.inc.
strict_uid_mode | ( | ) |
Check if strict naming rules are configured.
Return TRUE or FALSE depending on weither strictNamingRules are configured or not.
Definition at line 526 of file functions.inc.
Referenced by tests\is_uid(), and templateHandling\listFields().
to_byte | ( | $value | ) |
Convert various data sizes to bytes.
Given a certain value in the format n(g|m|k), where n is a value and (g|m|k) stands for Gigabyte, Megabyte and Kilobyte this function returns the byte value.
string | $value | a value in the above specified format |
Definition at line 746 of file functions.inc.
to_string | ( | $value | ) |
Return a string/HTML representation of an array.
This returns a string representation of a given value. It can be used to dump arrays, where every value is printed on its own line. The output is targetted at HTML output, it uses '
' for line breaks. If the value is already a string its returned unchanged.
mixed | $value | Whatever needs to be printed. |
Definition at line 549 of file functions.inc.
validate | ( | $string | ) |
Removes malicious characters from a (POST) string.
string | $string | the string to check for malicious caracters |
Definition at line 826 of file functions.inc.
Referenced by get_post(), managementListing\getAction(), and managementListing\updateBase().
xmlentities | ( | $str | ) |
Encode special string characters.
Encode the special caracters so we can use the string in HTML output, without breaking quotes.
string | $str | The String we want to encode. |
Definition at line 1394 of file functions.inc.