feat: complete package 2 delete flows and package 3 port management

This commit is contained in:
2026-02-18 10:16:24 +01:00
parent f4ce7f360d
commit 77758f71d3
14 changed files with 754 additions and 141 deletions

View File

@@ -2,12 +2,19 @@
/**
* app/modules/connections/delete.php
*
* Loescht eine Verbindung und leitet zur Liste zurueck.
* Loescht eine Verbindung (AJAX-POST bevorzugt, GET-Fallback fuer Redirects).
*/
$connectionId = (int)($_GET['id'] ?? $_POST['id'] ?? 0);
$isPost = ($_SERVER['REQUEST_METHOD'] ?? '') === 'POST';
$connectionId = (int)($_POST['id'] ?? $_GET['id'] ?? 0);
if ($connectionId <= 0) {
if ($isPost) {
header('Content-Type: application/json; charset=utf-8');
http_response_code(400);
echo json_encode(['success' => false, 'message' => 'Ungueltige Verbindungs-ID']);
exit;
}
$_SESSION['error'] = 'Ungueltige Verbindungs-ID';
header('Location: ?module=connections&action=list');
exit;
@@ -20,6 +27,12 @@ $connection = $sql->single(
);
if (!$connection) {
if ($isPost) {
header('Content-Type: application/json; charset=utf-8');
http_response_code(404);
echo json_encode(['success' => false, 'message' => 'Verbindung nicht gefunden']);
exit;
}
$_SESSION['error'] = 'Verbindung nicht gefunden';
header('Location: ?module=connections&action=list');
exit;
@@ -31,6 +44,17 @@ $rows = $sql->set(
[$connectionId]
);
if ($isPost) {
header('Content-Type: application/json; charset=utf-8');
if ($rows > 0) {
echo json_encode(['success' => true, 'message' => 'Verbindung geloescht']);
} else {
http_response_code(500);
echo json_encode(['success' => false, 'message' => 'Verbindung konnte nicht geloescht werden']);
}
exit;
}
if ($rows > 0) {
$_SESSION['success'] = 'Verbindung geloescht';
} else {