diff options
| author | 2013-12-28 13:54:52 +0100 | |
|---|---|---|
| committer | 2013-12-28 13:54:52 +0100 | |
| commit | 9ac1496d63da32524a33696187342ce061e9ef28 (patch) | |
| tree | fc45025f1055c9a4fa2eee26240617badecef969 /app | |
| parent | 45b2decce03e218fe7ad66479491123ce398ab1f (diff) | |
Bouge anon_access dans config.php
L'accès anonyme n'est pas au niveau utilisateur mais au niveau global.
Bouge FreshRSS_Configuration::conf->anonAccess() qui était stocké dans
*_user.php vers Minz_Configuration::allowAnonymous() stocké dans
config.php
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/126
+ autres optimisations
Contribue à https://github.com/marienfressinaud/FreshRSS/issues/260
Diffstat (limited to 'app')
| -rwxr-xr-x | app/Controllers/configureController.php | 11 | ||||
| -rwxr-xr-x | app/Controllers/indexController.php | 6 | ||||
| -rw-r--r-- | app/Models/Configuration.php | 12 | ||||
| -rw-r--r-- | app/Models/ConfigurationDAO.php | 4 | ||||
| -rw-r--r-- | app/layout/header.phtml | 2 | ||||
| -rw-r--r-- | app/views/configure/users.phtml | 2 | ||||
| -rw-r--r-- | app/views/index/index.phtml | 2 |
7 files changed, 13 insertions, 26 deletions
diff --git a/app/Controllers/configureController.php b/app/Controllers/configureController.php index 487f6e4ad..dd9674588 100755 --- a/app/Controllers/configureController.php +++ b/app/Controllers/configureController.php @@ -398,15 +398,13 @@ class FreshRSS_configure_Controller extends Minz_ActionController { $current_token = $this->view->conf->token(); $mail = Minz_Request::param('mail_login', false); - $anon = Minz_Request::param('anon_access', 'no'); $token = Minz_Request::param('token', $current_token); + $this->view->conf->_mailLogin($mail); - $this->view->conf->_anonAccess($anon); $this->view->conf->_token($token); $values = array( 'mail_login' => $this->view->conf->mailLogin(), - 'anon_access' => $this->view->conf->anonAccess(), 'token' => $this->view->conf->token(), ); @@ -415,7 +413,12 @@ class FreshRSS_configure_Controller extends Minz_ActionController { Minz_Session::_param('conf', $this->view->conf); Minz_Session::_param('mail', $this->view->conf->mailLogin()); - // notif + $anon = (bool)(Minz_Request::param('anon_access', false)); + if ($anon != Minz_Configuration::allowAnonymous()) { + Minz_Configuration::_allowAnonymous($anon); + Minz_Configuration::writeFile(); + } + $notif = array( 'type' => 'good', 'content' => Minz_Translate::t('configuration_updated') diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 6c0ba9058..0c229aedb 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -24,7 +24,7 @@ class FreshRSS_index_Controller extends Minz_ActionController { // check if user is log in if(login_is_conf ($this->view->conf) && !is_logged() && - $this->view->conf->anonAccess() === 'no' && + !Minz_Configuration::allowAnonymous() && !($output === 'rss' && $token_is_ok)) { return; } @@ -36,8 +36,8 @@ class FreshRSS_index_Controller extends Minz_ActionController { $params['search'] = urlencode ($params['search']); } if (login_is_conf($this->view->conf) && - $this->view->conf->anonAccess() === 'no' && - $token != '') { + !Minz_Configuration::allowAnonymous() && + $token !== '') { $params['token'] = $token; } $this->view->rss_url = array ( diff --git a/app/Models/Configuration.php b/app/Models/Configuration.php index cb2f90655..7f4be474d 100644 --- a/app/Models/Configuration.php +++ b/app/Models/Configuration.php @@ -20,7 +20,6 @@ class FreshRSS_Configuration extends Minz_Model { private $mark_when = array (); private $sharing = array (); private $theme; - private $anon_access; private $token; private $auto_load_more; private $topline_read; @@ -52,7 +51,6 @@ class FreshRSS_Configuration extends Minz_Model { $this->_sharing ($confDAO->sharing); $this->_theme ($confDAO->theme); FreshRSS_Themes::setThemeId ($confDAO->theme); - $this->_anonAccess ($confDAO->anon_access); $this->_token ($confDAO->token); $this->_autoLoadMore ($confDAO->auto_load_more); $this->_topline_read ($confDAO->topline_read); @@ -132,9 +130,6 @@ class FreshRSS_Configuration extends Minz_Model { public function theme () { return $this->theme; } - public function anonAccess () { - return $this->anon_access; - } public function token () { return $this->token; } @@ -283,13 +278,6 @@ class FreshRSS_Configuration extends Minz_Model { public function _theme ($value) { $this->theme = $value; } - public function _anonAccess ($value) { - if ($value == 'yes') { - $this->anon_access = 'yes'; - } else { - $this->anon_access = 'no'; - } - } public function _token ($value) { $this->token = $value; } diff --git a/app/Models/ConfigurationDAO.php b/app/Models/ConfigurationDAO.php index 91210e701..fa4d3338f 100644 --- a/app/Models/ConfigurationDAO.php +++ b/app/Models/ConfigurationDAO.php @@ -38,7 +38,6 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { 'print' => true ); public $theme = 'default'; - public $anon_access = 'no'; public $token = ''; public $auto_load_more = 'yes'; public $topline_read = 'yes'; @@ -108,9 +107,6 @@ class FreshRSS_ConfigurationDAO extends Minz_ModelArray { if (isset ($this->array['theme'])) { $this->theme = $this->array['theme']; } - if (isset ($this->array['anon_access'])) { - $this->anon_access = $this->array['anon_access']; - } if (isset ($this->array['token'])) { $this->token = $this->array['token']; } diff --git a/app/layout/header.phtml b/app/layout/header.phtml index bba22508e..aeb417a6e 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -21,7 +21,7 @@ <div class="item search"> <?php if(!login_is_conf ($this->conf) || is_logged() || - $this->conf->anonAccess() == 'yes') { ?> + Minz_Configuration::allowAnonymous()) { ?> <form action="<?php echo _url ('index', 'index'); ?>" method="get"> <div class="stick"> <?php $search = Minz_Request::param ('search', ''); ?> diff --git a/app/views/configure/users.phtml b/app/views/configure/users.phtml index 40cce590e..c57671ef3 100644 --- a/app/views/configure/users.phtml +++ b/app/views/configure/users.phtml @@ -50,7 +50,7 @@ <div class="form-group"> <div class="group-controls"> <label class="checkbox" for="anon_access"> - <input type="checkbox" name="anon_access" id="anon_access" value="yes"<?php echo $this->conf->anonAccess() == 'yes' ? ' checked="checked"' : ''; ?> /> + <input type="checkbox" name="anon_access" id="anon_access" value="1"<?php echo Minz_Configuration::allowAnonymous() ? ' checked="checked"' : ''; ?> /> <?php echo Minz_Translate::t('allow_anonymous'); ?> </label> </div> diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index cf98060c4..2d134ba4e 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -7,7 +7,7 @@ $token_is_ok = ($token != '' && $token == $token_param); if(!login_is_conf ($this->conf) || is_logged() || - $this->conf->anonAccess() == 'yes' || + Minz_Configuration::allowAnonymous() || ($output == 'rss' && $token_is_ok)) { if($output == 'rss') { $this->renderHelper ('view/rss_view'); |
