/** * Sets the state of one or more entries * * @return void */ public function accessTask() { // Check for request forgeries Request::checkToken(['get', 'post']); // Incoming $state = Request::getInt('access', 0); $ids = Request::getVar('id', array()); $ids = !is_array($ids) ? array($ids) : $ids; // Check for an ID if (count($ids) < 1) { App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_FORUM_SELECT_ENTRY_TO_CHANGE_ACCESS'), 'error'); return; } foreach ($ids as $id) { // Update record(s) $row = new Section(intval($id)); if (!$row->exists()) { continue; } $row->set('access', $state); if (!$row->store()) { throw new Exception($row->getError(), 500); } } // set message App::redirect(Route::url('index.php?option=' . $this->_option . '&controller=' . $this->_controller, false), Lang::txt('COM_FORUM_ITEMS_ACCESS_CHANGED', count($ids))); }