Views are in dedicated actions + improve Context

- Seperate normal, global and rss outputs in dedicated actions (NOT WORKING YET!)
- Rewrite aside_flux and nav_menu to use Context object
- Improve Context object

See https://github.com/marienfressinaud/FreshRSS/issues/634
This commit is contained in:
Marien Fressinaud
2014-10-21 16:46:36 +02:00
parent 8a7bab3a55
commit 80cffa6de5
9 changed files with 209 additions and 290 deletions

View File

@@ -7,47 +7,17 @@ class FreshRSS_index_Controller extends Minz_ActionController {
private $nb_not_read_cat = 0;
public function indexAction() {
$output = Minz_Request::param('output');
$token = FreshRSS_Context::$conf->token;
// TODO: update the context with information from request.
// TODO: then, in dedicated action, get corresponding entries
// check if user is logged in
if (!FreshRSS_Auth::hasAccess() && !Minz_Configuration::allowAnonymous()) {
$token_param = Minz_Request::param('token', '');
$token_is_ok = ($token != '' && $token === $token_param);
if ($output === 'rss' && !$token_is_ok) {
Minz_Error::error(403);
return;
} elseif ($output !== 'rss') {
// "hard" redirection is not required, just ask dispatcher to
// forward to the login form without 302 redirection
Minz_Request::forward(array('c' => 'auth', 'a' => 'login'));
return;
}
}
$params = Minz_Request::params();
if (isset($params['search'])) {
$params['search'] = urlencode($params['search']);
}
$this->view->url = array(
$prefered_output = FreshRSS_Context::$conf->view_mode;
Minz_Request::forward(array(
'c' => 'index',
'a' => 'index',
'params' => $params
);
'a' => $prefered_output
));
if ($output === 'rss') {
// no layout for RSS output
$this->view->_useLayout(false);
header('Content-Type: application/rss+xml; charset=utf-8');
} elseif ($output === 'global') {
Minz_View::appendScript(Minz_Url::display('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js')));
}
return;
$catDAO = new FreshRSS_CategoryDAO();
$entryDAO = FreshRSS_Factory::createEntryDao();
$this->view->cat_aside = $catDAO->listCategories();
$this->view->nb_favorites = $entryDAO->countUnreadReadFavorites();
$this->view->nb_not_read = FreshRSS_CategoryDAO::CountUnreads($this->view->cat_aside, 1);
$this->view->currentName = '';
@@ -60,10 +30,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
$getId = substr($get, 2);
if (!$this->checkAndProcessType($getType, $getId)) {
Minz_Log::debug('Not found [' . $getType . '][' . $getId . ']');
Minz_Error::error(
404,
array('error' => array(_t('page_not_found')))
);
Minz_Error::error(404);
return;
}
@@ -144,10 +111,7 @@ class FreshRSS_index_Controller extends Minz_ActionController {
$this->view->entries = $entries;
} catch (FreshRSS_EntriesGetter_Exception $e) {
Minz_Log::notice($e->getMessage());
Minz_Error::error(
404,
array('error' => array(_t('page_not_found')))
);
Minz_Error::error(404);
}
}
@@ -202,20 +166,59 @@ class FreshRSS_index_Controller extends Minz_ActionController {
}
}
/**
* This action displays the normal view of FreshRSS.
*/
public function normalAction() {
if (!FreshRSS_Auth::hasAccess() && !Minz_Configuration::allowAnonymous()) {
Minz_Request::forward(array('c' => 'auth', 'a' => 'login'));
return;
}
$catDAO = new FreshRSS_CategoryDAO();
$entryDAO = FreshRSS_Factory::createEntryDao();
$this->view->categories = $catDAO->listCategories();
}
/**
* This action displays the global view of FreshRSS.
*/
public function globalAction() {
if (!FreshRSS_Auth::hasAccess() && !Minz_Configuration::allowAnonymous()) {
Minz_Error::error(403);
Minz_Request::forward(array('c' => 'auth', 'a' => 'login'));
return;
}
Minz_View::appendScript(Minz_Url::display('/scripts/global_view.js?' . @filemtime(PUBLIC_PATH . '/scripts/global_view.js')));
$catDAO = new FreshRSS_CategoryDAO();
$this->view->categories = $catDAO->listCategories();
Minz_View::prependTitle(_t('gen.title.global_view') . ' · ');
}
/**
* This action displays the RSS feed of FreshRSS.
*/
public function rssAction() {
$token = FreshRSS_Context::$conf->token;
$token_param = Minz_Request::param('token', '');
$token_is_ok = ($token != '' && $token === $token_param);
// Check if user has access.
if (!FreshRSS_Auth::hasAccess() &&
!Minz_Configuration::allowAnonymous() &&
!$token_is_ok) {
Minz_Error::error(403);
}
// No layout for RSS output.
$this->view->_useLayout(false);
header('Content-Type: application/rss+xml; charset=utf-8');
}
/**
* This action displays the about page of FreshRSS.
*/

