PHP Classes

File: readme.txt

Recommend this page to a friend!
  Classes of Kaloyan Kirilov   Mrasnika's configuration system   readme.txt   Download  
File: readme.txt
Role: Documentation
Content type: text/plain
Description: Some details on the script
Class: Mrasnika's configuration system
Store and retrieve settings from XML files
Author: By
Last change:
Date: 20 years ago
Size: 4,290 bytes
 

Contents

Class file image Download
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 correctly; - "sessionSettings" is the place where session declaration and all related data are stored; - "fileSettings" is the declaration for all the directories and files that the applicataion(web-site) uses, along with their file permissions; - "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 settings; - "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 underscore("_"); - "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 hexdecinal numbers); - "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, double); - "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 "permissions" attribute; - "directory" - the same as "file", but for directories. It has to end with a slash (trailing slash). - Each setting or group (without the root element) has a description property, declared using DESCRIPTION element within the described elements.