/** * Update an entry * * @return void */ public function updateTask() { $this->requiresAuthentication(); $id = Request::getInt('id', 0); $tag = Request::getVar('tag', null); $raw = Request::getVar('raw_tag', null); $label = Request::getVar('label', null); $admin = Request::getInt('admin', 0); $subs = Request::getVar('substitutes', null); if (!$id) { throw new Exception(Lang::txt('COM_TAGS_ERROR_MISSING_DATA'), 500); } $record = new Tag($id); if (!$record->exists()) { $record->set('admin', $admin ? 1 : 0); if ($raw_tag) { $record->set('raw_tag', $raw_tag); } if ($tag) { $record->set('tag', $tag); } $record->set('label', $label); $record->set('substitutions', $subs); if (!$record->store(true)) { throw new Exception($record->getError(), 500); } } $this->send($record->toObject()); }