FusionDirectory
 All Data Structures Files Functions Variables
Public Member Functions | Data Fields
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 ($sizelimit=FALSE)
 Get a LDAP link object. More...
 
 set_current ($name)
 Set the current location. More...
 
 load_servers ()
 Load server information from config/LDAP. More...
 
 get_departments ()
 Store the departments from ldap in $this->departments.
 
 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 = array()
 Store configuration for current location.
 

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 (   $filename,
  $basedir = '' 
)

Class constructor of the config class.

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

Definition at line 77 of file class_config.inc.

References parse().

Member Function Documentation

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 94 of file class_config.inc.

References CACHE_DIR, CLASS_CACHE, session\global_get(), session\global_is_set(), session\global_set(), session\global_un_set(), parse(), and set_current().

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 763 of file class_config.inc.

References 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 730 of file class_config.inc.

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

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 259 of file class_config.inc.

References cred_decrypt(), msg_dialog\display(), session\global_get(), session\global_is_set(), and session\global_set().

Referenced by get_ldap_link().

get_ldap_link (   $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 303 of file class_config.inc.

References msg_dialog\display(), get_credentials(), session\global_get(), session\global_is_set(), session\global_set(), and ldap_init().

Referenced by get_departments(), and load_servers().

load_servers ( )

Load server information from config/LDAP.

This function searches the LDAP for servers (e.g. goImapServer, goMailServer etc.) and stores information about them $this->data['SERVERS']. In the case of mailservers the main section of the configuration file is searched, too.

Definition at line 433 of file class_config.inc.

References class_available(), get_cfg_value(), and get_ldap_link().

Referenced by set_current().

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 128 of file class_config.inc.

Referenced by __construct(), and check_and_reload().

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 706 of file class_config.inc.

set_current (   $name)

Set the current location.

Parameters
string$namethe name of the location

Definition at line 344 of file class_config.inc.

References class_available(), DEBUG_CONFIG, msg_dialog\display(), get_cfg_value(), session\global_set(), initLanguage(), and load_servers().

Referenced by check_and_reload().

snapshotEnabled ( )

Check if snapshot are enabled.

Returns
boolean TRUE if snapshot are enabled, FALSE otherwise

Definition at line 780 of file class_config.inc.

References msg_dialog\display(), get_cfg_value(), session\is_set(), and session\set().

tag_close (   $parser,
  $tag 
)

Close xml tag when parsing the xml config.

Parameters
string$parser
string$tag

Definition at line 240 of file class_config.inc.

tag_open (   $parser,
  $tag,
  $attrs 
)

Open xml tag when parsing the xml config.

Parameters
string$parser
string$tag
string$attrs

Definition at line 169 of file class_config.inc.


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