/** * Remove one or more entries * * @return void */ public function removeTask() { // Check for request forgeries Request::checkToken(); // Incoming $wishlist = Request::getInt('wishlist', 0); $ids = Request::getVar('id', array()); $ids = !is_array($ids) ? array($ids) : $ids; // Do we have any IDs? if (count($ids) > 0) { $tbl = new Wish($this->database); // Loop through each ID foreach ($ids as $id) { $id = intval($id); if (!$tbl->delete($id)) { throw new Exception($tbl->getError(), 500); } } } // Redirect App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller . '&wishlist=' . $wishlist, false), Lang::txt('COM_WISHLIST_ITEMS_REMOVED', count($ids))); }
/** * Remove one or more entries * * @return void */ public function removeTask() { // Check for request forgeries Request::checkToken(); if (!User::authorise('core.delete', $this->_option)) { App::abort(403, Lang::txt('JERROR_ALERTNOAUTHOR')); } // Incoming $ids = Request::getVar('id', array()); $ids = !is_array($ids) ? array($ids) : $ids; // Do we have any IDs? $i = 0; if (count($ids) > 0) { $tbl = new Wish($this->database); // Loop through each ID foreach ($ids as $id) { $id = intval($id); if (!$tbl->delete($id)) { Notify::error($tbl->getError()); continue; } $i++; } } if ($i) { Notify::success(Lang::txt('COM_WISHLIST_ITEMS_REMOVED', $i)); } // Redirect $this->cancelTask(); }