仰望星辰工作室

better-staridc-MNBT

Z zfhsh first commit 2 个月前
1<?php mnbt_admin_include('head'); ?>
2<?php header("Cache-Control: no-cache, must-revalidate"); ?>
3<script type="text/javascript" src="<?=mnbt_asset_url('js/md5.js')?>"></script>
4<script type="text/javascript" src="<?=mnbt_asset_url('js/xtset.js')?>?hc=<? echo $date?>"></script>
5<link rel="stylesheet" href="<?=mnbt_theme_asset('set-page.css', 'admin')?>">
6
7<div class="mn-set-page">
8<?php
9$set = isset($_GET['gn']) ? $_GET['gn'] : null;
10if ($set == 'wz') {
11?>
12<div class="mn-set-card">
13 <div class="mn-set-card-hd">
14 <div class="mn-set-icon"><i class="mdi mdi-earth"></i></div>
15 <div>
16 <h4>网站配置</h4>
17 <p>公告、联系方式与登录安全</p>
18 </div>
19 </div>
20 <div class="mn-set-card-bd">
21 <div class="mn-set-field">
22 <label for="wzgg">网站公告</label>
23 <textarea name="wzgg" rows="8" id="wzgg" class="form-control" placeholder="请在这填写网站公告"><?php echo $conf['gg']; ?></textarea>
24 </div>
25 <div class="mn-set-field">
26 <label for="qq">站长 QQ</label>
27 <input type="text" name="qq" id="qq" value="<?php echo $conf['qqh']; ?>" class="form-control" placeholder="请在这填写您的QQ号" required/>
28 </div>
29 <div class="mn-set-field">
30 <div class="mn-set-switch">
31 <div class="mn-set-switch-txt">
32 <strong>后台登录验证码</strong>
33 <span>开启后管理员登录需填写验证码</span>
34 </div>
35 <div class="custom-control custom-switch">
36 <input type="checkbox" class="custom-control-input" id="yzmkg" <?php if ($conf['yzm'] == 'true') echo 'checked'; ?>>
37 <label class="custom-control-label" for="yzmkg"></label>
38 </div>
39 </div>
40 <div class="mn-set-switch">
41 <div class="mn-set-switch-txt">
42 <strong>主机邮箱绑定</strong>
43 <span>要求用户绑定邮箱后方可使用部分功能</span>
44 </div>
45 <div class="custom-control custom-switch">
46 <input type="checkbox" class="custom-control-input" id="zjyxbd" <?php if ($conf['zjyxbd'] == 'true') echo 'checked'; ?>>
47 <label class="custom-control-label" for="zjyxbd"></label>
48 </div>
49 </div>
50 </div>
51 <div class="mn-set-actions">
52 <button class="btn btn-primary btn-block" type="button" onclick="setwz()"><i class="mdi mdi-content-save-outline"></i> 保存修改</button>
53 </div>
54 </div>
55</div>
56
57<?php } elseif ($set == 'api') { ?>
58<div class="mn-set-card">
59 <div class="mn-set-card-hd">
60 <div class="mn-set-icon"><i class="mdi mdi-key-variant"></i></div>
61 <div>
62 <h4>API 设置</h4>
63 <p>接口密钥、默认 PHP 与建站目录</p>
64 </div>
65 </div>
66 <div class="mn-set-card-bd">
67 <div class="mn-set-field">
68 <label for="apimy">API 密钥</label>
69 <div class="input-group mn-set-input-group">
70 <input type="text" class="form-control" name="apimy" id="apimy" value="<?php echo $conf['api']; ?>" placeholder="API密钥(推荐随机生成)"/>
71 <div class="input-group-append"><button class="btn btn-outline-secondary" type="button" onclick="apisc()">随机生成</button></div>
72 </div>
73 </div>
74 <div class="mn-set-field">
75 <label for="linuxml">Linux 建站目录</label>
76 <input type="text" name="linuxml" id="linuxml" value="<?php echo $conf['hxi']; ?>" class="form-control" placeholder="Linux宝塔面板的建站目录" required/>
77 <small>默认 /www/wwwroot</small>
78 </div>
79 <div class="mn-set-field">
80 <label for="winml">Windows 建站目录</label>
81 <input type="text" name="winml" id="winml" value="<?php echo $conf['hxo']; ?>" class="form-control" placeholder="Windows宝塔面板的建站目录" required/>
82 <small>默认 D:/wwwroot</small>
83 </div>
84 <div class="mn-set-field">
85 <div class="mn-set-switch">
86 <div class="mn-set-switch-txt">
87 <strong>API 接口开关</strong>
88 <span>关闭后外部系统将无法调用接口</span>
89 </div>
90 <div class="custom-control custom-switch">
91 <input type="checkbox" class="custom-control-input" id="apikg" <?php if ($conf['apiqk'] == 'true') echo 'checked'; ?>>
92 <label class="custom-control-label" for="apikg"></label>
93 </div>
94 </div>
95 </div>
96 <div class="mn-set-field">
97 <label for="apicompat">对外 API 协议模式</label>
98 <select class="form-control" id="apicompat" name="apicompat" size="1">
99 <option value="0" <?php if ((string)($conf['api_compat'] ?? '0') !== '1') echo 'selected'; ?>>新版协议(1.83+,默认)</option>
100 <option value="1" <?php if ((string)($conf['api_compat'] ?? '0') === '1') echo 'selected'; ?>>兼容 1.81 对接模块</option>
101 </select>
102 <small>兼容模式仅还原 1.81 老协议的行为约束(跨节点校验、站点名规则等),供未升级对接模块的老客户过渡使用。</small>
103 </div>
104 <div class="mn-set-actions">
105 <button class="btn btn-primary btn-block" type="button" onclick="setapi()"><i class="mdi mdi-content-save-outline"></i> 保存修改</button>
106 <button class="btn btn-outline-secondary btn-block" type="button" onclick="setapicompat()"><i class="mdi mdi-swap-vertical"></i> 保存协议模式</button>
107 </div>
108 <div class="mn-set-note">
109 <b>注意:</b>建站目录请勿随意修改,已开通主机可能受影响。API 密钥修改后,监控 URL 与外部对接均需同步更新。默认 PHP 版本需在宝塔软件商店中已安装。兼容模式只是过渡期方案,建议尽快升级对接模块(WordPress 销售插件 / 魔方财务 server module)后切回新版协议。
110 </div>
111 </div>
112</div>
113<script>
114// 协议模式独立提交:xtset.js 的 setapi() 不感知该字段,为避免公共 JS 扩散改动单独走 setapicompat
115function setapicompat() {
116 msloading('正在修改中!请稍后...','text-info','text-info');
117 let data = {};
118 data['gn'] = 'setapicompat';
119 data['api_compat'] = document.getElementById('apicompat').value;
120 $.post('./ajax.php', data, function (date) {
121 var jsoe = JSON.parse(date);
122 var qk = jsoe.code;
123 if (qk == '修改成功') {
124 msalert(1, '协议模式已保存!', 2000);
125 } else {
126 msalert(4, qk, 2000);
127 }
128 msloadingde();
129 });
130}
131</script>
132
133<?php } elseif ($set == 'kzmb') { ?>
134<div class="mn-set-card">
135 <div class="mn-set-card-hd">
136 <div class="mn-set-icon"><i class="mdi mdi-view-dashboard-outline"></i></div>
137 <div>
138 <h4>控制面板</h4>
139 <p>名称、FTP 面板、Logo 与开关</p>
140 </div>
141 </div>
142 <div class="mn-set-card-bd">
143 <div class="mn-set-field">
144 <label for="kzmbname">控制面板名称</label>
145 <input type="text" name="kzmbname" id="kzmbname" value="<?php echo $conf['name']; ?>" class="form-control" placeholder="请在这填写控制面板的名称" required/>
146 </div>
147 <div class="mn-set-field">
148 <label for="ftp">FTP 操作面板</label>
149 <select class="form-control" id="ftp" name="ftp" size="1">
150 <?php
151 $acd = '';
152 $acd2 = '';
153 if ($conf['hxw'] == '' || $conf['hxw'] == 'amftp') {
154 $acd = 'selected';
155 } else {
156 $acd2 = 'selected';
157 }
158 echo '
159 <option value="amftp" ' . $acd . '>AMFTP 操作面板</option>
160 <option value="mnftp" ' . $acd2 . '>MN 操作面板(推荐)</option>
161 ';
162 ?>
163 </select>
164 </div>
165 <div class="mn-set-field">
166 <label for="bq">显示版权</label>
167 <input type="text" name="bq" id="bq" value="<?php echo htmlspecialchars($conf['hxp']); ?>" class="form-control" placeholder="可以使用HTML标签" required/>
168 <small>例如:Copyright © 梦奈云 2026</small>
169 </div>
170 <div class="mn-set-field">
171 <label for="logoa">登录页 Logo</label>
172 <div class="custom-file">
173 <input type="file" name="logoa" id="logoa" class="custom-file-input">
174 <label class="custom-file-label" for="logoa">选择文件…</label>
175 </div>
176 </div>
177 <div class="mn-set-field">
178 <label for="logob">侧栏 Logo</label>
179 <div class="custom-file">
180 <input type="file" name="logob" id="logob" class="custom-file-input">
181 <label class="custom-file-label" for="logob">选择文件…</label>
182 </div>
183 </div>
184 <div class="mn-set-field">
185 <label for="logoc">用户头像 Logo</label>
186 <div class="custom-file">
187 <input type="file" name="logoc" id="logoc" class="custom-file-input">
188 <label class="custom-file-label" for="logoc">选择文件…</label>
189 </div>
190 </div>
191 <div class="mn-set-field">
192 <div class="mn-set-switch">
193 <div class="mn-set-switch-txt">
194 <strong>用户登录验证码</strong>
195 <span>控制面板登录是否需要验证码</span>
196 </div>
197 <div class="custom-control custom-switch">
198 <input type="checkbox" class="custom-control-input" id="yzmkzmb" <?php if ($conf['yzme'] == 'true') echo 'checked'; ?>>
199 <label class="custom-control-label" for="yzmkzmb"></label>
200 </div>
201 </div>
202 <div class="mn-set-switch">
203 <div class="mn-set-switch-txt">
204 <strong>控制面板开关</strong>
205 <span>关闭后用户无法进入控制面板</span>
206 </div>
207 <div class="custom-control custom-switch">
208 <input type="checkbox" class="custom-control-input" id="kzmbkg" <?php if ($conf['kzmbqk'] == 'true') echo 'checked'; ?>>
209 <label class="custom-control-label" for="kzmbkg"></label>
210 </div>
211 </div>
212 </div>
213 <div class="mn-set-actions">
214 <button class="btn btn-primary btn-block" type="button" onclick="setkzmb()"><i class="mdi mdi-content-save-outline"></i> 保存修改</button>
215 </div>
216 <div class="mn-set-note">
217 AMFTP 仅支持本机宝塔;MN 面板支持本地与远程。不上传 Logo 则沿用原图。上传后请清理浏览器/CDN 缓存。
218 </div>
219 </div>
220</div>
221
222<?php } elseif ($set == 'gl') { ?>
223<div class="mn-set-card">
224 <div class="mn-set-card-hd">
225 <div class="mn-set-icon"><i class="mdi mdi-account-key"></i></div>
226 <div>
227 <h4>管理账号</h4>
228 <p>修改后台登录账号与密码</p>
229 </div>
230 </div>
231 <div class="mn-set-card-bd">
232 <div class="mn-set-field">
233 <label for="ysuser">原账号</label>
234 <input type="text" name="ysuser" id="ysuser" class="form-control" placeholder="原来的账号" required/>
235 </div>
236 <div class="mn-set-field">
237 <label for="yspass">原密码</label>
238 <input type="password" name="yspass" id="yspass" class="form-control" placeholder="原来的密码" required/>
239 </div>
240 <div class="mn-set-field">
241 <label for="huser">新账号</label>
242 <input type="text" name="huser" id="huser" placeholder="不修改请留空" class="form-control"/>
243 </div>
244 <div class="mn-set-field">
245 <label for="hpass">新密码</label>
246 <input type="password" name="hpass" id="hpass" placeholder="不修改请留空" class="form-control"/>
247 </div>
248 <div class="mn-set-actions">
249 <button class="btn btn-primary btn-block" type="button" onclick="setgl()"><i class="mdi mdi-content-save-outline"></i> 保存修改</button>
250 </div>
251 </div>
252</div>
253
254<?php } elseif ($set == 'yzf') { ?>
255<div class="mn-set-card">
256 <div class="mn-set-card-hd">
257 <div class="mn-set-icon"><i class="mdi mdi-credit-card-outline"></i></div>
258 <div>
259 <h4>支付配置已迁移</h4>
260 <p>支付设置已改为插件化架构</p>
261 </div>
262 </div>
263 <div class="mn-set-card-bd">
264 <div class="mn-set-note">
265 自 V1.81 P3 起,支付方式改由<b>支付插件</b>提供。请前往 <a href="pay_settings.php" class="alert-link">支付设置</a> 页面启用付款方式,并在 <a href="plugin.php" class="alert-link">插件管理</a> 中配置各支付插件的 API 凭证。
266 </div>
267 <div class="mn-set-actions">
268 <a href="pay_settings.php" class="btn btn-primary btn-block"><i class="mdi mdi-arrow-right"></i> 前往支付设置</a>
269 </div>
270 </div>
271</div>
272
273<?php } elseif ($set == 'mail') { ?>
274<div class="mn-set-card">
275 <div class="mn-set-card-hd">
276 <div class="mn-set-icon"><i class="mdi mdi-email-outline"></i></div>
277 <div>
278 <h4>邮箱配置</h4>
279 <p>SMTP 发信参数</p>
280 </div>
281 </div>
282 <div class="mn-set-card-bd">
283 <div class="mn-set-field">
284 <label for="mailhost">SMTP 服务器</label>
285 <input type="text" name="mailhost" id="mailhost" class="form-control" value="<?php echo $conf['mailhost']; ?>" placeholder="请输入邮箱服务器地址" required/>
286 </div>
287 <div class="mn-set-field">
288 <label for="mailuser">邮箱账号</label>
289 <input type="text" name="mailuser" id="mailuser" class="form-control" value="<?php echo $conf['mailuser']; ?>" placeholder="请输入邮箱账号" required/>
290 </div>
291 <div class="mn-set-field">
292 <label for="mailpassword">邮箱密码 / 授权码</label>
293 <input type="text" name="mailpassword" id="mailpassword" placeholder="请输入邮箱密码" value="<?php echo $conf['mailpassword']; ?>" class="form-control" required/>
294 </div>
295 <div class="mn-set-field">
296 <label for="mailport">端口</label>
297 <input type="text" name="mailport" id="mailport" placeholder="请输入邮箱端口" value="<?php echo $conf['mailport']; ?>" class="form-control" required/>
298 </div>
299 <div class="mn-set-actions">
300 <button class="btn btn-primary btn-block" type="button" onclick="mailmode()"><i class="mdi mdi-content-save-outline"></i> 保存修改</button>
301 </div>
302 </div>
303</div>
304
305<?php } elseif ($set == 'jk') { ?>
306<div class="mn-set-card">
307 <div class="mn-set-card-hd">
308 <div class="mn-set-icon"><i class="mdi mdi-timer-sand"></i></div>
309 <div>
310 <h4>自动处理主机</h4>
311 <p>域名 / 文件监控到期后的删除或暂停策略</p>
312 </div>
313 </div>
314 <div class="mn-set-card-bd">
315 <div class="mn-set-field">
316 <div class="mn-set-switch">
317 <div class="mn-set-switch-txt">
318 <strong>域名监控 — 删除/处理开关</strong>
319 <span>达到阈值后按下方策略处理主机</span>
320 </div>
321 <div class="custom-control custom-switch">
322 <input type="checkbox" class="custom-control-input" id="ymkga" <?php if ($conf['ymjkkg'] == 'true') echo 'checked'; ?>>
323 <label class="custom-control-label" for="ymkga"></label>
324 </div>
325 </div>
326 <div class="mn-set-switch">
327 <div class="mn-set-switch-txt">
328 <strong>域名监控 — 邮件通知</strong>
329 <span>处理前发送邮件提醒</span>
330 </div>
331 <div class="custom-control custom-switch">
332 <input type="checkbox" class="custom-control-input" id="ymyjkga" <?php if ($conf['mtyxfskg'] == 'true') echo 'checked'; ?>>
333 <label class="custom-control-label" for="ymyjkga"></label>
334 </div>
335 </div>
336 </div>
337 <div class="mn-set-field">
338 <label for="ymtsyza">域名删除天数阈值</label>
339 <input type="text" name="ymtsyza" id="ymtsyza" value="<?php echo $conf['ymjktsyz']; ?>" class="form-control" placeholder="请输入天数" required/>
340 </div>
341 <div class="mn-set-field">
342 <div class="mn-set-switch">
343 <div class="mn-set-switch-txt">
344 <strong>文件监控 — 删除/处理开关</strong>
345 <span>达到阈值后按下方策略处理主机</span>
346 </div>
347 <div class="custom-control custom-switch">
348 <input type="checkbox" class="custom-control-input" id="wjkga" <?php if ($conf['wjjkkg'] == 'true') echo 'checked'; ?>>
349 <label class="custom-control-label" for="wjkga"></label>
350 </div>
351 </div>
352 <div class="mn-set-switch">
353 <div class="mn-set-switch-txt">
354 <strong>文件监控 — 邮件通知</strong>
355 <span>处理前发送邮件提醒</span>
356 </div>
357 <div class="custom-control custom-switch">
358 <input type="checkbox" class="custom-control-input" id="wjyjkga" <?php if ($conf['mtwjfskg'] == 'true') echo 'checked'; ?>>
359 <label class="custom-control-label" for="wjyjkga"></label>
360 </div>
361 </div>
362 </div>
363 <div class="mn-set-field">
364 <label for="wjtsyza">文件删除天数阈值</label>
365 <input type="text" name="wjtsyza" id="wjtsyza" value="<?php echo $conf['wjjktsyz']; ?>" class="form-control" placeholder="请输入天数" required/>
366 </div>
367 <div class="mn-set-field">
368 <label for="option1">处理方式</label>
369 <select class="form-control selectpicker" name="option1" id="option1">
370 <?php
371 if ($conf['optionzc'] == 'del') {
372 echo '<option value="del" selected>删除主机</option>';
373 echo '<option value="stop">暂停主机</option>';
374 } else {
375 echo '<option value="stop" selected>暂停主机</option>';
376 echo '<option value="del">删除主机</option>';
377 }
378 ?>
379 </select>
380 </div>
381 <div class="mn-set-actions">
382 <button class="btn btn-primary btn-block" type="button" onclick="jkscsz()"><i class="mdi mdi-content-save-outline"></i> 保存修改</button>
383 </div>
384 <div class="mn-set-note">
385 开启处理开关后按天数阈值执行;仅通知可只开邮件、关闭处理开关。天数请勿填 0 或负数。执行前一天会发送邮件提醒。
386 </div>
387 </div>
388</div>
389
390<?php } elseif ($set == 'theme') {
391 $userThemes = mnbt_theme_list('user');
392 $adminThemes = mnbt_theme_list('admin');
393 $dockerThemes = mnbt_theme_list('docker');
394 $curUserTheme = mnbt_theme_name('user');
395 $curAdminTheme = mnbt_theme_name('admin');
396 $curDockerTheme = mnbt_theme_name('docker');
397 $homeThemes = mnbt_theme_list('home');
398 $curHomeTheme = mnbt_theme_name('home');
399 // 主页内容配置(V1.84 独立主页系统,主页模板跟随用户端主题)
400 $hp = function ($key, $def = '') use ($conf) {
401 return isset($conf[$key]) && $conf[$key] !== '' ? $conf[$key] : $def;
402 };
403 $homePrimary = preg_match('/^#[0-9a-fA-F]{6}$/', (string)$hp('home_primary')) ? $hp('home_primary') : '#4f46e5';
404?>
405<div class="mn-set-card">
406 <div class="mn-set-card-hd">
407 <div class="mn-set-icon"><i class="mdi mdi-palette-outline"></i></div>
408 <div>
409 <h4>前端模板</h4>
410 <p>切换用户端 / 管理端主题皮肤</p>
411 </div>
412 </div>
413 <div class="mn-set-card-bd">
414 <div class="mn-set-field">
415 <label for="usertheme">用户端主题</label>
416 <select class="form-control" id="usertheme" name="usertheme">
417 <?php foreach ($userThemes as $t): ?>
418 <option value="<?=htmlspecialchars($t['name'])?>" <?=$curUserTheme === $t['name'] ? 'selected' : ''?>>
419 <?=htmlspecialchars($t['title'])?><?=$t['version'] ? ' v'.htmlspecialchars($t['version']) : ''?> (<?=htmlspecialchars($t['name'])?>)
420 </option>
421 <?php endforeach; ?>
422 </select>
423 <small>当前:<?=htmlspecialchars($curUserTheme)?> · 目录 templates/</small>
424 </div>
425 <div class="mn-set-field">
426 <label for="admintheme">管理端主题</label>
427 <select class="form-control" id="admintheme" name="admintheme">
428 <?php foreach ($adminThemes as $t): ?>
429 <option value="<?=htmlspecialchars($t['name'])?>" <?=$curAdminTheme === $t['name'] ? 'selected' : ''?>>
430 <?=htmlspecialchars($t['title'])?><?=$t['version'] ? ' v'.htmlspecialchars($t['version']) : ''?> (<?=htmlspecialchars($t['name'])?>)
431 </option>
432 <?php endforeach; ?>
433 </select>
434 <small>当前:<?=htmlspecialchars($curAdminTheme)?> · 缺页回退 default</small>
435 </div>
436 <div class="mn-set-field">
437 <label for="dockertheme">Docker 控制台主题</label>
438 <select class="form-control" id="dockertheme" name="dockertheme">
439 <?php if (empty($dockerThemes)): ?>
440 <option value="">(暂无可用 Docker 主题)</option>
441 <?php else: foreach ($dockerThemes as $t): ?>
442 <option value="<?=htmlspecialchars($t['name'])?>" <?=$curDockerTheme === $t['name'] ? 'selected' : ''?>>
443 <?=htmlspecialchars($t['title'])?><?=$t['version'] ? ' v'.htmlspecialchars($t['version']) : ''?> (<?=htmlspecialchars($t['name'])?>)
444 </option>
445 <?php endforeach; endif; ?>
446 </select>
447 <small>当前:<?=htmlspecialchars($curDockerTheme)?> · Docker 控制台(/docker/)皮肤</small>
448 </div>
449 <div class="mn-set-field">
450 <label for="hometheme">主页主题</label>
451 <select class="form-control" id="hometheme" name="hometheme">
452 <?php if (empty($homeThemes)): ?>
453 <option value="">(暂无可用主页主题)</option>
454 <?php else: foreach ($homeThemes as $t): ?>
455 <option value="<?=htmlspecialchars($t['name'])?>" <?=$curHomeTheme === $t['name'] ? 'selected' : ''?>>
456 <?=htmlspecialchars($t['title'])?><?=$t['version'] ? ' v'.htmlspecialchars($t['version']) : ''?> (<?=htmlspecialchars($t['name'])?>)
457 </option>
458 <?php endforeach; endif; ?>
459 </select>
460 <small>当前:<?=htmlspecialchars($curHomeTheme)?> · 站点根路径 / 的落地页皮肤(templates/主题/home/)</small>
461 </div>
462 <div class="mn-set-field">
463 <label>已安装主题</label>
464 <div class="table-responsive">
465 <table class="table table-hover mn-set-table">
466 <thead>
467 <tr>
468 <th>目录</th>
469 <th>名称</th>
470 <th>版本</th>
471 <th>用户端</th>
472 <th>管理端</th>
473 <th>Docker端</th>
474 <th>主页</th>
475 <th>说明</th>
476 </tr>
477 </thead>
478 <tbody>
479 <?php
480 $all = mnbt_theme_list(null);
481 if (empty($all)): ?>
482 <tr><td colspan="8" class="text-center text-muted">未发现主题</td></tr>
483 <?php else: foreach ($all as $t): ?>
484 <tr>
485 <td><code><?=htmlspecialchars($t['name'])?></code></td>
486 <td><?=htmlspecialchars($t['title'])?></td>
487 <td><?=htmlspecialchars($t['version'] ?: '-')?></td>
488 <td><?=!empty($t['has_user']) ? '<span class="text-success">支持</span>' : '<span class="text-muted">—</span>'?></td>
489 <td><?=!empty($t['has_admin']) ? '<span class="text-success">支持</span>' : '<span class="text-muted">—</span>'?></td>
490 <td><?=!empty($t['has_docker']) ? '<span class="text-success">支持</span>' : '<span class="text-muted">—</span>'?></td>
491 <td><?=!empty($t['has_home']) ? '<span class="text-success">支持</span>' : '<span class="text-muted">—</span>'?></td>
492 <td><?=htmlspecialchars($t['description'] ?: '-')?></td>
493 </tr>
494 <?php endforeach; endif; ?>
495 </tbody>
496 </table>
497 </div>
498 </div>
499 <div class="mn-set-actions">
500 <button class="btn btn-primary btn-block" type="button" onclick="settheme()"><i class="mdi mdi-content-save-outline"></i> 保存主题设置</button>
501 </div>
502 <div class="mn-set-note">
503 保存后用户端立即生效;管理端建议整页刷新。主题包放在 <code>templates/主题名/</code> 下即可被扫描。
504 </div>
505 </div>
506</div>
507
508<div class="mn-set-card">
509 <div class="mn-set-card-hd">
510 <div class="mn-set-icon"><i class="mdi mdi-home-city-outline"></i></div>
511 <div>
512 <h4>主页内容</h4>
513 <p>内置主页落地页配置,模板跟随上方所选主页主题(templates/主题/home/)</p>
514 </div>
515 </div>
516 <div class="mn-set-card-bd">
517 <div class="mn-set-field">
518 <div class="mn-set-switch">
519 <div class="mn-set-switch-txt">
520 <strong>启用内置主页</strong>
521 <span>关闭后恢复旧行为:插件接管或跳转用户面板</span>
522 </div>
523 <div class="custom-control custom-switch">
524 <input type="checkbox" class="custom-control-input" id="home_enable" <?php if ($hp('home_enable', 'true') == 'true') echo 'checked'; ?>>
525 <label class="custom-control-label" for="home_enable"></label>
526 </div>
527 </div>
528 </div>
529 <div class="mn-set-field">
530 <label for="home_title">站点标题</label>
531 <input type="text" name="home_title" id="home_title" value="<?php echo htmlspecialchars($hp('home_title')); ?>" class="form-control" placeholder="留空使用系统名称"/>
532 </div>
533 <div class="mn-set-field">
534 <label for="home_hero">Hero 标语</label>
535 <input type="text" name="home_hero" id="home_hero" value="<?php echo htmlspecialchars($hp('home_hero')); ?>" class="form-control" placeholder="高性能虚拟主机,即买即用"/>
536 <small>主页首屏大标题</small>
537 </div>
538 <div class="mn-set-field">
539 <label for="home_primary">主色调</label>
540 <div style="display:flex;align-items:center;gap:10px;">
541 <input type="color" id="home_primary" value="<?php echo htmlspecialchars($homePrimary); ?>" style="width:46px;height:34px;padding:2px;border:1px solid #ced4da;border-radius:4px;background:#fff;cursor:pointer;">
542 <input type="text" class="form-control" id="home_primary_hex" value="<?php echo htmlspecialchars($homePrimary); ?>" style="max-width:140px;" placeholder="#4f46e5"/>
543 </div>
544 <small>十六进制色值(#rrggbb),应用到主页按钮与强调元素</small>
545 </div>
546 <div class="mn-set-field">
547 <label for="home_logo">站点 Logo</label>
548 <div style="display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:8px;">
549 <img id="logo_preview" src="<?php echo htmlspecialchars(mnbt_asset_url($hp('home_logo', 'upload_logo/logo.index.png'))); ?>" alt="logo" style="width:36px;height:36px;object-fit:contain;border:1px solid #e5e7eb;border-radius:8px;background:#fff;">
550 <input type="file" id="logo_file" accept=".png,.jpg,.jpeg,.gif,.ico" style="display:none;">
551 <button type="button" class="btn btn-outline-secondary" onclick="pickHomeIcon('logo')"><i class="mdi mdi-upload"></i> 上传</button>
552 <button type="button" class="btn btn-outline-secondary" onclick="$('#home_logo').val('');$('#logo_preview').attr('src','../imsetes/upload_logo/logo.index.png')">恢复默认</button>
553 </div>
554 <input type="text" name="home_logo" id="home_logo" value="<?php echo htmlspecialchars($hp('home_logo')); ?>" class="form-control" placeholder="上传后自动填入,或手动填写 URL"/>
555 <small>留空使用系统控制面板 Logo(imsetes/upload_logo/logo.index.png)</small>
556 </div>
557 <div class="mn-set-field">
558 <label for="home_favicon">Favicon</label>
559 <div style="display:flex;align-items:center;gap:12px;flex-wrap:wrap;margin-bottom:8px;">
560 <input type="file" id="favicon_file" accept=".png,.jpg,.jpeg,.gif,.ico" style="display:none;">
561 <button type="button" class="btn btn-outline-secondary" onclick="pickHomeIcon('favicon')"><i class="mdi mdi-upload"></i> 上传</button>
562 <button type="button" class="btn btn-outline-secondary" onclick="$('#home_favicon').val('')">清除</button>
563 </div>
564 <input type="text" name="home_favicon" id="home_favicon" value="<?php echo htmlspecialchars($hp('home_favicon')); ?>" class="form-control" placeholder="上传后自动填入,或手动填写 URL"/>
565 <small>留空使用系统默认图标</small>
566 </div>
567 <div class="mn-set-field">
568 <label for="home_footer">底部版权</label>
569 <input type="text" name="home_footer" id="home_footer" value="<?php echo htmlspecialchars($hp('home_footer')); ?>" class="form-control" placeholder="留空使用系统版权(hxp)"/>
570 </div>
571 <div class="mn-set-field">
572 <div class="mn-set-switch">
573 <div class="mn-set-switch-txt">
574 <strong>显示公告区</strong>
575 <span>展示系统网站公告(MN_config.gg)</span>
576 </div>
577 <div class="custom-control custom-switch">
578 <input type="checkbox" class="custom-control-input" id="home_show_notice" <?php if ($hp('home_show_notice', 'true') == 'true') echo 'checked'; ?>>
579 <label class="custom-control-label" for="home_show_notice"></label>
580 </div>
581 </div>
582 <div class="mn-set-switch">
583 <div class="mn-set-switch-txt">
584 <strong>显示套餐区</strong>
585 <span>hosting_shop 启用且存在有效套餐时展示</span>
586 </div>
587 <div class="custom-control custom-switch">
588 <input type="checkbox" class="custom-control-input" id="home_show_plans" <?php if ($hp('home_show_plans', 'true') == 'true') echo 'checked'; ?>>
589 <label class="custom-control-label" for="home_show_plans"></label>
590 </div>
591 </div>
592 </div>
593 <?php
594 $homeThemeFields = function_exists('mnbt_home_render_settings_fields_default') ? mnbt_home_render_settings_fields_default() : '';
595 if ($homeThemeFields !== '') {
596 echo '<div class="mn-set-field" style="padding-top:8px;border-top:1px solid #e5e7eb;"><div class="mn-set-note" style="margin-bottom:8px;"><b>主题自定义设置</b>(当前主页主题注册的扩展项)</div></div>';
597 echo $homeThemeFields;
598 }
599 ?>
600 <div class="mn-set-actions">
601 <button class="btn btn-primary btn-block" type="button" onclick="saveHome()"><i class="mdi mdi-content-save-outline"></i> 保存主页内容</button>
602 </div>
603 <div class="mn-set-note">
604 <b>提示:</b>主页模板位于 <code>templates/当前主页主题/home/index.php</code>,缺页回退
605 <code>templates/default/home/index.php</code>。插件可通过 <code>home.blocks</code> 过滤器注入扩展区块;
606 启用 shop_frontend 等插件时,插件主页优先接管。
607 </div>
608 </div>
609</div>
610<script>
611document.getElementById('home_primary').addEventListener('input', function () {
612 document.getElementById('home_primary_hex').value = this.value;
613});
614function saveHome() {
615 var data = {
616 gn: 'save_home_settings',
617 home_enable: $('#home_enable').is(':checked') ? 'true' : 'false',
618 home_title: $('#home_title').val() || '',
619 home_hero: $('#home_hero').val() || '',
620 home_primary: $('#home_primary_hex').val() || '',
621 home_logo: $('#home_logo').val() || '',
622 home_favicon: $('#home_favicon').val() || '',
623 home_footer: $('#home_footer').val() || '',
624 home_show_notice: $('#home_show_notice').is(':checked') ? 'true' : 'false',
625 home_show_plans: $('#home_show_plans').is(':checked') ? 'true' : 'false',
626 };
627 // 主题自定义设置字段(name 以 home_ts_ 开头的 input/textarea/select)
628 document.querySelectorAll('#home_save_form [name^="home_ts_"], input[name^="home_ts_"], textarea[name^="home_ts_"], select[name^="home_ts_"]').forEach(function (el) {
629 if (el.type === 'checkbox') {
630 data[el.name] = el.checked ? 'true' : 'false';
631 } else {
632 data[el.name] = el.value || '';
633 }
634 });
635 $.post('./ajax.php', data, function (r) {
636 var j = JSON.parse(r);
637 msalert(j.code === '修改成功' ? 1 : 4, j.code || '保存失败', 2000);
638 });
639}
640function pickHomeIcon(target) {
641 document.getElementById(target + '_file').click();
642}
643function bindHomeIcon(target) {
644 var input = document.getElementById(target + '_file');
645 input.addEventListener('change', function () {
646 if (!input.files || !input.files.length) return;
647 var fd = new FormData();
648 fd.append('gn', 'home_upload_icon');
649 fd.append('target', target);
650 fd.append('icon', input.files[0]);
651 $.ajax({
652 url: './ajax.php',
653 type: 'POST',
654 data: fd,
655 processData: false,
656 contentType: false,
657 success: function (r) {
658 var j;
659 try { j = typeof r === 'string' ? JSON.parse(r) : r; } catch (e) { j = { code: '响应解析失败' }; }
660 if (j.code === '上传成功') {
661 var rel = 'imsetes/upload_logo/home_' + target + (target === 'favicon' ? '.ico' : '.png');
662 $('#' + target + '_value').val(rel);
663 if (target === 'logo') { $('#logo_preview').attr('src', '../' + rel).show(); }
664 msalert(1, '上传成功,请点击保存', 2000);
665 } else {
666 msalert(4, j.code || '上传失败', 2000);
667 }
668 },
669 error: function () { msalert(4, '网络错误,请重试', 2000); }
670 });
671 });
672}
673bindHomeIcon('logo');
674bindHomeIcon('favicon');
675</script>
676
677<?php } else { ?>
678<div class="mn-set-card">
679 <div class="mn-set-card-bd text-center text-muted py-5">
680 请从左侧菜单选择设置项
681 </div>
682</div>
683<?php } ?>
684</div>