- Move 374-line inline style block from login.php into assets/style.css (Phase 2 section) - Add auth-page, auth-card, auth-tabs, auth-form, profile-shell and related classes to the main stylesheet as the single source of truth for all styles - Fix Firebase v10 compat SDK error code: auth/invalid-credential now handled alongside legacy auth/wrong-password and auth/user-not-found codes - Harden api/session.php: add Content-Type JSON header, email format validation, and a full security documentation comment explaining the token trust model - Add FOUC comment to partials/head.php clarifying dark-only design intent
90 lines
3.8 KiB
PHP
90 lines
3.8 KiB
PHP
<?php
|
|
$pageTitle = $pageTitle ?? 'FlixCooks | Food Blog & Recipes';
|
|
$description = $description ?? 'Seasonal recipes, tested tips, and approachable cooking for busy weeknights.';
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<meta name="description" content="<?php echo e($description); ?>">
|
|
<title><?php echo e($pageTitle); ?></title>
|
|
<link rel="icon" type="image/png" href="/assets/favicon.png">
|
|
<link rel="alternate icon" type="image/x-icon" sizes="16x16 32x32" href="/favicon.ico">
|
|
|
|
<!-- Google Fonts: Playfair Display + Manrope -->
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Playfair+Display:ital,wght@0,400;0,500;0,600;0,700;1,400;1,500;1,600;1,700&family=Manrope:wght@300;400;500;600;700;800&display=swap" rel="stylesheet">
|
|
|
|
<!-- Main stylesheet -->
|
|
<link rel="stylesheet" href="/assets/style.css">
|
|
|
|
<!-- Firebase v10 compat SDKs -->
|
|
<script src="https://www.gstatic.com/firebasejs/10.8.0/firebase-app-compat.js"></script>
|
|
<script src="https://www.gstatic.com/firebasejs/10.8.0/firebase-auth-compat.js"></script>
|
|
<script src="https://www.gstatic.com/firebasejs/10.8.0/firebase-firestore-compat.js"></script>
|
|
<script>
|
|
(function() {
|
|
var config = <?php echo json_encode(get_firebase_config()); ?>;
|
|
firebase.initializeApp(config);
|
|
window.auth = firebase.auth();
|
|
window.db = firebase.firestore();
|
|
|
|
// Auto-sync PHP Session with Firebase Auth State
|
|
window.auth.onAuthStateChanged(function(user) {
|
|
var phpUser = <?php echo isset($_SESSION['fc_user']) ? json_encode($_SESSION['fc_user']) : 'null'; ?>;
|
|
if (user) {
|
|
if (!phpUser || phpUser.uid !== user.uid) {
|
|
user.getIdToken().then(function(token) {
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open('POST', '/api/session.php', true);
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
xhr.send('action=login&uid=' + encodeURIComponent(user.uid) + '&email=' + encodeURIComponent(user.email) + '&token=' + encodeURIComponent(token));
|
|
xhr.onload = function() {
|
|
if (xhr.status === 200) {
|
|
if (!phpUser) { window.location.reload(); }
|
|
}
|
|
};
|
|
});
|
|
}
|
|
} else {
|
|
if (phpUser) {
|
|
var xhr = new XMLHttpRequest();
|
|
xhr.open('POST', '/api/session.php', true);
|
|
xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
|
|
xhr.send('action=logout');
|
|
xhr.onload = function() {
|
|
window.location.reload();
|
|
};
|
|
}
|
|
}
|
|
});
|
|
})();
|
|
</script>
|
|
|
|
<!-- GSAP + ScrollTrigger (CDN) -->
|
|
<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/gsap.min.js"></script>
|
|
<script src="https://cdn.jsdelivr.net/npm/gsap@3.12.5/dist/ScrollTrigger.min.js"></script>
|
|
|
|
<!-- Lenis smooth scroll (CDN) -->
|
|
<script src="https://cdn.jsdelivr.net/npm/@studio-freight/lenis@1.0.42/bundled/lenis.min.js"></script>
|
|
|
|
<!-- Set theme instantly before paint to avoid FOUC (flash of unstyled content).
|
|
FlixCooks is a dark-only design by choice — no light mode is offered.
|
|
The theme attribute and localStorage flag are set unconditionally here. -->
|
|
<script>
|
|
(function(){
|
|
document.documentElement.setAttribute('data-theme', 'dark');
|
|
localStorage.setItem('fc-theme', 'dark');
|
|
})();
|
|
</script>
|
|
</head>
|
|
<body>
|
|
|
|
<!-- ── AuraMarbleBackground (fixed atmospheric grain layer) ── -->
|
|
<div class="bg-marble-container" aria-hidden="true">
|
|
<div class="bg-marble-grain"></div>
|
|
</div>
|
|
|