(see .htaccess). // Visible to the public only while the event is live (db_events_active rule); // logged-in staff may preview drafts/scheduled/expired events. Carries an // optional lead-capture form that stores submissions in event_leads. require_once __DIR__ . '/../config/db.php'; require_once __DIR__ . '/../config/functions.php'; // Resolve any SSO session up front (mirrors _open.php) so the is_staff() preview // gate below sees a logged-in admin. _open.php's later call then no-ops. if (empty($_SESSION['user_id']) && identity_is_federated()) { sso_resolve_session($pdo); } $slug = preg_replace('/[^a-z0-9\-]/', '', strtolower((string) ($_GET['slug'] ?? ''))); $event = $slug !== '' ? db_events_get_by_slug($pdo, $slug) : null; // Gate: live for everyone, otherwise only staff (preview). $can_view = $event && (events_is_live($event) || is_staff()); // ── Lead form submission (PRG) ────────────────────────────────────────────── $lead_errors = []; if ($can_view && $_SERVER['REQUEST_METHOD'] === 'POST') { csrf_check(); $back = base_url('evento/' . rawurlencode($event['slug'])); // Honeypot: a filled "website" field means a bot — silently accept & drop. if (trim((string) ($_POST['website'] ?? '')) !== '') { header('Location: ' . $back . '?ok=1#inscricao'); exit; } // The exact wording the visitor consents to — stored for GDPR evidence. $consent_text = 'Autorizo o contacto e o tratamento dos meus dados para efeitos desta inscrição, nos termos da Política de Privacidade.'; $lead = [ 'name' => trim((string) ($_POST['lead_name'] ?? '')), 'email' => trim((string) ($_POST['lead_email'] ?? '')), 'phone' => trim((string) ($_POST['lead_phone'] ?? '')), 'message' => trim((string) ($_POST['lead_message'] ?? '')), 'consent' => !empty($_POST['lead_consent']) ? 1 : 0, 'consent_text' => $consent_text, // First hop of X-Forwarded-For (behind the id.andmore.pt proxy), else peer. 'ip' => trim(explode(',', (string) ($_SERVER['HTTP_X_FORWARDED_FOR'] ?? ''))[0]) ?: ($_SERVER['REMOTE_ADDR'] ?? ''), 'user_agent' => (string) ($_SERVER['HTTP_USER_AGENT'] ?? ''), ]; if ($lead['name'] === '') $lead_errors[] = 'Indica o teu nome.'; if ($lead['email'] === '' && $lead['phone'] === '') $lead_errors[] = 'Indica um email ou um telefone para te podermos contactar.'; if ($lead['email'] !== '' && !filter_var($lead['email'], FILTER_VALIDATE_EMAIL)) $lead_errors[] = 'O email indicado não é válido.'; if (!$lead['consent']) $lead_errors[] = 'É necessário aceitar o tratamento dos dados para enviar a inscrição.'; if (!$lead_errors) { db_event_lead_create($pdo, (int) $event['e_id'], $lead); header('Location: ' . $back . '?ok=1#inscricao'); exit; } // fall through and re-render with $lead_errors + the submitted $lead values $lead_old = $lead; } // ── Not found / not visible ───────────────────────────────────────────────── if (!$can_view) { http_response_code(404); $current_uri_2 = ''; require __DIR__ . '/_open.php'; ?>

Evento não encontrado

Este evento pode já ter terminado ou o link estar incorreto.

Voltar ao início
'https://schema.org', '@type' => 'Event', 'name' => $event['title'], 'description' => $seo_desc !== '' ? $seo_desc : $event['title'], 'url' => $event_url, 'eventStatus' => 'https://schema.org/EventScheduled', 'eventAttendanceMode' => 'https://schema.org/OfflineEventAttendanceMode', ]; if ($hero_url !== '') $ld_event['image'] = [$hero_url]; if (!empty($event['event_starts_at'])) $ld_event['startDate'] = str_replace(' ', 'T', (string) $event['event_starts_at']); if (!empty($event['event_ends_at'])) $ld_event['endDate'] = str_replace(' ', 'T', (string) $event['event_ends_at']); $ld_event['location'] = $event['location'] !== '' ? ['@type' => 'Place', 'name' => $event['location']] : ['@type' => 'Place', 'name' => ($info['name'] ?? '') !== '' ? $info['name'] : 'FitMe 3070', 'address' => $info['adress'] ?? '']; $ld_event['organizer'] = [ '@type' => 'Organization', 'name' => ($info['name'] ?? '') !== '' ? $info['name'] : 'FitMe 3070', 'url' => base_url(), ]; $GLOBALS['_jsonld_extra'] = $ld_event; require __DIR__ . '/_open.php'; ?>
Pré-visualização — este evento não está visível ao público ().
>
Evento

>
Participa

Inscreve-te

Deixa os teus dados e entramos em contacto.

Inscrição enviada com sucesso. Obrigado!