diff options
Diffstat (limited to 'app/Controllers')
| -rwxr-xr-x | app/Controllers/entryController.php | 1 | ||||
| -rwxr-xr-x | app/Controllers/feedController.php | 3 | ||||
| -rwxr-xr-x | app/Controllers/indexController.php | 64 |
3 files changed, 36 insertions, 32 deletions
diff --git a/app/Controllers/entryController.php b/app/Controllers/entryController.php index 1d9989f40..bff1073ef 100755 --- a/app/Controllers/entryController.php +++ b/app/Controllers/entryController.php @@ -46,6 +46,7 @@ class FreshRSS_entry_Controller extends Minz_ActionController { if ($id === false) { // id is false? It MUST be a POST request! if (!Minz_Request::isPost()) { + Minz_Request::bad(_t('feedback.access.not_found'), array('c' => 'index', 'a' => 'index')); return; } diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php index b559d3c22..6a8aa01cf 100755 --- a/app/Controllers/feedController.php +++ b/app/Controllers/feedController.php @@ -114,6 +114,8 @@ class FreshRSS_feed_Controller extends Minz_ActionController { Minz_Request::bad(_t('feedback.sub.feed.invalid_url', $url), $url_redirect); } + $feed->_httpAuth($http_auth); + try { $feed->load(true); } catch (FreshRSS_Feed_Exception $e) { @@ -140,7 +142,6 @@ class FreshRSS_feed_Controller extends Minz_ActionController { } $feed->_category($cat); - $feed->_httpAuth($http_auth); // Call the extension hook $name = $feed->name(); diff --git a/app/Controllers/indexController.php b/app/Controllers/indexController.php index baaf99065..7e626720e 100755 --- a/app/Controllers/indexController.php +++ b/app/Controllers/indexController.php @@ -32,42 +32,44 @@ class FreshRSS_index_Controller extends Minz_ActionController { Minz_Error::error(404); } - try { - $entries = $this->listEntriesByContext(); - - $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(); - } + $this->view->callbackBeforeContent = function() { + try { + $entries = $this->listEntriesByContext(); + + $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; + $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()); - Minz_Error::error(404); - } + $this->view->entries = $entries; + } catch (FreshRSS_EntriesGetter_Exception $e) { + Minz_Log::notice($e->getMessage()); + Minz_Error::error(404); + } - $this->view->categories = FreshRSS_Context::$categories; + $this->view->categories = FreshRSS_Context::$categories; - $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); - $title = FreshRSS_Context::$name; - if (FreshRSS_Context::$get_unread > 0) { - $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; - } - Minz_View::prependTitle($title . ' · '); + $this->view->rss_title = FreshRSS_Context::$name . ' | ' . Minz_View::title(); + $title = FreshRSS_Context::$name; + if (FreshRSS_Context::$get_unread > 0) { + $title = '(' . FreshRSS_Context::$get_unread . ') ' . $title; + } + Minz_View::prependTitle($title . ' · '); + }; } /** |