View File

@@ -26,21 +26,11 @@ class FreshRSS extends Minz_FrontController {
// Load context and configuration.
FreshRSS_Context::init();
$this->loadParamsView();
$this->loadStylesAndScripts();
$this->loadNotifications();
$this->loadExtensions();
}
private function loadParamsView() {
// TODO: outputs should be different actions.
$output = Minz_Request::param('output', '');
if (($output === '') || ($output !== 'normal' && $output !== 'rss' && $output !== 'reader' && $output !== 'global')) {
$output = FreshRSS_Context::$conf->view_mode;
Minz_Request::_param('output', $output);
}
}
private function loadStylesAndScripts() {
$theme = FreshRSS_Themes::load(FreshRSS_Context::$conf->theme);
if ($theme) {

View File

@@ -6,7 +6,22 @@
*/
class FreshRSS_Context {
public static $conf = null;
public static $total_unread = 0;
public static $total_starred = array(
'all' => 0,
'read' => 0,
'unread' => 0,
);
public static $state = 0;
public static $current_get = array(
'all' => false,
'starred' => false,
'feed' => false,
'category' => false,
);
public static $order = 'DESC';
public static function init() {
// Init configuration.
@@ -23,10 +38,56 @@ class FreshRSS_Context {
Minz_Translate::init();
// Get the current state.
self::$state = self::$conf->default_view;
// self::$state = self::$conf->default_view;
}
public static function stateEnabled($state) {
public static function isStateEnabled($state) {
return self::$state & $state;
}
public static function getRevertState($state) {
if (self::$state & $state) {
return self::$state & ~$state;
} else {
return self::$state | $state;
}
}
public static function currentGet() {
if (self::$current_get['all']) {
return 'a';
} elseif (self::$current_get['starred']) {
return 's';
} elseif (self::$current_get['feed']) {
return 'f_' . self::$current_get['feed'];
} elseif (self::$current_get['category']) {
return 'c_' . self::$current_get['category'];
}
}
public static function isCurrentGet($get) {
$type = $get[0];
$id = substr($get, 2);
switch($type) {
case 'a':
return self::$current_get['all'];
case 's':
return self::$current_get['starred'];
case 'f':
return self::$current_get['feed'] === $id;
case 'c':
return self::$current_get['category'] === $id;
default:
return false;
}
}
public static function nextStep() {
// TODO: fix this method.
return array(
'get' => 'a',
'idMax' => (time() - 1) . '000000'
);
}
}

View File

@@ -1,82 +1,53 @@
<div class="aside aside_flux<?php if (FreshRSS_Context::$conf->hide_read_feeds && ($this->state & FreshRSS_Entry::STATE_NOT_READ) && !($this->state & FreshRSS_Entry::STATE_READ)) echo ' state_unread'; ?>" id="aside_flux">
<div class="aside aside-flux" id="aside-flux">
<a class="toggle_aside" href="#close"><?php echo _i('close'); ?></a>
<ul class="categories">
<?php if (FreshRSS_Auth::hasAccess()) { ?>
<form id="mark-read-aside" method="post" style="display: none"></form>
<?php if (FreshRSS_Auth::hasAccess()) { ?>
<div class="stick configure-feeds">
<a class="btn btn-important" href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('subscription_management'); ?></a>
<a class="btn btn-important" href="<?php echo _url('importExport', 'index'); ?>"><?php echo _i('import'); ?></a>
</div>
<?php } elseif (Minz_Configuration::needsLogin()) { ?>
<a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('about_freshrss'); ?></a>
<?php } ?>
<li>
<div class="stick configure-feeds">
<a class="btn btn-important" href="<?php echo _url('subscription', 'index'); ?>"><?php echo _t('subscription_management'); ?></a>
<a class="btn btn-important" href="<?php echo _url('importExport', 'index'); ?>"><?php echo _i('import'); ?></a>
</div>
<form id="mark-read-aside" method="post" style="display: none"></form>
<ul class="tree">
<li class="tree-folder<?php echo FreshRSS_Context::isCurrentGet('a') ? ' active' : ''; ?>">
<a class="tree-folder-title" data-unread="<?php echo format_number(FreshRSS_Context::$total_unread); ?>" href="<?php echo _url('index', 'index'); ?>"><?php echo _i('all'), ' ', _t('main_stream'); ?></a>
</li>
<li class="tree-folder<?php echo FreshRSS_Context::isCurrentGet('s') ? ' active' : ''; ?>">
<a class="tree-folder-title" data-unread="<?php echo format_number(FreshRSS_Context::$total_starred['unread']); ?>" href="<?php echo _url('index', 'index', 'get', 's'); ?>"><?php echo _i('bookmark'), ' ', _t('favorite_feeds', format_number(FreshRSS_Context::$total_starred['all'])); ?></a>
</li>
<?php } elseif (Minz_Configuration::needsLogin()) { ?>
<li><a href="<?php echo _url('index', 'about'); ?>"><?php echo _t('about_freshrss'); ?></a></li>
<?php } ?>
<?php
$arUrl = array('c' => 'index', 'a' => 'index', 'params' => array());
if (FreshRSS_Context::$conf->view_mode !== Minz_Request::param('output', 'normal')) {
$arUrl['params']['output'] = 'normal';
foreach ($this->categories as $cat) {
$feeds = $cat->feeds();
if (!empty($feeds)) {
?>
<li class="tree-folder<?php echo FreshRSS_Context::isCurrentGet('c_' . $cat->id()) ? ' active' : ''; ?>">
<a class="tree-folder-title" data-unread="<?php echo format_number($cat->nbNotRead()); ?>" href="<?php echo _url('index', 'index', 'get', 'c_' . $cat->id()); ?>"><?php echo _i('category'), ' ', $cat->name(); ?></a>
<ul class="items">
<?php foreach ($feeds as $feed) { ?>
<li class="item<?php echo FreshRSS_Context::isCurrentGet('f_' . $feed->id()) ? ' active' : ''; ?>">
<div class="dropdown">
<div class="dropdown-target"></div>
<a class="dropdown-toggle" data-fweb="<?php echo $feed->website(); ?>"><?php echo _i('configure'); ?></a>
<?php /* feed_config_template */ ?>
</div>
<img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" />
<a data-unread="<?php echo format_number($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority(); ?>" href="<?php echo _url('index', 'index', 'get', 'f_' . $feed->id()); ?>"><?php echo $feed->name(); ?></a>
</li>
<?php } ?>
</ul>
</li>
<?php
}
}
?>
<li>
<div class="category all<?php echo $this->get_c == 'a' ? ' active' : ''; ?>">
<a data-unread="<?php echo formatNumber($this->nb_not_read); ?>" class="btn<?php echo $this->get_c == 'a' ? ' active' : ''; ?>" href="<?php echo Minz_Url::display($arUrl); ?>">
<?php echo _i('all'); ?>
<?php echo _t('main_stream'); ?>
</a>
</div>
</li>
<li>
<div class="category favorites<?php echo $this->get_c == 's' ? ' active' : ''; ?>">
<a data-unread="<?php echo formatNumber($this->nb_favorites['unread']); ?>" class="btn<?php echo $this->get_c == 's' ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 's'; echo Minz_Url::display($arUrl); ?>">
<?php echo _i('bookmark'); ?>
<?php echo _t('favorite_feeds', formatNumber($this->nb_favorites['all'])); ?>
</a>
</div>
</li>
<?php
foreach ($this->cat_aside as $cat) {
$feeds = $cat->feeds();
if (!empty($feeds)) {
$c_active = false;
$c_show = false;
if ($this->get_c == $cat->id()) {
$c_active = true;
if (!FreshRSS_Context::$conf->display_categories || $this->get_f) {
$c_show = true;
}
}
?><li data-unread="<?php echo $cat->nbNotRead(); ?>"<?php if ($c_active) echo ' class="active"'; ?>><?php
?><div class="category stick<?php echo $c_active ? ' active' : ''; ?>"><?php
?><a data-unread="<?php echo formatNumber($cat->nbNotRead()); ?>" class="btn<?php echo $c_active ? ' active' : ''; ?>" href="<?php $arUrl['params']['get'] = 'c_' . $cat->id(); echo Minz_Url::display($arUrl); ?>"><?php echo $cat->name(); ?></a><?php
?><a class="btn dropdown-toggle" href="#"><?php echo _i($c_show ? 'up' : 'down'); ?></a><?php
?></div><?php
?><ul class="feeds<?php echo $c_show ? ' active' : ''; ?>"><?php
foreach ($feeds as $feed) {
$feed_id = $feed->id();
$nbEntries = $feed->nbEntries();
$f_active = ($this->get_f == $feed_id);
?><li id="f_<?php echo $feed_id; ?>" class="item<?php echo $f_active ? ' active' : ''; ?><?php echo $feed->inError() ? ' error' : ''; ?><?php echo $nbEntries == 0 ? ' empty' : ''; ?>" data-unread="<?php echo $feed->nbNotRead(); ?>"><?php
?><div class="dropdown"><?php
?><div class="dropdown-target"></div><?php
?><a class="dropdown-toggle" data-fweb="<?php echo $feed->website(); ?>"><?php echo _i('configure'); ?></a><?php
/* feed_config_template */
?></div><?php
?> <img class="favicon" src="<?php echo $feed->favicon(); ?>" alt="✇" /> <?php
?><a class="feed" data-unread="<?php echo formatNumber($feed->nbNotRead()); ?>" data-priority="<?php echo $feed->priority(); ?>" href="<?php $arUrl['params']['get'] = 'f_' . $feed_id; echo Minz_Url::display($arUrl); ?>"><?php echo $feed->name(); ?></a><?php
?></li><?php
}
?></ul><?php
?></li><?php
}
} ?>
</ul>
<span class="aside_flux_ender"><!-- For fixed menu --></span>
</div>
<script id="feed_config_template" type="text/html">

View File

@@ -1,6 +1,5 @@
<?php
$actual_view = Minz_Request::param('output', 'normal');
?>
<?php $actual_view = Minz_Request::actionName(); ?>
<div class="nav_menu">
<?php if ($actual_view === 'normal') { ?>
<a class="btn toggle_aside" href="#aside_flux"><?php echo _i('category'); ?></a>
@@ -9,82 +8,24 @@
<?php if (FreshRSS_Auth::hasAccess()) { ?>
<div id="nav_menu_actions" class="stick">
<?php
$url_state = $this->url;
$states = array(
'read' => FreshRSS_Entry::STATE_READ,
'unread' => FreshRSS_Entry::STATE_NOT_READ,
'starred' => FreshRSS_Entry::STATE_FAVORITE,
'non-starred' => FreshRSS_Entry::STATE_NOT_FAVORITE,
);
if ($this->state & FreshRSS_Entry::STATE_READ) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_READ;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_READ;
$checked = 'false';
$class = '';
}
foreach ($states as $state_str => $state) {
$state_enabled = FreshRSS_Context::isStateEnabled($state);
$url_state = Minz_Request::currentRequest();
$url_state['params']['state'] = FreshRSS_Context::getRevertState($state);
?>
<a id="toggle-read"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_read'); ?>">
<?php echo _i('read'); ?>
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_NOT_READ) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_READ;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_READ;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-unread"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_not_reads'); ?>">
<?php echo _i('unread'); ?>
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_FAVORITE || $this->get_c == 's') {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_FAVORITE;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_FAVORITE;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-favorite"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_favorite'); ?>">
<?php echo _i('starred'); ?>
</a>
<?php
if ($this->state & FreshRSS_Entry::STATE_NOT_FAVORITE) {
$url_state['params']['state'] = $this->state & ~FreshRSS_Entry::STATE_NOT_FAVORITE;
$checked = 'true';
$class = 'active';
} else {
$url_state['params']['state'] = $this->state | FreshRSS_Entry::STATE_NOT_FAVORITE;
$checked = 'false';
$class = '';
}
?>
<a id="toggle-not-favorite"
class="btn <?php echo $class; ?>"
aria-checked="<?php echo $checked; ?>"
href="<?php echo Minz_Url::display($url_state); ?>"
title="<?php echo _t('show_not_favorite'); ?>">
<?php echo _i('non-starred'); ?>
</a>
<a id="toggle-<?php echo $state_str; ?>"
class="btn <?php echo $state_enabled ? 'active' : ''; ?>"
aria-checked="<?php echo $state_enabled ? 'true' : 'false'; ?>"
title="<?php echo _t($state_str); ?>"
href="<?php echo Minz_Url::display($url_state); ?>"><?php echo _i($state_str); ?></a>
<?php } ?>
<div class="dropdown">
<div id="dropdown-query" class="dropdown-target"></div>
@@ -109,7 +50,7 @@
<?php } ?>
<?php
$url_query = $this->url;
$url_query = Minz_Request::currentRequest();;
$url_query['c'] = 'configure';
$url_query['a'] = 'addQuery';
?>
@@ -117,74 +58,26 @@
</ul>
</div>
</div>
<?php
$get = false;
$get = FreshRSS_Context::currentGet();
$next_step = FreshRSS_Context::nextStep();
$string_mark = _t('mark_all_read');
if ($this->get_f) {
$get = 'f_' . $this->get_f;
if ($get[0] == 'f') {
$string_mark = _t('mark_feed_read');
} elseif ($this->get_c && $this->get_c != 'a') {
if ($this->get_c === 's') {
$get = 's';
} else {
$get = 'c_' . $this->get_c;
}
} elseif ($get[0] == 'c') {
$string_mark = _t('mark_cat_read');
}
$nextGet = $get;
if (FreshRSS_Context::$conf->onread_jump_next && strlen($get) > 2) {
$anotherUnreadId = '';
$foundCurrent = false;
switch ($get[0]) {
case 'c':
foreach ($this->cat_aside as $cat) {
if ($cat->id() == $this->get_c) {
$foundCurrent = true;
continue;
}
if ($cat->nbNotRead() <= 0) continue;
$anotherUnreadId = $cat->id();
if ($foundCurrent) break;
}
$nextGet = empty($anotherUnreadId) ? 'a' : 'c_' . $anotherUnreadId;
break;
case 'f':
foreach ($this->cat_aside as $cat) {
if ($cat->id() == $this->get_c) {
foreach ($cat->feeds() as $feed) {
if ($feed->id() == $this->get_f) {
$foundCurrent = true;
continue;
}
if ($feed->nbNotRead() <= 0) continue;
$anotherUnreadId = $feed->id();
if ($foundCurrent) break;
}
break;
}
}
$nextGet = empty($anotherUnreadId) ? 'c_' . $this->get_c : 'f_' . $anotherUnreadId;
break;
}
}
$p = isset($this->entries[0]) ? $this->entries[0] : null;
$idMax = $p === null ? (time() - 1) . '000000' : $p->id();
if ($this->order === 'ASC') { //In this case we do not know but we guess idMax
$idMax2 = (time() - 1) . '000000';
if (strcmp($idMax2, $idMax) > 0) {
$idMax = $idMax2;
}
}
$arUrl = array('c' => 'entry', 'a' => 'read', 'params' => array('get' => $get, 'nextGet' => $nextGet, 'idMax' => $idMax));
$output = Minz_Request::param('output', '');
if ($output != '' && FreshRSS_Context::$conf->view_mode !== $output) {
$arUrl['params']['output'] = $output;
}
$markReadUrl = Minz_Url::display($arUrl);
Minz_Session::_param('markReadUrl', $markReadUrl);
$mark_read_url = array(
'c' => 'entry',
'a' => 'read',
'params' => array(
'get' => $get,
'nextGet' => $next_step['get'],
'idMax' => $next_step['idMax']
)
);
?>
<form id="mark-read-menu" method="post" style="display: none"></form>
@@ -193,7 +86,7 @@
<?php $confirm = FreshRSS_Context::$conf->reading_confirm ? 'confirm' : ''; ?>
<button class="read_all btn <?php echo $confirm; ?>"
form="mark-read-menu"
formaction="<?php echo $markReadUrl; ?>"
formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
type="submit"><?php echo _t('mark_read'); ?></button>
<div class="dropdown">
@@ -206,15 +99,16 @@
<li class="item">
<button class="as-link <?php echo $confirm; ?>"
form="mark-read-menu"
formaction="<?php echo $markReadUrl; ?>"
formaction="<?php echo Minz_Url::display($mark_read_url); ?>"
type="submit"><?php echo $string_mark; ?></button>
</li>
<li class="separator"></li>
<?php
$mark_before_today = $arUrl;
$mark_before_today['params']['idMax'] = $this->today . '000000';
$mark_before_one_week = $arUrl;
$mark_before_one_week['params']['idMax'] = ($this->today - 604800) . '000000';
$today = @strtotime('today');
$mark_before_today = $mark_read_url;
$mark_before_today['params']['idMax'] = $today . '000000';
$mark_before_one_week = $mark_read_url;
$mark_before_one_week['params']['idMax'] = ($today - 604800) . '000000';
?>
<li class="item">
<button class="as-link <?php echo $confirm; ?>"
@@ -233,25 +127,20 @@
</div>
<?php } ?>
<?php $url_output = $this->url; ?>
<?php $url_output = Minz_Request::currentRequest(); ?>
<div class="stick" id="nav_menu_views">
<?php $url_output['params']['output'] = 'normal'; ?>
<?php $url_output['a'] = 'normal'; ?>
<a class="view_normal btn <?php echo $actual_view == 'normal'? 'active' : ''; ?>" title="<?php echo _t('normal_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
<?php echo _i("view-normal"); ?>
</a>
<?php $url_output['a'] = 'global'; unset($url_output['params']['output']); ?>
<?php $url_output['a'] = 'global'; ?>
<a class="view_global btn <?php echo $actual_view == 'global'? 'active' : ''; ?>" title="<?php echo _t('global_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
<?php echo _i("view-global"); ?>
</a>
<?php $url_output['params']['output'] = 'reader'; ?>
<a class="view_reader btn <?php echo $actual_view == 'reader'? 'active' : ''; ?>" title="<?php echo _t('reader_view'); ?>" href="<?php echo Minz_Url::display($url_output); ?>">
<?php echo _i("view-reader"); ?>
</a>
<?php
$url_output['params']['output'] = 'rss';
$url_output['a'] = 'rss';
if (FreshRSS_Context::$conf->token) {
$url_output['params']['token'] = FreshRSS_Context::$conf->token;
}
@@ -284,7 +173,7 @@
</div>
<?php
if ($this->order === 'DESC') {
if (FreshRSS_Context::$order === 'DESC') {
$order = 'ASC';
$icon = 'up';
$title = 'older_first';
@@ -293,7 +182,7 @@
$icon = 'down';
$title = 'newer_first';
}
$url_order = $this->url;
$url_order = Minz_Request::currentRequest();
$url_order['params']['order'] = $order;
?>
<a id="toggle-order" class="btn" href="<?php echo Minz_Url::display($url_order); ?>" title="<?php echo _t($title); ?>">

View File

@@ -5,9 +5,7 @@
$url_base = array(
'c' => 'index',
'a' => 'index',
'params' => array(
'state' => FreshRSS_Context::$state
)
'params' => array()
);
foreach ($this->categories as $cat) {

View File

@@ -80,7 +80,7 @@ if (!empty($this->entries)) {
?></li><?php
}
}
$feed = FreshRSS_CategoryDAO::findFeed($this->cat_aside, $item->feed()); //We most likely already have the feed object in cache
$feed = FreshRSS_CategoryDAO::findFeed($this->categories, $item->feed()); //We most likely already have the feed object in cache
if ($feed == null) {
$feed = $item->feed(true);
if ($feed == null) {

View File

@@ -45,6 +45,13 @@ class Minz_Request {
public static function defaultActionName() {
return self::$default_action_name;
}
public static function currentRequest() {
return array(
'c' => self::$controller_name,
'a' => self::$action_name,
'params' => self::$params,
);
}
/**
* Setteurs