aboutsummaryrefslogtreecommitdiff
path: root/admin/api
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-01-01 10:37:28 +0100
committerMinteck <contact@minteck.org>2022-01-01 10:37:28 +0100
commitef055e79855cf3be1ad5e1aa5f9ebad480062384 (patch)
treeff074b29a7a87c3ccfc3b10741bbe30cb28e103e /admin/api
parente3a79df6428799024eac64e9cffbb062317aeb95 (diff)
downloadmain-ef055e79855cf3be1ad5e1aa5f9ebad480062384.tar.gz
main-ef055e79855cf3be1ad5e1aa5f9ebad480062384.tar.bz2
main-ef055e79855cf3be1ad5e1aa5f9ebad480062384.zip
Bye furriesHEADtrunk
Diffstat (limited to 'admin/api')
-rw-r--r--admin/api/_demo.php5
-rw-r--r--admin/api/autosave.php31
-rw-r--r--admin/api/createURL.php20
-rw-r--r--admin/api/deleteURL.php23
-rw-r--r--admin/api/draftvslive.php41
-rw-r--r--admin/api/getIpLocation.php38
-rw-r--r--admin/api/getQuota.php54
-rw-r--r--admin/api/getUbuntuUpgrades.php10
-rw-r--r--admin/api/getUpdates.php26
-rw-r--r--admin/api/ipTest.php4
-rw-r--r--admin/api/refreshUpdates.php4
-rw-r--r--admin/api/serverLogSummary.php8
-rw-r--r--admin/api/serverTemp.php20
-rw-r--r--admin/api/serverTime.php12
-rw-r--r--admin/api/setlive.php33
-rw-r--r--admin/api/terminateAllSessions.php34
-rw-r--r--admin/api/terminateGameSessions.php23
-rw-r--r--admin/api/terminateWebSessions.php23
18 files changed, 0 insertions, 409 deletions
diff --git a/admin/api/_demo.php b/admin/api/_demo.php
deleted file mode 100644
index 68b5ad6..0000000
--- a/admin/api/_demo.php
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-// Do your API stuff here! \ No newline at end of file
diff --git a/admin/api/autosave.php b/admin/api/autosave.php
deleted file mode 100644
index 67943cb..0000000
--- a/admin/api/autosave.php
+++ /dev/null
@@ -1,31 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_POST['document']) && strpos($_POST['document'], "/") === false) {
- $doc = $_POST['document'];
-} else {
- echo("E_ABORT: document");
- die();
-}
-
-if (isset($_POST['article']) && strpos($_POST['article'], "/") === false) {
- $blog = $_POST['article'];
-}
-
-if (isset($_POST['content'])) {
- $data = $_POST['content'];
-} else {
- echo("E_ABORT: content");
- die();
-}
-
-echo("STEP");
-if ($_POST["document"] === "blog.en") {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-" . $blog . ".json.html", $data);
-} else if ($_POST["document"] === "blog.fr") {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-" . $blog . ".json.fr.html", $data);
-} else {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html", $data);
-}
-echo("SUCCESS"); \ No newline at end of file
diff --git a/admin/api/createURL.php b/admin/api/createURL.php
deleted file mode 100644
index dc8a569..0000000
--- a/admin/api/createURL.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['shortenedName']) && strpos($_GET['shortenedName'], "/") === false && strpos($_GET['shortenedName'], " ") === false) {
- $name = $_GET['shortenedName'];
-} else {
- die();
-}
-
-if (isset($_GET['redirectsTo']) && strpos($_GET['shortenedName'], " ") === false) {
- $output = $_GET['redirectsTo'];
-} else {
- die();
-}
-
-file_put_contents("/mnt/minteckrolt-urls/links.txt", file_get_contents("/mnt/minteckrolt-urls/links.txt") . "\n" . $name . " " . $output);
-
-header("Location: /admin/panes/shortens.php");
-die(); \ No newline at end of file
diff --git a/admin/api/deleteURL.php b/admin/api/deleteURL.php
deleted file mode 100644
index 895751e..0000000
--- a/admin/api/deleteURL.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
- $arg = $_GET['_'];
-} else {
- die();
-}
-
-$urls = explode("\n", file_get_contents("/mnt/minteckrolt-urls/links.txt"));
-$newUrlsArr = [];
-
-foreach ($urls as $url) {
- if (explode(" ", $url)[0] !== $arg) {
- $newUrlsArr[] = $url;
- }
-}
-
-file_put_contents("/mnt/minteckrolt-urls/links.txt", implode("\n", $newUrlsArr));
-
-header("Location: /admin/panes/shortens.php");
-die(); \ No newline at end of file
diff --git a/admin/api/draftvslive.php b/admin/api/draftvslive.php
deleted file mode 100644
index cc5e325..0000000
--- a/admin/api/draftvslive.php
+++ /dev/null
@@ -1,41 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_POST['document']) && strpos($_POST['document'], "/") === false) {
- $doc = $_POST['document'];
-} else {
- die();
-}
-
-if ($doc === "conduct.fr") {
- if (file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/fr.html")) {
- die("true");
- } else {
- die("false");
- }
-}
-
-if ($doc === "conduct.en") {
- if (file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/en.html")) {
- die("true");
- } else {
- die("false");
- }
-}
-
-if ($doc === "blog.en") {
- if (file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.html") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_POST['article']}.json.html")) {
- die("true");
- } else {
- die("false");
- }
-}
-
-if ($doc === "blog.fr") {
- if (file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.fr.html") === file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_POST['article']}.json.fr.html")) {
- die("true");
- } else {
- die("false");
- }
-} \ No newline at end of file
diff --git a/admin/api/getIpLocation.php b/admin/api/getIpLocation.php
deleted file mode 100644
index c40d96e..0000000
--- a/admin/api/getIpLocation.php
+++ /dev/null
@@ -1,38 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
- $arg = $_GET['_'];
-} else {
- die();
-}
-
-if (!file_exists($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json")) {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json", "[]");
-}
-
-$ipCache = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json"), true);
-
-$data = null;
-foreach ($ipCache as $ip => $item) {
- if ($ip === $_GET['_']) {
- $data = $item;
- }
-}
-
-if ($data === null) {
- $data = unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=' . $arg));
- $ipCache[$_GET['_']] = $data;
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/ipcache.json", json_encode($ipCache));
-}
-
-if ($data["geoplugin_status"] === 404) {
- die("<span class='text-muted'>" . l("Local IP address", "Adresse IP locale") . "</span>");
-} else {
- if ($data["geoplugin_inEU"]) {
- die($data["geoplugin_countryName"] . " <span class='badge text-light border-light' style='border:1px solid;vertical-align: middle;'>" . l("EU", "UE") . "</span>");
- } else {
- die($data["geoplugin_countryName"]);
- }
-} \ No newline at end of file
diff --git a/admin/api/getQuota.php b/admin/api/getQuota.php
deleted file mode 100644
index 1d64737..0000000
--- a/admin/api/getQuota.php
+++ /dev/null
@@ -1,54 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
- $arg = $_GET['_'];
-} else {
- die();
-}
-
-$webs = scandir("/mnt/minteckrolt-cloud");
-
-if (in_array($arg, $webs)) {
- $tier = trim(file_get_contents("/mnt/minteckrolt-cloud/" . $arg . "/Tier"));
-
- exec("du -hs /mnt/minteckrolt-cloud/" . $arg, $ret);
- $parts = explode(" ", $ret[0]);
-
- exec("du -s /mnt/minteckrolt-cloud/" . $arg, $ret2);
- $parts2 = explode(" ", $ret2[0]);
-
- if ($tier === "3") {
- $perc = ($parts2[0] / 100000) * 100;
- if ($perc > 75) {
- die("<span class='text-danger'>" . l("Using", "Utilise") . " " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
- } else if ($perc > 50) {
- die("<span class='text-warning'>" . l("Using", "Utilise") . " " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
- } else {
- die("<span class='text-success'>" . l("Using", "Utilise") . " " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
- }
- } else if ($tier === "5") {
- $perc = ($parts2[0] / 250000) * 100;
- if ($perc > 75) {
- die("<span class='text-danger'>" . l("Using", "Utilise") . " " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
- } else if ($perc > 50) {
- die("<span class='text-warning'>" . l("Using", "Utilise") . " " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
- } else {
- die("<span class='text-success'>" . l("Using", "Utilise") . " " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
- }
- } else if ($tier === "7") {
- $perc = ($parts2[0] / 500000) * 100;
- if ($perc > 75) {
- die("<span class='text-danger'>" . l("Using", "Utilise") . " " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
- } else if ($perc > 50) {
- die("<span class='text-warning'>" . l("Using", "Utilise") . " " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
- } else {
- die("<span class='text-success'>" . l("Using", "Utilise") . " " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
- }
- } else {
- die("<span class='text-success'>" . l("Using", "Utilise") . " " . $parts[0] . "</span>");
- }
-}
-
-die("Unable to calculate data usage"); \ No newline at end of file
diff --git a/admin/api/getUbuntuUpgrades.php b/admin/api/getUbuntuUpgrades.php
deleted file mode 100644
index ca49f38..0000000
--- a/admin/api/getUbuntuUpgrades.php
+++ /dev/null
@@ -1,10 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-exec("bash -c \"sudo mtsp-do-release-upgrade | grep 'New release'\"", $ret);
-if (count($ret) === 1) {
- echo(l("<b>Ubuntu " . explode("'", $ret[0])[1] . "</b> is available, use <code>do-release-upgrade</code> to upgrade", "<b>Ubuntu " . explode("'", $ret[0])[1] . "</b> est disponible, exécutez la commande <code>do-release-upgrade</code> pour effectuer la mise à niveau"));
-} else {
- echo(l("This server is running the latest version of Ubuntu", "Ce serveur exécute la dernière version d'Ubuntu"));
-} \ No newline at end of file
diff --git a/admin/api/getUpdates.php b/admin/api/getUpdates.php
deleted file mode 100644
index 5d9c373..0000000
--- a/admin/api/getUpdates.php
+++ /dev/null
@@ -1,26 +0,0 @@
-<?php
-
-header("Content-Type: application/json");
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-exec("bash -c \"sudo mtsp-apt-get-2| grep ^Inst\"", $ret);
-$data = [];
-$data["count"] = count($ret);
-$data["packages"] = [];
-
-foreach ($ret as $package) {
- $parts = explode(" ", trim($package));
- $pkg = [
- "name" => trim($parts[1]),
- "version" => [
- "local" => trim(explode("]", explode("[", $parts[2])[1])[0]),
- "remote" => trim(explode("(", $parts[3])[1]),
- ],
- "repos" => trim(explode(":", explode("(", explode("[", trim($package))[1])[1])[1]),
- "architecture" => trim(explode("]", explode("[", trim($package))[2])[0])
- ];
-
- $data["packages"][] = $pkg;
-}
-
-echo(json_encode($data, JSON_PRETTY_PRINT)); \ No newline at end of file
diff --git a/admin/api/ipTest.php b/admin/api/ipTest.php
deleted file mode 100644
index 123507e..0000000
--- a/admin/api/ipTest.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-echo var_export(unserialize(file_get_contents('http://www.geoplugin.net/php.gp?ip=127.0.0.1'))); \ No newline at end of file
diff --git a/admin/api/refreshUpdates.php b/admin/api/refreshUpdates.php
deleted file mode 100644
index ec4c707..0000000
--- a/admin/api/refreshUpdates.php
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-exec("bash -c \"sudo mtsp-apt-get-1", $ret); \ No newline at end of file
diff --git a/admin/api/serverLogSummary.php b/admin/api/serverLogSummary.php
deleted file mode 100644
index a4a20a0..0000000
--- a/admin/api/serverLogSummary.php
+++ /dev/null
@@ -1,8 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-exec("journalctl -b --quiet", $ret);
-$cnt = count($ret);
-
-echo("<b>" . $cnt . "</b> " . l("system log messages since last system startup", "messages de journalisation du système depuis le dernier démarrage")); \ No newline at end of file
diff --git a/admin/api/serverTemp.php b/admin/api/serverTemp.php
deleted file mode 100644
index 613c411..0000000
--- a/admin/api/serverTemp.php
+++ /dev/null
@@ -1,20 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-echo(l("Server running at", "Serveur fonctionnant à") . " <b>");
-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(l("completely overheating!", "en pleine surchauffe !"));
-} else if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 60) {
- echo(l("starting to throttle!", "commence à être bridé !"));
-} else {
- echo(l("under normal temperatures", "températures habituelles"));
-} \ No newline at end of file
diff --git a/admin/api/serverTime.php b/admin/api/serverTime.php
deleted file mode 100644
index a64a39e..0000000
--- a/admin/api/serverTime.php
+++ /dev/null
@@ -1,12 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.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(l($days . " day·s, " . $hours . " hour·s, " . $mins . " minute·s, " . ceil($secs) . " second·s", $days . " jour·s, " . $hours . " heure·s, " . $mins . " minute·s, " . ceil($secs) . " seconde·s")); \ No newline at end of file
diff --git a/admin/api/setlive.php b/admin/api/setlive.php
deleted file mode 100644
index 0ef8b94..0000000
--- a/admin/api/setlive.php
+++ /dev/null
@@ -1,33 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_POST['document']) && strpos($_POST['document'], "/") === false) {
- $doc = $_POST['document'];
-} else {
- die();
-}
-
-if ($doc === "conduct.fr") {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/fr.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html"));
-}
-
-if ($doc === "conduct.en") {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/code/en.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html"));
-}
-
-if ($doc === "blog.en") {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_POST['article']}.json.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.html"));
-}
-
-if ($doc === "blog.fr") {
- file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/blog/data/{$_POST['article']}.json.fr.html", file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.fr.html"));
-}
-
-if ($doc === "blog.en") {
- unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.html");
-} else if ($doc === "blog.fr") {
- unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/blog-{$_POST['article']}.json.fr.html");
-} else {
- unlink($_SERVER['DOCUMENT_ROOT'] . "/includes/drafts/" . $doc . ".html");
-} \ No newline at end of file
diff --git a/admin/api/terminateAllSessions.php b/admin/api/terminateAllSessions.php
deleted file mode 100644
index 46c1b33..0000000
--- a/admin/api/terminateAllSessions.php
+++ /dev/null
@@ -1,34 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
- $arg = $_GET['_'];
-} else {
- die();
-}
-
-$webs = scandir("/mnt/kartik/online/private/tokens");
-
-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"] === $arg) {
- unlink("/mnt/kartik/online/private/tokens/" . $webt);
- }
- }
-}
-
-$webs = scandir("/mnt/kartik/online/private/gametokens");
-
-foreach ($webs 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"] === $arg) {
- unlink("/mnt/kartik/online/private/gametokens/" . $webt);
- }
- }
-}
-
-header("Location: /admin/panes/kartik.php");
-die(); \ No newline at end of file
diff --git a/admin/api/terminateGameSessions.php b/admin/api/terminateGameSessions.php
deleted file mode 100644
index 6975e81..0000000
--- a/admin/api/terminateGameSessions.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
- $arg = $_GET['_'];
-} else {
- die();
-}
-
-$webs = scandir("/mnt/kartik/online/private/gametokens");
-
-foreach ($webs 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"] === $arg) {
- unlink("/mnt/kartik/online/private/gametokens/" . $webt);
- }
- }
-}
-
-header("Location: /admin/panes/kartik.php");
-die();
diff --git a/admin/api/terminateWebSessions.php b/admin/api/terminateWebSessions.php
deleted file mode 100644
index 170f4d8..0000000
--- a/admin/api/terminateWebSessions.php
+++ /dev/null
@@ -1,23 +0,0 @@
-<?php
-
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-
-if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
- $arg = $_GET['_'];
-} else {
- die();
-}
-
-$webs = scandir("/mnt/kartik/online/private/tokens");
-
-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"] === $arg) {
- unlink("/mnt/kartik/online/private/tokens/" . $webt);
- }
- }
-}
-
-header("Location: /admin/panes/kartik.php");
-die(); \ No newline at end of file