<?php
/**
 * Name: Nxz官网系统
 * URI: https://www.nxzlm.com/
 * Description: 逆行者官网系统源码，简单好用带后台
 * Version: 1.0.0
 * Author: 逆行者联盟
 */
require_once '../includes/common.php';
check_admin_login();

if (isset($_GET['action']) && $_GET['action'] == 'logout') {
    session_destroy();
    header("Location: login.php");
    exit;
}
?>
<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>后台管理 - <?php echo htmlspecialchars(get_config('site_name')); ?></title>
    <link rel="stylesheet" href="../assets/layui/css/layui.css">
    <style>
        .layui-layout-admin .layui-logo { color: #fff; font-weight: bold; background-color: #20222A !important; }
        .layui-header { background-color: #20222A !important; }
        .layui-side.layui-bg-black { background-color: #20222A !important; }
        .layui-layout-admin .layui-footer { background-color: #f2f2f2; text-align: center; color: #666; }
    </style>
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo layui-hide-xs"><?php echo htmlspecialchars(get_config('site_name')); ?></div>
        <ul class="layui-nav layui-layout-left">
            <li class="layui-nav-item layui-show-xs-inline-block layui-hide-sm" lay-header-event="menuLeft">
                <i class="layui-icon layui-icon-shrink-right"></i>
            </li>
            <li class="layui-nav-item"><a href="../index.php" target="_blank">网站首页</a></li>
        </ul>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <i class="layui-icon layui-icon-username"></i> <?php echo htmlspecialchars($_SESSION['admin_user']); ?>
                </a>
            </li>
            <li class="layui-nav-item"><a href="?action=logout">退出</a></li>
        </ul>
    </div>

    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul class="layui-nav layui-nav-tree" lay-filter="nav">
                <li class="layui-nav-item layui-this"><a href="javascript:;" data-url="dashboard.php"><i class="layui-icon layui-icon-home"></i> 控制台</a></li>
                <li class="layui-nav-item"><a href="javascript:;" data-url="settings.php"><i class="layui-icon layui-icon-set"></i> 系统设置</a></li>
                <li class="layui-nav-item"><a href="javascript:;" data-url="sliders.php"><i class="layui-icon layui-icon-carousel"></i> 轮播图管理</a></li>
                <li class="layui-nav-item"><a href="javascript:;" data-url="projects.php"><i class="layui-icon layui-icon-template-1"></i> 项目管理</a></li>
                <li class="layui-nav-item"><a href="javascript:;" data-url="services.php"><i class="layui-icon layui-icon-component"></i> 服务管理</a></li>
                <li class="layui-nav-item"><a href="javascript:;" data-url="members.php"><i class="layui-icon layui-icon-user"></i> 团队成员</a></li>
                <li class="layui-nav-item"><a href="javascript:;" data-url="links.php"><i class="layui-icon layui-icon-link"></i> 友情链接</a></li>
            </ul>
        </div>
    </div>

    <div class="layui-body" style="background-color: #f2f2f2; padding: 15px; box-sizing: border-box;">
        <iframe src="dashboard.php" id="mainIframe" frameborder="0" style="width: 100%; height: 100%; border: none;"></iframe>
    </div>

    <div class="layui-footer">
        © <?php echo date('Y'); ?> <?php echo $nxz_copyright['Name']; ?> - <?php echo $nxz_copyright['Author']; ?> 版权所有 | <?php echo $nxz_copyright['Ps']; ?>
    </div>
</div>

<script src="../assets/layui/layui.js"></script>
<script>
layui.use(['element', 'jquery'], function(){
    var element = layui.element;
    var $ = layui.jquery;
    
    // 菜单切换
    $('.layui-nav-tree a').on('click', function(){
        var url = $(this).attr('data-url');
        if(url){
            $('#mainIframe').attr('src', url);
        }
    });
});
</script>
</body>
</html>