/** * Update the form actions. Usage: * * /form/api/actions/form-id * * Expects a single POST item named `actions` containing * the data structure of the form actions. */ public function post_actions($id) { $f = new Form($id); if ($f->error) { return $this->error(i18n_get('Form not found')); } if (!isset($_POST['actions'])) { $_POST['actions'] = array(); } if (!is_array($_POST['actions'])) { return $this->error(i18n_get('Invalid actions parameter')); } $f->actions = $_POST['actions']; $f->put(); if ($f->error) { return $this->error(i18n_get('Failed to save changes')); } \Versions::add($f); return i18n_get('Form updated'); }