请查看CHANGELOG.md获取更新信息

This commit is contained in:
MasonLiu committed 2026-09-13 00:54:16 +08:00
1 parent bf772046cc
commit 9bb6e6a41e
18 files changed
+879 -105

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
<?php
/**
* notice.php —— 更新公告(前台展示页)
* 数据来自 notices 表,由后台「更新公告管理」(admin/notice.php)维护;
* 展示每条公告的发布时间与最后修改时间,内容支持超链接与换行。
*/
$P = '';
require_once __DIR__ . '/includes/layout.php';
$pdo = db();
// 置顶优先;其余按发布时间倒序(旧公告保留、顺次展示)
$notices = $pdo->query('SELECT * FROM notices WHERE enabled = 1 ORDER BY pinned DESC, created_at DESC, id DESC')->fetchAll();
layout_head('更新公告');
?>
<div class="func-bar">
<div class="wrap func-bar-inner">
<a class="btn btn-sm" href="index.php" title="返回首页">← 返回首页</a>
<span class="func-bar-title">更新公告</span>
<span class="spacer"></span>
</div>
</div>
<main class="page-main">
<div class="wrap page-body">
<?php if (!$notices): ?>
<div class="panel-card">
<p class="tip" style="margin:0">暂无更新公告。</p>
</div>
<?php else: ?>
<?php foreach ($notices as $n): ?>
<?php
$title = trim((string) $n['title']);
$created = (string) $n['created_at'];
$updated = (string) $n['updated_at'];
?>
<div class="notice-item">
<h2 class="notice-title">
<?php if ((int) $n['pinned'] === 1): ?><span class="badge badge-ok">置顶</span><?php endif; ?>
<?= $title !== '' ? he($title) : '公告' ?>
</h2>
<div class="notice-meta">
<?php if ($created !== ''): ?><span>发布时间:<?= he($created) ?></span><?php endif; ?>
<?php if ($updated !== ''): ?>
<span>最后修改:<?= he($updated) ?><?= ($updated === $created) ? '(未修改)' : '' ?></span>
<?php endif; ?>
</div>
<div class="notice-body"><?= notice_html((string) $n['content']) ?></div>
</div>
<?php endforeach; ?>
<?php endif; ?>
</div>
</main>
<?php layout_theme_fab(); ?>
<script src="assets/js/common.js"></script>
</body>
</html>