pdo(); $q = trim((string)($_GET['q'] ?? '')); $loc = trim((string)($_GET['loc'] ?? '')); $radius = isset($_GET['radius']) ? (float)$_GET['radius'] : 5.0; $radius = ($radius > 0) ? $radius : 5.0; $lat = isset($_GET['lat']) && $_GET['lat'] !== '' ? (float)$_GET['lat'] : null; $lng = isset($_GET['lng']) && $_GET['lng'] !== '' ? (float)$_GET['lng'] : null; $results = []; function geocode_loc(string $loc): array { $url = 'https://nominatim.openstreetmap.org/search?' . http_build_query([ 'format' => 'jsonv2', 'limit' => 1, 'q' => $loc, ]); $ctx = stream_context_create([ 'http' => [ 'method' => 'GET', 'header' => "User-Agent: papa-kind-treff/1.0\r\nAccept-Language: de\r\n", 'timeout' => 6, ], ]); $resp = @file_get_contents($url, false, $ctx); if ($resp === false) return [null, null]; $json = json_decode($resp, true); if (!is_array($json) || empty($json[0]['lat']) || empty($json[0]['lon'])) return [null, null]; return [round((float)$json[0]['lat'], 6), round((float)$json[0]['lon'], 6)]; } if ($pdo && ($q !== '' || $loc !== '' || ($lat !== null && $lng !== null))) { if ($lat === null && $lng === null && $loc !== '') { [$lat, $lng] = geocode_loc($loc); } $geo = ($lat !== null && $lng !== null) ? ['lat' => $lat, 'lng' => $lng, 'radius' => $radius] : null; $search = new \App\Search($pdo); $results = $search->searchEvents($q, 100, $geo); } ?>

Suche

Events finden

Bitte gib einen Suchbegriff oder einen Ort ein.

Ergebnis(se)

Keine passenden Events gefunden.

📍 km

Ort:

Details anzeigen