/dev/null &"); break; case 'docker_load_stop': $daemon = "/usr/local/emhttp/plugins/dynamix.docker.manager/scripts/docker_load"; if (exec("pgrep -f $daemon")) passthru("pkill -f $daemon &>/dev/null &"); break; case 'autostart': // update container autostart setting $container = urldecode(($_POST['container'])); $wait = $_POST['wait']; $item = rtrim("$container $wait"); $autostart = @file($autostart_file, FILE_IGNORE_NEW_LINES) ?: []; $key = array_search($item, $autostart); if ($_POST['auto']=='true') { if ($key===false) $autostart[] = $item; } else { unset($autostart[$key]); } if ($autostart) { if (file_exists($user_prefs)) { $prefs = parse_ini_file($user_prefs); $sort = []; foreach ($autostart as $ct) $sort[] = array_search(var_split($ct),$prefs) ?? 999; array_multisort($sort,$autostart); } else { natcasesort($autostart); } file_put_contents($autostart_file, implode("\n", $autostart)."\n"); } else @unlink($autostart_file); break; case 'wait': // update wait period used after container autostart $container = urldecode(($_POST['container'])); $wait = $_POST['wait']; $item = rtrim("$container $wait"); $autostart = file($autostart_file, FILE_IGNORE_NEW_LINES) ?: []; $names = array_map('var_split', $autostart); $autostart[array_search($container,$names)] = $item; file_put_contents($autostart_file, implode("\n", $autostart)."\n"); break; case 'templates': // update template readfile("$docroot/update.htm"); $repos = $_POST['template_repos']; file_put_contents($template_repos, $repos); $DockerTemplates = new DockerTemplates(); $DockerTemplates->downloadTemplates(); break; } if (isset($_GET['is_dir'])) { echo json_encode(['is_dir' => is_dir($_GET['is_dir'])]); } ?>