$zip->addFromString($name, $content); } } $zip->close(); $data = file_get_contents($zip_file); $_SESSION['download'] = array('name' => basename($_GET['file']) . '.zip', 'file' => $zip_file); $server->send_msg($id, 'done'); break; case 'definitions': $response['success'] = true; $json = file_get_contents($definitions); $response['definitions'] = json_decode($json); break; case 'save_path': if ($_POST['expand'] != 'false') { $_SESSION['paths'][] = $_POST['path']; $_SESSION['paths'] = array_unique($_SESSION['paths']); } else { foreach ($_SESSION['paths'] as $k => $v) { if (substr($v, 0, strlen($_POST['path'])) == $_POST['path']) { unset($_SESSION['paths'][$k]); } } } break; default: echo '{"success":false,"error":"No command"}'; break; } $server->close();