aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche/Poche.class.php
diff options
context:
space:
mode:
Diffstat (limited to 'inc/poche/Poche.class.php')
-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' :