Class: atkConfig
Source Location: /class.atkconfig.inc
Class atkConfig
Method Summary
| static
mixed
|
get() |
Get a configuration value for a section (typically a module) |
| static
array
|
getConfigForSection() |
Get the configuration values for a section and if the section turns out to be a module, try to get the module configs and merge them as fallbacks. |
| static
array
|
getDirConfigForSection() |
Get all configuration values from all configuration files for a specific directory and a specific section. |
| static
void
|
smartDebugLevel() |
Returns a debug level based on the given options for dynamically checking/setting the debug level. If nothing found returns the default level. |
| void |
addPop3Response() |
Translate pop3 server responses to user readable error messages. |
| void |
attribRestrict() |
Restrict access to an attribute to a certain entity (group or level) |
| void |
grant() |
Grants acces to an entity (group or level) |
Methods
static mixed get(
string
$section, string
$tag, [mixed
$default = ""]
)
|
|
Get a configuration value for a section (typically a module)
Can be overridden with a global function config_$section_$tag. Relies on your configurations being in configs/ (or wherever $config_configdir says). Also gets $section.*.inc.php. If the section is a module and has a skel/configs/ it will get those configs too and use them as defaults.
Example: atkConfig::get('color','mymodule','FF0000');
Parameters:
|
string |
$section: |
Section to check (typically a module) |
|
string |
$tag: |
Name of configuration to get |
|
mixed |
$default: |
Default to use if configuration value does not exist |
API Tags:
| Return: | Configuration value |
| Access: | public |
static array getConfigForSection(
string
$section
)
|
|
Get the configuration values for a section and if the section turns out to be a module, try to get the module configs and merge them as fallbacks.
Parameters:
|
string |
$section: |
Name of the section to get configs for |
API Tags:
| Return: | Configuration values |
| Access: | protected |
static array getDirConfigForSection(
string
$dir, string
$section
)
|
|
Get all configuration values from all configuration files for a specific directory and a specific section.
Parameters:
|
string |
$dir: |
Directory where the configuration files are |
|
string |
$section: |
Section to get configuration values for |
API Tags:
| Return: | Configuration values |
| Access: | protected |
static void ipDebugEnabled(
array
$params
)
|
|
Is debugging enabled for client IP?
Parameters:
static void requestDebugEnabled(
array
$params
)
|
|
Is debugging enabled by special request variable?
Parameters:
static void smartDebugLevel(
int
$default, [array
$options = array()]
)
|
|
Returns a debug level based on the given options for dynamically checking/setting the debug level. If nothing found returns the default level.
Parameters:
|
int |
$default: |
The default debug level |
|
array |
$options: |
|
void addPop3Response(
String
$substring, String
$message
)
|
|
Translate pop3 server responses to user readable error messages.
This function is only of use when using pop3 as authentication method. Some pop3 servers give specific error messages that may be of interest to the user. If you use this function (in the config file) and atk encounters the specified substring in a server response, the specified message is displayed.
Parameters:
|
String |
$substring: |
The substring to look for in the server response. |
|
String |
$message: |
The message to display to the user upon encounter of the substring. |
void addUser(
String
$name, String
$password, [mixed
$securitylevel = 0]
)
|
|
Create a new user.
When $config_authentication is set to "config", this method can be used in the configfile to create users. Mind you that anybody who has read access on the config file, can read the passwords. It is advisable to use a more secure authentication method like "db" or "pop3".
Parameters:
|
String |
$name: |
The login name. |
|
String |
$password: |
The password of the user. |
|
mixed |
$securitylevel: |
The securitylevel or group of the user. Permissions are granted on level/group basis, depending on the setting of $config_security_scheme |
void attribRestrict(
String
$node, String
$attrib, String
$mode, mixed
$entity
)
|
|
Restrict access to an attribute to a certain entity (group or level)
When $config_authorization is set to "config", this method can be used to restrict access to certain attributes for a given entity. This means that certain users can not edit or even view some attributes in a node. This is called "attribute level security".
If this method is called on a node/attrib combination, only those users who match the level/group can view/edit the attribute. If no calls are made for an attribute, the attribute is considered unrestricted and every user has access.
Parameters:
|
String |
$node: |
The node on which access is restricted. |
|
String |
$attrib: |
The name of the attribute that is to be restricted. |
|
String |
$mode: |
The action to restrict ("edit" or "view") |
|
mixed |
$entity: |
The level/group that has access to the attribute. |
void grant(
String
$node, String
$action, mixed
$entity
)
|
|
Grants acces to an entity (group or level)
When $config_authorization is set to "config", this method can be used in the configfile to grant privileges.
Parameters:
|
String |
$node: |
The node on which to grant a privilege. |
|
String |
$action: |
The action (privilege) that is granted. |
|
mixed |
$entity: |
The entity (securitylevel or group) to which the privilege is granted. |