diff options
author | Minteck <nekostarfan@gmail.com> | 2021-08-08 12:04:30 +0200 |
---|---|---|
committer | Minteck <nekostarfan@gmail.com> | 2021-08-08 12:04:30 +0200 |
commit | 95112b1eb06a4be531ded59563d53a63a8d614e8 (patch) | |
tree | fd3dc676227309c87a39feab9ca458985e327907 /admin/panes | |
parent | 87303b0d3540037fb94efdde24dbaacb2880d6cb (diff) | |
download | main-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.gz main-95112b1eb06a4be531ded59563d53a63a8d614e8.tar.bz2 main-95112b1eb06a4be531ded59563d53a63a8d614e8.zip |
Opening!
Diffstat (limited to 'admin/panes')
-rw-r--r-- | admin/panes/code.php | 43 | ||||
-rw-r--r-- | admin/panes/disk.php | 81 | ||||
-rw-r--r-- | admin/panes/editor.php | 591 | ||||
-rw-r--r-- | admin/panes/files.php | 4 | ||||
-rw-r--r-- | admin/panes/hardware.lshw.php | 4 | ||||
-rw-r--r-- | admin/panes/hardware.php | 76 | ||||
-rw-r--r-- | admin/panes/home.php | 267 | ||||
-rw-r--r-- | admin/panes/kartik.php | 220 | ||||
-rw-r--r-- | admin/panes/neutroning.php | 65 | ||||
-rw-r--r-- | admin/panes/quotas.php | 56 | ||||
-rw-r--r-- | admin/panes/telemetry.php | 946 | ||||
-rw-r--r-- | admin/panes/unchained.php | 160 | ||||
-rw-r--r-- | admin/panes/uptime.php | 172 | ||||
-rw-r--r-- | admin/panes/version.php | 277 |
14 files changed, 2413 insertions, 549 deletions
diff --git a/admin/panes/code.php b/admin/panes/code.php new file mode 100644 index 0000000..5c716e3 --- /dev/null +++ b/admin/panes/code.php @@ -0,0 +1,43 @@ +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Code of Conduct</h2>
+
+ <h4 style="text-align:center;">editor powered by Neutron</h4>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item">English (primary) <span style="float:right;"><a href="/admin/panes/editor.php?file=conduct.en&name=Code%20of%20Conduct%20-%20English&context=code">Edit</a> · <a href="/code-of-conduct/?en" target="_blank">View</a></span></li>
+ <li class="list-group-item">French <span style="float:right;"><a href="/admin/panes/editor.php?file=conduct.fr&name=Code%20of%20Conduct%20-%20French&context=code">Edit</a> · <a href="/code-of-conduct/?fr" target="_blank">View</a></span></li>
+ </ul>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/disk.php b/admin/panes/disk.php new file mode 100644 index 0000000..72d772f --- /dev/null +++ b/admin/panes/disk.php @@ -0,0 +1,81 @@ +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Disk Space Usage</h2>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?php
+
+ exec("df -h -x tmpfs -x squashfs -x devtmpfs --total --output=source,fstype,size,used,avail,pcent,ipcent,iused,itotal,target", $disktotal);
+ echo(implode("\n", $disktotal));
+
+ ?>
+ </pre>
+ <ul class="list-group">
+ <li class="list-group-item">
+ <details>
+ <summary>Show all filesystems (including RAM disks and pseudo-fs)</summary>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?php
+
+ exec("df -ha --output=source,fstype,size,used,avail,pcent,ipcent,iused,itotal,target", $disktotal2);
+ echo(implode("\n", $disktotal2));
+
+ ?>
+ </pre>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Show filesystems mount options</summary>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?php
+
+ exec("mount", $disktotal3);
+ echo(implode("\n", $disktotal3));
+
+ ?>
+ </pre>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Show block devices tree</summary>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?php
+
+ exec("lsblk -mp", $disktotal4);
+ echo(implode("\n", $disktotal4));
+
+ ?>
+ </pre>
+ </details>
+ </li>
+ </ul>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/editor.php b/admin/panes/editor.php new file mode 100644 index 0000000..b337060 --- /dev/null +++ b/admin/panes/editor.php @@ -0,0 +1,591 @@ +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */
+
+if (isset($_GET['file']) && strpos($_GET['file'], "/") === false) {} else {
+ die();
+}
+
+if (isset($_GET['name']) && strpos($_GET['name'], "/") === false) {} else {
+ die();
+}
+
+if (isset($_GET['context']) && strpos($_GET['context'], "/") === false) {} else {
+ die();
+}
+
+if (isset($_GET['article']) && strpos($_GET['article'], "/") === false) {} else {
+ if (isset($_GET['article'])) {
+ die();
+ }
+}
+
+?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <p style="text-align: center;"><a href="/admin/panes/<?= $_GET['context'] ?>.php">← Go back</a></p>
+ <h2 style="text-align:center;"><?= strip_tags($_GET['name']) ?></h2>
+
+ <h4 id="autosave-status" style="text-align:center;transition:opacity 200ms;">Saved as draft</h4>
+
+ <textarea name="content" id="editor"><?php
+
+ if ($_GET['file'] === "conduct.fr") {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $_GET['file'] . ".html")) {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $_GET['file'] . ".html"));
+ } else {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/fr.html"));
+ }
+ }
+
+ if ($_GET['file'] === "conduct.en") {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $_GET['file'] . ".html")) {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $_GET['file'] . ".html"));
+ } else {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/en.html"));
+ }
+ }
+
+ if ($_GET['file'] === "blog.en") {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_GET['article']}.json.html")) {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_GET['article']}.json.html"));
+ } else {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_GET['article']}.json.html"));
+ }
+ }
+
+ if ($_GET['file'] === "blog.fr") {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_GET['article']}.json.fr.html")) {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_GET['article']}.json.fr.html"));
+ } else {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_GET['article']}.json.fr.html")) {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_GET['article']}.json.fr.html"));
+ } else {
+ echo(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_GET['article']}.json.html"));
+ }
+ }
+ }
+
+ ?></textarea>
+
+ <br>
+
+ <script src="/static/js/ckeditor.js"></script>
+ <script>
+ let colors = [{
+ color: 'hsl(0, 0%, 0%)',
+ },
+ {
+ color: 'hsl(0, 0%, 12.5%)',
+ },
+ {
+ color: 'hsl(0, 0%, 25%)',
+ },
+ {
+ color: 'hsl(0, 0%, 37.5%)',
+ },
+ {
+ color: 'hsl(0, 0%, 50%)',
+ },
+ {
+ color: 'hsl(0, 0%, 62.5%)',
+ },
+ {
+ color: 'hsl(0, 0%, 75%)',
+ },
+ {
+ color: 'hsl(0, 0%, 87.5%)',
+ },
+ {
+ color: 'hsl(0, 0%, 100%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(0, 100%, 10%)',
+ },
+ {
+ color: 'hsl(0, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(0, 100%, 25%)',
+ },
+ {
+ color: 'hsl(0, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(0, 100%, 50%)',
+ },
+ {
+ color: 'hsl(0, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(0, 100%, 75%)',
+ },
+ {
+ color: 'hsl(0, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(0, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(30, 100%, 10%)',
+ },
+ {
+ color: 'hsl(30, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(30, 100%, 25%)',
+ },
+ {
+ color: 'hsl(30, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(30, 100%, 50%)',
+ },
+ {
+ color: 'hsl(30, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(30, 100%, 75%)',
+ },
+ {
+ color: 'hsl(30, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(30, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(60, 100%, 10%)',
+ },
+ {
+ color: 'hsl(60, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(60, 100%, 25%)',
+ },
+ {
+ color: 'hsl(60, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(60, 100%, 50%)',
+ },
+ {
+ color: 'hsl(60, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(60, 100%, 75%)',
+ },
+ {
+ color: 'hsl(60, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(60, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(90, 100%, 10%)',
+ },
+ {
+ color: 'hsl(90, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(90, 100%, 25%)',
+ },
+ {
+ color: 'hsl(90, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(90, 100%, 50%)',
+ },
+ {
+ color: 'hsl(90, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(90, 100%, 75%)',
+ },
+ {
+ color: 'hsl(90, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(90, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(120, 100%, 10%)',
+ },
+ {
+ color: 'hsl(120, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(120, 100%, 25%)',
+ },
+ {
+ color: 'hsl(120, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(120, 100%, 50%)',
+ },
+ {
+ color: 'hsl(120, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(120, 100%, 75%)',
+ },
+ {
+ color: 'hsl(120, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(120, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(150, 100%, 10%)',
+ },
+ {
+ color: 'hsl(150, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(150, 100%, 25%)',
+ },
+ {
+ color: 'hsl(150, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(150, 100%, 50%)',
+ },
+ {
+ color: 'hsl(150, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(150, 100%, 75%)',
+ },
+ {
+ color: 'hsl(150, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(150, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(180, 100%, 10%)',
+ },
+ {
+ color: 'hsl(180, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(180, 100%, 25%)',
+ },
+ {
+ color: 'hsl(180, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(180, 100%, 50%)',
+ },
+ {
+ color: 'hsl(180, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(180, 100%, 75%)',
+ },
+ {
+ color: 'hsl(180, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(180, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(210, 100%, 10%)',
+ },
+ {
+ color: 'hsl(210, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(210, 100%, 25%)',
+ },
+ {
+ color: 'hsl(210, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(210, 100%, 50%)',
+ },
+ {
+ color: 'hsl(210, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(210, 100%, 75%)',
+ },
+ {
+ color: 'hsl(210, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(210, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(240, 100%, 10%)',
+ },
+ {
+ color: 'hsl(240, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(240, 100%, 25%)',
+ },
+ {
+ color: 'hsl(240, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(240, 100%, 50%)',
+ },
+ {
+ color: 'hsl(240, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(240, 100%, 75%)',
+ },
+ {
+ color: 'hsl(240, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(240, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(270, 100%, 10%)',
+ },
+ {
+ color: 'hsl(270, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(270, 100%, 25%)',
+ },
+ {
+ color: 'hsl(270, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(270, 100%, 50%)',
+ },
+ {
+ color: 'hsl(270, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(270, 100%, 75%)',
+ },
+ {
+ color: 'hsl(270, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(270, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(300, 100%, 10%)',
+ },
+ {
+ color: 'hsl(300, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(300, 100%, 25%)',
+ },
+ {
+ color: 'hsl(300, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(300, 100%, 50%)',
+ },
+ {
+ color: 'hsl(300, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(300, 100%, 75%)',
+ },
+ {
+ color: 'hsl(300, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(300, 100%, 90%)',
+ hasBorder: true,
+ },
+ {
+ color: 'hsl(330, 100%, 10%)',
+ },
+ {
+ color: 'hsl(330, 100%, 12.5%)',
+ },
+ {
+ color: 'hsl(330, 100%, 25%)',
+ },
+ {
+ color: 'hsl(330, 100%, 37.5%)',
+ },
+ {
+ color: 'hsl(330, 100%, 50%)',
+ },
+ {
+ color: 'hsl(330, 100%, 62.5%)',
+ },
+ {
+ color: 'hsl(330, 100%, 75%)',
+ },
+ {
+ color: 'hsl(330, 100%, 87.5%)',
+ },
+ {
+ color: 'hsl(330, 100%, 90%)',
+ hasBorder: true,
+ }];
+ let editor;
+ ClassicEditor
+ .create( document.querySelector( '#editor' ), {
+ toolbar: [
+ 'undo', 'redo', '|', 'removeFormat', '|', 'heading', '|', 'fontSize', 'fontColor', 'fontBackgroundColor', 'alignment', '|', 'bold', 'italic', 'underline', 'strikethrough', '|', 'subscript', 'superscript', '|', 'code', '|', 'outdent', 'indent', '|', 'bulletedList', 'numberedList', '|', 'link', 'imageUpload', 'mediaEmbed', 'blockQuote', 'insertTable', 'codeBlock', '|', 'horizontalLine'
+ ],
+ fontColor: {
+ colors: colors,
+ columns: 9
+ },
+ autosave: {
+ save( editor ) {
+ return saveData( editor.getData() );
+ }
+ },
+ } )
+
+ .then( newEditor => {
+ editor = newEditor;
+ } )
+ .catch( error => {
+ console.error( error );
+ } );
+ </script>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction, JSUnfilteredForInLoop -->
+ <script>
+ function publish() {
+ $("html, body").animate({scrollTop: 0}, 100);
+ document.getElementById("autosave-status").style.opacity = "0";
+ setTimeout(() => {
+ document.getElementById("autosave-status").innerText = "Publishing...";
+ document.getElementById("autosave-status").style.opacity = "1";
+ setTimeout(() => {
+ $.ajax("/admin/api/setlive.php", {
+ dataType: 'text',
+ type: 'post',
+ contentType: 'application/x-www-form-urlencoded',
+ data: {
+ document: "<?= $_GET['file'] ?>",
+ <?= isset($_GET['article']) ? "article: \"{$_GET['article']}\"" : "" ?>
+ },
+ success: (data) => {
+ document.getElementById("autosave-status").style.opacity = "0";
+ setTimeout(() => {
+ document.getElementById("autosave-status").innerText = "Published";
+ document.getElementById("autosave-status").style.opacity = "1";
+ }, 200)
+ document.getElementById("publish-btn").disabled = data.trim() === "false";
+ },
+ error: (e) => {
+ console.error(e);
+ document.getElementById("autosave-status").style.opacity = "0";
+ setTimeout(() => {
+ document.getElementById("autosave-status").innerText = "Unable to publish";
+ document.getElementById("autosave-status").style.opacity = "1";
+ }, 200)
+ alert("An error prevents publishing the document. You may continue editing it but your changes may not be automatically saved on the server");
+ }
+ });
+ }, 200)
+ }, 200)
+ }
+
+ function saveData(data) {
+ document.getElementById("autosave-status").style.opacity = "0";
+ setTimeout(() => {
+ document.getElementById("autosave-status").innerText = "Saving...";
+ document.getElementById("autosave-status").style.opacity = "1";
+ setTimeout(() => {
+ $.ajax("/admin/api/autosave.php", {
+ dataType: 'text',
+ type: 'post',
+ contentType: 'application/x-www-form-urlencoded',
+ data: {
+ document: "<?= $_GET['file'] ?>",
+ <?= isset($_GET['article']) ? "article: \"{$_GET['article']}\"," : "" ?>
+ content: data
+ },
+ success: (data) => {
+ $.ajax("/admin/api/draftvslive.php", {
+ dataType: 'text',
+ type: 'post',
+ contentType: 'application/x-www-form-urlencoded',
+ data: {
+ document: "<?= $_GET['file'] ?>",
+ <?= isset($_GET['article']) ? "article: \"{$_GET['article']}\"" : "" ?>
+ },
+ success: (data) => {
+ document.getElementById("autosave-status").style.opacity = "0";
+ setTimeout(() => {
+ document.getElementById("autosave-status").innerText = "Saved as draft";
+ document.getElementById("autosave-status").style.opacity = "1";
+ }, 200)
+ document.getElementById("publish-btn").disabled = data.trim() === "true";
+ },
+ error: (e) => {
+ console.error(e);
+ document.getElementById("autosave-status").style.opacity = "0";
+ setTimeout(() => {
+ document.getElementById("autosave-status").innerText = "Unable to save";
+ document.getElementById("autosave-status").style.opacity = "1";
+ }, 200)
+ alert("An error prevents saving the document. You may continue editing it but your changes won't be automatically saved on the server");
+ }
+ });
+ },
+ error: (e) => {
+ console.error(e);
+ document.getElementById("autosave-status").style.opacity = "0";
+ setTimeout(() => {
+ document.getElementById("autosave-status").innerText = "Unable to save";
+ document.getElementById("autosave-status").style.opacity = "1";
+ }, 200)
+ alert("An error prevents saving the document. You may continue editing it but your changes won't be automatically saved on the server");
+ }
+ });
+ }, 200)
+ }, 200)
+ }
+ </script>
+
+ <link rel="stylesheet" href="/static/css/editor.css">
+ <p style="text-align: center;"><button id="publish-btn" onclick="publish();" class="btn btn-primary">Publish changes</button></p>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/files.php b/admin/panes/files.php new file mode 100644 index 0000000..5f836de --- /dev/null +++ b/admin/panes/files.php @@ -0,0 +1,4 @@ +<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/tinyfilemanager.php";
\ No newline at end of file diff --git a/admin/panes/hardware.lshw.php b/admin/panes/hardware.lshw.php new file mode 100644 index 0000000..f50c1ce --- /dev/null +++ b/admin/panes/hardware.lshw.php @@ -0,0 +1,4 @@ +<?php + +exec("sudo lshw -html -quiet", $ret); +echo(implode("\n", $ret));
\ No newline at end of file diff --git a/admin/panes/hardware.php b/admin/panes/hardware.php new file mode 100644 index 0000000..05c839f --- /dev/null +++ b/admin/panes/hardware.php @@ -0,0 +1,76 @@ +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style><?php
+
+function command($command) {
+ $data = [];
+ exec($command, $data);
+ return implode("\n", $data);
+}
+
+?>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Hardware Information</h2>
+ <ul class="list-group">
+ <li class="list-group-item">
+ <details>
+ <summary>General system information</summary>
+ <iframe src="/admin/panes/hardware.lshw.php" style="border:none;width:100%;height:100vh;"></iframe>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Attached PCI devices</summary>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?= command("lspci") ?></pre>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Attached USB devices</summary>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?= command("lsusb -t") ?></pre>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Attached processors</summary>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?= command("lscpu") ?></pre>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Loaded kernel modules</summary>
+ <pre style="background:#111;color:white;border-radius:5px;padding: 10px;"><?= command("lsmod") ?></pre>
+ </details>
+ </li>
+ </ul>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/home.php b/admin/panes/home.php index ac106e4..fade996 100644 --- a/admin/panes/home.php +++ b/admin/panes/home.php @@ -1,136 +1,133 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?> - -<style> - ::-webkit-scrollbar { - width: 5px; - } - - ::-webkit-scrollbar-track { - border-radius: 9999px; - background: transparent; - } - - ::-webkit-scrollbar-thumb { - border-radius: 9999px; - background-color: rgba(136, 136, 136, 0.5); - transition: background 200ms; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: rgba(85, 85, 85, 0.75); - } - - ::-webkit-scrollbar-thumb:active { - background-color: #222; - } - - .list-group-item { - background: #34373c; - } -</style> - -<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;"> - <h2 style="text-align:center;">Welcome back <?= $_DATA["name"] ?>!</h2> - <ul class="list-group" style="margin-top:30px;"> - <li class="list-group-item"> - <span id="temperature">Server running at <b><?php - - exec("sensors -j", $out); - $outp = implode("\n", $out); - $outd = json_decode($outp, true); - - echo(round($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"], 1)); - - ?>°C</b>, <?php - - if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 90) { - echo("completely overheating!"); - } else if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 60) { - echo("starting to throttle!"); - } else { - echo("under normal temperatures"); - } - - ?></span> <a href="#" onclick="window.parent.activity('activity-version', '/admin/panes/version.php', window.parent.document.getElementById('activity-version'));" style="float:right;">Manage...</a></li><li class="list-group-item"><b><?php - - $uca = scandir("/mnt/blogchain/_posts"); - $uct = []; - - foreach ($uca as $art) { - if (is_file("/mnt/blogchain/_posts/" . $art) && substr($art, 0, 1) !== "." && substr($art, 0, 1) !== "_") { - $uct[] = $art; - } - } - - echo(count($uct)); - - ?></b> UnchainedTech article·s, <?php - - $uca = scandir("/mnt/blogchain/_posts/_drafts"); - $uct2 = []; - - foreach ($uca as $art) { - if (is_file("/mnt/blogchain/_posts/_drafts/" . $art) && substr($art, 0, 1) !== "." && substr($art, 0, 1) !== "_") { - $uct2[] = $art; - } - } - - echo(count($uct2)); - - ?> draft·s <a onclick="window.parent.activity('activity-unchained', '/admin/panes/unchained.php', window.parent.document.getElementById('activity-unchained'));" href="#" style="float:right;">Manage...</a></li> - <li class="list-group-item"><b><?php - - $uca = scandir("/mnt/minteckrolt-cloud"); - $uct3 = []; - - foreach ($uca as $art) { - if (is_dir("/mnt/minteckrolt-cloud/" . $art) && substr($art, 0, 1) === "~") { - $uct3[] = $art; - } - } - - echo(count($uct3)); - - ?></b> Neutron Cloud website·s <a onclick="window.parent.activity('activity-quotas', '/admin/panes/quotas.php', window.parent.document.getElementById('activity-quotas'));" href="#" style="float:right;">Manage...</a></li> - <li class="list-group-item"><b><?php - - $uca = scandir("/mnt/kartik/online/private/stats"); - $uct4 = []; - - foreach ($uca as $art) { - if (is_file("/mnt/kartik/online/private/stats/" . $art)) { - $uct4[] = $art; - } - } - - echo(count($uct4)); - - ?></b> Kartik Online player·s <a onclick="window.parent.activity('activity-kartik', '/admin/panes/kartik.php', window.parent.document.getElementById('activity-kartik'));" href="#" style="float:right;">Manage...</a></li> - <li class="list-group-item"><b><?php - - $uca = scandir("/mnt/minteckrolt-main/includes/blog/data"); - $uct5 = []; - - foreach ($uca as $art) { - if (is_dir("/mnt/minteckrolt-main/includes/blog/data/" . $art)) { - $uct4[] = $art; - } - } - - echo(count($uct4)); - - ?></b> blog article·s <a onclick="window.parent.activity('activity-blog', '/admin/panes/blog.php', window.parent.document.getElementById('activity-blog'));" href="#" style="float:right;">Manage...</a></li> - </ul> - <!--suppress JSUnresolvedVariable, JSUnresolvedFunction --> - <script> - setInterval(() => { - $.ajax("/admin/api/serverTemp.php", { - success: (data) => { - document.getElementById("temperature").innerHTML = data; - } - }); - }, 500) - </script> -</div> - +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Welcome back <?= $_DATA["name"] ?>!</h2>
+ <ul class="list-group" style="margin-top:30px;">
+ <li class="list-group-item">
+ <span id="temperature">Server running at <b><?php
+
+ exec("sensors -j", $out);
+ $outp = implode("\n", $out);
+ $outd = json_decode($outp, true);
+
+ echo(round($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"], 1));
+
+ ?>°C</b>, <?php
+
+ if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 90) {
+ echo("completely overheating!");
+ } else if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 60) {
+ echo("starting to throttle!");
+ } else {
+ echo("under normal temperatures");
+ }
+
+ ?></span> <a href="#" onclick="window.parent.activity('activity-version', '/admin/panes/version.php', window.parent.document.getElementById('activity-version'));" style="float:right;">Manage...</a></li><li class="list-group-item"><b><?php
+
+ $uca = scandir("/mnt/blogchain/_posts");
+ $uct = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/blogchain/_posts/" . $art) && substr($art, 0, 1) !== "." && substr($art, 0, 1) !== "_") {
+ $uct[] = $art;
+ }
+ }
+
+ echo(count($uct));
+
+ ?></b> UnchainedTech article·s, <?php
+
+ $uca = scandir("/mnt/blogchain/_posts/_drafts");
+ $uct2 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/blogchain/_posts/_drafts/" . $art) && substr($art, 0, 1) !== "." && substr($art, 0, 1) !== "_") {
+ $uct2[] = $art;
+ }
+ }
+
+ echo(count($uct2));
+
+ ?> draft·s <a onclick="window.parent.activity('activity-unchained', '/admin/panes/unchained.php', window.parent.document.getElementById('activity-unchained'));" href="#" style="float:right;">Manage...</a></li>
+ <li class="list-group-item"><b><?php
+
+ $uca = scandir("/mnt/minteckrolt-cloud");
+ $uct3 = [];
+
+ foreach ($uca as $art) {
+ if (is_dir("/mnt/minteckrolt-cloud/" . $art) && substr($art, 0, 1) === "~") {
+ $uct3[] = $art;
+ }
+ }
+
+ echo(count($uct3));
+
+ ?></b> Neutron Cloud website·s <a onclick="window.parent.activity('activity-quotas', '/admin/panes/quotas.php', window.parent.document.getElementById('activity-quotas'));" href="#" style="float:right;">Manage...</a></li>
+ <li class="list-group-item"><b><?php
+
+ $uca = scandir("/mnt/kartik/online/private/stats");
+ $uct4 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/kartik/online/private/stats/" . $art)) {
+ $uct4[] = $art;
+ }
+ }
+
+ echo(count($uct4));
+
+ ?></b> Kartik Online player·s <a onclick="window.parent.activity('activity-kartik', '/admin/panes/kartik.php', window.parent.document.getElementById('activity-kartik'));" href="#" style="float:right;">Manage...</a></li>
+ <li class="list-group-item">Using <b><?php
+
+ exec("df -h -x tmpfs -x squashfs -x devtmpfs --total -P", $outdisk);
+ $outn = explode(" ", preg_replace('/\s+/', ' ', $outdisk[count($outdisk) - 1]));
+ echo($outn[2] . "/" . $outn[1]);
+
+ ?></b> on all disks, <b><?php
+
+ echo($outn[3]);
+
+ ?></b> free <a onclick="window.parent.activity('activity-disk', '/admin/panes/disk.php', window.parent.document.getElementById('activity-disk'));" href="#" style="float:right;">Manage...</a></li>
+ </ul>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
+ <script>
+ setInterval(() => {
+ $.ajax("/admin/api/serverTemp.php", {
+ success: (data) => {
+ document.getElementById("temperature").innerHTML = data;
+ }
+ });
+ }, 500)
+ </script>
+</div>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/kartik.php b/admin/panes/kartik.php index 87a975f..10b47f5 100644 --- a/admin/panes/kartik.php +++ b/admin/panes/kartik.php @@ -1,111 +1,111 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?> - -<style> - ::-webkit-scrollbar { - width: 5px; - } - - ::-webkit-scrollbar-track { - border-radius: 9999px; - background: transparent; - } - - ::-webkit-scrollbar-thumb { - border-radius: 9999px; - background-color: rgba(136, 136, 136, 0.5); - transition: background 200ms; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: rgba(85, 85, 85, 0.75); - } - - ::-webkit-scrollbar-thumb:active { - background-color: #222; - } - - .list-group-item { - background: #34373c; - } -</style> - -<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;"> - <div> - <h2 style="text-align:center;">Kartik Online</h2> - <h4 style="text-align:center;"><?php - - $uca = scandir("/mnt/kartik/online/private/stats"); - $uct4 = []; - - foreach ($uca as $art) { - if (is_file("/mnt/kartik/online/private/stats/" . $art)) { - $uct4[] = $art; - } - } - - echo(count($uct4)); - - ?> player·s</h4> - - <ul class="list-group"> - <?php - - $uca = scandir("/mnt/kartik/online/private/stats"); - $uct4 = []; - - foreach ($uca as $art) { - if (is_file("/mnt/kartik/online/private/stats/" . $art)): ?> - - <li class="list-group-item"><?= $art ?> <?php - - $osession = 0; - $gsession = 0; - $tsession = 0; - - $webs = scandir("/mnt/kartik/online/private/tokens"); - $ings = scandir("/mnt/kartik/online/private/gametokens"); - - foreach ($webs as $webt) { - if (!is_dir("/mnt/kartik/online/private/tokens/" . $webt)) { - $d = json_decode(file_get_contents("/mnt/kartik/online/private/tokens/" . $webt), true); - if ($d["id"] === $art) { - $osession++; - } - } - } - - foreach ($ings as $webt) { - if (!is_dir("/mnt/kartik/online/private/gametokens/" . $webt)) { - $d = json_decode(file_get_contents("/mnt/kartik/online/private/gametokens/" . $webt), true); - if ($d["id"] === $art) { - $gsession++; - } - } - } - - $tsession = $osession + $gsession; - if ($tsession > 1) { - $tsessions = "s"; - } else { - $tsessions = ""; - } - - if ($osession > 0) { - echo("<span class='badge text-warning border-warning' style='border:1px solid;vertical-align: middle;'>{$tsession} session{$tsessions} ({$gsession}:{$osession})</span>"); - } else if ($gsession > 0) { - echo("<span class='badge text-success border-success' style='border:1px solid;vertical-align: middle;'>{$tsession} session{$tsessions} ({$gsession}:0)</span>"); - } else { - echo("<span class='badge text-light border-light' style='border:1px solid;vertical-align: middle;'>Offline (0:0)</span>"); - } - - ?> <span style="float:right;"><a href="/admin/api/terminateWebSessions.php?_=<?= $art ?>">Terminate Web</a> · <a href="/admin/api/terminateGameSessions.php?_=<?= $art ?>">Terminate Game</a> · <a href="/admin/api/terminateAllSessions.php?_=<?= $art ?>">Terminate All</a></span></li> - - <?php endif; - } - - ?> - </ul> - </div> -</div> - +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <div>
+ <h2 style="text-align:center;">Kartik Online</h2>
+ <h4 style="text-align:center;"><?php
+
+ $uca = scandir("/mnt/kartik/online/private/stats");
+ $uct4 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/kartik/online/private/stats/" . $art)) {
+ $uct4[] = $art;
+ }
+ }
+
+ echo(count($uct4));
+
+ ?> player·s</h4>
+
+ <ul class="list-group">
+ <?php
+
+ $uca = scandir("/mnt/kartik/online/private/stats");
+ $uct4 = [];
+
+ foreach ($uca as $art) {
+ if (is_file("/mnt/kartik/online/private/stats/" . $art)): ?>
+
+ <li class="list-group-item"><?= $art ?> <?php
+
+ $osession = 0;
+ $gsession = 0;
+ $tsession = 0;
+
+ $webs = scandir("/mnt/kartik/online/private/tokens");
+ $ings = scandir("/mnt/kartik/online/private/gametokens");
+
+ foreach ($webs as $webt) {
+ if (!is_dir("/mnt/kartik/online/private/tokens/" . $webt)) {
+ $d = json_decode(file_get_contents("/mnt/kartik/online/private/tokens/" . $webt), true);
+ if ($d["id"] === $art) {
+ $osession++;
+ }
+ }
+ }
+
+ foreach ($ings as $webt) {
+ if (!is_dir("/mnt/kartik/online/private/gametokens/" . $webt)) {
+ $d = json_decode(file_get_contents("/mnt/kartik/online/private/gametokens/" . $webt), true);
+ if ($d["id"] === $art) {
+ $gsession++;
+ }
+ }
+ }
+
+ $tsession = $osession + $gsession;
+ if ($tsession > 1) {
+ $tsessions = "s";
+ } else {
+ $tsessions = "";
+ }
+
+ if ($osession > 0) {
+ echo("<span class='badge text-warning border-warning' style='border:1px solid;vertical-align: middle;'>{$tsession} session{$tsessions} ({$gsession}:{$osession})</span>");
+ } else if ($gsession > 0) {
+ echo("<span class='badge text-success border-success' style='border:1px solid;vertical-align: middle;'>{$tsession} session{$tsessions} ({$gsession}:0)</span>");
+ } else {
+ echo("<span class='badge text-light border-light' style='border:1px solid;vertical-align: middle;'>Offline (0:0)</span>");
+ }
+
+ ?> <span style="float:right;"><a href="/admin/api/terminateWebSessions.php?_=<?= $art ?>">Terminate Web</a> · <a href="/admin/api/terminateGameSessions.php?_=<?= $art ?>">Terminate Game</a> · <a href="/admin/api/terminateAllSessions.php?_=<?= $art ?>">Terminate All</a></span></li>
+
+ <?php endif;
+ }
+
+ ?>
+ </ul>
+ </div>
+</div>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/neutroning.php b/admin/panes/neutroning.php new file mode 100644 index 0000000..d8a73c5 --- /dev/null +++ b/admin/panes/neutroning.php @@ -0,0 +1,65 @@ +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Neutron Cloud Map</h2>
+
+ <h4 style="text-align:center;">Full map of all the websites that exists in Neutron Cloud</h4>
+
+ <details open>
+ <summary>cloud.minteck.ro.lt</summary>
+ <?php $index=1;foreach (scandir("/mnt/minteckrolt-cloud") as $site): if (substr($site, 0, 1) === "~"): ?>
+ <details open style="margin-left:23px;">
+ <summary><a target="_blank" href="https://cloud.minteck.ro.lt/<?= $site ?>/?source=minteck-admin"><?= $site ?></a></summary>
+ <details open style="margin-left:23px;">
+ <summary>cms-special</summary>
+ <ul style="margin:0;">
+ <li><a target="_blank" href="https://cloud.minteck.ro.lt/<?= $site ?>/cms-special/admin">admin</a></li>
+ <li><a target="_blank" href="https://cloud.minteck.ro.lt/<?= $site ?>/cms-special/calendar">calendar</a></li>
+ <li><a target="_blank" href="https://cloud.minteck.ro.lt/<?= $site ?>/cms-special/gallery">gallery</a></li>
+ <li><a target="_blank" href="https://cloud.minteck.ro.lt/<?= $site ?>/cms-special/version">version</a></li>
+ </ul>
+ </details>
+ <ul style="margin:0;">
+ <?php foreach (scandir("/mnt/minteckrolt-cloud/" . $site . "/data/webcontent/pages") as $page): if (trim($page) !== "." && trim($page) !== ".."): ?>
+ <?php if ($page === "index"): ?>
+ <li><a target="_blank" href="https://cloud.minteck.ro.lt/<?= $site ?>"><?= $page ?>.php</a></li>
+ <?php else: ?>
+ <li><a target="_blank" href="https://cloud.minteck.ro.lt/<?= $site ?>/<?= $page ?>"><?= $page ?></a></li>
+ <?php endif; ?>
+ <?php endif;endforeach; ?>
+ </ul>
+ </details>
+ <?php $index++;endif;endforeach; ?>
+ </details>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/quotas.php b/admin/panes/quotas.php new file mode 100644 index 0000000..91b6899 --- /dev/null +++ b/admin/panes/quotas.php @@ -0,0 +1,56 @@ +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Neutron Cloud Quotas</h2>
+
+ <h4 style="text-align:center;">Websites that reached their limit can be locked down</h4>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <?php $index=1;foreach (scandir("/mnt/minteckrolt-cloud") as $site): if (substr($site, 0, 1) === "~"): ?>
+ <li class="list-group-item"><i><?= strip_tags(file_get_contents("/mnt/minteckrolt-cloud/" . $site . "/data/webcontent/sitename")) ?></i> (<a href="https://cloud.minteck.ro.lt/<?= $site ?>" target="_blank"><code><?= $site ?></code></a>, X<?= file_get_contents("/mnt/minteckrolt-cloud/" . $site . "/Tier") ?> Tier)<br><span class="text-muted" id="quota-<?= $index ?>">Calculating...</span><span style="float:right;"><a href="/admin/NeutronManage/?_=<?= $site ?>" target="_blank">Admin Panel</a></span><!--suppress JSUnresolvedVariable, JSUnresolvedFunction, JSUnfilteredForInLoop -->
+ <script>
+ setTimeout(() => {
+ $.ajax("/admin/api/getQuota.php?_=<?= $site ?>", {
+ async: false,
+ success: (data) => {
+ document.getElementById("quota-<?= $index ?>").innerHTML = data;
+ },
+ error: () => {
+ document.getElementById("quota-<?= $index ?>").innerText = "Unable to calculate data usage";
+ }
+ });
+ }, 1000 * <?= $index ?>)
+ </script></li>
+ <?php $index++;endif;endforeach; ?>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/telemetry.php b/admin/panes/telemetry.php new file mode 100644 index 0000000..e87be24 --- /dev/null +++ b/admin/panes/telemetry.php @@ -0,0 +1,946 @@ +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */
+
+function urlize($scheme) {
+ $p = explode(":", $scheme);
+
+ if ($p[0] === "space") {
+ return "https://minteck.ro.lt" . $p[1];
+ }
+
+ if ($p[0] === "unchained") {
+ return "https://unchainedtech.minteck.ro.lt" . $p[1];
+ }
+
+ if ($p[0] === "kartik") {
+ return "https://kartik.hopto.org" . $p[1];
+ }
+
+ return "about:blank";
+}
+
+?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">Telemetry Information</h2>
+
+ <?php $db = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/telemetry.json")); ?>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item">Lifetime Visitors <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+
+ echo (count($uniques));
+
+ ?></span></li>
+ <li class="list-group-item">Most Viewed Page <span style="float:right;"><?php
+
+ $record = 0;
+ $recname = "-";
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ $thispage = 0;
+
+ foreach ($visitors as $visitor) {
+ $thispage++;
+ }
+
+ if ($thispage > $record) {
+ $recname = "<a href='" . urlize($page) . "' target='_blank'><code>" . $page . "</code></a>";
+ $record = $thispage;
+ }
+ }
+ }
+ }
+ }
+
+ echo ($recname);
+
+ ?></span></li>
+ <li class="list-group-item">Least Viewed Page <span style="float:right;"><?php
+
+ $record = 2;
+ $recname = "-";
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ $thispage = 0;
+
+ foreach ($visitors as $visitor) {
+ $thispage++;
+ }
+
+ if ($thispage < $record) {
+ $recname = "<a href='" . urlize($page) . "' target='_blank'><code>" . $page . "</code></a>";
+ $record = $thispage;
+ }
+ }
+ }
+ }
+ }
+
+ echo ($recname);
+
+ ?></span></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item text-muted">Tomorrow <span style="float:right;"><?php
+
+ $uniques = [];
+ $totalDays = 0;
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ foreach ($days as $pages) {
+ $totalDays++;
+ $dayUniques = [];
+
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $dayUniques)) {
+ array_push($dayUniques, $visitor);
+ }
+ }
+ }
+
+ $uniques = array_merge($uniques, $dayUniques);
+ }
+ }
+ }
+
+ $expect = round(count($uniques) / $totalDays);
+ echo ($expect);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d')) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($expect - count($uniques)), 0, 1) !== "-") {
+ if ((int)($expect - count($uniques)) === 0) {
+ echo("<span style='color:orange;opacity:.5;'> (±" . ($expect - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;opacity:.5;'> (+" . ($expect - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;opacity:.5;'> (" . ($expect - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item">Today <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d')) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d', strtotime("-1 day"))) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item">Yesterday <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d', strtotime("-1 day"))) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $yesterday = count($uniques);
+ echo ($yesterday);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ if ($day === date('d', strtotime("-2 day"))) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($yesterday - count($uniques)), 0, 1) !== "-") {
+ if ((int)($yesterday - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($yesterday - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($yesterday - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($yesterday - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item text-muted"><?= date("F Y", strtotime("+1 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+ $totalDays = 0;
+
+ foreach ($db as $months) {
+ foreach ($months as $days) {
+ $totalDays++;
+ $dayUniques = [];
+
+ foreach ($days as $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $dayUniques)) {
+ array_push($dayUniques, $visitor);
+ }
+ }
+ }
+ }
+
+ $uniques = array_merge($uniques, $dayUniques);
+ }
+ }
+
+ $expect = round(count($uniques) / $totalDays);
+ echo ($expect);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($expect - count($uniques)), 0, 1) !== "-") {
+ if ((int)($expect - count($uniques)) === 0) {
+ echo("<span style='color:orange;opacity:.5;'> (±" . ($expect - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;opacity:.5;'> (+" . ($expect - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;opacity:.5;'> (" . ($expect - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("F Y") ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m')) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-1 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("F Y", strtotime("-1 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-1 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-2 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("F Y", strtotime("-2 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-2 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-3 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li><li class="list-group-item"><?= date("F Y", strtotime("-3 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-3 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-4 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li><li class="list-group-item"><?= date("F Y", strtotime("-4 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-4 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-5 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li><li class="list-group-item"><?= date("F Y", strtotime("-5 month")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-5 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ if ($month === date('m', strtotime("-6 month"))) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item"><?= date("Y") ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y')) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-1 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("Y", strtotime("-1 year")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-1 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-2 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ <li class="list-group-item"><?= date("Y", strtotime("-2 year")) ?> <span style="float:right;"><?php
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-2 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $today = count($uniques);
+ echo ($today);
+
+ $uniques = [];
+
+ foreach ($db as $year => $months) {
+ if ($year === date('y', strtotime("-3 year"))) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ foreach ($visitors as $visitor) {
+ if (!in_array($visitor, $uniques)) {
+ array_push($uniques, $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ if (substr((string)($today - count($uniques)), 0, 1) !== "-") {
+ if ((int)($today - count($uniques)) === 0) {
+ echo("<span style='color:orange;'> (±" . ($today - count($uniques)) . ")</span>");
+ } else {
+ echo("<span style='color:limegreen;'> (+" . ($today - count($uniques)) . ")</span>");
+ }
+ } else {
+ echo("<span style='color:red;'> (" . ($today - count($uniques)) . ")</span>");
+ }
+
+ ?></span></li>
+ </ul>
+
+ <br>
+
+ <ul class="list-group">
+ <li class="list-group-item">
+ <details>
+ <summary>Kartik downloads</summary>
+ <ul class="list-group">
+ <li class="list-group-item"><b>All update channels <span style="float:right;"><?= (int)trim(file_get_contents("/mnt/kartik-cdn/stats/stable")) + (int)trim(file_get_contents("/mnt/kartik-cdn/stats/eap")) + (int)trim(file_get_contents("/mnt/kartik-cdn/stats/beta")) + (int)trim(file_get_contents("/mnt/kartik-cdn/stats/nightly")) ?> downloads</span></b></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo.png" width="24px"> Kartik Stable <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/stable")) ?> downloads</span></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo-eap.png" width="24px"> Kartik EAP <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/eap")) ?> downloads</span></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo-beta.png" width="24px"> Kartik Beta <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/beta")) ?> downloads</span></li>
+ <li class="list-group-item"><img alt="" src="https://github.com/Minteck-Projects/Kartik-Core/raw/trunk/logo/logo-nightly.png" width="24px"> Kartik Nightly <span style="float:right;"><?= trim(file_get_contents("/mnt/kartik-cdn/stats/nightly")) ?> downloads</span></li>
+ </ul>
+ </details>
+ </li>
+ <li class="list-group-item">
+ <details>
+ <summary>Page-specific statistics</summary>
+ <p>
+ <?php
+
+ $assocs = [];
+ $spages = [];
+
+ foreach ($db as $year => $months) {
+ foreach ($months as $month => $days) {
+ foreach ($days as $day => $pages) {
+ foreach ($pages as $page => $visitors) {
+ if (substr($page, 0, 7) !== "/admin/") {
+ if (!isset($spages[$page])) {
+ $spages[$page] = 0;
+ }
+ foreach ($visitors as $visitor) {
+ if (!in_array($page . "|" . $visitor, $assocs)) {
+ $spages[$page]++;
+ array_push($assocs, $page . "|" . $visitor);
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+
+ $max = 0;
+ foreach ($spages as $visitors) {
+ if ($visitors > $max) {
+ $max = $visitors;
+ }
+ }
+
+ arsort($spages);
+
+ foreach ($spages as $page => $visitors): ?>
+ <div class="progress" style="height:25px;background:#222;margin-bottom:2px;">
+ <div class="progress-bar" style="background:#444;width:<?= ($visitors/$max)*100 ?>%;"></div>
+ <span class="progress-bar-text"><a class="text-white" href="<?= urlize($page) ?>" target="_blank"><?= $page ?></a> <span class="text-muted">(<?= $visitors ?>)</span></span>
+ </div>
+ <?php endforeach; ?>
+ </p>
+
+ <style>
+ .progress-bar-text {
+ position: absolute;
+ padding-top: 14px;
+ font-size: 14px;
+ text-align:left;
+ padding-left:10px;
+ }
+ </style>
+ </details>
+ </li>
+ </ul>
+</div>
+
+<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/unchained.php b/admin/panes/unchained.php index cab35b5..8f3133f 100644 --- a/admin/panes/unchained.php +++ b/admin/panes/unchained.php @@ -1,81 +1,81 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?> - -<style> - ::-webkit-scrollbar { - width: 5px; - } - - ::-webkit-scrollbar-track { - border-radius: 9999px; - background: transparent; - } - - ::-webkit-scrollbar-thumb { - border-radius: 9999px; - background-color: rgba(136, 136, 136, 0.5); - transition: background 200ms; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: rgba(85, 85, 85, 0.75); - } - - ::-webkit-scrollbar-thumb:active { - background-color: #222; - } - - .list-group-item { - background: #34373c; - } -</style> - -<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;display: flex;align-items:center;justify-content: center;height:100%;" id="main"> - <div> - <p style="text-align: center;"> - <img src="/logo.svg" width="96px"><span class="text-muted"> ⏵⏵⏵ </span><!--suppress CheckImageSize --> - <img src="/static/apps/unchainedtech.png" width="96px"> - </p> - <br> - <h2 style="text-align:center;">You already have access to UnchainedTech Admin</h2> - - <h4 style="text-align:center;">We automatically logged you into UnchainedTech Admin when you logged in to Minteck Admin</h4><br> - - <div style="text-align: center;width:max-content;margin-left:auto;margin-right:auto;"> - <p class="btn-group"> - <a href="https://unchainedtech.minteck.ro.lt/articles" target="_blank" class="btn btn-outline-light">All Articles</a> - <a href="https://unchainedtech.minteck.ro.lt/admin" target="_blank" class="btn btn-outline-light">Admin Tasks</a> - </p> - </div> - - <small><p style="text-align: center;"> - v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='none';document.getElementById('secondary').style.display='';">Manage drafts</a> - </p></small> - </div> -</div> - - <div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;display:none;" id="secondary"> - <div> - <h2 style="text-align:center;">UnchainedTech</h2> - <h4 style="text-align:center;">Drafts List</h4> - - <small><p style="text-align: center;"> - v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='flex';document.getElementById('secondary').style.display='none';">Hide drafts list</a> - </p></small> - - <ul class="list-group"> - <?php - - $drafts = false; - foreach (scandir("/mnt/blogchain/_posts/_drafts") as $draft) { - if ($draft !== "." && $draft !== ".." && $draft !== ".gitkeep" && $draft !== "_template.md") { - $drafts = true; - echo('<li class="list-group-item">' . substr($draft, 0, -3) . '<span style="float:right;"><a href="https://unchainedtech.minteck.ro.lt/admin/article/' . substr($draft, 0, -3) . '" target="_blank">Preview</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/edit/production/_drafts/' . $draft . '" target="_blank">Edit</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/delete/production/_drafts/' . $draft . '" target="_blank">Delete</a></span></li>'); - } - } - - ?> - </ul> - </div> - </div> - +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;display: flex;align-items:center;justify-content: center;height:100%;" id="main">
+ <div>
+ <p style="text-align: center;">
+ <img src="/logo.svg" width="96px"><span class="text-muted"> ⏵⏵⏵ </span><!--suppress CheckImageSize -->
+ <img src="/static/apps/unchainedtech.png" width="96px">
+ </p>
+ <br>
+ <h2 style="text-align:center;">You already have access to UnchainedTech Admin</h2>
+
+ <h4 style="text-align:center;">We automatically logged you into UnchainedTech Admin when you logged in to Minteck Admin</h4><br>
+
+ <div style="text-align: center;width:max-content;margin-left:auto;margin-right:auto;">
+ <p class="btn-group">
+ <a href="https://unchainedtech.minteck.ro.lt/articles" target="_blank" class="btn btn-outline-light">All Articles</a>
+ <a href="https://unchainedtech.minteck.ro.lt/admin" target="_blank" class="btn btn-outline-light">Admin Tasks</a>
+ </p>
+ </div>
+
+ <small><p style="text-align: center;">
+ v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='none';document.getElementById('secondary').style.display='';">Manage drafts</a>
+ </p></small>
+ </div>
+</div>
+
+ <div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;display:none;" id="secondary">
+ <div>
+ <h2 style="text-align:center;">UnchainedTech</h2>
+ <h4 style="text-align:center;">Drafts List</h4>
+
+ <small><p style="text-align: center;">
+ v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='flex';document.getElementById('secondary').style.display='none';">Hide drafts list</a>
+ </p></small>
+
+ <ul class="list-group">
+ <?php
+
+ $drafts = false;
+ foreach (scandir("/mnt/blogchain/_posts/_drafts") as $draft) {
+ if ($draft !== "." && $draft !== ".." && $draft !== ".gitkeep" && $draft !== "_template.md") {
+ $drafts = true;
+ echo('<li class="list-group-item">' . substr($draft, 0, -3) . '<span style="float:right;"><a href="https://unchainedtech.minteck.ro.lt/admin/article/' . substr($draft, 0, -3) . '" target="_blank">Preview</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/edit/production/_drafts/' . $draft . '" target="_blank">Edit</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/delete/production/_drafts/' . $draft . '" target="_blank">Delete</a></span></li>');
+ }
+ }
+
+ ?>
+ </ul>
+ </div>
+ </div>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/uptime.php b/admin/panes/uptime.php index 71a6545..bc2a43e 100644 --- a/admin/panes/uptime.php +++ b/admin/panes/uptime.php @@ -1,87 +1,87 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?> - -<style> - ::-webkit-scrollbar { - width: 5px; - } - - ::-webkit-scrollbar-track { - border-radius: 9999px; - background: transparent; - } - - ::-webkit-scrollbar-thumb { - border-radius: 9999px; - background-color: rgba(136, 136, 136, 0.5); - transition: background 200ms; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: rgba(85, 85, 85, 0.75); - } - - ::-webkit-scrollbar-thumb:active { - background-color: #222; - } - - .list-group-item { - background: #34373c; - } -</style> - -<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;"> - <h2 style="text-align:center;">The server has been running for</h2> - - <h4 style="text-align:center;" id="uptime"><?php - - $str = @file_get_contents('/proc/uptime'); - $num = floatval($str); - $secs = fmod($num, 60); $num = intdiv($num, 60); - $mins = $num % 60; $num = intdiv($num, 60); - $hours = $num % 24; $num = intdiv($num, 24); - $days = $num; - - echo($days . " day·s, " . $hours . " hour·s, " . $mins . " minute·s, " . ceil($secs) . " second·s") - - ?></h4> - <!--suppress JSUnresolvedVariable, JSUnresolvedFunction --> - <script> - setInterval(() => { - $.ajax("/admin/api/serverTime.php", { - success: (data) => { - document.getElementById("uptime").innerText = data; - } - }); - }, 500) - </script> - - <ul class="list-group" style="margin-top:20px;"> - <li class="list-group-item"> - <b><?php - - exec("journalctl --disk-usage", $ret); - $data = trim(implode("\n", $ret)); - - $val = explode(" ", $data)[6]; - echo($val); - - ?></b> of data has been collected to ensure easy system maintenance and audit - </li> - <li class="list-group-item" id="logsummary"> - Calculating... - </li> - <!--suppress JSUnresolvedVariable, JSUnresolvedFunction --> - <script> - $.ajax("/admin/api/serverLogSummary.php", { - success: (data) => { - document.getElementById("logsummary").innerHTML = data; - }, - error: () => { - document.getElementById("logsummary").innerText = "An error occurred while loading this content"; - } - }); - </script> - </ul> -</div> - +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">The server has been running for</h2>
+
+ <h4 style="text-align:center;" id="uptime"><?php
+
+ $str = @file_get_contents('/proc/uptime');
+ $num = floatval($str);
+ $secs = fmod($num, 60); $num = intdiv($num, 60);
+ $mins = $num % 60; $num = intdiv($num, 60);
+ $hours = $num % 24; $num = intdiv($num, 24);
+ $days = $num;
+
+ echo($days . " day·s, " . $hours . " hour·s, " . $mins . " minute·s, " . ceil($secs) . " second·s")
+
+ ?></h4>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
+ <script>
+ setInterval(() => {
+ $.ajax("/admin/api/serverTime.php", {
+ success: (data) => {
+ document.getElementById("uptime").innerText = data;
+ }
+ });
+ }, 500)
+ </script>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item">
+ <b><?php
+
+ exec("journalctl --disk-usage", $ret);
+ $data = trim(implode("\n", $ret));
+
+ $val = explode(" ", $data)[6];
+ echo($val);
+
+ ?></b> of data has been collected to ensure easy system maintenance and audit
+ </li>
+ <li class="list-group-item" id="logsummary">
+ Calculating...
+ </li>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
+ <script>
+ $.ajax("/admin/api/serverLogSummary.php", {
+ success: (data) => {
+ document.getElementById("logsummary").innerHTML = data;
+ },
+ error: () => {
+ document.getElementById("logsummary").innerText = "An error occurred while loading this content";
+ }
+ });
+ </script>
+ </ul>
+</div>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file diff --git a/admin/panes/version.php b/admin/panes/version.php index 04ef136..10f1274 100644 --- a/admin/panes/version.php +++ b/admin/panes/version.php @@ -1,139 +1,140 @@ -<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?> - -<style> - ::-webkit-scrollbar { - width: 5px; - } - - ::-webkit-scrollbar-track { - border-radius: 9999px; - background: transparent; - } - - ::-webkit-scrollbar-thumb { - border-radius: 9999px; - background-color: rgba(136, 136, 136, 0.5); - transition: background 200ms; - } - - ::-webkit-scrollbar-thumb:hover { - background-color: rgba(85, 85, 85, 0.75); - } - - ::-webkit-scrollbar-thumb:active { - background-color: #222; - } - - .list-group-item { - background: #34373c; - } -</style> - -<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;"> - <h2 style="text-align:center;">This server is running <?= php_uname('s') ?> version</h2> - - <h4 style="text-align:center;"><?= php_uname('r') . " " . php_uname('v') ?></h4> - - <ul class="list-group" style="margin-top:20px;"> - <li class="list-group-item">PHP <?= PHP_VERSION ?></li> - <li class="list-group-item">UnchainedTech <?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?></li> - <li class="list-group-item">Neutron Cloud <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/version")) ?></li> - <li class="list-group-item">Neutron Copper <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/cyclic_version")) ?></li> - <li class="list-group-item">Neutron Titanium <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/jaw_version")) ?></li> - <li class="list-group-item"> - <?php - - $osr = []; - $lines = explode("\n", file_get_contents("/etc/os-release")); - - foreach ($lines as $line) { - if (trim($line) !== "") { - $parts = explode("=", $line); - $osr[$parts[0]] = str_replace("\"", "", $parts[1]); - } - } - - echo($osr["NAME"] . " " . $osr["VERSION"]); - - ?> - </li> - <li class="list-group-item">Git <?php exec("git --version", $res);$p = explode(" ", $res[0]);array_shift($p);array_shift($p);echo(implode(" ", $p)) ?></li> - <li class="list-group-item"><?php - - $soft = $_SERVER['SERVER_SOFTWARE']; - - if (strpos(strtolower($soft), "apache") !== false) { - echo("Apache HTTP Server"); - } else { - echo("nginx"); - } - - ?> <?php - - $soft = $_SERVER['SERVER_SOFTWARE']; - - if (strpos(strtolower($soft), "apache") !== false) { - exec("apache2 -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2)); - } else { - exec("nginx -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2)); - } - - ?></li> - </ul> - - <ul class="list-group" style="margin-top:20px;"> - <li id="checking" class="list-group-item">Checking for updates...</li> - <li id="checking2" class="list-group-item" style="display:none;"></li> - <li id="found" class="list-group-item" style="display:none;"> - <b id="updates-count">0</b> package·s have updates available - - <details> - <summary>View details</summary> - <ul class="list-group" id="updates-list"></ul> - </details> - </li> - </ul> - <!--suppress JSUnresolvedVariable, JSUnresolvedFunction, JSUnfilteredForInLoop --> - <script> - $.ajax("/admin/api/refreshUpdates.php", { - success: (data) => { - document.getElementById("checking").innerText = "Checking for Ubuntu upgrades..."; - $.ajax("/admin/api/getUbuntuUpgrades.php", { - success: (data) => { - document.getElementById("checking").innerHTML = data; - document.getElementById("checking2").style.display = ""; - document.getElementById("checking2").innerText = "Reading package lists..."; - $.ajax("/admin/api/getUpdates.php", { - success: (data) => { - document.getElementById("checking2").innerText = "Please wait..."; - document.getElementById("updates-count").innerText = data.count; - - dom = ""; - for (let index in data.packages) { - item = data.packages[index]; - dom += `<li class="list-group-item"><b>${item.name}</b> (<span style="color: orange;">${item.version.local}</span> → <span style="color: green;">${item.version.remote}</span>)<br>Provided by: <code>${item.repos}</code>, target architecture: <code>${item.architecture}</code></li>` - } - - document.getElementById("updates-list").innerHTML = dom; - - document.getElementById("checking2").outerHTML = ""; - document.getElementById("found").style.display = ""; - }, - error: () => { - document.getElementById("checking2").innerText = "An error occurred while loading this content"; - } - }); - }, - error: () => { - document.getElementById("checking").innerText = "An error occurred while loading this content"; - } - }); - }, - error: () => { - document.getElementById("checking").innerText = "An error occurred while loading this content"; - } - }); - </script> -</div> - +<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.php";/** @var array $_DATA */ ?>
+
+<style>
+ ::-webkit-scrollbar {
+ width: 5px;
+ }
+
+ ::-webkit-scrollbar-track {
+ border-radius: 9999px;
+ background: transparent;
+ }
+
+ ::-webkit-scrollbar-thumb {
+ border-radius: 9999px;
+ background-color: rgba(136, 136, 136, 0.5);
+ transition: background 200ms;
+ }
+
+ ::-webkit-scrollbar-thumb:hover {
+ background-color: rgba(85, 85, 85, 0.75);
+ }
+
+ ::-webkit-scrollbar-thumb:active {
+ background-color: #222;
+ }
+
+ .list-group-item {
+ background: #34373c;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
+ <h2 style="text-align:center;">This server is running <?= php_uname('s') ?> version</h2>
+
+ <h4 style="text-align:center;"><?= php_uname('r') . " " . php_uname('v') ?></h4>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li class="list-group-item">PHP <?= PHP_VERSION ?></li>
+ <li class="list-group-item">Minteck's Space <?= trim(file_get_contents($_SERVER["DOCUMENT_ROOT"] . "/version.txt")) ?></li>
+ <li class="list-group-item">UnchainedTech <?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?></li>
+ <li class="list-group-item">Neutron Cloud <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/version")) ?></li>
+ <li class="list-group-item">Neutron Copper <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/cyclic_version")) ?></li>
+ <li class="list-group-item">Neutron Titanium <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/jaw_version")) ?></li>
+ <li class="list-group-item">
+ <?php
+
+ $osr = [];
+ $lines = explode("\n", file_get_contents("/etc/os-release"));
+
+ foreach ($lines as $line) {
+ if (trim($line) !== "") {
+ $parts = explode("=", $line);
+ $osr[$parts[0]] = str_replace("\"", "", $parts[1]);
+ }
+ }
+
+ echo($osr["NAME"] . " " . $osr["VERSION"]);
+
+ ?>
+ </li>
+ <li class="list-group-item">Git <?php exec("git --version", $res);$p = explode(" ", $res[0]);array_shift($p);array_shift($p);echo(implode(" ", $p)) ?></li>
+ <li class="list-group-item"><?php
+
+ $soft = $_SERVER['SERVER_SOFTWARE'];
+
+ if (strpos(strtolower($soft), "apache") !== false) {
+ echo("Apache HTTP Server");
+ } else {
+ echo("nginx");
+ }
+
+ ?> <?php
+
+ $soft = $_SERVER['SERVER_SOFTWARE'];
+
+ if (strpos(strtolower($soft), "apache") !== false) {
+ exec("apache2 -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2));
+ } else {
+ exec("nginx -v", $res2);$p = explode(" ", $res2[0]);array_shift($p);array_shift($p);$p2 = explode("/", implode(" ", $p));array_shift($p2);echo(implode(" ", $p2));
+ }
+
+ ?></li>
+ </ul>
+
+ <ul class="list-group" style="margin-top:20px;">
+ <li id="checking" class="list-group-item">Checking for updates...</li>
+ <li id="checking2" class="list-group-item" style="display:none;"></li>
+ <li id="found" class="list-group-item" style="display:none;">
+ <b id="updates-count">0</b> package·s have updates available
+
+ <details>
+ <summary>View details</summary>
+ <ul class="list-group" id="updates-list"></ul>
+ </details>
+ </li>
+ </ul>
+ <!--suppress JSUnresolvedVariable, JSUnresolvedFunction, JSUnfilteredForInLoop -->
+ <script>
+ $.ajax("/admin/api/refreshUpdates.php", {
+ success: (data) => {
+ document.getElementById("checking").innerText = "Checking for Ubuntu upgrades...";
+ $.ajax("/admin/api/getUbuntuUpgrades.php", {
+ success: (data) => {
+ document.getElementById("checking").innerHTML = data;
+ document.getElementById("checking2").style.display = "";
+ document.getElementById("checking2").innerText = "Reading package lists...";
+ $.ajax("/admin/api/getUpdates.php", {
+ success: (data) => {
+ document.getElementById("checking2").innerText = "Please wait...";
+ document.getElementById("updates-count").innerText = data.count;
+
+ dom = "";
+ for (let index in data.packages) {
+ item = data.packages[index];
+ dom += `<li class="list-group-item"><b>${item.name}</b> (<span style="color: orange;">${item.version.local}</span> → <span style="color: green;">${item.version.remote}</span>)<br>Provided by: <code>${item.repos}</code>, target architecture: <code>${item.architecture}</code></li>`
+ }
+
+ document.getElementById("updates-list").innerHTML = dom;
+
+ document.getElementById("checking2").outerHTML = "";
+ document.getElementById("found").style.display = "";
+ },
+ error: () => {
+ document.getElementById("checking2").innerText = "An error occurred while loading this content";
+ }
+ });
+ },
+ error: () => {
+ document.getElementById("checking").innerText = "An error occurred while loading this content";
+ }
+ });
+ },
+ error: () => {
+ document.getElementById("checking").innerText = "An error occurred while loading this content";
+ }
+ });
+ </script>
+</div>
+
<?php require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/footer.php"; ?>
\ No newline at end of file |