Files
fitme3070.pt/site/_open.php
T

33 lines
1.6 KiB
PHP

<?php
// Shared bootstrap + page-top chrome for the public site. Mirrors what the old
// CI4 BaseController emitted before each Home action: seo + include (head/body)
// + navbar + messenger chat. A page may set $current_uri_2 before including this.
require_once __DIR__ . '/../config/db.php';
require_once __DIR__ . '/../config/functions.php';
// The gym this page belongs to: ?gym=<slug> from the URL folder (/3070/…), or
// the default gym for pages outside a gym folder (privacy page, events).
// Unknown slugs — and unpublished gyms for anyone not logged in to the
// backoffice — are a plain 404.
$gym = site_gym($pdo);
if (!$gym) { require __DIR__ . '/404.php'; exit; }
$GLOBALS['_gym'] = $gym;
$info = site_info($pdo, (int) $gym['id']);
$navbar = site_navbar($gym);
$current_uri_2 = $current_uri_2 ?? '';
$nav_center_logo = $nav_center_logo ?? false; // index.php: big centred logo (navbar.php)
$GLOBALS['_view_shared'] = compact('info', 'navbar', 'current_uri_2', 'gym', 'nav_center_logo');
echo view('include'); // renders view('seo') inside <head>
echo view('navbar');
echo view('messenger_chat');
// Staff previewing a gym that isn't public yet.
if (empty($gym['is_published'])) {
echo '<div class="event-preview-bar">Pré-visualização — <strong>' . htmlspecialchars($gym['name'])
. '</strong> ainda não está publicado. Só quem tem sessão iniciada no backoffice vê esta página.</div>' . "\n";
}
// Page content landmark — closed at the top of site/includes/footer.php, so
// every public page gets one <main> (and the skip link a real target).
echo '<main id="conteudo">' . "\n";