$confForm->validForm(); $data['errors'] = $confForm->get_errQueue(); // something failed? if (count($data['errors']) > 0) { exit(json_encode($data)); } $svcMount = $confForm->getFldValue('fsmount'); $cfgPtr['fsmounts'][$svcMount]['uuid'] = $confForm->getFldValue('uuid'); $cfgPtr['fsmounts'][$svcMount]['label'] = $confForm->getFldValue('label'); $cfgPtr['fsmounts'][$svcMount]['filesystem'] = $confForm->getFldValue('filesystem'); $cfgPtr['fsmounts'][$svcMount]['comment'] = $confForm->getFldValue('desc'); $cfgPtr['fsmounts'][$svcMount]['active'] = $confForm->getFldValue('active'); $svcAvail = getAvailServices(); $svcSetNow = null; foreach (array_keys($svcAvail) as $svc) { $svcActive = $confForm->getCbState($svc, 'yes', 'int'); if ($svcActive === 1) { $cfgPtr['services'][$svc]['fsmount'] = $svcMount; $cfgPtr['services'][$svc]['active'] = 1; $svcSetNow[] = $svc; } else { if (isset($cfgPtr['services'][$svc]['fsmount'])) { if ($cfgPtr['services'][$svc]['fsmount'] == $svcMount) { $cfgPtr['services'][$svc]['active'] = 0; } } } } $data['debug'] = $cfgPtr; $data['retval'] = 0; write_config();