feat(site): root opens the main gym; other gyms as navbar buttons
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
aa55d44406
commit
716eec9f6d
4 files changed
+45
-4
No files matched your search
+5
-3
@@ -5,13 +5,15 @@ $current_uri_2 = '';
|
||||
|
||||
// No gym in the URL (/, /home, old links): send people to a gym page. With a
|
||||
// single published gym that is a 301 to it (query string kept, e.g.
|
||||
// ?agendar=ok); with more, the gym chooser.
|
||||
// ?agendar=ok); with more, the main (default) gym — the others are reached
|
||||
// from the navbar's «Ginásios» menu.
|
||||
if (($_GET['gym'] ?? '') === '') {
|
||||
require_once __DIR__ . '/../config/db.php';
|
||||
require_once __DIR__ . '/../config/functions.php';
|
||||
$published = db_gyms_published($pdo);
|
||||
if (count($published) > 1) { require __DIR__ . '/gym_chooser.php'; exit; }
|
||||
$to = $published[0] ?? db_gyms_default($pdo) ?? gym_fallback();
|
||||
$main = null;
|
||||
foreach ($published as $g) { if ((int) ($g['is_default'] ?? 0) === 1) { $main = $g; break; } }
|
||||
$to = $main ?? $published[0] ?? db_gyms_default($pdo) ?? gym_fallback();
|
||||
$qs = $_SERVER['QUERY_STRING'] ?? '';
|
||||
header('Location: ' . gym_url($to) . ($qs !== '' ? '?' . $qs : ''), true, 301);
|
||||
exit;
|
||||
|
||||
Reference in new issue
Block a user