diff --git a/partials/landing/account/dashboard.php b/partials/landing/account/dashboard.php index ba6bec1..6449fdc 100644 --- a/partials/landing/account/dashboard.php +++ b/partials/landing/account/dashboard.php @@ -4,7 +4,7 @@ if (!isset($_SESSION['user_id'])) { } $app = app(); -$pdo = $app->pdo(); + $pdo = $app->pdo(); $flash = $app->flash()->get(); $userId = (int)$_SESSION['user_id']; $error = ''; @@ -92,7 +92,13 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { $zip = trim((string)($_POST['zip'] ?? '')); $city = trim((string)($_POST['city'] ?? '')); $region = trim((string)($_POST['region'] ?? '')); - [$lat, $lng] = geocode_address($street, $zip, $city, $region); + $lat = isset($_POST['lat']) && $_POST['lat'] !== '' ? (float)$_POST['lat'] : null; + $lng = isset($_POST['lng']) && $_POST['lng'] !== '' ? (float)$_POST['lng'] : null; + if ($lat === 0.0 && $lng === 0.0 && ($_POST['lat'] === '0' || $_POST['lng'] === '0')) { + // keep zero if explicitly set (unlikely) + } elseif ($lat === null || $lng === null) { + [$lat, $lng] = geocode_address($street, $zip, $city, $region); + } $stmt = $pdo->prepare('INSERT INTO events (created_by, title, teaser_public, description, location_label, street, zip, city, region, lat, lng, starts_at, allow_kids, visibility, status, created_at, updated_at) VALUES (:uid, :title, :teaser, :descr, :loc, :street, :zip, :city, :region, :lat, :lng, :start, :allow, :vis, :status, NOW(), NOW())'); $stmt->execute([ @@ -412,6 +418,22 @@ $events = $stmt->fetchAll(PDO::FETCH_ASSOC) ?: []; + + +
Klick auf die Karte setzt den Treffpunkt. Zoom/Scroll möglich.
+