From f400621f44c2aac0b1bb4204e95e4c35a8a35f8f Mon Sep 17 00:00:00 2001 From: Marien Fressinaud Date: Wed, 1 Oct 2014 13:37:10 +0200 Subject: Fix problem when deleting default category This is not allowed! See https://github.com/marienfressinaud/FreshRSS/issues/646 --- app/Controllers/categoryController.php | 4 ++++ app/Controllers/subscriptionController.php | 1 + 2 files changed, 5 insertions(+) (limited to 'app/Controllers') diff --git a/app/Controllers/categoryController.php b/app/Controllers/categoryController.php index 2c99751a4..c79f37fa4 100644 --- a/app/Controllers/categoryController.php +++ b/app/Controllers/categoryController.php @@ -123,6 +123,10 @@ class FreshRSS_category_Controller extends Minz_ActionController { Minz_Request::bad(_t('category_no_id'), $url_redirect); } + if ($id === $default_category->id()) { + Minz_Request::bad(_t('category_not_delete_default'), $url_redirect); + } + if ($feedDAO->changeCategory($id, $default_category->id()) === false) { Minz_Request::bad(_t('error_occurred'), $url_redirect); } diff --git a/app/Controllers/subscriptionController.php b/app/Controllers/subscriptionController.php index 83f803edb..aabae7b8f 100644 --- a/app/Controllers/subscriptionController.php +++ b/app/Controllers/subscriptionController.php @@ -19,6 +19,7 @@ class FreshRSS_subscription_Controller extends Minz_ActionController { $catDAO = new FreshRSS_CategoryDAO(); + $catDAO->checkDefault(); $this->view->categories = $catDAO->listCategories(false); $this->view->default_category = $catDAO->getDefault(); } -- cgit v1.2.3