仰望星辰工作室

better-staridc-MNBT

Z zfhsh first commit 2 个月前
1<?php
2/**
3 * 共用顶栏导航(所有前端页面共用:首页落地页 + user_info/balance/hosting_shop 各功能页)。
4 * 依赖 shop_frontend_url() / shop_frontend_brand_mark()(lib/shop_frontend.php)。
5 * 样式来自 assets/style.css(.sf-topbar 系列),页面需先引入该样式表。
6 */
7if (!defined('IN_CRONLITE')) { exit; }
8$current_user = $current_user ?? null;
9$active = $active ?? '';
10$brand = $brand ?? 'MNBT 云服务';
11$brand_logo = $brand_logo ?? '';
12$has_balance = $has_balance ?? false;
13$has_hosting = $has_hosting ?? false;
14?>
15<header class="sf-topbar">
16 <div class="sf-container sf-topbar-inner">
17 <a class="sf-brand" href="<?= shop_frontend_url('') ?>">
18 <?php if ($brand_logo): ?>
19 <img class="sf-brand-img" src="<?= htmlspecialchars($brand_logo) ?>" alt="<?= htmlspecialchars($brand) ?>">
20 <?php else: ?>
21 <span class="sf-brand-mark"><?= htmlspecialchars(shop_frontend_brand_mark($brand)) ?></span>
22 <?php endif; ?>
23 <span class="sf-brand-text"><?= htmlspecialchars($brand) ?></span>
24 </a>
25 <nav class="sf-nav">
26 <a href="<?= shop_frontend_url('') ?>" class="<?= $active === 'home' ? 'active' : '' ?>">首页</a>
27 <?php if ($has_hosting): ?>
28 <a href="<?= shop_frontend_url('shop') ?>" class="<?= $active === 'shop' ? 'active' : '' ?>">主机套餐</a>
29 <?php if ($current_user): ?>
30 <a href="<?= shop_frontend_url('shop/assets') ?>" class="<?= $active === 'assets' ? 'active' : '' ?>">我的主机</a>
31 <a href="<?= shop_frontend_url('shop/orders') ?>" class="<?= $active === 'orders' ? 'active' : '' ?>">我的订单</a>
32 <?php endif; ?>
33 <?php endif; ?>
34 <?php if ($has_balance && $current_user): ?>
35 <a href="<?= shop_frontend_url('balance') ?>" class="<?= $active === 'balance' ? 'active' : '' ?>">我的余额</a>
36 <?php endif; ?>
37 </nav>
38 <div class="sf-nav-right">
39 <?php if ($current_user): ?>
40 <a href="<?= shop_frontend_url('account/profile') ?>" class="<?= $active === 'profile' ? 'active' : '' ?>"><?= htmlspecialchars($current_user['username']) ?></a>
41 <a href="<?= shop_frontend_url('account/logout') ?>" class="sf-btn sf-btn-ghost sf-btn-sm">退出</a>
42 <?php else: ?>
43 <a href="<?= shop_frontend_url('account/login') ?>" class="<?= $active === 'login' ? 'active' : '' ?>">登录</a>
44 <a href="<?= shop_frontend_url('account/register') ?>" class="sf-btn sf-btn-primary sf-btn-sm">注册</a>
45 <?php endif; ?>
46 </div>
47 </div>
48</header>