2026-09-30 00:49:53 +08:00
|
|
|
|
<?php
|
|
|
|
|
|
$navItems = [
|
|
|
|
|
|
'home' => ['首页', 'home'],
|
2026-09-30 08:13:07 +08:00
|
|
|
|
'kin' => ['家谱', 'kin'],
|
2026-09-30 00:49:53 +08:00
|
|
|
|
'people' => ['名册', 'people'],
|
|
|
|
|
|
];
|
|
|
|
|
|
if (\App\Auth::isAdmin()) {
|
|
|
|
|
|
$navItems['settings'] = ['设置', 'settings'];
|
|
|
|
|
|
}
|
2026-09-30 08:13:07 +08:00
|
|
|
|
// ⚠️ 变量名不要叫 $me:layout 是在 extract($data) **之后**被 require 的,
|
|
|
|
|
|
// 这里再赋值会把页面传进来的 $me(当前登录者的完整记录)覆盖掉。
|
|
|
|
|
|
// home.php 用 $me 画「补充亲属关系」链接,被覆盖成 true 之后
|
|
|
|
|
|
// 链接就变成 people/show&id=0,还顺带在页首打出一条 Warning。
|
|
|
|
|
|
// 改名前请先确认所有模板都没有依赖这个布尔值。
|
|
|
|
|
|
$isLoggedIn = \App\Auth::check();
|
2026-09-30 00:49:53 +08:00
|
|
|
|
?>
|
|
|
|
|
|
<!DOCTYPE html>
|
|
|
|
|
|
<html lang="zh-CN">
|
|
|
|
|
|
<head>
|
|
|
|
|
|
<meta charset="utf-8">
|
|
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
|
|
|
|
<title><?= e($pageTitle) ?> · 家书</title>
|
|
|
|
|
|
<link rel="icon" href="/favicon.ico">
|
|
|
|
|
|
<link rel="apple-touch-icon" href="/apple-touch-icon.png">
|
|
|
|
|
|
<link rel="manifest" href="/site.webmanifest">
|
|
|
|
|
|
<meta name="theme-color" content="#A84A28">
|
|
|
|
|
|
<link rel="stylesheet" href="<?= e(asset('/assets/css/app.css')) ?>">
|
|
|
|
|
|
</head>
|
|
|
|
|
|
<body>
|
|
|
|
|
|
|
2026-09-30 08:13:07 +08:00
|
|
|
|
<?php if ($isLoggedIn): ?>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<header class="topbar">
|
|
|
|
|
|
<div class="topbar-inner">
|
|
|
|
|
|
<a class="brand" href="<?= e(url('home')) ?>">
|
|
|
|
|
|
<img src="<?= e(asset('/assets/icons/icon-96.png')) ?>" alt="">
|
|
|
|
|
|
<span>家书</span>
|
|
|
|
|
|
</a>
|
|
|
|
|
|
<nav class="nav">
|
|
|
|
|
|
<?php foreach ($navItems as $route => list($label, $key)): ?>
|
|
|
|
|
|
<a class="<?= $pageKey === $key ? 'on' : '' ?>" href="<?= e(url($route)) ?>"><?= e($label) ?></a>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
</nav>
|
|
|
|
|
|
<div class="topbar-right">
|
2026-09-30 09:44:55 +08:00
|
|
|
|
<?php /* 点自己的头像/名字 = 直接编辑自己的资料。
|
|
|
|
|
|
⚠️ 以前这里是个不可点的 <span>:想改自己的信息得绕
|
|
|
|
|
|
「名册 → 找到自己 → 编辑资料」三步,而最该一眼可达的
|
|
|
|
|
|
恰恰是「改我自己」这件事。 */ ?>
|
|
|
|
|
|
<a class="who" href="<?= e(url('people/me')) ?>" title="改我自己的资料">
|
2026-09-30 08:13:07 +08:00
|
|
|
|
<img src="<?= e(avatar_url($_SESSION['avatar'] ?? null)) ?>" alt="">
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<span class="who-name"><?= e(\App\Auth::name()) ?></span>
|
2026-09-30 08:13:07 +08:00
|
|
|
|
<?php if (\App\Auth::isGuest()): ?><span class="badge">访客</span><?php endif; ?>
|
2026-09-30 09:44:55 +08:00
|
|
|
|
</a>
|
2026-09-30 00:49:53 +08:00
|
|
|
|
<a class="link-quiet who-pwd" href="<?= e(url('auth/password')) ?>">改密码</a>
|
|
|
|
|
|
<a class="link-quiet" href="<?= e(url('auth/logout', ['_csrf' => csrf_token()])) ?>">退出</a>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
</header>
|
|
|
|
|
|
<?php endif; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<main class="<?= in_array($pageKey, ['install', 'login'], true) ? 'container-narrow' : 'container' ?>">
|
|
|
|
|
|
|
|
|
|
|
|
<?php foreach (take_flash() as $f): ?>
|
|
|
|
|
|
<div class="flash">
|
|
|
|
|
|
<div class="flash-item <?= $f['type'] === 'err' ? 'err' : '' ?>"><?= e($f['message']) ?></div>
|
|
|
|
|
|
</div>
|
|
|
|
|
|
<?php endforeach; ?>
|
|
|
|
|
|
|
|
|
|
|
|
<?php require $tplFile; ?>
|
|
|
|
|
|
|
|
|
|
|
|
</main>
|
|
|
|
|
|
|
|
|
|
|
|
<script src="<?= e(asset('/assets/js/app.js')) ?>"></script>
|
|
|
|
|
|
</body>
|
|
|
|
|
|
</html>
|