<?php 
session_start();
if (!isset($_SESSION['eggzie_iboPlayer'])) {
    header('location:login.php');
    exit();
}

$userId = $_SESSION['id'];
$db = new SQLite3('./a/.eggziepanels.db');
$query = $db->query('SELECT * FROM USERS WHERE id="1"');
$userData = $query->fetchArray();
$userName = $userData['NAME'];
$userLogo = $userData['LOGO'];

$themeConfig = json_decode(file_get_contents('./includes/eggzie.json'), true);
$themeColor = $themeConfig['info']['aa'];
?>
<!DOCTYPE html>
<html lang="pt-BR">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="description" content="">
    <meta name="author" content="">
    <meta name="google" content="notranslate">
    <script src="https://kit.fontawesome.com/3794d2f89f.js" crossorigin="anonymous"></script>
    <title>IBO PRO</title>
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <link rel="icon" href="favicon.ico" type="image/x-icon">
    <link href="css/sb-admin-<?= $themeColor ?>.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="css/jquery.datetimepicker.min.css"/>
    <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">
    <link href="https://fonts.googleapis.com/css?family=Nunito:200,300,400,600,700,800,900" rel="stylesheet">
</head>
<body id="page-top">

<!-- Page Wrapper -->
<div id="wrapper">

    <!-- Sidebar -->
    <ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">

        <!-- Sidebar - Brand -->
        <a class="sidebar-brand d-flex align-items-center justify-content-center" href="colour.php">
            <div class="sidebar-brand-icon">
                <img class="img-profile" width="65px" src="<?= $userLogo ?: 'img/logo.png' ?>">
            </div>
        </a>

        <!-- Divider -->
        <hr class="sidebar-divider my-0">

        <!-- Users -->
        <li class="nav-item">
            <a class="nav-link" href="users.php">
                <i class="fas fa-fw fa-user-plus"></i>
                <span>Usuários</span>
            </a>
        </li>

        <!-- APK Update -->
        <li class="nav-item">
    <a class="nav-link" href="update.php">
        <i class="fas fa-fw fa-sync-alt"></i>
        <span>Atualizar APK</span>
    </a>
</li>

        <!-- Profile -->
        <li class="nav-item">
            <a class="nav-link" href="profile.php">
                <i class="fas fa-fw fa-user"></i>
                <span>Perfil</span>
            </a>
        </li>

        <!-- Cloud -->
        <li class="nav-item">
            <a class="nav-link collapsed" href="#" data-toggle="collapse" data-target="#collapseCloud" aria-expanded="true" aria-controls="collapseCloud">
                <i class="fas fa-fw fa-cloud"></i>
                <span>Cloud</span>
            </a>
            <div id="collapseCloud" class="collapse" aria-labelledby="headingCloud" data-parent="#accordionSidebar">
                <div class="bg-white py-2 collapse-inner rounded">
                    <h6 class="collapse-header">Uploads Cloud:</h6>
                    <a class="collapse-item" href="https://db.tt" target="_blank"><i class="fas fa-fw fa-share"></i> DropBox</a>
                    <a class="collapse-item" href="https://mega.nz/" target="_blank"><i class="fas fa-fw fa-share"></i> Mega</a>
                </div>
            </div>
        </li>

        <!-- Colour.php button -->
        <li class="nav-item">
            <a class="nav-link" href="colour.php">
                <i class="fas fa-fw fa-palette"></i>
                <span>Alterar Cor</span>
            </a>
        </li>

        <!-- Logout -->
        <li class="nav-item">
            <a class="nav-link" href="logout.php">
                <i class="fas fa-fw fa-sign-out-alt"></i>
                <span>Sair</span>
            </a>
        </li>

        <!-- Divider -->
        <hr class="sidebar-divider d-none d-md-block">

        <!-- Sidebar Toggler -->
        <div class="text-center d-none d-md-inline">
            <button class="rounded-circle border-0" id="sidebarToggle"></button>
        </div>

    </ul>
    <!-- End of Sidebar -->

    <!-- Content Wrapper -->
    <div id="content-wrapper" class="d-flex flex-column">

        <!-- Main Content -->
        <div id="content">

            <!-- Topbar -->
            <nav class="navbar navbar-expand navbar-light topbar mb-4 static-top shadow">

                <!-- Sidebar Toggle (Topbar) -->
                <button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">
                    <i class="fa fa-bars"></i>
                </button>

                <div><h5 class="m-0 text-primary">IBO PRO</h5></div>

                <!-- Topbar Navbar -->
                <ul class="navbar-nav ml-auto">

                    <div class="topbar-divider d-none d-sm-block"></div>

                    <!-- Nav Item - Logout -->
                    <li class="nav-item dropdown no-arrow mx-1">
                        <a class="nav-link dropdown-toggle" href="logout.php">
                            <span class="badge badge-danger">Sair</span>
                            <i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-red-400"></i>
                        </a>
                    </li>
                </ul>
            </nav>
            <!-- End of Topbar -->