summaryrefslogtreecommitdiff
path: root/pages/about.inc
diff options
context:
space:
mode:
Diffstat (limited to 'pages/about.inc')
-rw-r--r--pages/about.inc96
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'; ?>