![]() Server : Apache/2 System : Linux server-15-235-50-60 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64 User : gositeme ( 1004) PHP Version : 8.2.29 Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname Directory : /home/gositeme/.cursor-server/data/User/History/15511605/ |
<?php
/**
* Shared Navbar Component
*/
if (!function_exists('getCurrentUser')) {
require_once __DIR__ . '/auth.php';
}
$currentUser = getCurrentUser();
$currentPage = basename($_SERVER['PHP_SELF'], '.php');
if (!isset($lang)) {
$lang = $_GET['lang'] ?? (isset($_COOKIE['lang']) ? $_COOKIE['lang'] : 'en');
}
?>
<nav class="navbar">
<div class="container">
<div class="nav-brand">
<a href="/">🌐 Free Village Network</a>
</div>
<div class="nav-links">
<a href="/commons" class="<?= $currentPage === 'commons' ? 'active' : '' ?>">The Commons</a>
<a href="/ledger" class="<?= $currentPage === 'ledger' ? 'active' : '' ?>">The Ledger</a>
<a href="/land" class="<?= $currentPage === 'land' ? 'active' : '' ?>">The Land</a>
<?php if (isLoggedIn()): ?>
<a href="/dashboard.php">Dashboard</a>
<a href="/profile.php"><?= htmlspecialchars($currentUser['display_name'] ?: $currentUser['username']) ?></a>
<a href="/logout.php">Logout</a>
<?php else: ?>
<a href="/login.php">Login</a>
<a href="/register.php" class="btn-outline">Register</a>
<?php endif; ?>
<div class="lang-switcher">
<a href="?lang=en<?= isset($_GET['page']) ? '&page=' . $_GET['page'] : '' ?>" class="<?= $lang === 'en' ? 'active' : '' ?>">EN</a>
<a href="?lang=fr<?= isset($_GET['page']) ? '&page=' . $_GET['page'] : '' ?>" class="<?= $lang === 'fr' ? 'active' : '' ?>">FR</a>
</div>
<div class="theme-switcher" id="themeSwitcher" title="Toggle theme">
<span class="theme-switcher-icon" id="themeIcon">🌙</span>
</div>
<script>
// Ensure theme switcher works
document.addEventListener('DOMContentLoaded', function() {
const switcher = document.getElementById('themeSwitcher');
if (switcher) {
switcher.addEventListener('click', function() {
if (window.toggleTheme) {
window.toggleTheme();
} else {
// Fallback
const current = document.documentElement.getAttribute('data-theme') || 'dark';
const newTheme = current === 'dark' ? 'light' : 'dark';
document.documentElement.setAttribute('data-theme', newTheme);
localStorage.setItem('theme', newTheme);
const icon = document.getElementById('themeIcon');
if (icon) icon.textContent = newTheme === 'light' ? '🌙' : '☀️';
}
});
}
});
</script>
</div>
</div>
</nav>