diff options
| author | 2013-07-27 13:58:58 +0200 | |
|---|---|---|
| committer | 2013-07-27 13:58:58 +0200 | |
| commit | 22febc135134511b43a8543ea45c49c7aeec6f84 (patch) | |
| tree | e2596663533d36ec017fc1c7e8730245d6de0d19 | |
| parent | c4dcda6b47594a543046602056c5b7c27df70e39 (diff) | |
Fix issue #101 : option interdiction anonymes
Ajout d'une option pour interdire la lecture anonyme (interdit par
défaut)
Correction de l'internationalisation pour la pagination des logs
| -rwxr-xr-x | app/controllers/configureController.php | 3 | ||||
| -rw-r--r-- | app/i18n/en.php | 10 | ||||
| -rw-r--r-- | app/i18n/fr.php | 10 | ||||
| -rw-r--r-- | app/layout/header.phtml | 8 | ||||
| -rw-r--r-- | app/layout/persona.phtml | 25 | ||||
| -rwxr-xr-x | app/models/RSSConfiguration.php | 28 | ||||
| -rw-r--r-- | app/views/configure/display.phtml | 4 | ||||
| -rwxr-xr-x | app/views/helpers/logs_pagination.phtml | 8 | ||||
| -rw-r--r-- | app/views/helpers/view/global_view.phtml (renamed from app/views/helpers/global_view.phtml) | 0 | ||||
| -rw-r--r-- | app/views/helpers/view/normal_view.phtml (renamed from app/views/helpers/normal_view.phtml) | 0 | ||||
| -rw-r--r-- | app/views/helpers/view/reader_view.phtml (renamed from app/views/helpers/reader_view.phtml) | 0 | ||||
| -rwxr-xr-x | app/views/helpers/view/rss_view.phtml (renamed from app/views/helpers/rss_view.phtml) | 0 | ||||
| -rw-r--r-- | app/views/index/index.phtml | 25 |
13 files changed, 93 insertions, 28 deletions
diff --git a/app/controllers/configureController.php b/app/controllers/configureController.php index ce53e1040..b91582520 100755 --- a/app/controllers/configureController.php +++ b/app/controllers/configureController.php @@ -147,6 +147,7 @@ class configureController extends ActionController { $sort = Request::param ('sort_order', 'low_to_high'); $old = Request::param ('old_entries', 3); $mail = Request::param ('mail_login', false); + $anon = Request::param ('anon_access', 'no'); $openArticle = Request::param ('mark_open_article', 'no'); $openSite = Request::param ('mark_open_site', 'no'); $scroll = Request::param ('mark_scroll', 'no'); @@ -161,6 +162,7 @@ class configureController extends ActionController { $this->view->conf->_sortOrder ($sort); $this->view->conf->_oldEntries ($old); $this->view->conf->_mailLogin ($mail); + $this->view->conf->_anonAccess ($anon); $this->view->conf->_markWhen (array ( 'article' => $openArticle, 'site' => $openSite, @@ -178,6 +180,7 @@ class configureController extends ActionController { 'sort_order' => $this->view->conf->sortOrder (), 'old_entries' => $this->view->conf->oldEntries (), 'mail_login' => $this->view->conf->mailLogin (), + 'anon_access' => $this->view->conf->anonAccess (), 'mark_when' => $this->view->conf->markWhen (), 'url_shaarli' => $this->view->conf->urlShaarli (), ); diff --git a/app/i18n/en.php b/app/i18n/en.php index 0ea64ac32..3287e3a15 100644 --- a/app/i18n/en.php +++ b/app/i18n/en.php @@ -45,6 +45,12 @@ return array ( 'older_first' => 'Oldest first', 'newer_first' => 'Newer first', + // Pagination + 'first' => 'First', + 'previous' => 'Previous', + 'next' => 'Next', + 'last' => 'Last', + // CONTROLLERS 'article_published_on' => 'This article originally appeared on <a href="%s">%s</a>', 'article_published_on_author' => 'This article originally appeared on <a href="%s">%s</a> by %s', @@ -144,6 +150,7 @@ return array ( 'delete_articles_every' => 'Remove articles every', 'month' => 'months', 'persona_connection_email' => 'Login mail address (use <a href="https://persona.org/">Persona</a>)', + 'allow_anonymous' => 'Allow anonymous reading', 'reading_configuration' => 'Reading configuration', 'articles_per_page' => 'Number of articles per page', 'default_view' => 'Default view', @@ -196,6 +203,9 @@ return array ( 'logs' => 'Logs', 'logs_empty' => 'Log file is empty', + 'forbidden_access' => 'Forbidden access', + 'forbidden_access_description' => 'Access is password protected, please <a class="signin" href="#">sign in</a> to read your feeds.', + // DATE 'january' => 'january', 'february' => 'february', diff --git a/app/i18n/fr.php b/app/i18n/fr.php index 022cd38bb..d5a7f8fa0 100644 --- a/app/i18n/fr.php +++ b/app/i18n/fr.php @@ -45,6 +45,12 @@ return array ( 'older_first' => 'Plus anciens en premier', 'newer_first' => 'Plus récents en premier', + // Pagination + 'first' => 'Début', + 'previous' => 'Précédent', + 'next' => 'Suivant', + 'last' => 'Fin', + // CONTROLLERS 'article_published_on' => 'Article publié initialement sur <a href="%s">%s</a>', 'article_published_on_author' => 'Article publié initialement sur <a href="%s">%s</a> par %s', @@ -144,6 +150,7 @@ return array ( 'delete_articles_every' => 'Supprimer les articles tous les', 'month' => 'mois', 'persona_connection_email' => 'Adresse mail de connexion (utilise <a href="https://persona.org/">Persona</a>)', + 'allow_anonymous' => 'Autoriser la lecture anonyme', 'reading_configuration' => 'Configuration de lecture', 'articles_per_page' => 'Nombre d\'articles par page', 'default_view' => 'Vue par défaut', @@ -196,6 +203,9 @@ return array ( 'logs' => 'Logs', 'logs_empty' => 'Les logs sont vides', + 'forbidden_access' => 'Accès interdit', + 'forbidden_access_description' => 'L\'accès est protégé par un mot de passe, veuillez <a class="signin" href="#">vous connecter</a> pour accéder aux flux.', + // DATE 'january' => 'janvier', 'february' => 'février', diff --git a/app/layout/header.phtml b/app/layout/header.phtml index 4131f8687..a46864482 100644 --- a/app/layout/header.phtml +++ b/app/layout/header.phtml @@ -1,9 +1,9 @@ <?php if (login_is_conf ($this->conf)) { ?> <ul class="nav nav-head"> <?php if (!is_logged ()) { ?> - <li class="item"><i class="icon i_login"></i> <a id="signin" href="#"><?php echo Translate::t ('login'); ?></a></li> + <li class="item"><i class="icon i_login"></i> <a class="signin" href="#"><?php echo Translate::t ('login'); ?></a></li> <?php } else { ?> - <li class="item"><i class="icon i_logout"></i> <a id="signout" href="#"><?php echo Translate::t ('logout'); ?></a></li> + <li class="item"><i class="icon i_logout"></i> <a class="signout" href="#"><?php echo Translate::t ('logout'); ?></a></li> <?php } ?> </ul> <?php } ?> @@ -15,6 +15,9 @@ </div> <div class="item search"> + <?php if(!login_is_conf ($this->conf) || + is_logged() || + $this->conf->anonAccess() == 'yes') { ?> <form action="<?php echo _url ('index', 'index'); ?>" method="get"> <div class="stick"> <?php $search = Request::param ('search', ''); ?> @@ -38,6 +41,7 @@ <button class="btn" type="submit"><i class="icon i_search"></i></button> </div> </form> + <?php } ?> </div> <?php if (!login_is_conf ($this->conf) || is_logged ()) { ?> diff --git a/app/layout/persona.phtml b/app/layout/persona.phtml index 8db8d5167..f25e4c3fd 100644 --- a/app/layout/persona.phtml +++ b/app/layout/persona.phtml @@ -1,4 +1,5 @@ <?php if (login_is_conf ($this->conf)) { ?> + <?php $mail = Session::param ('mail', 'null'); if ($mail != 'null') { @@ -12,21 +13,15 @@ login_url = "<?php echo Url::display (array ('a' => 'login')); ?>"; logout_url = "<?php echo Url::display (array ('a' => 'logout')); ?>"; currentUser = <?php echo $mail; ?>; -var signinLink = $('a#signin'); -if (signinLink) { - signinLink.click(function() { - navigator.id.request(); - return false; - }); -}; - -var signoutLink = $('a#signout'); -if (signoutLink) { - signoutLink.click(function() { - navigator.id.logout(); - return false; - }); -}; +$('a.signin').click(function() { + navigator.id.request(); + return false; +}); + +$('a.signout').click(function() { + navigator.id.logout(); + return false; +}); navigator.id.watch({ loggedInUser: currentUser, diff --git a/app/models/RSSConfiguration.php b/app/models/RSSConfiguration.php index dde120e4a..798ce2d0c 100755 --- a/app/models/RSSConfiguration.php +++ b/app/models/RSSConfiguration.php @@ -17,6 +17,8 @@ class RSSConfiguration extends Model { private $mail_login = ''; private $mark_when = array (); private $url_shaarli = ''; + private $theme; + private $anon_access; public function __construct () { $confDAO = new RSSConfigurationDAO (); @@ -32,6 +34,8 @@ class RSSConfiguration extends Model { $this->_mailLogin ($confDAO->mail_login); $this->_markWhen ($confDAO->mark_when); $this->_urlShaarli ($confDAO->url_shaarli); + $this->_theme ($confDAO->theme); + $this->_anonAccess ($confDAO->anon_access); } public function availableLanguages () { @@ -82,6 +86,12 @@ class RSSConfiguration extends Model { public function urlShaarli () { return $this->url_shaarli; } + public function theme () { + return $this->theme; + } + public function anonAccess () { + return $this->anon_access; + } public function _language ($value) { if (!isset ($this->available_languages[$value])) { @@ -171,6 +181,16 @@ class RSSConfiguration extends Model { $this->url_shaarli = $value; } } + public function _theme ($value) { + $this->theme = $value; + } + public function _anonAccess ($value) { + if ($value == 'yes') { + $this->anon_access = 'yes'; + } else { + $this->anon_access = 'no'; + } + } } class RSSConfigurationDAO extends Model_array { @@ -198,6 +218,8 @@ class RSSConfigurationDAO extends Model_array { 'scroll' => 'no' ); public $url_shaarli = ''; + public $theme = 'default'; + public $anon_access = 'no'; public function __construct () { parent::__construct (PUBLIC_PATH . '/data/Configuration.array.php'); @@ -238,6 +260,12 @@ class RSSConfigurationDAO extends Model_array { if (isset ($this->array['url_shaarli'])) { $this->url_shaarli = $this->array['url_shaarli']; } + if (isset ($this->array['theme'])) { + $this->theme = $this->array['theme']; + } + if (isset ($this->array['anon_access'])) { + $this->anon_access = $this->array['anon_access']; + } } public function update ($values) { diff --git a/app/views/configure/display.phtml b/app/views/configure/display.phtml index 7ed5989e2..f8e94c0f2 100644 --- a/app/views/configure/display.phtml +++ b/app/views/configure/display.phtml @@ -31,6 +31,10 @@ <div class="group-controls"> <input type="email" id="mail_login" name="mail_login" value="<?php echo $mail ? $mail : ''; ?>" placeholder="<?php echo Translate::t ('blank_to_disable'); ?>" /> <noscript><b><?php echo Translate::t ('javascript_should_be_activated'); ?></b></noscript> + <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"' : ''; ?> /> + <?php echo Translate::t ('allow_anonymous'); ?> + </label> </div> </div> diff --git a/app/views/helpers/logs_pagination.phtml b/app/views/helpers/logs_pagination.phtml index 0088dabc6..9f1d6cb23 100755 --- a/app/views/helpers/logs_pagination.phtml +++ b/app/views/helpers/logs_pagination.phtml @@ -9,14 +9,14 @@ <?php $params[$getteur] = 1; ?> <li class="item pager-first"> <?php if ($this->currentPage > 1) { ?> - <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">« Début</a> + <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">« <?php echo Translate::t('first'); ?></a> <?php } ?> </li> <?php $params[$getteur] = $this->currentPage - 1; ?> <li class="item pager-previous"> <?php if ($this->currentPage > 1) { ?> - <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ Précédent</a> + <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">‹ <?php echo Translate::t('previous'); ?></a> <?php } ?> </li> @@ -34,13 +34,13 @@ <?php $params[$getteur] = $this->currentPage + 1; ?> <li class="item pager-next"> <?php if ($this->currentPage < $this->nbPage) { ?> - <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">Suivant ›</a> + <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t('next'); ?> ›</a> <?php } ?> </li> <?php $params[$getteur] = $this->nbPage; ?> <li class="item pager-last"> <?php if ($this->currentPage < $this->nbPage) { ?> - <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>">Fin »</a> + <a href="<?php echo Url::display (array ('c' => $c, 'a' => $a, 'params' => $params)); ?>"><?php echo Translate::t('last'); ?> »</a> <?php } ?> </li> </ul> diff --git a/app/views/helpers/global_view.phtml b/app/views/helpers/view/global_view.phtml index fff391cba..fff391cba 100644 --- a/app/views/helpers/global_view.phtml +++ b/app/views/helpers/view/global_view.phtml diff --git a/app/views/helpers/normal_view.phtml b/app/views/helpers/view/normal_view.phtml index 4f08bea7f..4f08bea7f 100644 --- a/app/views/helpers/normal_view.phtml +++ b/app/views/helpers/view/normal_view.phtml diff --git a/app/views/helpers/reader_view.phtml b/app/views/helpers/view/reader_view.phtml index 46a65a4e3..46a65a4e3 100644 --- a/app/views/helpers/reader_view.phtml +++ b/app/views/helpers/view/reader_view.phtml diff --git a/app/views/helpers/rss_view.phtml b/app/views/helpers/view/rss_view.phtml index 83de6de2e..83de6de2e 100755 --- a/app/views/helpers/rss_view.phtml +++ b/app/views/helpers/view/rss_view.phtml diff --git a/app/views/index/index.phtml b/app/views/index/index.phtml index 46ff33b3a..4bf82f9b4 100644 --- a/app/views/index/index.phtml +++ b/app/views/index/index.phtml @@ -2,12 +2,23 @@ $output = Request::param ('output', 'normal'); -if ($output == 'rss') { - $this->renderHelper ('rss_view'); -} elseif($output == 'reader') { - $this->renderHelper ('reader_view'); -} elseif($output == 'global') { - $this->renderHelper ('global_view'); +if(!login_is_conf ($this->conf) || + is_logged() || + $this->conf->anonAccess() == 'yes') { + if($output == 'rss') { + $this->renderHelper ('view/rss_view'); + } elseif($output == 'reader') { + $this->renderHelper ('view/reader_view'); + } elseif($output == 'global') { + $this->renderHelper ('view/global_view'); + } else { + $this->renderHelper ('view/normal_view'); + } } else { - $this->renderHelper ('normal_view'); +?> +<div class="post content"> + <h1><?php echo Translate::t ('forbidden_access'); ?></h1> + <p><?php echo Translate::t ('forbidden_access_description'); ?></p> +</div> +<?php }
\ No newline at end of file |
