diff options
| author | 2015-01-08 10:27:01 +0100 | |
|---|---|---|
| committer | 2015-01-08 10:27:01 +0100 | |
| commit | 46e98bad9119c3ee7088b65ebb6b4d1331419602 (patch) | |
| tree | 6f0e081597ba9ced0c0faca9b5e4c04394605aaf /app/FreshRSS.php | |
| parent | 7584364a4c2b407e97909e94ba274da62620abea (diff) | |
| parent | 9265cd57333b2a91effc6ea284b504fbc977b9ed (diff) | |
Merge branch '730-improve_configuration' into dev
BREAKING FEATURE: please follow instructions from
https://github.com/FreshRSS/FreshRSS/issues/730 to
update your configuration file.
Fix https://github.com/FreshRSS/FreshRSS/issues/730
Diffstat (limited to 'app/FreshRSS.php')
| -rw-r--r-- | app/FreshRSS.php | 46 |
1 files changed, 32 insertions, 14 deletions
diff --git a/app/FreshRSS.php b/app/FreshRSS.php index 6114a5d1a..002a70af5 100644 --- a/app/FreshRSS.php +++ b/app/FreshRSS.php @@ -6,10 +6,30 @@ class FreshRSS extends Minz_FrontController { Minz_Session::init('FreshRSS'); } - // Need to be called just after session init because it initializes - // current user. - FreshRSS_Auth::init(); + $this->initConfiguration(); + $this->initAuth(); + FreshRSS_Context::init(); + $this->initI18n(); + FreshRSS_Share::load(join_path(DATA_PATH, 'shares.php')); + $this->loadStylesAndScripts(); + $this->loadNotifications(); + $this->loadExtensions(); + } + + private function initConfiguration() { + $configuration_setter = new FreshRSS_ConfigurationSetter(); + $current_user = Minz_Session::param('currentUser', '_'); + + Minz_Configuration::register('user', + join_path(USERS_PATH, $current_user, 'config.php'), + join_path(USERS_PATH, '_', 'config.default.php'), + $configuration_setter); + $system_conf = Minz_Configuration::get('system'); + $system_conf->_configurationSetter($configuration_setter); + } + private function initAuth() { + FreshRSS_Auth::init(); if (Minz_Request::isPost() && !is_referer_from_same_domain()) { // Basic protection against XSRF attacks FreshRSS_Auth::removeAccess(); @@ -22,21 +42,19 @@ class FreshRSS extends Minz_FrontController { )) ); } + } - // Load context and configuration. - FreshRSS_Context::init(); - - // Init i18n. - Minz_Session::_param('language', FreshRSS_Context::$conf->language); - Minz_Translate::init(); + private function initI18n() { + Minz_Session::_param('language', FreshRSS_Context::$user_conf->language); - $this->loadStylesAndScripts(); - $this->loadNotifications(); - $this->loadExtensions(); + Minz_Translate::init(array( + 'en' => 'English', + 'fr' => 'Français', + ), FreshRSS_Context::$user_conf->language); } private function loadStylesAndScripts() { - $theme = FreshRSS_Themes::load(FreshRSS_Context::$conf->theme); + $theme = FreshRSS_Themes::load(FreshRSS_Context::$user_conf->theme); if ($theme) { foreach($theme['files'] as $file) { if ($file[0] === '_') { @@ -57,7 +75,7 @@ class FreshRSS extends Minz_FrontController { Minz_View::appendScript(Minz_Url::display('/scripts/shortcut.js?' . @filemtime(PUBLIC_PATH . '/scripts/shortcut.js'))); Minz_View::appendScript(Minz_Url::display('/scripts/main.js?' . @filemtime(PUBLIC_PATH . '/scripts/main.js'))); - if (Minz_Configuration::authType() === 'persona') { + if (FreshRSS_Context::$system_conf->auth_type === 'persona') { // TODO move it in a plugin // Needed for login AND logout with Persona. Minz_View::appendScript('https://login.persona.org/include.js'); |
