change event
All checks were successful
Deploy / deploy (push) Successful in 54s

This commit is contained in:
2026-08-10 21:00:54 +02:00
parent d442b888a5
commit e0cc5989cc
13 changed files with 648 additions and 76 deletions

View File

@@ -393,8 +393,14 @@ final class AccountPages
throw new \RuntimeException('Die neue Eintragslogik ist aktuell nicht verfügbar.');
}
$payload = $_POST;
$existingListingId = $action === 'event_update' ? (int)($_POST['listing_id'] ?? 0) : 0;
$existingListing = $existingListingId > 0 ? $listingCatalog->getDashboardEntry($userId, $existingListingId) : null;
$existingListing = null;
if ($action === 'event_update') {
$existingListingId = (int)($_POST['listing_id'] ?? 0);
$existingListing = $existingListingId > 0 ? $listingCatalog->getMemberEntry($existingListingId) : null;
if (!is_array($existingListing) || (string)($existingListing['status'] ?? '') !== 'published') {
throw new \RuntimeException('Eintrag nicht gefunden.');
}
}
$street = trim((string)($_POST['street'] ?? ''));
$zip = trim((string)($_POST['zip'] ?? ''));
$city = trim((string)($_POST['city'] ?? ''));
@@ -426,12 +432,18 @@ final class AccountPages
trim((string)($payload['description'] ?? '')),
trim((string)($payload['title'] ?? ''))
);
$listingCatalog->saveDashboardEntry(
$userId,
$payload,
$action === 'event_update' ? (int)($_POST['listing_id'] ?? 0) : null
);
$info = $entryKind === 'place' ? 'Ort gespeichert.' : 'Veranstaltung gespeichert.';
if ($action === 'event_update') {
$listingCatalog->submitUpdateRequest(
$userId,
(int)($_POST['listing_id'] ?? 0),
$payload,
(string)($_POST['moderation_reason'] ?? '')
);
$info = $entryKind === 'place' ? 'Änderungsanfrage für den Ort eingereicht.' : 'Änderungsanfrage für die Veranstaltung eingereicht.';
} else {
$listingCatalog->submitCreateSuggestion($userId, $payload);
$info = $entryKind === 'place' ? 'Ort zur Freigabe eingereicht.' : 'Veranstaltung zur Freigabe eingereicht.';
}
} else {
$existingEvent = null;
if ($action === 'event_update') {
@@ -563,17 +575,13 @@ final class AccountPages
'id' => $eventId,
]);
$info = 'Event wurde abgesagt.';
} elseif ($action === 'listing_delete') {
} elseif ($action === 'listing_delete_request') {
$listingId = (int)($_POST['listing_id'] ?? 0);
if (!$listingCatalog) {
throw new \RuntimeException('Die neue Eintragslogik ist aktuell nicht verfügbar.');
}
$entry = $listingCatalog->getDashboardEntry($userId, $listingId);
if (is_array($entry)) {
self::deleteStoredImage((string)($entry['image_path'] ?? ''));
}
$listingCatalog->deleteDashboardEntry($userId, $listingId);
$info = 'Eintrag gelöscht.';
$listingCatalog->submitDeleteRequest($userId, $listingId, (string)($_POST['moderation_reason'] ?? ''));
$info = 'Löschanfrage wurde eingereicht.';
} elseif ($action === 'community_admin_apply') {
if (!$community || !$communityAccess) {
throw new \RuntimeException('Community-Funktionen sind aktuell nicht verfügbar.');
@@ -697,7 +705,9 @@ final class AccountPages
$eventsJoinedUpcoming = [];
$eventsJoinedPast = [];
$editEvent = null;
$otherListings = [];
$directoryListings = [];
$userSubmittedListings = [];
$listingRequestMap = [];
$editListing = null;
$listingCategories = $listingCatalog ? $listingCatalog->listCategories(['general', 'place', 'food', 'event', 'family']) : [];
$categoryReviewItems = $listingCatalog && $canManageSystemSettings ? $listingCatalog->listCategoryReviewItems() : [];
@@ -763,11 +773,18 @@ final class AccountPages
$editEvent = $stmt?->fetch(\PDO::FETCH_ASSOC) ?: null;
}
if ($listingCatalog) {
$otherListings = $listingCatalog->listDashboardEntries($userId);
$directoryListings = $listingCatalog->listPublishedDirectoryEntries();
$userSubmittedListings = $listingCatalog->listUserSubmittedEntries($userId);
$listingRequestMap = $listingCatalog->listUserOpenModerationRequestMap($userId);
if (isset($_GET['edit_listing'])) {
$editListingId = (int)$_GET['edit_listing'];
if ($editListingId > 0) {
$editListing = $listingCatalog->getDashboardEntry($userId, $editListingId);
$candidate = $listingCatalog->getMemberEntry($editListingId);
if (is_array($candidate) && (string)($candidate['status'] ?? '') === 'published') {
$editListing = $candidate;
} else {
$error = 'Der gewünschte Eintrag ist für eine Änderungsanfrage nicht verfügbar.';
}
}
}
}
@@ -808,7 +825,9 @@ final class AccountPages
'eventsJoinedUpcoming',
'eventsJoinedPast',
'editEvent',
'otherListings',
'directoryListings',
'userSubmittedListings',
'listingRequestMap',
'editListing',
'listingCategories',
'categoryReviewItems',