summaryrefslogtreecommitdiff
path: root/public/system/index.php
blob: 95b17a59208997a0445b30aa8dd781e76d414057 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
include_once "../../src/partials.php";
include_once "../../src/accounts.php";
include_once "../../src/alert.php";
include_once "../../src/config.php";

if (!MOD_SYSTEM_DASHBOARD) {
    generate_alert("/404.php", "System dashboard is disabled", 405);
    exit;
}

if (!authorize_user(true) || (!$_SESSION["user_role"]["permission_approve_emotes"] && !$_SESSION["user_role"]["permission_report_review"])) {
    generate_alert("/404.php", "Not enough permissions", 403);
    exit;
}

$db = new PDO(DB_URL, DB_USER, DB_PASS);

?>

<html>

<head>
    <title>System panel - <?php echo INSTANCE_NAME ?></title>
    <link rel="stylesheet" href="/static/style.css">
    <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon">
</head>

<body>
    <div class="container">
        <div class="wrapper">
            <?php html_navigation_bar() ?>
            <section class="content">
                <section class="box">
                    <div class="box navtab">System panel</div>
                    <div class="box content">
                        <?php
                        if (MOD_EMOTES_APPROVE && $_SESSION["user_role"]["permission_approve_emotes"]) {
                            echo '<a href="/system/emotes">Emotes';

                            $results = $db->query("SELECT COUNT(*) FROM emotes WHERE visibility = 2")->fetch()[0];

                            if ($results > 0) {
                                echo " ($results pending)";
                            }

                            echo '</a>';
                        }

                        if (REPORTS_ENABLE && $_SESSION["user_role"]["permission_report_review"]) {
                            echo '<a href="/system/reports">Reports';

                            $results = $db->query("SELECT COUNT(*) FROM reports WHERE resolved_by IS NULL")->fetch()[0];

                            if ($results > 0) {
                                echo " ($results pending)";
                            }

                            echo '</a>';
                        }
                        ?>
                    </div>
                </section>
            </section>
        </div>
    </div>
</body>

</html>