diff options
author | Minteck <contact@minteck.org> | 2022-10-10 20:51:39 +0200 |
---|---|---|
committer | Minteck <contact@minteck.org> | 2022-10-10 20:51:39 +0200 |
commit | 108525534c28013cfe1897c30e4565f9893f3766 (patch) | |
tree | dd3e5132971f96ab5f05e7f3f8f6dbbf379a19bd /pages/about.inc | |
parent | 2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff) | |
download | pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2 pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip |
Update
Diffstat (limited to 'pages/about.inc')
-rw-r--r-- | pages/about.inc | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/pages/about.inc b/pages/about.inc new file mode 100644 index 0000000..d6b0eeb --- /dev/null +++ b/pages/about.inc @@ -0,0 +1,96 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/init.inc"; global $title; global $isLoggedIn; +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; +}); + +function prettySize($bytes) { + if ($bytes > 1024) { + if ($bytes > 1024**2) { + if ($bytes > 1024**3) { + return round($bytes / 1024**3, 1) . " MB"; + } else { + return round($bytes / 1024**2, 1) . " MB"; + } + } else { + return round($bytes / 1024, 1) . " KB"; + } + } else { + return $bytes . " B"; + } +} + +?> + +<br> +<div class="container"> + <div id="page-content"> + <h2>About Cold Haze</h2> + <p> + <b>Cold Haze Engine version 2.<?= $version["build"] ?>.<?= hexdec(substr($version["hash"], 0, 4)) ?>.<?= $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'; ?> |