\n"; ?> Mandanten - Elwig - Elektronische Winzergenossenschaftsverwaltung

Mandanten

Startseite

\n"; } ?>
Name
$c

JSON-Format

format(DateTimeInterface::RFC3339) . '"'; $zwstid = "\"$parts[2]\""; } list($meta, $version, $files) = get_zip_meta($path); $files ??= "null"; $version ??= "null"; echo " {\"name\": \"$file\", \"timestamp\": $datetime, \"zwstid\": $zwstid, \"meta\": $meta, \"files\": $files, " . "\"version\": $version, \"url\": \"$url\", \"size\": $size, \"created\": \"$cre\", \"modified\": \"$mod\"}"; $first = false; } echo "\n]}\n"; exit(); } $file = substr($path, strlen("/$c/")); $path = ".data/clients/$c/$file"; if (str_contains($file, '/')) { header("Status: 400"); exit("400 Bad Request :(\n"); } elseif ($_SERVER['REQUEST_METHOD'] === 'GET') { $size = filesize($path); if ($size === false) { header("Status: 404"); exit("404 Not Found :(\n"); } $type = mime_content_type($path); header("Content-Type: $type"); header("Content-Disposition: attachment; filename=\"$file\""); header("Content-Length: $size"); readfile($path); } elseif ($_SERVER['REQUEST_METHOD'] === 'PUT') { $putdata = fopen('php://input', 'r'); $fp = fopen($path, 'wb'); if ($fp === false) { header("Status: 500"); exit("500 Internal Server Error :(\n"); } while ($data = fread($putdata, 4096)) fwrite($fp, $data); fclose($fp); fclose($putdata); header("Status: 201"); exit("201 Created :)\n"); } elseif ($_SERVER['REQUEST_METHOD'] === 'DELETE') { if (unlink($path) === false) { header("Status: 500"); exit("500 Internal Server Error :(\n"); } exit("200 OK :)\n"); } else { header("Status: 405"); header("Allow: GET, PUT, DELETE"); exit("405 Method Not Allowed :(\n"); } exit(); } header("Status: 404"); if ($format === 'text') { header('Content-Type: text/plain; charset=UTF-8'); echo "404 Not Found :(\n"; } else if ($format === 'json') { header('Content-Type: application/json; charset=UTF-8'); echo "{\"status\": \"error\", \"errors\": [{\"message\": \"Not found\"}]}\n"; } else { header('Content-Type: text/html; charset=UTF-8'); header('Content-Length: 0'); } exit();