178 lines
9.0 KiB
PHP
178 lines
9.0 KiB
PHP
<?php
|
|
// This file assumes $pdo is available from init.php,
|
|
// and that an auth check has already been performed.
|
|
// It also assumes the $settings array and optionally $current_tab_data have been pre-loaded.
|
|
|
|
// Initialize variables with global settings as defaults
|
|
$theme = $settings['theme'] ?? 'light';
|
|
$bg_url = $settings['background_image_url'] ?? '';
|
|
$bg_brightness = $settings['background_brightness'] ?? '100';
|
|
$bg_saturation = $settings['background_saturation'] ?? '100';
|
|
$theme_transparency = $settings['theme_transparency'] ?? '85';
|
|
$custom_css = $settings['custom_css'] ?? '';
|
|
|
|
// --- Tab-Specific Override ---
|
|
// Overwrite the variables if a tab-specific setting is available.
|
|
if (isset($current_tab_data)) {
|
|
if (!empty($current_tab_data['theme'])) {
|
|
$theme = $current_tab_data['theme'];
|
|
}
|
|
if (isset($current_tab_data['theme_transparency']) && $current_tab_data['theme_transparency'] !== null) {
|
|
$theme_transparency = $current_tab_data['theme_transparency'];
|
|
}
|
|
// Background settings are only overridden if a URL is explicitly set for the tab.
|
|
if (!empty($current_tab_data['background_image_url'])) {
|
|
$bg_url = $current_tab_data['background_image_url'];
|
|
$bg_brightness = $current_tab_data['background_brightness'];
|
|
$bg_saturation = $current_tab_data['background_saturation'];
|
|
}
|
|
}
|
|
|
|
$body_classes = ['theme-' . htmlspecialchars($theme)];
|
|
if ($theme !== 'dark' && intval($bg_brightness) < 70) {
|
|
$body_classes[] = 'dark-background-active';
|
|
}
|
|
|
|
// Add any additional body classes from globals
|
|
if (isset($GLOBALS['body_class'])) {
|
|
$body_classes[] = $GLOBALS['body_class'];
|
|
}
|
|
|
|
$navbar_classes = ['navbar', 'navbar-expand-lg', 'mb-4'];
|
|
if (in_array('dark-background-active', $body_classes) || $theme === 'dark') {
|
|
$navbar_classes[] = 'navbar-dark';
|
|
} else {
|
|
$navbar_classes[] = 'navbar-light';
|
|
}
|
|
$data_bs_theme = 'light';
|
|
if ($theme === 'dark' || in_array('dark-background-active', $body_classes)) {
|
|
$data_bs_theme = 'dark';
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="<?php echo htmlspecialchars($language); ?>" data-bs-theme="<?php echo $data_bs_theme; ?>">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="robots" content="noindex, nofollow">
|
|
<title><?php echo htmlspecialchars($settings['site_title'] ?? 'Bookmarkly'); ?></title>
|
|
<link rel="icon" href="<?php echo htmlspecialchars($settings['site_favicon'] ?? $settings['site_logo'] ?? 'include/images/favicon.ico'); ?>">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.10.5/font/bootstrap-icons.css" rel="stylesheet">
|
|
<link href="include/css/style.css" rel="stylesheet">
|
|
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
|
|
<style>
|
|
:root {
|
|
--bg-brightness: <?php echo intval($bg_brightness); ?>%;
|
|
--bg-saturation: <?php echo intval($bg_saturation); ?>%;
|
|
--theme-transparency: <?php echo intval($theme_transparency) / 100; ?>;
|
|
}
|
|
body {
|
|
<?php if (!empty($bg_url)): ?>
|
|
background-image: url('<?php echo htmlspecialchars($bg_url); ?>');
|
|
background-size: cover;
|
|
background-position: center;
|
|
background-attachment: fixed;
|
|
<?php endif; ?>
|
|
}
|
|
body::before {
|
|
content: '';
|
|
position: fixed;
|
|
top: 0; left: 0;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
z-index: -1;
|
|
<?php if (!empty($bg_url)): ?>
|
|
backdrop-filter: brightness(var(--bg-brightness)) saturate(var(--bg-saturation));
|
|
<?php else: ?>
|
|
/* Apply a default background color if no image is set */
|
|
background-color: var(--bs-body-bg);
|
|
<?php endif; ?>
|
|
}
|
|
|
|
<?php if ($theme === 'transparent'): ?>
|
|
.card, .modal-content {
|
|
background-color: rgba(var(--bs-body-bg-rgb), var(--theme-transparency)) !important;
|
|
backdrop-filter: blur(10px);
|
|
}
|
|
<?php endif; ?>
|
|
<?php echo $custom_css; /* User-provided CSS, ensure sanitization if necessary elsewhere */ ?>
|
|
</style>
|
|
</head>
|
|
<body class="<?php echo implode(' ', $body_classes); ?>" data-favicon-service-url="<?php echo htmlspecialchars($settings['favicon_extractor_url']); ?>">
|
|
|
|
<header>
|
|
<nav class="navbar navbar-expand-lg">
|
|
<div class="container-fluid">
|
|
<!-- Left side: Logo/Brand -->
|
|
<div class="navbar-left">
|
|
<a class="navbar-brand" href="index.php">
|
|
<img src="<?php echo htmlspecialchars($settings['site_logo'] ?? 'include/images/favicon.ico'); ?>" alt="<?php echo htmlspecialchars($settings['site_title'] ?? 'Bookmarkly'); ?> Logo" height="<?php echo htmlspecialchars($settings['logo_height'] ?? '50'); ?>">
|
|
<?php if (($settings['display_site_title'] ?? '1') === '1'): ?>
|
|
<?php echo htmlspecialchars($settings['site_title'] ?? 'Bookmarkly'); ?>
|
|
<?php endif; ?>
|
|
</a>
|
|
</div>
|
|
|
|
<!-- Center: Search Bar -->
|
|
<div class="search-container-center">
|
|
<div class="input-group search">
|
|
<input type="text" class="form-control" id="searchInput" placeholder="<?php echo translate('index_search_placeholder'); ?>" autocomplete="off">
|
|
<button class="btn btn-outline-secondary" type="button" id="searchButton">
|
|
<i class="bi bi-search"></i>
|
|
</button>
|
|
<button class="btn btn-outline-secondary" type="button" id="searchEngineButton" title="Zoek op internet">
|
|
<i class="bi bi-globe"></i>
|
|
</button>
|
|
</div>
|
|
<div id="searchResults" class="search-results"></div>
|
|
</div>
|
|
|
|
<!-- Right side: Navigation -->
|
|
<div class="navbar-right">
|
|
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
|
|
<span class="navbar-toggler-icon"></span>
|
|
</button>
|
|
<div class="collapse navbar-collapse" id="navbarNav">
|
|
<ul class="navbar-nav ms-auto mb-2 mb-lg-0">
|
|
<?php if (isset($_SESSION['user_id'])): ?>
|
|
<?php if (isAdmin() || isUser()): ?>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="bookmarks.php"><i class="bi bi-bookmarks-fill"></i> <?php echo translate('nav_manage'); ?></a>
|
|
</li>
|
|
<?php endif; ?>
|
|
|
|
<?php if (isAdmin()): ?>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="tabs_settings.php"><i class="bi bi-folder"></i> <?php echo translate('nav_manage_tabs'); ?></a>
|
|
</li>
|
|
<?php endif; ?>
|
|
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="settings.php"><i class="bi bi-gear-fill"></i> <?php echo translate('nav_settings'); ?></a>
|
|
</li>
|
|
|
|
<li class="nav-item dropdown">
|
|
<a class="nav-link dropdown-toggle" href="#" id="navbarDropdown" role="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
<i class="bi bi-person-circle"></i> <?php echo htmlspecialchars($_SESSION['username']); ?>
|
|
</a>
|
|
<ul class="dropdown-menu dropdown-menu-end" aria-labelledby="navbarDropdown">
|
|
<li><a class="dropdown-item" href="profile.php">Change Password</a></li>
|
|
<?php if (isAdmin()): ?>
|
|
<li><a class="dropdown-item" href="user_settings.php">Manage Users</a></li>
|
|
<?php endif; ?>
|
|
<li><hr class="dropdown-divider"></li>
|
|
<li><a class="dropdown-item" href="logout.php"><i class="bi bi-box-arrow-right"></i> <?php echo translate('nav_logout'); ?></a></li>
|
|
</ul>
|
|
</li>
|
|
<?php else: ?>
|
|
<li class="nav-item">
|
|
<a class="nav-link" href="login.php"><i class="bi bi-box-arrow-in-right"></i> <?php echo translate('login_button'); ?></a>
|
|
</li>
|
|
<?php endif; ?>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|