<?php
@header('Content-Type: text/html; charset=UTF-8');
?><!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <title><?php echo $title?></title>
  <meta name="keywords" content="<?php echo $conf['keywords']?>">
  <meta name="description" content="<?php echo $conf['description']?>">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=3.0, user-scalable=yes">
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no">
  <link href="https://s4.zstatic.net/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet">
  <link href="https://s4.zstatic.net/ajax/libs/twitter-bootstrap/3.4.1/css/bootstrap.min.css" rel="stylesheet">
  <link href="https://s4.zstatic.net/ajax/libs/bootstrap-material-design/0.5.10/css/bootstrap-material-design.min.css" rel="stylesheet">
  <link href="https://s4.zstatic.net/ajax/libs/bootstrap-material-design/0.5.10/css/ripples.min.css" rel="stylesheet">
  <?php if($is_file){?><link rel="stylesheet" href="https://s4.zstatic.net/ajax/libs/aplayer/1.10.1/APlayer.min.css"><link href="assets/css/ckplayer.css" rel="stylesheet"><?php }?>
  <link href="assets/css/style.css?v=<?php echo VERSION?>" rel="stylesheet">
  <link href="assets/css/sidebar.css?v=<?php echo VERSION?>" rel="stylesheet">
  <script type="text/javascript" src="https://s4.zstatic.net/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
</head>
<body>

<div class="app-container">
    <!-- Mobile Toggle -->
    <a href="javascript:;" class="mobile-toggle" onclick="toggleSidebar()">
        <i class="fa fa-bars"></i>
    </a>
    <div class="sidebar-overlay" onclick="toggleSidebar()"></div>

    <!-- Sidebar -->
    <div class="sidebar" id="app-sidebar">
        <div class="sidebar-header">
            <a href="./" class="sidebar-brand"><i class="fa fa-cloud"></i> <?php echo $conf['title']?></a>
        </div>
        
        <?php if($islogin2): ?>
        <div class="sidebar-user">
            <img src="<?php echo !empty($userrow['faceimg']) ? $userrow['faceimg'] : './assets/img/avatar.png'; ?>" alt="Avatar" onerror="this.src='data:image/svg+xml,<svg xmlns=&quot;http://www.w3.org/2000/svg&quot; viewBox=&quot;0 0 100 100&quot;><circle cx=&quot;50&quot; cy=&quot;35&quot; r=&quot;20&quot; fill=&quot;%23ccc&quot;/><circle cx=&quot;50&quot; cy=&quot;90&quot; r=&quot;35&quot; fill=&quot;%23ccc&quot;/></svg>'">
            <div class="user-name"><?php echo $userrow['nickname']?></div>
            <div class="user-id">@<?php echo $userrow['username']?></div>
        </div>
        <?php endif; ?>

        <ul class="sidebar-menu">
            <li class="<?php echo (checkIfActive('index') && !isset($_GET['m'])) ? 'active' : ''?>">
                <a href="./"><i class="fa fa-home"></i> 首页大厅</a>
            </li>
            <?php if($islogin2): ?>
            <li class="<?php echo checkIfActive('disk')?>">
                <a href="disk.php"><i class="fa fa-folder-open"></i> 我的网盘</a>
            </li>
            <li class="<?php echo checkIfActive('upload')?>">
                <a href="upload.php"><i class="fa fa-cloud-upload"></i> 上传文件</a>
            </li>
            <li class="<?php echo checkIfActive('user_center')?>">
                <a href="user_center.php"><i class="fa fa-user-circle"></i> 个人中心</a>
            </li>
            <?php else: ?>
            <li class="<?php echo checkIfActive('mine')?>">
                <a href="./?m=mine"><i class="fa fa-folder-open"></i> 我的文件</a>
            </li>
            <?php if($conf['forcelogin'] == 0): ?>
            <li class="<?php echo checkIfActive('upload')?>">
                <a href="upload.php"><i class="fa fa-cloud-upload"></i> 上传文件</a>
            </li>
            <?php endif; ?>
            <?php endif; ?>

            <?php if($is_file): ?>
            <li class="<?php echo checkIfActive('file')?>">
                <a href=""><i class="fa fa-file-text-o"></i> 文件详情</a>
            </li>
            <?php endif; ?>

            <li class="menu-divider"></li>

            <?php if(!$islogin2): ?>
                <?php if($conf['userlogin']): ?>
                <li class="<?php echo checkIfActive('login')?>">
                    <a href="./login.php"><i class="fa fa-sign-in"></i> 登录账号</a>
                </li>
                <li class="<?php echo checkIfActive('register')?>">
                    <a href="./register.php"><i class="fa fa-user-plus"></i> 注册账号</a>
                </li>
                <?php endif; ?>
            <?php else: ?>
                <li>
                    <a href="./login.php?logout=1" onclick="return confirm('是否确定退出登录？')"><i class="fa fa-sign-out text-danger"></i> <span class="text-danger">退出登录</span></a>
                </li>
            <?php endif; ?>
        </ul>

        <div class="sidebar-footer">
            &copy; <?php echo date("Y")?> <?php echo $conf['title']?>
        </div>
    </div>

    <!-- Main Content Wrapper -->
    <div class="main-content">

    <!-- Bottom Navigation Bar - Mobile -->
    <nav class="bottom-nav">
        <ul class="bottom-nav-list">
            <li class="bottom-nav-item <?php echo (checkIfActive('index') && !isset($_GET['m'])) ? 'active' : ''?>">
                <a href="index.php" <?php if(checkIfActive('index') && !isset($_GET['m'])): ?>style="color: #14b8a6 !important;"<?php endif; ?>>
                    <i class="fa fa-bullhorn"></i>
                    <span>广场</span>
                </a>
            </li>
            <li class="bottom-nav-item <?php echo checkIfActive('disk,mine')?>">
                <a href="<?php echo $islogin2 ? 'disk.php' : './?m=mine'?>" <?php if(checkIfActive('disk,mine')): ?>style="color: #14b8a6 !important;"<?php endif; ?>>
                    <i class="fa fa-folder-open"></i>
                    <span>文件</span>
                </a>
            </li>
            <li class="bottom-nav-item upload-item">
                <a href="upload.php">
                    <i class="fa fa-plus"></i>
                </a>
            </li>
            <li class="bottom-nav-item <?php echo checkIfActive('redeem')?>">
                <a href="redeem.php" <?php if(checkIfActive('redeem')): ?>style="color: #14b8a6 !important;"<?php endif; ?>>
                    <i class="fa fa-gift"></i>
                    <span>兑换</span>
                </a>
            </li>
            <li class="bottom-nav-item <?php echo checkIfActive('user_center,login,register')?>">
                <a href="user_center.php" <?php if(checkIfActive('user_center,login,register')): ?>style="color: #14b8a6 !important;"<?php endif; ?>>
                    <i class="fa fa-user"></i>
                    <span>我的</span>
                </a>
            </li>
        </ul>
    </nav>

<script>
function toggleSidebar() {
    $('#app-sidebar').toggleClass('active');
    $('.sidebar-overlay').toggleClass('active');
}
</script>
