First Commit

This commit is contained in:
2026-08-19 17:26:06 +01:00
parent f782c6f531
commit 121f788c28
25 changed files with 5132 additions and 73 deletions
+115 -11
View File
@@ -1,20 +1,124 @@
<?php
// Handle quick language switch if requested
if (isset($_GET['set_lang'])) {
set_active_lang($_GET['set_lang']);
$redirect_url = strtok($_SERVER["REQUEST_URI"], '?');
$get_params = $_GET;
unset($get_params['set_lang']);
if (!empty($get_params)) {
$redirect_url .= '?' . http_build_query($get_params);
}
header("Location: " . $redirect_url);
exit;
}
$current_lang = get_current_lang();
$site_title = get_site_setting('site_title', 'Blocknotes');
$site_favicon = get_site_setting('site_favicon', 'assets/img/favicon.png');
?>
<!DOCTYPE html>
<html lang="en">
<html lang="<?= htmlspecialchars($current_lang) ?>">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" href="<?= htmlspecialchars($site_favicon) ?>">
<?php include(INCLUDES_FOLD . "head_links.php"); ?>
<title><?php echo ucfirst($GLOBALS["current_page"] ?? "Home"); ?></title>
<?php
// Inject dynamic HSL theme colors from session if set
$user = current_user();
$pri = $user['theme_pri'] ?? 98;
$sec = $user['theme_sec'] ?? 207;
$thi = $user['theme_thi'] ?? 280;
?>
<style id="dynamic-theme-vars">
:root {
--pri: <?= (int)$pri ?>;
--sec: <?= (int)$sec ?>;
--thi: <?= (int)$thi ?>;
}
</style>
<title><?php
$cp = $GLOBALS["current_page"] ?? "home";
if ($cp === 'home') echo __('dashboard_title_user');
elseif ($cp === 'view_blocknote') echo __('nav_blocknotes');
elseif ($cp === 'profile') echo __('profile_title');
elseif ($cp === 'admin_users') echo __('admin_title');
elseif ($cp === 'login') echo __('nav_login');
else echo ucfirst($cp);
?> - <?= htmlspecialchars($site_title) ?></title>
</head>
<body>
<div id="debug-target-container"></div>
<header>
<ul class="main-nav">
<li><a href="#">Home</a></li>
<li><a href="#">Page1</a></li>
<li><a href="#">Page2</a></li>
<li><a href="#">Page3</a></li>
<li><a href="#">Page4</a></li>
</ul>
</header>
<header class="navbar-header">
<div class="nav-container">
<a href="index.php?page=home&view=all" class="brand-logo">
<?php if (!empty($site_favicon) && file_exists(ROOT_DIR . $site_favicon)): ?>
<img src="<?= htmlspecialchars($site_favicon) ?>" alt="Favicon" style="width:28px; height:28px; object-fit:contain; border-radius:4px;">
<?php else: ?>
<span class="logo-icon">📝</span>
<?php endif; ?>
<span class="logo-text"><?= htmlspecialchars($site_title) ?></span>
</a>
<nav>
<ul class="main-nav">
<?php if (is_logged_in()): ?>
<li>
<a href="index.php?page=home&view=all" class="<?= ($cp === 'home' || $cp === 'view_blocknote') ? 'active' : '' ?>">
<?= __('nav_blocknotes') ?>
</a>
</li>
<li>
<a href="index.php?page=profile" class="<?= ($cp === 'profile') ? 'active' : '' ?>">
<?= __('nav_colors_profile') ?>
</a>
</li>
<?php if (is_admin()): ?>
<li class="admin-nav-item">
<a href="index.php?page=admin_users" class="admin-link <?= ($cp === 'admin_users') ? 'active' : '' ?>">
<?= __('nav_admin') ?>
</a>
</li>
<?php endif; ?>
<li class="user-meta-item">
<?php if (is_owner()): ?>
<span class="user-badge badge-owner" style="background: rgba(234, 179, 8, 0.25); border-color: rgba(234, 179, 8, 0.5); color: #fde047; box-shadow: 0 0 10px rgba(234,179,8,0.3);">
👑 <?= htmlspecialchars($user['username']) ?> (<?= __('badge_owner') ?>)
</span>
<?php else: ?>
<span class="user-badge <?= is_admin() ? 'badge-admin' : 'badge-user' ?>">
👤 <?= htmlspecialchars($user['username']) ?> (<?= is_admin() ? 'Admin' : 'User' ?>)
</span>
<?php endif; ?>
</li>
<!-- Language Quick Selector -->
<li class="lang-selector-item">
<select onchange="location.href=this.value;" style="background: rgba(0,0,0,0.3); color: #fff; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 0.3rem 0.5rem; font-size: 0.82rem; cursor: pointer;">
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'it'])) ?>" <?= ($current_lang === 'it') ? 'selected' : '' ?>>🇮🇹 IT</option>
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'en'])) ?>" <?= ($current_lang === 'en') ? 'selected' : '' ?>>🇬🇧 EN</option>
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'es'])) ?>" <?= ($current_lang === 'es') ? 'selected' : '' ?>>🇪🇸 ES</option>
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'fr'])) ?>" <?= ($current_lang === 'fr') ? 'selected' : '' ?>>🇫🇷 FR</option>
</select>
</li>
<li><a href="index.php?page=logout" class="nav-logout-btn"><?= __('nav_logout') ?></a></li>
<?php else: ?>
<!-- Guest Language Quick Selector -->
<li class="lang-selector-item">
<select onchange="location.href=this.value;" style="background: rgba(0,0,0,0.3); color: #fff; border: 1px solid rgba(255,255,255,0.15); border-radius: 6px; padding: 0.3rem 0.5rem; font-size: 0.82rem; cursor: pointer;">
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'it'])) ?>" <?= ($current_lang === 'it') ? 'selected' : '' ?>>🇮🇹 IT</option>
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'en'])) ?>" <?= ($current_lang === 'en') ? 'selected' : '' ?>>🇬🇧 EN</option>
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'es'])) ?>" <?= ($current_lang === 'es') ? 'selected' : '' ?>>🇪🇸 ES</option>
<option value="index.php?<?= http_build_query(array_merge($_GET, ['set_lang' => 'fr'])) ?>" <?= ($current_lang === 'fr') ? 'selected' : '' ?>>🇫🇷 FR</option>
</select>
</li>
<li><a href="index.php?page=login" class="active"><?= __('nav_login') ?></a></li>
<?php endif; ?>
</ul>
</nav>
</div>
</header>
<div class="main-wrapper">