aboutsummaryrefslogtreecommitdiff
path: root/app/Controllers/feedController.php
diff options
context:
space:
mode:
authorGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-30 15:44:45 +0200
committerGravatar Marien Fressinaud <dev@marienfressinaud.fr> 2014-09-30 15:44:45 +0200
commit9e0a62727f8ff3c6a68b4ef85089633677ff67ef (patch)
tree72b2065f0f3e0fb3943ba0e6e98a7aaf673c4aa0 /app/Controllers/feedController.php
parentedb02c8fefdb292c96d7b37ad4e2c311e9d43b44 (diff)
Move empty cat action in the new Controller
feedController::delete is simpler than before. Improve coding style See https://github.com/marienfressinaud/FreshRSS/issues/646
Diffstat (limited to 'app/Controllers/feedController.php')
-rwxr-xr-xapp/Controllers/feedController.php66
1 files changed, 20 insertions, 46 deletions
diff --git a/app/Controllers/feedController.php b/app/Controllers/feedController.php
index c7cc25fbb..7ef427ac2 100755
--- a/app/Controllers/feedController.php
+++ b/app/Controllers/feedController.php
@@ -376,62 +376,36 @@ class FreshRSS_feed_Controller extends Minz_ActionController {
}
}
- public function deleteAction () {
- if (Minz_Request::isPost ()) {
- $type = Minz_Request::param ('type', 'feed');
- $id = Minz_Request::param ('id');
-
+ public function deleteAction() {
+ if (Minz_Request::isPost()) {
+ $id = Minz_Request::param('id');
$feedDAO = FreshRSS_Factory::createFeedDao();
- if ($type == 'category') {
- // List feeds to remove then related user queries.
- $feeds = $feedDAO->listByCategory($id);
-
- if ($feedDAO->deleteFeedByCategory ($id)) {
- // Remove related queries
- foreach ($feeds as $feed) {
- $this->view->conf->remove_query_by_get('f_' . $feed->id());
- }
- $this->view->conf->save();
- $notif = array (
- 'type' => 'good',
- 'content' => Minz_Translate::t ('category_emptied')
- );
- //TODO: Delete old favicons
- } else {
- $notif = array (
- 'type' => 'bad',
- 'content' => Minz_Translate::t ('error_occured')
- );
- }
- } else {
- if ($feedDAO->deleteFeed ($id)) {
- // Remove related queries
- $this->view->conf->remove_query_by_get('f_' . $id);
- $this->view->conf->save();
+ if ($feedDAO->deleteFeed($id)) {
+ // TODO: Delete old favicon
- $notif = array (
- 'type' => 'good',
- 'content' => Minz_Translate::t ('feed_deleted')
- );
- //TODO: Delete old favicon
- } else {
- $notif = array (
- 'type' => 'bad',
- 'content' => Minz_Translate::t ('error_occured')
- );
- }
+ // Remove related queries
+ $this->view->conf->remove_query_by_get('f_' . $id);
+ $this->view->conf->save();
+
+ $notif = array(
+ 'type' => 'good',
+ 'content' => _t('feed_deleted')
+ );
+ } else {
+ $notif = array(
+ 'type' => 'bad',
+ 'content' => _t('error_occured')
+ );
}
- Minz_Session::_param ('notification', $notif);
+ Minz_Session::_param('notification', $notif);
$redirect_url = Minz_Request::param('r', false, true);
if ($redirect_url) {
Minz_Request::forward($redirect_url);
- } elseif ($type == 'category') {
- Minz_Request::forward(array ('c' => 'configure', 'a' => 'categorize'), true);
} else {
- Minz_Request::forward(array ('c' => 'configure', 'a' => 'feed'), true);
+ Minz_Request::forward(array('c' => 'configure', 'a' => 'feed'), true);
}
}
}