hovselist_write('mole-' . $list, $moles); $lists[] = 'mole-' . $list; } break; case 'restart_mailingset': exec(__DIR__ . '/mailingset restart', $output, $fail); $content = $fail ? 'Failed to restart Mailingset.' : 'Successfully restarted Mailingset.'; break; case 'insert': $mole = new Mole(); foreach ($_POST as $field => $val) { if (property_exists('Mole', $field)) { $mole->{$field} = $val; } } $content = $mole->insert($pdo); if (!$content and array_key_exists('major', $_POST)) { $content = $mole->setMajors($pdo, explode(',', $_POST['major'])); } break; case 'update': $mole = Mole::getMoleByUid($pdo, (int) $_POST['uid']); foreach ($_POST as $field => $val) { if (property_exists('Mole', $field . 'Bak')) { $mole->{$field} = $val; } } $content = $mole->update($pdo); if (!$content and array_key_exists('major', $_POST)) { $majors = explode(',', $_POST['major']); $majors_bak = array_keys($mole->getMajors($pdo));