diff options
| author | 2013-11-08 22:38:38 +0100 | |
|---|---|---|
| committer | 2013-11-08 22:38:38 +0100 | |
| commit | 2d330e43f23ba8d600e9fd20b8f5799fb4afb8ab (patch) | |
| tree | 234986b9b14a2eba114599f1d84cc908fe8778a1 /app | |
| parent | 38cf6946ed2fdbf1149978428ed93053dd9a375a (diff) | |
Fix issue #236: balise link pour flux rss
Ajout d'une balise link pour indiquer l'url du flux RSS
Diffstat (limited to 'app')
| -rwxr-xr-x | app/controllers/indexController.php | 19 | ||||
| -rw-r--r-- | app/layout/layout.phtml | 3 | ||||
| -rw-r--r-- | app/layout/nav_menu.phtml | 22 |
3 files changed, 23 insertions, 21 deletions
diff --git a/app/controllers/indexController.php b/app/controllers/indexController.php index 17feaf94b..c818f1170 100755 --- a/app/controllers/indexController.php +++ b/app/controllers/indexController.php @@ -12,6 +12,7 @@ class indexController extends ActionController { $token_param = Request::param ('token', ''); $token_is_ok = ($token != '' && $token == $token_param); + // check if user is log in if(login_is_conf ($this->view->conf) && !is_logged() && $this->view->conf->anonAccess() == 'no' && @@ -19,7 +20,25 @@ class indexController extends ActionController { return; } + // construction of RSS url of this feed + $params = Request::params (); + $params['output'] = 'rss'; + if (isset ($params['search'])) { + $params['search'] = urlencode ($params['search']); + } + if (login_is_conf($this->view->conf) && + $this->view->conf->anonAccess() == 'no' && + $token != '') { + $params['token'] = $token; + } + $this->view->rss_url = array ( + 'c' => 'index', + 'a' => 'index', + 'params' => $params + ); + if ($output == 'rss') { + // no layout for RSS output $this->view->_useLayout (false); } else { if(!$output) { diff --git a/app/layout/layout.phtml b/app/layout/layout.phtml index f958acb46..192a6d73f 100644 --- a/app/layout/layout.phtml +++ b/app/layout/layout.phtml @@ -5,6 +5,9 @@ <meta name="viewport" content="initial-scale=1.0" /> <link rel="icon" type="image/x-icon" href="<?php echo Url::display ('/favicon.ico'); ?>" /> <link rel="icon" type="image/png" href="<?php echo Url::display ('/favicon.ico'); ?>" /> + <?php if (isset ($this->rss_url)) { ?> + <link rel="alternate" type="application/rss+xml" title="<?php echo View::title(); ?>" href="<?php echo Url::display ($this->rss_url); ?>" /> + <?php } ?> <?php echo self::headTitle (); ?> <?php echo self::headStyle (); ?> <?php echo self::headScript (); ?> diff --git a/app/layout/nav_menu.phtml b/app/layout/nav_menu.phtml index 93287b84c..de327f040 100644 --- a/app/layout/nav_menu.phtml +++ b/app/layout/nav_menu.phtml @@ -122,27 +122,7 @@ </li> <?php } ?> <li class="item"> - <?php - $params = Request::params (); - $params['output'] = 'rss'; - if (isset ($params['search'])) { - $params['search'] = urlencode ($params['search']); - } - - $token = $this->conf->token (); - if (login_is_conf($this->conf) && - $this->conf->anonAccess() == 'no' && - $token != '') { - $params['token'] = $token; - } - - $url = array ( - 'c' => 'index', - 'a' => 'index', - 'params' => $params - ); - ?> - <a class="view_rss" target="_blank" rel="alternate" type="application/rss+xml" href="<?php echo Url::display ($url); ?>"> + <a class="view_rss" target="_blank" href="<?php echo Url::display ($this->rss_url); ?>"> <?php echo Translate::t ('rss_view'); ?> </a> </li> |
