Settings: Porovnání verzí

Z Freenetis Wiki
Přejít na: navigace, hledání
(Založena nová stránka: cs:Nastavení TODO)
 
Řádek 1: Řádek 1:
 
[[cs:Nastavení]]
 
[[cs:Nastavení]]
TODO
+
[[ru:Настройки]]
 +
 
 +
[[en: 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)
 +
 
 +
= 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

Verze z 10. 12. 2013, 12:42

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)

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