FusionDirectory
Public Member Functions | Data Fields | Protected Member Functions
config Class Reference

This class is responsible for parsing and querying the fusiondirectory configuration file. More...

Public Member Functions

 __construct ($filename, $basedir='')
 Class constructor of the config class. More...
 
 check_and_reload ($force=FALSE)
 Check and reload the configuration. More...
 
 parse ($filename)
 Parse the given configuration file. More...
 
 tag_open ($parser, $tag, $attrs)
 Open xml tag when parsing the xml config. More...
 
 tag_close ($parser, $tag)
 Close xml tag when parsing the xml config. More...
 
 get_credentials ($creds)
 Get the password when needed from the config file. More...
 
 get_ldap_link (bool $sizelimit=FALSE)
 Get a LDAP link object. More...
 
 set_current ($name)
 Set the current location. More...
 
 updateManagementConfig (string $managementClass, $managementConfig, bool $userConfig=FALSE)
 Update the management config in the LDAP and the cache.
 
 hasManagementConfig (string $managementClass, bool $userConfig=FALSE)
 Test if there is a stored management config.
 
 getManagementConfig ($managementClass)
 Returns the config for a management class, or NULL.
 
 searchHooks ($class, $value)
 Search for hooks. More...
 
 get_cfg_value ($name, $default='')
 Get a configuration value from the config. More...
 
 check_session_lifetime ()
 Check if session lifetime matches session.gc_maxlifetime. More...
 
 snapshotEnabled ()
 Check if snapshot are enabled. More...
 

Data Fields

 $current = []
 Store configuration for current location.
 

Protected Member Functions

 storeDepartmentList ()
 Store the departments from ldap in $this->departmentList.
 
 storeDepartmentTree ()
 Store the tree render for departments in $this->departmentTree.
 

Detailed Description

This class is responsible for parsing and querying the fusiondirectory configuration file.

Definition at line 31 of file class_config.inc.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $filename,
  $basedir = '' 
)

Class constructor of the config class.

Parameters
string$filenamepath to the configuration file
string$basedirbase directory

Definition at line 76 of file class_config.inc.

References parse().

Member Function Documentation

◆ check_and_reload()

check_and_reload (   $force = FALSE)

Check and reload the configuration.

This function checks if the configuration has changed, since it was read the last time and reloads it. It uses the file mtime to check weither the file changed or not.

Definition at line 93 of file class_config.inc.

References CACHE_DIR, CLASS_CACHE, session\get(), session\is_set(), parse(), session\set(), set_current(), and session\un_set().

◆ check_session_lifetime()

check_session_lifetime ( )

Check if session lifetime matches session.gc_maxlifetime.

On debian systems the session files are deleted with a cronjob, which detects all files older than specified in php.ini:'session.gc_maxlifetime' and removes them. This function checks if the fusiondirectory.conf value matches the range defined by session.gc_maxlifetime.

Returns
boolean TRUE or FALSE depending on weither the settings match or not. If SESSIONLIFETIME is not configured in FusionDirectory it always returns TRUE.

Definition at line 854 of file class_config.inc.

References get_cfg_value().

◆ get_cfg_value()

get_cfg_value (   $name,
  $default = '' 
)

Get a configuration value from the config.

This returns a configuration value from the config. It either uses the data of the current location ($this->current), if it contains the value (e.g. current['BASE']) or otherwise uses the data from the main configuration section.

If no value is found and an optional default has been specified, then the default is returned.

Parameters
string$nameThe configuration key (case-insensitive)
string$defaultA default that is returned, if no value is found
Returns
string the configuration value if found or the default value

Definition at line 821 of file class_config.inc.

Referenced by check_session_lifetime(), set_current(), and snapshotEnabled().

◆ get_credentials()

get_credentials (   $creds)

Get the password when needed from the config file.

This function can be used to get the password associated to a keyword in the config file

Parameters
string$credsthe keyword associated to the password needed
Returns
string the password corresponding to the keyword

Definition at line 264 of file class_config.inc.

References cred_decrypt(), session\get(), htmlescape(), session\is_set(), and session\set().

Referenced by get_ldap_link().

◆ get_ldap_link()

get_ldap_link ( bool  $sizelimit = FALSE)

Get a LDAP link object.

This function can be used to get an ldap object, which in turn can be used to query the LDAP. See the LDAP class for more information on how to use it.

Example usage:

$ldap = $config->get_ldap_link();
Parameters
boolean$sizelimitWeither to impose a sizelimit on the LDAP object or not. Defaults to false. If set to true, the size limit in the configuration file will be used to set the option LDAP_OPT_SIZELIMIT.
Returns
ldapMultiplexer object

Definition at line 307 of file class_config.inc.

References get_credentials(), htmlescape(), and LDAP\init().

Referenced by set_current(), storeDepartmentList(), and updateManagementConfig().

◆ parse()

parse (   $filename)

Parse the given configuration file.

Parses the configuration file and displays errors if there is something wrong with it.

Parameters
string$filenameThe filename of the configuration file.

Definition at line 123 of file class_config.inc.

References htmlescape().

Referenced by __construct(), and check_and_reload().

◆ searchHooks()

searchHooks (   $class,
  $value 
)

Search for hooks.

Example usage:

$postcmd = $config->search(get_class($this), 'POSTMODIFY');
Parameters
string$classThe class name
string$valueKey to search in the hooks
Returns
array of hook commands or empty array

Definition at line 797 of file class_config.inc.

◆ set_current()

set_current (   $name)

Set the current location.

Parameters
string$namethe name of the location

Definition at line 343 of file class_config.inc.

References Lock\add(), CACHE_DIR, CLASS_CACHE, CONFIGRDN, DEBUG_CONFIG, Lock\deleteByObject(), get_cfg_value(), get_ldap_link(), htmlescape(), Language\init(), objects\open(), and session\set().

Referenced by check_and_reload().

◆ snapshotEnabled()

snapshotEnabled ( )

Check if snapshot are enabled.

Returns
boolean TRUE if snapshot are enabled, FALSE otherwise

Definition at line 871 of file class_config.inc.

References class_available(), logging\debug(), get_cfg_value(), htmlescape(), session\is_set(), and session\set().

◆ tag_close()

tag_close (   $parser,
  $tag 
)

Close xml tag when parsing the xml config.

Parameters
string$parser
string$tag

Definition at line 245 of file class_config.inc.

◆ tag_open()

tag_open (   $parser,
  $tag,
  $attrs 
)

Open xml tag when parsing the xml config.

Parameters
string$parser
string$tag
string$attrs

Definition at line 163 of file class_config.inc.


The documentation for this class was generated from the following file: