diff options
| author | 2019-07-25 16:51:48 +0200 | |
|---|---|---|
| committer | 2019-07-25 16:51:48 +0200 | |
| commit | 82611c9622ed23b0e9fcf5f9f651ddffa1fd7706 (patch) | |
| tree | fc2c97fd8dd84ec30473cb85b889d8326c9a831a /app/Controllers/subscriptionController.php | |
| parent | 744a9e8cf00aef7dec0acfa5f90f0dcfa2ef8837 (diff) | |
| parent | 042b40eeeea77db854daab1bec96fce5c2cdd4b2 (diff) | |
Merge pull request #2451 from FreshRSS/dev1.14.3
FreshRSS 1.14.3
Diffstat (limited to 'app/Controllers/subscriptionController.php')
| -rw-r--r-- | app/Controllers/subscriptionController.php | 46 |
1 files changed, 43 insertions, 3 deletions
diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 9cf41ed0b..79da39751 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -35,9 +35,20 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $this->view->onlyFeedsWithError = Minz_Request::paramTernary('error'); $id = Minz_Request::param('id'); - if ($id !== false) { - $feedDAO = FreshRSS_Factory::createFeedDao(); - $this->view->feed = $feedDAO->searchById($id); + $this->view->displaySlider = false; + if (false !== $id) { + $type = Minz_Request::param('type'); + $this->view->displaySlider = true; + switch ($type) { + case 'category': + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + $this->view->category = $categoryDAO->searchById($id); + break; + default: + $feedDAO = FreshRSS_Factory::createFeedDao(); + $this->view->feed = $feedDAO->searchById($id); + break; + } } } @@ -140,6 +151,35 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { } } + public function categoryAction() { + $this->view->_useLayout(false); + + $categoryDAO = FreshRSS_Factory::createCategoryDao(); + + $id = Minz_Request::param('id'); + $category = $categoryDAO->searchById($id); + if ($id === false || null === $category) { + Minz_Error::error(404); + return; + } + $this->view->category = $category; + + if (Minz_Request::isPost()) { + $values = array( + 'name' => Minz_Request::param('name', ''), + ); + + invalidateHttpCache(); + + $url_redirect = array('c' => 'subscription', 'params' => array('id' => $id, 'type' => 'category')); + if (false !== $categoryDAO->updateCategory($id, $values)) { + Minz_Request::good(_t('feedback.sub.category.updated'), $url_redirect); + } else { + Minz_Request::bad(_t('feedback.sub.category.error'), $url_redirect); + } + } + } + /** * This action displays the bookmarklet page. */ |
