Undefined
By: Guest | Date: Apr 1 2010 19:13 | Format: PHP | Expires: never | Size: 10.53 KB | Hits: 1035
- <?PHP
- FINAL CLASS ILLI_Container_Constants EXTENDS ILLI_Container
- {
- public function init()
- {
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')
- // register the accepted offset-types for all settings;
- // the 3rd param is a switch-case-setting
- // name of application
- // this allows you to use a single-installation of ILLI for several apps; default is localhost
- -> set_Rule('string','APPLICATION_PROFILE')
- // php-ini
- -> set_Rule('array', 'PHP_INI')
- // aparse incoming get-vars
- // todo: move that into routing
- -> set_Rule('array', 'CLEANVARS_GET')
- // accepted vars, but hide for parsing
- -> set_Rule('array', 'CLEANVARS_GET_IGNORE')
- // allow ILLI to kill all unregistred vars
- -> set_Rule('bool', 'CLEANVARS_GET_DISCARD_UNREGISTERED')
- // allow only incoming get if client accept session-cookie
- -> set_Rule('bool', 'CLEANVARS_GET_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE')
- // aparse incoming post-vars
- // todo: move that into routing
- -> set_Rule('array', 'CLEANVARS_POST')
- // accepted vars, but hide for parsing
- -> set_Rule('array', 'CLEANVARS_POST_IGNORE')
- // allow ILLI to kill all unregistred vars
- -> set_Rule('bool', 'CLEANVARS_POST_DISCARD_UNREGISTERED')
- // allow only incoming post if client accept session-cookie
- -> set_Rule('bool', 'CLEANVARS_POST_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE')
- // env-mode-tolerance; defaults are PRODUCTION and DEVELOPMENT
- // url-deep-path; for root set = '/'
- -> set_Rule('string','BASE_DEVELOPMENT')
- -> set_Rule('string','BASE_PRODUCTION')
- // select layout-dir for view
- -> set_Rule('string','LAYOUT')
- // show errors and exception only for defined i.p.
- -> set_Rule('array', 'DEVELOPMENT_IP')
- // will redirect all requests to self-repaired, clean uri
- -> set_Rule('bool', 'FORWARD_TO_REPAIRED_URI')
- // page-encoding; this is global for pageoutput and form-accepted-charset
- -> set_Rule('string','ENCODING')
- // set cache timeouts for filetypes
- // @to0do: move that value into routing-table
- -> set_Rule('array', 'CLIENT_CACHE_CONTROL_MAX_AGE')
- -> set_Rule('array', 'CLIENT_CACHE_PRAGMA_CACHE')
- // min/max-php-version
- -> set_Rule('string','PHP_MIN_VERSION')
- -> set_Rule('string','PHP_MAX_VERSION');
- }
- public function run()
- {
- // default values
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('APPLICATION_PROFILE')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->APPLICATION_PROFILE = 'localhost';
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('PHP_INI')))
- (
- 'session.use_cookies' => true,
- 'session.use_only_cookies' => true,
- 'session.use_trans_sid' => false,
- 'session.hash_function' => '1',
- 'session.hash_bits_per_character' => 5,
- 'url_rewriter.tags' => '',
- 'expose_php' => 'off'
- );
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_GET')))
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_GET_IGNORE')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->CLEANVARS_GET_IGNORE = array();
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_GET_DISCARD_UNREGISTERED')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->CLEANVARS_GET_DISCARD_UNREGISTERED = TRUE;
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_GET_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->CLEANVARS_GET_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE = TRUE;
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_POST')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->CLEANVARS_POST = array();
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_POST_IGNORE')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->CLEANVARS_POST_IGNORE = array();
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_POST_DISCARD_UNREGISTERED')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->CLEANVARS_POST_DISCARD_UNREGISTERED = TRUE;
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('CLEANVARS_POST_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->CLEANVARS_POST_DISCARD_ALL_ON_MISSING_SESSIONCOOKIE = TRUE;
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('FORWARD_TO_REPAIRED_URI')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->FORWARD_TO_REPAIRED_URI = TRUE;
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('DEVELOPMENT_IP')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->DEVELOPMENT_IP = array('127.0.0.1', '127.0.0.2');
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('LAYOUT')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->LAYOUT = 'default';
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('BASE_DEVELOPMENT')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->BASE_DEVELOPMENT = '/';
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('BASE_PRODUCTION')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->BASE_PRODUCTION = '/';
- if(!(ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->offsetExists('ENCODING')))
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->ENCODING = 'UTF-8';
- // hardcoded to disallow usage
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')
- -> set_Entry('ENVIRONMENT_MODE', (in_array($_SERVER['REMOTE_ADDR'], ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->DEVELOPMENT_IP) ? 'DEVELOPMENT' : 'PRODUCTION'))
- -> set_Entry('PHP_MIN_VERSION', '5.2')
- -> set_Entry('PHP_MAX_VERSION', '6');
- // write directories
- ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')
- -> set_Rule('core')
- -> set_Rule('app')
- -> set_Entry('core', 'ROOT', rtrim(str_replace(array("/","\"), DIRECTORY_SEPARATOR, dirname(dirname(dirname(dirname(dirname(dirname(__FILE__))))))), '/\').DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'SYSTEM', rtrim(str_replace(array("/","\"), DIRECTORY_SEPARATOR, dirname(dirname(dirname(dirname(dirname(__FILE__)))))), '/\').DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'APP', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->SYSTEM.'APP'.DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'LIBRARIES', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->SYSTEM.'LIBRARIES'.DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'FILES', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->SYSTEM.'FILES'.DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'MEDIA', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->FILES.'media'.DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'PARTIALS', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->FILES.'partials'.DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'STYLES', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->MEDIA.'styles'.DIRECTORY_SEPARATOR)
- -> set_Entry('core', 'JSCRIPTS', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->MEDIA.'javascripts'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'ROOT', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->CORE->APP.DIRECTORY_SEPARATOR.ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Configuration')->APPLICATION_PROFILE.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'BROADCAST', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->ROOT.'broadcast'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'CACHE', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->ROOT.'cache'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'CONFIGS', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->ROOT.'configs'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'FILES', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->ROOT.'files'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'LAYOUTS', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->ROOT.'layouts'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'MODULES', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->ROOT.'modules'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'ROUTING', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->CONFIGS.'routing'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'MEDIA', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->FILES.'media'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'PARTIALS', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->FILES.'partials'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'STYLES', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->MEDIA.'styles'.DIRECTORY_SEPARATOR)
- -> set_Entry('app', 'JSCRIPTS', ILLI_Constructeur::get_Instance('ILLI_Container_Constants_Directories')->APP->MEDIA.'javascripts'.DIRECTORY_SEPARATOR);
- }
- }
Latest pastes
59 minutes ago
11 hours ago
1 days ago
2 days ago
2 days ago