churchtube/includes/header.php

71 lines
2.7 KiB
PHP

<?php
require_once __DIR__ . '/auth.php';
require_once __DIR__ . '/db.php';
require_once __DIR__ . '/settings_helper.php';
$site_title = get_setting('site_title', 'ChurchTube');
$primary_color = get_setting('primary_color', '#7c4dff');
$secondary_color = get_setting('secondary_color', '#ff4081');
$logo_url = get_setting('logo_url', '');
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title><?= htmlspecialchars($site_title) ?></title>
<link rel="stylesheet" href="assets/css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
<style>
:root {
--primary-color: <?= $primary_color ?>;
--secondary-color: <?= $secondary_color ?>;
}
@media (max-width: 600px) {
.logo {
font-size: 1.2rem !important;
max-width: 150px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
.search-bar {
display: none !important;
}
}
</style>
</head>
<body>
<header>
<a href="index.php" class="logo">
<?php if ($logo_url): ?>
<img src="<?= htmlspecialchars($logo_url) ?>" alt="Logo" style="height: 40px;">
<?php else: ?>
<?= htmlspecialchars($site_title) ?>
<?php endif; ?>
</a>
<form class="search-bar" action="index.php" method="GET">
<input type="text" name="q" placeholder="Search sermons..." value="<?= htmlspecialchars($_GET['q'] ?? '') ?>">
<button type="submit" style="background:none; border:none; color:white; cursor:pointer; padding: 0 10px;">
<i class="fas fa-search"></i>
</button>
</form>
<div class="user-actions" style="display: flex; gap: 16px; align-items: center;">
<?php if (isEditor()): ?>
<a href="admin/index.php" class="btn btn-primary" style="padding: 8px 16px; font-size: 0.9rem;">
<i class="fas fa-plus"></i> Admin
</a>
<?php endif; ?>
<?php if (isLoggedIn()): ?>
<span style="color: var(--text-muted);">Hi, <?= htmlspecialchars($_SESSION['username']) ?></span>
<a href="logout.php" title="Logout"><i class="fas fa-sign-out-alt"></i></a>
<?php else: ?>
<a href="login.php" class="btn btn-primary" style="padding: 8px 16px; font-size: 0.9rem;">Login</a>
<?php endif; ?>
</div>
</header>
<main style="min-height: calc(100vh - 64px);">