summaryrefslogtreecommitdiff
path: root/pages/about.inc
blob: 8a62d6648fd99b1f52b22ee95c764578682cedf2 (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
70
71
72
73
74
75
76
77
78
79
80
<?php

require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; global $lang; global $pages;
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/header.inc';
$version = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/version.json"), true);

$ignore = [
    $_SERVER['DOCUMENT_ROOT'] . "/Data",
    $_SERVER['DOCUMENT_ROOT'] . "/bits/Data",
    $_SERVER['DOCUMENT_ROOT'] . "/Private/Data",
    $_SERVER['DOCUMENT_ROOT'] . "/bits/Private/Data",
    $_SERVER['DOCUMENT_ROOT'] . "/includes/data",
    $_SERVER['DOCUMENT_ROOT'] . "/includes/tokens",
];

function rscandir($dir, $inverseIgnore = false) {
    global $ignore;
    $files = [];

    foreach (array_filter(scandir($dir), function ($i) {
        return !str_starts_with($i, ".");
    }) as $file) {
        if (!(($inverseIgnore && !in_array($dir . "/" . $file, $ignore)) || (!$inverseIgnore && in_array($dir . "/" . $file, $ignore)))) {
            if (is_dir($dir . "/" . $file)) {
                array_push($files, ...rscandir($dir . "/" . $file));
            } else {
                $files[] = $dir . "/" . $file;
            }
        }
    }

    return array_unique($files);
}

$sizeSystem = array_reduce(array_map(function ($i) {
    return filesize($i);
}, rscandir($_SERVER['DOCUMENT_ROOT'])), function ($a, $b) {
    return $a + $b;
});

$sizeData = array_reduce(array_map(function ($i) {
    return filesize($i);
}, rscandir($_SERVER['DOCUMENT_ROOT'], true)), function ($a, $b) {
    return $a + $b;
});

?>

<br>
<div class="container">
    <div id="page-content">
        <h2>About Cold Haze</h2>
        <p>
            <b>Cold Haze Engine version 2.<?= $version["build"] ?>.<?= $version["revision"] ?></b><br>
            Version date: <?= date('D j M Y, G:i:s T', $version["timestamp"]) ?><br>
            Version ID: <code style="color: white;"><?= $version["hash"] ?></code><br>
            Install path: <?= $_SERVER['DOCUMENT_ROOT'] ?><br>
            Server software: <?= $_SERVER['SERVER_SOFTWARE'] ?>, via <?= $_SERVER['GATEWAY_INTERFACE'] ?><br>
            Transport protocol: <?= $_SERVER['SERVER_PROTOCOL'] ?>
        </p>

        <p>
            <b>PHP <?= PHP_VERSION ?></b><br>
            Zend Engine: <?= zend_version() ?><br>
            Server API: <?= php_sapi_name() ?><br>
            Memory usage: <?= prettySize(memory_get_peak_usage()) ?><br>
            Server OS: <?= php_uname("s") ?> <?= php_uname("r") ?><br>
            Server domain name: <?= php_uname("n") ?><br>
            Server architecture: <?= php_uname("m") ?>
        </p>

        <p>
            <b>Disk space usage</b><br>
            Engine: <?= prettySize($sizeSystem) ?><br>
            Database: <?= prettySize($sizeData) ?>
        </p>
    </div>
</div>

<?php require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/footer.inc'; ?>