Settings
Like any other information system and FreenetIS must have the possibility of various settings to the user and the system. At present, the more care two libraries:
application / libraries / settings.php (to set through a database) system / core / config.php (to set through the configuration file)
Obsah
- 1 Initial state
- 2 Current Status
- 3 Actual implementation
- 3.1 Library Settings
- 3.1.1 Variables
- 3.1.1.1 contact
- 3.1.1.2 currency
- 3.1.1.3 db_schema_version
- 3.1.1.4 Debtor
- 3.1.1.5 default_country
- 3.1.1.6 email_default_email
- 3.1.1.7 email_driver
- 3.1.1.8 email_hostname
- 3.1.1.9 email_port
- 3.1.1.10 EMAIL_PASSWORD
- 3.1.1.11 email_username
- 3.1.1.12 gateway
- 3.1.1.13 index_page
- 3.1.1.14 info
- 3.1.1.15 interrupt
- 3.1.1.16 map_google_maps_api_key
- 3.1.1.17 optional_message
- 3.1.1.18 payment_notice
- 3.1.1.19 protocol
- 3.1.1.20 registration_info
- 3.1.1.21 registration_license
- 3.1.1.22 self_registration
- 3.1.1.23 suffix
- 3.1.1.24 title
- 3.1.1.25 unknown device
- 3.1.1.26 use_javascript
- 3.1.1.27 voip_billing_driver
- 3.1.1.28 voip_billing_partner
- 3.1.1.29 voip_billing_password
- 3.1.1.30 voip_number_exclude
- 3.1.1.31 voip_number_interval
- 3.1.1.32 voip_sip_server
- 3.1.1.33 website_after_redirection
- 3.1.2 Methods
- 3.1.3 set =
- 3.1.1 Variables
- 3.2 Library Config
- 3.1 Library Settings
Initial state
In original condition Kohana framework supported only setting in the configuration file, no database setup over there. It follows that the system did not go to create form settings - you then have to pre-generate these files => big security risk.
Current Status
Almost all the settings have been moved into the database. In the configuration file leaving only the access data to the database.
Actual implementation
Library Settings
All settings are stored in a database table Config.
Variables
contact
currency
- The currency that is used in the system
- Can be set in Settings - System - Currency
- 'Default': CZK
db_schema_version
- Probably the most important variable - Specifies the current revision of the database schema used in the Autoupdate DB structure
-Can not be set by the user in the system, determines itself
Debtor
default_country
- Basic country used in a system (id from table countries)
- 'Default': 55 (Czech Republic) domain ==== ====
- Domain, which runs on FreenetIS
- If your address FreenetISu <nowiki> http://www.mojedomena.cz/freenetis/ </ nowiki>, this variable <nowiki> www.mojedomena.cz </ nowiki>
- 'Default': empty (for a URL then use server :: HTTP_HOST ())
email_default_email
- Default e-mail - all e-mails sent from FreenetIS will be listed as the sender of this address
- Can be set in Settings - System - Default e-mail
- 'Default': no-reply@freenetis.org
email_driver
- Driver sending e-mail - the way they send e-mails
- The possible options - native (using php mail), SMTP and Sendmail
- Set in the Settings - E-mail - Driver
- 'Default': native
email_hostname
- SMTP server host
- Is taken into account only if it is set to SMTP email_driver
- Set in the Settings - E-mail - Host Name
- 'Default': empty
email_port
- SMTP server port
- Is taken into account only if it is set to SMTP email_driver
- Set in the Settings - E-mail - Port
-Default: 25
EMAIL_PASSWORD
- Password for the SMTP server host
- Is taken into account only if it is set to SMTP email_driver
- Set in the Settings - E-mail - Password
- 'Default': empty
email_username
- Username to access the SMTP server host
- Is taken into account only if it is set to SMTP email_driver
- Set in the Settings - E-mail - User Name
- 'Default': empty
gateway
index_page
- Boolean variable, whether it is displayed index.php in the URL
- 1 => will be displayed, 0 => will be not displayed
- Can be set in Settings - System - Clean URL (via negation)
-Default 1
info
interrupt
map_google_maps_api_key
- Key for Google Maps API, which is in use.
-Default: empty
optional_message
payment_notice
protocol
- Protocol, which runs on FreenetIS
- If your address FreenetISu <nowiki> http://www.mojedomena.cz/freenetis/ </ nowiki>, this variable <nowiki> http </ nowiki>
- 'Default': empty (for a URL is used the value of http)
registration_info
- Information that appears on the exported on top of application
- 'Default': empty
registration_license
- Licensing conditions that appear on the bottom of the exported application
- 'Default': empty
self_registration
- Logical variable whether to allow self-registration of candidates for membership
- Can be set in Settings - System - Self-Registration
- 'Default' 1
suffix
- Suffix for the domain in the URL, which runs FreenetIS
- If your address FreenetISu <nowiki> http://www.mojedomena.cz/freenetis/ </ nowiki>, this variable <nowiki> / freenetis / </ nowiki>
- Must always begin and end with a slash (may be /)
- 'Default': empty (for a URL is then used substr (server :: SCRIPT_NAME (), 0, -9))
title
- Page title that appears in the header (inside the HTML title attribute)
- Can be set in Settings - System - Page title
- 'Default': FreenetIS
unknown device
====upload directory====
- Specifies the directory in which to upload files (imports, etc.)
-Default upload
use_javascript
- Boolean variable, whether it is used javascript
- Obsolete, in the future will be removed
- 'Default' 1
voip_billing_driver
- Variable contains the currently selected driver for VoIP
- Currently supported for VOIP solutions only drver from NFX z.s.p.o.
- 'Default' 0
voip_billing_partner
- Variable contains the user name to log on to billing
- 'Default' empty
voip_billing_password
- Variable contains the user password to log on to billing
-Default empty
voip_number_exclude
- Variable contains a nine-digit numbers separated by a semicolon (;)
- The figures shown in this list are not offered for selection for the registration of VoIP account
-Default empty
voip_number_interval
- Variable contains a nine-digit number in the range of shape-XXXXXXXXX XXXXXXXXX
- The figures shown in this list are offered for selection for the registration of VoIP account
-Default empty
voip_sip_server
- Variable holds a string with the SIP server hostname. Eg. sip.slfree.czf
- Appears in VoIP account as additional information. It has no effect on the control panel.
- 'Default': empty
website_after_redirection
Methods
The entire library contains only two methods - set and get.
The controller and the views is used to dynamically access - at the top of the controller creates an instance of the library:
$ this-> settings = new Settings ();
and then as the value of the variable suffix is obtained as follows:
$ this-> Settings-> get ('suffix');
In the other application (helpers, etc.) must then use the static approach:
$ suffix = Settings :: get ('suffix');
Get
- Returns the value specified by the key
- If it finds a non-empty value, return it
- If it finds a null value or an unexpected error happens, it checks whether there is a private attribute of the same name (ie default)
- If it exists, return it
- If there is, try to return the same name variable from the config (the config file)
set =
- Set the variable input with keys to the specified value
- If an unexpected error occurs, it returns failure
- Else if variable already exists in the database, updates it
- Attempt to create variable in the database if does not exist,
Library Config
These are the settings that are written to the configuration file config.php.
It is, however, only variables with data for the database connection.
Variables
db_type
- Database type (mysql, pgsql)
- Yet is only supported by MySQL
-Default: mysql
db_name
- Name of the database, which runs FreenetIS
-Default: freenetis
db_host
- The address of the host that will run FreenetIS
-Default: localhost
db_user
- User name to connect to the database
-Default: freenetis
DB_PASSWORD
- The user password for the database connection
-Default: freenetis
db_table_prefix
- Prefix for tables FreenetIS
- Useful if you want to use a common database for FreenetIS and other project
-Default: empty
Methods
Unlike libraries Settings at the library only uses static approach:
$ db_name = Config :: get ('db_name')
Get=
- Returns the value of the configuration file according to a specified key
set=
- Set the desired value for the specified key