This class uses an XML file to build a data structure for keeping different kind of
settings. The XML file has different element for various data types, which are
validated when read or set. The settings from the configuration file are separated
into different groups, depending on the purpose they are used in the application.
These settings can be modified using the class, and then again saved to XML format.
Here's a brief description of the XML file elements:
- The root element CONFIG has 3 attributes:
- "saveDate" is the date on which the
config was was altered for the last time;
- "authorAdmin" is the administrator
account, that was the last to alter the
configuration file. This is either the
master-administrator account from
<administrationSettings>, or any
of the application administrators;
- "authorIP" is the IP address, from
which the configuration file was
altered for the last time.
- There are 9 setting-group elements, used for seaprating different data.
- "administrationSettings" is for
built-in administrator accounts, and
administration specific data;
- "applicationSettings" is for settings
and restrictions applied to the information,
used by the application;
- "phpSettings" is used to modify the
PHP settigs for the application to run
- "sessionSettings" is the place where
session declaration and all related data
- "fileSettings" is the declaration for all the
directories and files that the
applicataion(web-site) uses, along with their
- "debugSettings" is for storing debug settings;
- "miscellaneousSettings" is for all the settings,
that can not fit in any other setting-group :)
- "customSettings" is for your own custom
- "databaseSettings" is for database accounts,
and related database settings.
- You can make your own setting-groups in the "big" setting-groups, using
the GROUP element, which has only one attribute - the name of the group.
- There are a couple of settings, used as groups, and they are:
- "administrator" - for storing administrator
accounts in the configuration file instead in
account database (or whatever you use);
- "session" element is for grouping the
declarations for session used by the
application - name and timeout in general,
but you can add whatever you want.
- The basic elements of the configiration XML file are validated, depending
on their type. The types and the validation are:
- "alias" is a string, which has some restrictions -
it has to start with a letter, and then the rest of
the characters must be letters, digits, or
- "password" is a valid MD5 hash - 32 symbols,
using all the digits and the letters from A to F(
these are all the symbols used for representing
- "email" has to a be a valid email address;
- "string" has no restrictions - it's just a string :)
- "url" has to be a valid URL address. I made
a state of the art validation regular expression,
which even checks the TLD(top-level-domain)
of the URL (.com, .cc, .net, etc, but all existing).
- "boolean" has to be a valid boolean value.
The only allowed values are:
- 1, TRUE or ON for True;
- 0, FALSE or OFF for False.
The values are case-insensitive, and when set,
all values will be converted to ON/OFF;
- "int" - valid integer value (negative too);
- "float" - valid floating point number (real,
- "file" - path to a file. The path will not be
checked, because it may not be absolute, but
relative to some different base directory (the
root directory for the application, or something
else). The validation made are only for the
absence of illeagal characters, and for the
file permissions, which are set using the
- "directory" - the same as "file", but for
directories. It has to end with a slash (trailing
- Each setting or group (without the root element) has a description property,
declared using DESCRIPTION element within the described elements.