diff options
| author | 2013-12-05 22:12:08 +0100 | |
|---|---|---|
| committer | 2013-12-05 22:12:08 +0100 | |
| commit | 0e4274fc006203d23b632f4a7a7593427729d649 (patch) | |
| tree | a1fbf80826c39a8d6ba2b6a7f5bf01510bfa3156 /app/controllers/feedController.php | |
| parent | e4cf8a7396d5da06b44a803ce2843361b1077f91 (diff) | |
Permet de supprimer les articles d'un flux
Implémente https://github.com/marienfressinaud/FreshRSS/issues/311
Diffstat (limited to 'app/controllers/feedController.php')
| -rwxr-xr-x | app/controllers/feedController.php | 83 |
1 files changed, 50 insertions, 33 deletions
diff --git a/app/controllers/feedController.php b/app/controllers/feedController.php index c978857b2..02647e10f 100755 --- a/app/controllers/feedController.php +++ b/app/controllers/feedController.php @@ -157,6 +157,21 @@ class feedController extends ActionController { } } + public function truncateAction () { + if (Request::isPost ()) { + $id = Request::param ('id'); + $feedDAO = new FeedDAO (); + $n = $feedDAO->truncate($id); + $notif = array( + 'type' => $n === false ? 'bad' : 'good', + 'content' => Translate::t ('n_entries_deleted', $n) + ); + Session::_param ('notification', $notif); + invalidateHttpCache(); + Request::forward (array ('c' => 'configure', 'a' => 'feed', 'params' => array('id' => $id)), true); + } + } + public function actualizeAction () { @set_time_limit(300); @@ -356,44 +371,46 @@ class feedController extends ActionController { } public function deleteAction () { - $type = Request::param ('type', 'feed'); - $id = Request::param ('id'); + if (Request::isPost ()) { + $type = Request::param ('type', 'feed'); + $id = Request::param ('id'); - $feedDAO = new FeedDAO (); - if ($type == 'category') { - if ($feedDAO->deleteFeedByCategory ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Translate::t ('category_emptied') - ); - //TODO: Delete old favicons - } else { - $notif = array ( - 'type' => 'bad', - 'content' => Translate::t ('error_occured') - ); - } - } else { - if ($feedDAO->deleteFeed ($id)) { - $notif = array ( - 'type' => 'good', - 'content' => Translate::t ('feed_deleted') - ); - Feed::faviconDelete($id); + $feedDAO = new FeedDAO (); + if ($type == 'category') { + if ($feedDAO->deleteFeedByCategory ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => Translate::t ('category_emptied') + ); + //TODO: Delete old favicons + } else { + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('error_occured') + ); + } } else { - $notif = array ( - 'type' => 'bad', - 'content' => Translate::t ('error_occured') - ); + if ($feedDAO->deleteFeed ($id)) { + $notif = array ( + 'type' => 'good', + 'content' => Translate::t ('feed_deleted') + ); + Feed::faviconDelete($id); + } else { + $notif = array ( + 'type' => 'bad', + 'content' => Translate::t ('error_occured') + ); + } } - } - Session::_param ('notification', $notif); + Session::_param ('notification', $notif); - if ($type == 'category') { - Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); - } else { - Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + if ($type == 'category') { + Request::forward (array ('c' => 'configure', 'a' => 'categorize'), true); + } else { + Request::forward (array ('c' => 'configure', 'a' => 'feed'), true); + } } } |
