From 1fe5ed5d210334a051c48442fad29a14e8aee155 Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 22 Oct 2014 19:19:15 +0200 Subject: nextGet and idMax are coming back. See https://github.com/marienfressinaud/FreshRSS/issues/634 --- app/Controllers/entryController.php | 14 +++----------- app/Controllers/indexController.php | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 12 deletions(-) (limited to 'app/Controllers') diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 449029648..d11f3a520 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -17,14 +17,6 @@ class FreshRSS_entry_Controller extends Minz_ActionController { ); } - // Keep parameter information (output) to do a correct redirection at - // the end. - $this->params = array(); - $output = Minz_Request::param('output', ''); - if ($output != '' && FreshRSS_Context::$conf->view_mode !== $output) { - $this->params['output'] = $output; - } - // If ajax request, we do not print layout $this->ajax = Minz_Request::param('ajax'); if ($this->ajax) { @@ -53,6 +45,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { $get = Minz_Request::param('get'); $next_get = Minz_Request::param('nextGet', $get); $id_max = Minz_Request::param('idMax', 0); + $params = array(); $entryDAO = FreshRSS_Factory::createEntryDao(); if ($id === false) { @@ -86,7 +79,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { // Redirect to the correct page (category, feed or starred) // Not "a" because it is the default value if nothing is // given. - $this->params['get'] = $next_get; + $params['get'] = $next_get; } } } else { @@ -98,7 +91,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { Minz_Request::good(_t('feeds_marked_read'), array( 'c' => 'index', 'a' => 'index', - 'params' => $this->params, + 'params' => $params, ), true); } } @@ -123,7 +116,6 @@ class FreshRSS_entry_Controller extends Minz_ActionController { Minz_Request::forward(array( 'c' => 'index', 'a' => 'index', - 'params' => $this->params, ), true); } } diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index 2dd4c3068..80675b3a6 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -34,12 +34,25 @@ class FreshRSS_index_Controller extends Minz_ActionController { try { $entries = $this->listEntriesByContext(); - if (count($entries) > FreshRSS_Context::$number) { + $nb_entries = count($entries); + if ($nb_entries > FreshRSS_Context::$number) { // We have more elements for pagination $last_entry = array_pop($entries); FreshRSS_Context::$next_id = $last_entry->id(); } + $first_entry = $nb_entries > 0 ? $entries[0] : null; + FreshRSS_Context::$id_max = $first_entry === null ? + (time() - 1) . '000000' : + $first_entry->id(); + if (FreshRSS_Context::$order === 'ASC') { + // In this case we do not know but we guess id_max + $id_max = (time() - 1) . '000000'; + if (strcmp($id_max, FreshRSS_Context::$id_max) > 0) { + FreshRSS_Context::$id_max = $id_max; + } + } + $this->view->entries = $entries; } catch (FreshRSS_EntriesGetter_Exception $e) { Minz_Log::notice($e->getMessage()); -- cgit v1.2.3