From 0e4274fc006203d23b632f4a7a7593427729d649 Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Thu, 5 Dec 2013 22:12:08 +0100 Subject: Permet de supprimer les articles d'un flux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Implémente https://github.com/marienfressinaud/FreshRSS/issues/311 --- app/controllers/feedController.php | 83 +++++++++++++++++++++++--------------- 1 file changed, 50 insertions(+), 33 deletions(-) (limited to 'app/controllers/feedController.php') 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); + } } } -- cgit v1.2.3