请查看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

+46 -42
View File
@@ -6,36 +6,36 @@
$P = '';
require_once __DIR__ . '/includes/layout.php';
$siteName = setting_get('site_name', '知识导航站');
$siteName = setting_get('site_name', 'SecHome');
$siteSlogan = setting_get('site_slogan', '');
$heroBg = setting_get('hero_bg', ''); // 后台自定义顶部背景(纯色 / CSS 渐变)
// 首页顶部组件模式:weather=天气(默认) / info=访客信息 / blank=空白精简
$heroMode = setting_get('hero_mode', 'weather');
if (!in_array($heroMode, ['weather', 'info', 'blank'], true)) {
$heroMode = 'weather';
$heroMode = 'weather';
}
$visitor = [];
if ($heroMode === 'info') {
$visitor = visitor_brief();
$visitor = visitor_brief();
}
$lastUpdated = setting_get('last_updated', '');
if ($lastUpdated === '') {
$lastUpdated = '暂无更新记录';
$lastUpdated = '暂无更新记录';
}
// 名言:服务端随机一条 + 全量池(供点击格言本身切换)
$quoteFile = DATA_DIR . '/quota.txt';
$quotes = [];
if (is_file($quoteFile)) {
$raw = @file($quoteFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if (is_array($raw)) {
foreach ($raw as $ln) {
$ln = trim($ln);
if ($ln !== '' && strpos($ln, '#') !== 0) {
$quotes[] = $ln;
}
}
$raw = @file($quoteFile, FILE_IGNORE_NEW_LINES | FILE_SKIP_EMPTY_LINES);
if (is_array($raw)) {
foreach ($raw as $ln) {
$ln = trim($ln);
if ($ln !== '' && strpos($ln, '#') !== 0) {
$quotes[] = $ln;
}
}
}
}
$quoteText = $quotes ? $quotes[array_rand($quotes)] : '知识就是力量。';
@@ -45,31 +45,32 @@ $cats = db()->query('SELECT * FROM categories ORDER BY sort ASC, id ASC')->fetch
$quickLinks = db()->query('SELECT * FROM quick_links WHERE enabled = 1 ORDER BY sort ASC, id ASC')->fetchAll();
$catLink = [
'popular' => 'nav.php?cat=popular',
'red' => 'nav.php?cat=red',
'blue' => 'nav.php?cat=blue',
'tool' => 'func/index.php',
'article' => 'article/index.php',
'popular' => 'nav.php?cat=popular',
'red' => 'nav.php?cat=red',
'blue' => 'nav.php?cat=blue',
'tool' => 'func/index.php',
'article' => 'article/index.php',
];
$catIcon = [
'popular' => '📖',
'red' => '⚔️',
'blue' => '🛡️',
'tool' => '🧰',
'article' => '📚',
'popular' => '📖',
'red' => '⚔️',
'blue' => '🛡️',
'tool' => '🧰',
'article' => '📚',
];
$catHint = [
'popular' => '入门·科普·前沿',
'red' => '攻防演练资源',
'blue' => '防御·应急·溯源',
'tool' => '进入功能区',
'article' => '进入文章库',
'popular' => '入门·科普·前沿',
'red' => '攻防演练资源',
'blue' => '防御·应急·溯源',
'tool' => '进入功能区',
'article' => '进入文章库',
];
layout_head('');
?>
<!-- Hero 顶部展示栏 -->
<header class="hero<?= $heroMode === 'blank' ? ' hero-slim' : '' ?>"<?php if ($heroBg !== ''): ?> style="background:<?= he($heroBg) ?>"<?php endif; ?>>
<header class="hero<?= $heroMode === 'blank' ? ' hero-slim' : '' ?>" <?php if ($heroBg !== ''): ?>
style="background:<?= he($heroBg) ?>" <?php endif; ?>>
<div class="wrap hero-inner">
<div class="hero-top">
<div class="brand">
@@ -89,16 +90,17 @@ layout_head('');
<?php if ($heroMode === 'weather'): ?>
<!-- 天气模式(默认):第三方天气条 -->
<div class="weather-box">
<iframe width="800" height="150" src="https://i.tianqi.com/?c=code&a=getcode&id=48&num=6&icon=1" frameborder="0"></iframe>
<iframe width="800" height="150" src="https://i.tianqi.com/?c=code&a=getcode&id=48&num=6&icon=1"
frameborder="0"></iframe>
</div>
<?php elseif ($heroMode === 'info'): ?>
<!-- 访客信息模式:IP / 浏览器 / 系统 / 内核 / 屏幕 / 语言 -->
<div class="visitor-box js-visitor-box">
<div class="vb-grid">
<div class="vb-cell"><span>访问者 IP</span><b><?= he((string)($visitor['ip'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>浏览器</span><b><?= he((string)($visitor['browser'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>操作系统</span><b><?= he((string)($visitor['os'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>内核 / 渲染引擎</span><b><?= he((string)($visitor['kernel'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>访问者 IP</span><b><?= he((string) ($visitor['ip'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>浏览器</span><b><?= he((string) ($visitor['browser'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>操作系统</span><b><?= he((string) ($visitor['os'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>内核 / 渲染引擎</span><b><?= he((string) ($visitor['kernel'] ?? '未知')) ?></b></div>
<div class="vb-cell"><span>屏幕分辨率</span><b class="js-vscreen">--</b></div>
<div class="vb-cell"><span>系统语言</span><b class="js-vlang">--</b></div>
</div>
@@ -127,14 +129,15 @@ layout_head('');
<?php if ($quickLinks): ?>
<div class="quick-strip">
<?php foreach ($quickLinks as $ql):
$qIcon = trim((string)($ql['icon'] ?? ''));
$qIcon = trim((string) ($ql['icon'] ?? ''));
$qIcon = $qIcon !== '' ? $qIcon : '🔗';
$qNote = trim((string)($ql['note'] ?? ''));
$qNote = trim((string) ($ql['note'] ?? ''));
?>
<a class="quick-tile" href="<?= he((string)$ql['url']) ?>" target="_blank" rel="noopener noreferrer" title="<?= he($qNote !== '' ? $qNote : (string)$ql['name']) ?>">
<a class="quick-tile" href="<?= he((string) $ql['url']) ?>" target="_blank" rel="noopener noreferrer"
title="<?= he($qNote !== '' ? $qNote : (string) $ql['name']) ?>">
<span class="q-tile-ic"><?= site_icon($qIcon, '') ?></span>
<span class="q-tile-b">
<b><?= he((string)$ql['name']) ?></b>
<b><?= he((string) $ql['name']) ?></b>
<?php if ($qNote !== ''): ?><small><?= he($qNote) ?></small><?php endif; ?>
</span>
</a>
@@ -143,13 +146,13 @@ layout_head('');
<?php endif; ?>
<div class="boards">
<?php foreach ($cats as $c):
$k = (string)$c['key'];
$k = (string) $c['key'];
$href = $catLink[$k] ?? 'index.php';
$bIcon = trim((string)($c['icon'] ?? ''));
$bIcon = trim((string) ($c['icon'] ?? ''));
$bIcon = $bIcon !== '' ? $bIcon : ($catIcon[$k] ?? '●');
$descTxt = trim((string)($c['description'] ?? ''));
$descTxt = trim((string) ($c['description'] ?? ''));
if ($descTxt === '') {
$descTxt = $catHint[$k] ?? '';
$descTxt = $catHint[$k] ?? '';
}
?>
<a class="board-card" href="<?= he($href) ?>" title="<?= he($c['name']) ?>:<?= he($descTxt) ?>">
@@ -168,4 +171,5 @@ layout_head('');
<script src="assets/js/common.js"></script>
</body>
</html>
</html>