aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc
diff options
context:
space:
mode:
authormoparisthebest <admin@moparisthebest.com>2015-01-12 19:11:45 -0500
committermoparisthebest <admin@moparisthebest.com>2015-01-12 19:52:41 -0500
commit512e5e5bd195ea4547dc7fa29f34a9d205bd7a54 (patch)
tree3ab4e2b2a847bc9eab910f20e9d08afee462b064 /inc
parent7f782e44965b005efe01d347dedd1825872b9345 (diff)
downloadwallabag-512e5e5bd195ea4547dc7fa29f34a9d205bd7a54.tar.gz
wallabag-512e5e5bd195ea4547dc7fa29f34a9d205bd7a54.tar.zst
wallabag-512e5e5bd195ea4547dc7fa29f34a9d205bd7a54.zip
Add ability to delete all articles matching a search
Diffstat (limited to 'inc')
-rwxr-xr-xinc/poche/Poche.class.php31
1 files changed, 22 insertions, 9 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index c7c59878..540aa55e 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -201,18 +201,31 @@ class Poche
201 } 201 }
202 break; 202 break;
203 case 'delete': 203 case 'delete':
204 $msg = 'delete link #' . $id; 204 if (isset($_GET['search'])) {
205 if ($this->store->deleteById($id, $this->user->getId())) { 205 //when we want to apply a delete to a search
206 if (DOWNLOAD_PICTURES) { 206 $tags = array($_GET['search']);
207 Picture::removeDirectory(ABS_PATH . $id); 207 $allentry_ids = $this->store->search($tags[0], $this->user->getId());
208 $entry_ids = array();
209 foreach ($allentry_ids as $eachentry) {
210 $entry_ids[] = $eachentry[0];
208 } 211 }
209 $this->messages->add('s', _('the link has been deleted successfully')); 212 } else { // delete a single article
213 $entry_ids = array($id);
210 } 214 }
211 else { 215 foreach($entry_ids as $id) {
212 $this->messages->add('e', _('the link wasn\'t deleted')); 216 $msg = 'delete link #' . $id;
213 $msg = 'error : can\'t delete link #' . $id; 217 if ($this->store->deleteById($id, $this->user->getId())) {
218 if (DOWNLOAD_PICTURES) {
219 Picture::removeDirectory(ABS_PATH . $id);
220 }
221 $this->messages->add('s', _('the link has been deleted successfully'));
222 }
223 else {
224 $this->messages->add('e', _('the link wasn\'t deleted'));
225 $msg = 'error : can\'t delete link #' . $id;
226 }
227 Tools::logm($msg);
214 } 228 }
215 Tools::logm($msg);
216 Tools::redirect('?'); 229 Tools::redirect('?');
217 break; 230 break;
218 case 'toggle_fav' : 231 case 'toggle_fav' :