function numRunningApps($appType) { $rval = 0; $ra = runningApps(); foreach ($ra as $value) { if ($value['appType'] == $appType) { $rval++; } } return $rval; }
if (isPOST()) { array_map('unlink', glob("../data/appdata/*.json")); array_map('unlink', glob("../data/messages/*.json")); array_map('unlink', glob("../data/*.json")); jsonOut(json_encode(array("cool" => "beans"))); } else { badReq('POST only'); } break; case 'screenmap': header('Content-Type: application/json'); echo json_encode(screenMap()); break; case 'running': header('Content-Type: application/json'); echo json_encode(runningApps()); break; case 'kill': if (isPOST() && isset($_REQUEST['appid'])) { $kill = killApp($_REQUEST['appid']); if ($kill["success"]) { jsonOut(json_encode(array("killed" => $_REQUEST['appid']))); } else { badReq($kill["msg"]); } } else { badReq('Wrong verb or no appid'); } break; case 'launch': if (isPOST() && isset($_REQUEST['appid'])) {