aboutsummaryrefslogtreecommitdiff
path: root/admin
diff options
context:
space:
mode:
authorMinteck <nekostarfan@gmail.com>2021-08-08 22:31:51 +0200
committerMinteck <nekostarfan@gmail.com>2021-08-08 22:31:51 +0200
commit94c57fa247ba107fce8fc1d1fc355191229dbddc (patch)
tree865048aa574ef63ad322ed8e5057eb7629e03c29 /admin
parente255736e3f2a95ee82cadc01b0c70749ab946226 (diff)
downloadmain-94c57fa247ba107fce8fc1d1fc355191229dbddc.tar.gz
main-94c57fa247ba107fce8fc1d1fc355191229dbddc.tar.bz2
main-94c57fa247ba107fce8fc1d1fc355191229dbddc.zip
Permissions system
Diffstat (limited to 'admin')
-rw-r--r--admin/NeutronManage/index.php3
-rw-r--r--admin/api/getIpLocation.php4
-rw-r--r--admin/api/getQuota.php20
-rw-r--r--admin/api/getUbuntuUpgrades.php4
-rw-r--r--admin/api/serverLogSummary.php2
-rw-r--r--admin/api/serverTemp.php8
-rw-r--r--admin/api/serverTime.php2
-rw-r--r--admin/callback/index.php9
-rw-r--r--admin/index.php27
-rw-r--r--admin/panes/audit.php56
-rw-r--r--admin/panes/denied.php62
-rw-r--r--admin/panes/home.php36
-rw-r--r--admin/panes/neutroning.php4
-rw-r--r--admin/panes/quotas.php8
-rw-r--r--admin/panes/telemetry.php26
-rw-r--r--admin/panes/unchained.php16
-rw-r--r--admin/panes/uptime.php21
-rw-r--r--admin/panes/version.php26
-rw-r--r--admin/private/header.api.php14
-rw-r--r--admin/private/header.php20
-rw-r--r--admin/private/header.sso.php25
-rw-r--r--admin/private/permissions.json22
-rw-r--r--admin/private/permissions.php37
23 files changed, 318 insertions, 134 deletions
diff --git a/admin/NeutronManage/index.php b/admin/NeutronManage/index.php
index f15a43e..0b10034 100644
--- a/admin/NeutronManage/index.php
+++ b/admin/NeutronManage/index.php
@@ -1,6 +1,7 @@
<?php
-require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
+$_OVERRIDEPERMISSION = "neutron";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.sso.php";
if (isset($_GET['_']) && strpos($_GET['_'], "/") === false) {
$arg = $_GET['_'];
diff --git a/admin/api/getIpLocation.php b/admin/api/getIpLocation.php
index fe34438..c40d96e 100644
--- a/admin/api/getIpLocation.php
+++ b/admin/api/getIpLocation.php
@@ -28,10 +28,10 @@ if ($data === null) {
}
if ($data["geoplugin_status"] === 404) {
- die("<span class='text-muted'>Local IP address</span>");
+ 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;'>EU</span>");
+ 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"]);
}
diff --git a/admin/api/getQuota.php b/admin/api/getQuota.php
index 7b4e8e9..1d64737 100644
--- a/admin/api/getQuota.php
+++ b/admin/api/getQuota.php
@@ -22,32 +22,32 @@ if (in_array($arg, $webs)) {
if ($tier === "3") {
$perc = ($parts2[0] / 100000) * 100;
if ($perc > 75) {
- die("<span class='text-danger'>Using " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
+ die("<span class='text-danger'>" . l("Using", "Utilise") . " " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
} else if ($perc > 50) {
- die("<span class='text-warning'>Using " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
+ die("<span class='text-warning'>" . l("Using", "Utilise") . " " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
} else {
- die("<span class='text-success'>Using " . $parts[0] . "/100M (" . round($perc, 2) . "%)</span>");
+ 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'>Using " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
+ die("<span class='text-danger'>" . l("Using", "Utilise") . " " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
} else if ($perc > 50) {
- die("<span class='text-warning'>Using " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
+ die("<span class='text-warning'>" . l("Using", "Utilise") . " " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
} else {
- die("<span class='text-success'>Using " . $parts[0] . "/250M (" . round($perc, 2) . "%)</span>");
+ 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'>Using " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
+ die("<span class='text-danger'>" . l("Using", "Utilise") . " " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
} else if ($perc > 50) {
- die("<span class='text-warning'>Using " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
+ die("<span class='text-warning'>" . l("Using", "Utilise") . " " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
} else {
- die("<span class='text-success'>Using " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
+ die("<span class='text-success'>" . l("Using", "Utilise") . " " . $parts[0] . "/500M (" . round($perc, 2) . "%)</span>");
}
} else {
- die("<span class='text-success'>Using " . $parts[0] . "</span>");
+ die("<span class='text-success'>" . l("Using", "Utilise") . " " . $parts[0] . "</span>");
}
}
diff --git a/admin/api/getUbuntuUpgrades.php b/admin/api/getUbuntuUpgrades.php
index 7da6259..8273036 100644
--- a/admin/api/getUbuntuUpgrades.php
+++ b/admin/api/getUbuntuUpgrades.php
@@ -4,7 +4,7 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
exec("bash -c \"sudo do-release-upgrade -c | grep 'New release'\"", $ret);
if (count($ret) === 1) {
- echo("<b>Ubuntu " . explode("'", $ret[0])[1] . "</b> is available, use <code>do-release-upgrade</code> to upgrade");
+ 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("This server is running the latest version of Ubuntu");
+ 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/serverLogSummary.php b/admin/api/serverLogSummary.php
index 78c0a2c..a4a20a0 100644
--- a/admin/api/serverLogSummary.php
+++ b/admin/api/serverLogSummary.php
@@ -5,4 +5,4 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
exec("journalctl -b --quiet", $ret);
$cnt = count($ret);
-echo("<b>" . $cnt . "</b> system log messages since last system startup"); \ No newline at end of file
+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
index 55cf34b..613c411 100644
--- a/admin/api/serverTemp.php
+++ b/admin/api/serverTemp.php
@@ -2,7 +2,7 @@
require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/header.api.php";
-echo("Server running at <b>");
+echo(l("Server running at", "Serveur fonctionnant à") . " <b>");
exec("sensors -j", $out);
$outp = implode("\n", $out);
$outd = json_decode($outp, true);
@@ -12,9 +12,9 @@ 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!");
+ echo(l("completely overheating!", "en pleine surchauffe !"));
} else if ($outd["cpu_thermal-virtual-0"]["temp1"]["temp1_input"] > 60) {
- echo("starting to throttle!");
+ echo(l("starting to throttle!", "commence à être bridé !"));
} else {
- echo("under normal temperatures");
+ 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
index 77ba321..a64a39e 100644
--- a/admin/api/serverTime.php
+++ b/admin/api/serverTime.php
@@ -9,4 +9,4 @@ $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"); \ No newline at end of file
+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/callback/index.php b/admin/callback/index.php
index 8816c32..5052369 100644
--- a/admin/callback/index.php
+++ b/admin/callback/index.php
@@ -36,7 +36,14 @@ if (isset($result["access_token"])) {
$result = curl_exec($crl);
$result = json_decode($result, true);
- if ($result["id"] === "74bca7d2-4694-477c-8bc1-9003315abbee") {
+ $login = false;
+ foreach (json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/permissions.json"), true) as $id => $user) {
+ if ($result["id"] === $id && in_array("login", $user)) {
+ $login = true;
+ }
+ }
+
+ if ($login) {
$token = bin2hex(random_bytes(32));
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/tokens/" . $token, json_encode($result));
setcookie("ADMIN_TOKEN", $token, 0, "/", ".minteck.ro.lt", true, true);
diff --git a/admin/index.php b/admin/index.php
index 0473560..c05b0be 100644
--- a/admin/index.php
+++ b/admin/index.php
@@ -147,37 +147,37 @@
<div id="menu" style="height:100%;">
<div class="item selected" id="activity-home" style="margin-top:15vh;">
<img src="/static/admin/home.svg" class="item-icon" alt="">
- <span class="item-text">Home</span>
+ <span class="item-text"><?= l("Home", "Accueil") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-files">
<img src="/static/admin/files.svg" class="item-icon" alt="">
- <span class="item-text">Files</span>
+ <span class="item-text"><?= l("Files", "Fichiers") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-audit">
<img src="/static/admin/audit.svg" class="item-icon" alt="">
- <span class="item-text">Security Audit</span>
+ <span class="item-text"><?= l("Security Audit", "Audit de sécurité") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-hardware">
<img src="/static/admin/hardware.svg" class="item-icon" alt="">
- <span class="item-text">Hardware</span>
+ <span class="item-text"><?= l("Hardware", "Matériel") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-disk">
<img src="/static/admin/disk.svg" class="item-icon" alt="">
- <span class="item-text">Disk Space</span>
+ <span class="item-text"><?= l("Disk Space", "Espace disque") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-uptime">
<img src="/static/admin/uptime.svg" class="item-icon" alt="">
- <span class="item-text">Uptime</span>
+ <span class="item-text"><?= l("Uptime", "Temps système") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-version">
<img src="/static/admin/version.svg" class="item-icon" alt="">
- <span class="item-text">Software Versions</span>
+ <span class="item-text"><?= l("Software Versions", "Versions du logiciel") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-unchained">
@@ -187,21 +187,22 @@
</div>
<div class="item" id="activity-kartik">
<img src="/static/admin/kartik.svg" class="item-icon" alt="">
- <span class="item-text">Kartik Online
+ <span class="item-text">Kartik Online</span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-telemetry">
<img src="/static/admin/telemetry.svg" class="item-icon" alt="">
- <span class="item-text">Telemetry</span>
+ <span class="item-text"><?= l("Telemetry", "Télémétrie") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
- </div><div class="item" id="activity-shortens">
+ </div>
+ <div class="item" id="activity-shortens">
<img src="/static/admin/shortens.svg" class="item-icon" alt="">
- <span class="item-text">Shortened URLs</span>
+ <span class="item-text"><?= l("Shortened URLs", "URL raccourcies") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-code">
<img src="/static/admin/code.svg" class="item-icon" alt="">
- <span class="item-text">Code of Conduct</span>
+ <span class="item-text"><?= l("Code of Conduct", "Code de Conduite") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
<div class="item" id="activity-quotas">
@@ -211,7 +212,7 @@
</div>
<div class="item" id="activity-neutroning">
<img src="/static/admin/neutroning.svg" class="item-icon" alt="">
- <span class="item-text">Sites Map</span>
+ <span class="item-text"><?= l("Sites Map", "Plan des sites") ?></span>
<img alt="" src="/static/reload.png" class="reloadbtn">
</div>
diff --git a/admin/panes/audit.php b/admin/panes/audit.php
index c2a8609..3292ec8 100644
--- a/admin/panes/audit.php
+++ b/admin/panes/audit.php
@@ -51,13 +51,13 @@
</style>
<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
- <h2 style="text-align:center;">Security Audit</h2>
+ <h2 style="text-align:center;"><?= l("Security Audit", "Audit de sécurité") ?></h2>
<table class="table table-hover">
<thead>
<tr>
- <th>IP address</th>
- <th>Connections</th>
- <th>Username(s)</th>
+ <th><?= l("IP address", "Adresse IP") ?></th>
+ <th><?= l("Connections", "Connexions") ?></th>
+ <th><?= l("Username(s)", "Nom(s) d'utilisateur") ?></th>
<th>Actions</th>
</tr>
</thead>
@@ -69,6 +69,16 @@
$dir = array_reverse($dir);
+ /** @var array $perms */
+ $viewFullIps = false;
+ foreach ($perms as $user => $uperms) {
+ if ($user === $_DATA['id']) {
+ if (in_array("addresses", $uperms)) {
+ $viewFullIps = true;
+ }
+ }
+ }
+
foreach ($dir as $file) {
if ($file !== "." && $file !== "..") {
if (substr($file, 0, 5) === "auth.") {
@@ -129,8 +139,24 @@
$index = 1;
foreach ($ips as $ip => $info) {
if ($ip !== "port") {
+ $pip = explode(".", $ip);
+
+ if ($viewFullIps) {
+ $rip = $ip;
+ } else {
+ if (strlen($pip[3]) === 3) $pip[3] = "xxx";
+ if (strlen($pip[3]) === 2) $pip[3] = "xx";
+ if (strlen($pip[3]) === 1) $pip[3] = "x";
+
+ if (strlen($pip[2]) === 3) $pip[2] = "xxx";
+ if (strlen($pip[2]) === 2) $pip[2] = "xx";
+ if (strlen($pip[2]) === 1) $pip[2] = "x";
+
+ $rip = implode(".", $pip);
+ }
+
echo("<tr>
- <td class='addr-location'><code>" . $ip . "</code><br><span id='iplocation-" . $ip . "'><span class='text-muted'>Please wait...</span></span>");?>
+ <td class='addr-location'><code>" . $rip . "</code><br><span id='iplocation-" . $ip . "'><span class='text-muted'>" . l("Please wait", "Patientez") . "...</span></span>");?>
<!--suppress JSUnresolvedVariable -->
<script>
@@ -145,7 +171,7 @@
</script>
<?php
if ($ip === $_SERVER['REMOTE_ADDR']) {
- echo(" <span class='badge text-primary border-primary' style='border:1px solid;vertical-align: middle;'>You</span>");
+ echo(" <span class='badge text-primary border-primary' style='border:1px solid;vertical-align: middle;'>" . l("You", "Vous") . "</span>");
}
echo("</td>
<td>");
@@ -166,27 +192,27 @@
}
}
if (count($info["connections"]) === 0) {
- echo("<span class='text-muted'>Never connected</span>");
+ echo("<span class='text-muted'>" . l("Never connected", "Jamais connecté") . "</span>");
} else {
- echo($success . " succeeded, " . $failed . " failed, " . $invalid . " invalid");
+ echo($success . " " . l("succeeded", "réussi") . ", " . $failed . " " . l("failed", "échoué") . ", " . $invalid . " " . l("invalid", "invalide"));
}
- echo("<br>Last: ");
+ echo("<br>" . l("Last", "Dernier ") . ": ");
if ($info["connections"][0]["status"] === "ok") {
- echo("<span class='badge text-success border-success' style='border:1px solid;vertical-align: middle;'>Succeeded</span>");
+ echo("<span class='badge text-success border-success' style='border:1px solid;vertical-align: middle;'>" . l("Succeeded", "Réussi") . "</span>");
}
if ($info["connections"][0]["status"] === "error") {
- echo("<span class='badge text-warning border-warning' style='border:1px solid;vertical-align: middle;'>Failed</span>");
+ echo("<span class='badge text-warning border-warning' style='border:1px solid;vertical-align: middle;'>" . l("Failed", "Échoué") . "</span>");
}
if ($info["connections"][0]["status"] === "invalid") {
- echo("<span class='badge text-danger border-danger' style='border:1px solid;vertical-align: middle;'>Invalid</span>");
+ echo("<span class='badge text-danger border-danger' style='border:1px solid;vertical-align: middle;'>" . l("Invalid", "Invalide") . "</span>");
}
echo("</td>
- <td class='users'><details><summary>Show full list</summary><ul class='list-group'>");
+ <td class='users'><details><summary>" . l("Show full list", "Afficher la liste") . "</summary><ul class='list-group'>");
$uniqueUsers = [];
$connectionsWithUsers = 0;
@@ -208,11 +234,11 @@
}
if (count($uniqueUsers) === 0) {
- echo("<li class='list-group-item text-muted'>Username was never sent to server</li>");
+ echo("<li class='list-group-item text-muted'>" . l("Username was never sent to server", "Le nom d'utilisateur n'a jamais été transmis au service") . "</li>");
}
echo("</ul></details></td></td>
- <td><a href='#'>Details</a> · <a href='https://cleantalk.org/blacklists/report-ip' target='_blank'>Report</a></td>
+ <td><a href='https://cleantalk.org/blacklists/report-ip' target='_blank'>" . l("Report as fraudulent", "Signaler comme fraude") . "</a></td>
</tr>");
$index++;
diff --git a/admin/panes/denied.php b/admin/panes/denied.php
new file mode 100644
index 0000000..9a29fcb
--- /dev/null
+++ b/admin/panes/denied.php
@@ -0,0 +1,62 @@
+<?php require $_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;
+ }
+
+ body {
+ background: #5f1b1b !important;
+ }
+</style>
+
+<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;display: flex;align-items:center;justify-content: center;height:100%;">
+ <div>
+ <p style="text-align: center;">
+ <!--suppress CheckImageSize -->
+ <img src="/static/admin/locked.svg" style="width:96px;filter:invert(1);">
+ </p>
+ <br>
+ <h2 style="text-align:center;"><?= l("Access is denied", "Accès refusé") ?></h2>
+
+ <h4 style="text-align:center;"><?= l("You don't have the", "Vous ne disposez pas de la permission") ?> <code>admin.<?= strip_tags($_GET['_'] ?? "*") ?></code><?= l(" permission, which is required to access this resource", ", qui est nécessaire pour accéder à ce contenu") ?>.</h4><br>
+
+ <div id="homebtn" style="text-align: center;width:max-content;margin-left:auto;margin-right:auto;">
+ <p class="btn-group">
+ <a onclick="window.parent.activity('activity-home', '/admin/panes/home.php', window.parent.document.getElementById('activity-home'));" class="btn btn-outline-light"><?= l("Home", "Accueil") ?></a>
+ </p>
+ </div>
+ <script>
+ if (window.parent === window) document.getElementById("homebtn").style.display = "none";
+ </script>
+
+ <small><p style="text-align: center;">
+ <?= l("If you believe this is an error", "Si vous pensez qu'il s'agit d'une erreur") ?>, <a href="/contact" target="_blank"><?= l("contact Minteck", "contactez Minteck") ?></a>
+ </p></small>
+ </div>
+</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 fade996..3bc3429 100644
--- a/admin/panes/home.php
+++ b/admin/panes/home.php
@@ -30,28 +30,10 @@
</style>
<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
- <h2 style="text-align:center;">Welcome back <?= $_DATA["name"] ?>!</h2>
+ <h2 style="text-align:center;"><?= l("Welcome back", "Vous revoilà") ?> <?= $_DATA["name"] ?><?= l("", " ") ?>!</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
+ <span id="temperature"><?= l("Server running at", "Serveur fonctionnant à") ?> <b>--.-°C</b>, n/a</span> <a href="#" onclick="window.parent.activity('activity-version', '/admin/panes/version.php', window.parent.document.getElementById('activity-version'));" style="float:right;"><?= l("Manage", "Gérer") ?>...</a></li><li class="list-group-item"><b><?php
$uca = scandir("/mnt/blogchain/_posts");
$uct = [];
@@ -64,7 +46,7 @@
echo(count($uct));
- ?></b> UnchainedTech article·s, <?php
+ ?></b> <?= l("UnchainedTech article·s", "article·s sur UnchainedTech") ?>, <?php
$uca = scandir("/mnt/blogchain/_posts/_drafts");
$uct2 = [];
@@ -77,7 +59,7 @@
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>
+ ?> <?= l("draft·s", "brouillon·s") ?> <a onclick="window.parent.activity('activity-unchained', '/admin/panes/unchained.php', window.parent.document.getElementById('activity-unchained'));" href="#" style="float:right;"><?= l("Manage", "Gérer") ?>...</a></li>
<li class="list-group-item"><b><?php
$uca = scandir("/mnt/minteckrolt-cloud");
@@ -91,7 +73,7 @@
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>
+ ?></b> <?= l("Neutron Cloud website·s", "site·s Neutron Cloud") ?> <a onclick="window.parent.activity('activity-quotas', '/admin/panes/quotas.php', window.parent.document.getElementById('activity-quotas'));" href="#" style="float:right;"><?= l("Manage", "Gérer") ?>...</a></li>
<li class="list-group-item"><b><?php
$uca = scandir("/mnt/kartik/online/private/stats");
@@ -105,18 +87,18 @@
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
+ ?></b> <?= l("Kartik Online player·s", "joueurs·s Kartik Online") ?> <a onclick="window.parent.activity('activity-kartik', '/admin/panes/kartik.php', window.parent.document.getElementById('activity-kartik'));" href="#" style="float:right;"><?= l("Manage", "Gérer") ?>...</a></li>
+ <li class="list-group-item"><?= l("Using", "Utilisation de") ?> <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
+ ?></b> <?= l("on all disks", "sur tous les disques") ?>, <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>
+ ?></b> <?= l("free", "de libre") ?> <a onclick="window.parent.activity('activity-disk', '/admin/panes/disk.php', window.parent.document.getElementById('activity-disk'));" href="#" style="float:right;"><?= l("Manage", "Gérer") ?>...</a></li>
</ul>
<!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
<script>
diff --git a/admin/panes/neutroning.php b/admin/panes/neutroning.php
index d8a73c5..07a64a6 100644
--- a/admin/panes/neutroning.php
+++ b/admin/panes/neutroning.php
@@ -30,9 +30,9 @@
</style>
<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
- <h2 style="text-align:center;">Neutron Cloud Map</h2>
+ <h2 style="text-align:center;"><?= l("Neutron Cloud Map", "Plan de Neutron Cloud") ?></h2>
- <h4 style="text-align:center;">Full map of all the websites that exists in Neutron Cloud</h4>
+ <h4 style="text-align:center;"><?= l("Full map of all the websites that exists in Neutron Cloud", "Plan complet de tous les sites Web qui existent dans Neutron Cloud") ?></h4>
<details open>
<summary>cloud.minteck.ro.lt</summary>
diff --git a/admin/panes/quotas.php b/admin/panes/quotas.php
index 91b6899..8102a0d 100644
--- a/admin/panes/quotas.php
+++ b/admin/panes/quotas.php
@@ -30,13 +30,13 @@
</style>
<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
- <h2 style="text-align:center;">Neutron Cloud Quotas</h2>
+ <h2 style="text-align:center;"><?= l("Neutron Cloud Quotas", "Quotas de Neutron Cloud") ?></h2>
- <h4 style="text-align:center;">Websites that reached their limit can be locked down</h4>
+ <h4 style="text-align:center;"><?= l("Websites that reached their limit can be locked down", "Les sites Web qui ont atteint leur limite peuvent être bloqués") ?></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 -->
+ <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>, <?= l("X", "Tier X") ?><?= trim(file_get_contents("/mnt/minteckrolt-cloud/" . $site . "/Tier")) ?><?= l(" Tier", "") ?>)<br><span class="text-muted" id="quota-<?= $index ?>"><?= l("Calculating", "Calcul") ?>...</span><span style="float:right;"><a href="/admin/NeutronManage/?_=<?= $site ?>" target="_blank"><?= l("Admin Panel", "Espace d'administration") ?></a></span><!--suppress JSUnresolvedVariable, JSUnresolvedFunction, JSUnfilteredForInLoop -->
<script>
setTimeout(() => {
$.ajax("/admin/api/getQuota.php?_=<?= $site ?>", {
@@ -45,7 +45,7 @@
document.getElementById("quota-<?= $index ?>").innerHTML = data;
},
error: () => {
- document.getElementById("quota-<?= $index ?>").innerText = "Unable to calculate data usage";
+ document.getElementById("quota-<?= $index ?>").innerText = "<?= l("An error occurred while loading this content, perhaps you don't have permission to access it", "Une erreur s'est produite lors du chargement de ce contenu, peut-être que vous n'avez pas la permission d'y accéder") ?>";
}
});
}, 1000 * <?= $index ?>)
diff --git a/admin/panes/telemetry.php b/admin/panes/telemetry.php
index e87be24..3a589cc 100644
--- a/admin/panes/telemetry.php
+++ b/admin/panes/telemetry.php
@@ -50,12 +50,12 @@ function urlize($scheme) {
</style>
<div class="container" style="color:white;padding-top:15vh;padding-bottom:15vh;">
- <h2 style="text-align:center;">Telemetry Information</h2>
+ <h2 style="text-align:center;"><?= l("Telemetry Information", "Informations de télémétrie") ?></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
+ <li class="list-group-item"><?= l("Lifetime Visitors", "Visiteurs depuis toujours") ?> <span style="float:right;"><?php
$uniques = [];
@@ -76,7 +76,7 @@ function urlize($scheme) {
echo (count($uniques));
?></span></li>
- <li class="list-group-item">Most Viewed Page <span style="float:right;"><?php
+ <li class="list-group-item"><?= l("Most Viewed Page", "Page la plus vue") ?> <span style="float:right;"><?php
$record = 0;
$recname = "-";
@@ -103,7 +103,7 @@ function urlize($scheme) {
echo ($recname);
?></span></li>
- <li class="list-group-item">Least Viewed Page <span style="float:right;"><?php
+ <li class="list-group-item"><?= l("Least Viewed Page", "Page la moins vue") ?> <span style="float:right;"><?php
$record = 2;
$recname = "-";
@@ -133,7 +133,7 @@ function urlize($scheme) {
</ul>
<ul class="list-group" style="margin-top:20px;">
- <li class="list-group-item text-muted">Tomorrow <span style="float:right;"><?php
+ <li class="list-group-item text-muted"><?= l("Tomorrow", "Demain") ?> <span style="float:right;"><?php
$uniques = [];
$totalDays = 0;
@@ -193,7 +193,7 @@ function urlize($scheme) {
}
?></span></li>
- <li class="list-group-item">Today <span style="float:right;"><?php
+ <li class="list-group-item"><?= l("Today", "Aujourd'hui") ?> <span style="float:right;"><?php
$uniques = [];
@@ -253,7 +253,7 @@ function urlize($scheme) {
}
?></span></li>
- <li class="list-group-item">Yesterday <span style="float:right;"><?php
+ <li class="list-group-item"><?= l("Yesterday", "Hier") ?> <span style="float:right;"><?php
$uniques = [];
@@ -873,19 +873,19 @@ function urlize($scheme) {
<ul class="list-group">
<li class="list-group-item">
<details>
- <summary>Kartik downloads</summary>
+ <summary><?= l("Kartik downloads", "Téléchargements de Kartik") ?></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"><b><?= l("All update channels", "Tous les canaux de mise à jour") ?> <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>
+ <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")) ?> <?= l("downloads", "téléchargements") ?></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")) ?> <?= l("downloads", "téléchargements") ?></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")) ?> <?= l("downloads", "téléchargements") ?></span></li>
</ul>
</details>
</li>
<li class="list-group-item">
<details>
- <summary>Page-specific statistics</summary>
+ <summary><?= l("Page-specific statistics", "Statistiques par page") ?></summary>
<p>
<?php
diff --git a/admin/panes/unchained.php b/admin/panes/unchained.php
index 8f3133f..5f29406 100644
--- a/admin/panes/unchained.php
+++ b/admin/panes/unchained.php
@@ -36,19 +36,19 @@
<img src="/static/apps/unchainedtech.png" width="96px">
</p>
<br>
- <h2 style="text-align:center;">You already have access to UnchainedTech Admin</h2>
+ <h2 style="text-align:center;"><?= l("You already have access to UnchainedTech Admin", "Vous avez déjà accès à l'administration de UnchainedTech") ?></h2>
- <h4 style="text-align:center;">We automatically logged you into UnchainedTech Admin when you logged in to Minteck Admin</h4><br>
+ <h4 style="text-align:center;"><?= l("We automatically logged you into UnchainedTech Admin when you logged in to Minteck Cloud Admin Console", "Nous vous avons automatiquement connecté à l'administration d'UnchainedTech lorsque vous vous êtes connecté à Minteck Cloud Admin Console") ?></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>
+ <a href="https://unchainedtech.minteck.ro.lt/articles" target="_blank" class="btn btn-outline-light"><?= l("All Articles", "Tous les articles") ?></a>
+ <a href="https://unchainedtech.minteck.ro.lt/admin" target="_blank" class="btn btn-outline-light"><?= l("Admin Tasks", "Tâches d'administration") ?></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>
+ v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='none';document.getElementById('secondary').style.display='';"><?= l("Manage drafts", "Gérer les brouillons") ?></a>
</p></small>
</div>
</div>
@@ -56,10 +56,10 @@
<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>
+ <h4 style="text-align:center;"><?= l("Drafts List", "Liste des brouillons") ?></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>
+ v<?= trim(file_get_contents("/mnt/blogchain/version.txt")) ?> • <a href="#" onclick="document.getElementById('main').style.display='flex';document.getElementById('secondary').style.display='none';"><?= l("Hide drafts list", "Masquer la liste des brouillons") ?></a>
</p></small>
<ul class="list-group">
@@ -69,7 +69,7 @@
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>');
+ 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">' . l("Preview", "Prévisualiser") . '</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/edit/production/_drafts/' . $draft . '" target="_blank">' . l("Edit", "Modifier") . '</a> · <a href="https://github.com/Minteck/UnchainedTech-Content/delete/production/_drafts/' . $draft . '" target="_blank">' . l("Delete", "Supprimer") . '</a></span></li>');
}
}
diff --git a/admin/panes/uptime.php b/admin/panes/uptime.php
index bc2a43e..f0d0e7c 100644
--- a/admin/panes/uptime.php
+++ b/admin/panes/uptime.php
@@ -30,20 +30,9 @@
</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>
+ <h2 style="text-align:center;"><?= l("The server has been running for", "Le serveur est en fonctionnement depuis") ?></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>
+ <h4 style="text-align:center;" id="uptime">---</h4>
<!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
<script>
setInterval(() => {
@@ -65,10 +54,10 @@
$val = explode(" ", $data)[6];
echo($val);
- ?></b> of data has been collected to ensure easy system maintenance and audit
+ ?></b> <?= l("of data has been collected to ensure easy system maintenance and audit", "de données ont été recueillies pour faciliter la maintenance du système et les audits de sécurité") ?>
</li>
<li class="list-group-item" id="logsummary">
- Calculating...
+ Calcul en cours...
</li>
<!--suppress JSUnresolvedVariable, JSUnresolvedFunction -->
<script>
@@ -77,7 +66,7 @@
document.getElementById("logsummary").innerHTML = data;
},
error: () => {
- document.getElementById("logsummary").innerText = "An error occurred while loading this content";
+ document.getElementById("logsummary").innerText = "<?= l("An error occurred while loading this content, perhaps you don't have permission to access it", "Une erreur s'est produite lors du chargement de ce contenu, peut-être que vous n'avez pas la permission d'y accéder") ?>";
}
});
</script>
diff --git a/admin/panes/version.php b/admin/panes/version.php
index 10f1274..8642178 100644
--- a/admin/panes/version.php
+++ b/admin/panes/version.php
@@ -30,7 +30,7 @@
</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>
+ <h2 style="text-align:center;"><?= l("This server is running", "Ce serveur exécute") ?> <?= php_uname('s') ?> version</h2>
<h4 style="text-align:center;"><?= php_uname('r') . " " . php_uname('v') ?></h4>
@@ -38,7 +38,7 @@
<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 Cloud <?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/version")) ?> (<?= trim(file_get_contents("/mnt/minteckrolt-cloud/@BASE/source/api/codename")) ?>)</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">
@@ -64,7 +64,7 @@
$soft = $_SERVER['SERVER_SOFTWARE'];
if (strpos(strtolower($soft), "apache") !== false) {
- echo("Apache HTTP Server");
+ echo(l("Apache HTTP Server", "Serveur HTTP Apache"));
} else {
echo("nginx");
}
@@ -83,13 +83,13 @@
</ul>
<ul class="list-group" style="margin-top:20px;">
- <li id="checking" class="list-group-item">Checking for updates...</li>
+ <li id="checking" class="list-group-item"><?= l("Checking for updates", "Recherche de mises à jour") ?>...</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
+ <b id="updates-count">0</b> <?= l("package·s have updates available", "paquet·s peuvent être mis à jour") ?>
<details>
- <summary>View details</summary>
+ <summary><?= l("View details", "Voir les détails") ?></summary>
<ul class="list-group" id="updates-list"></ul>
</details>
</li>
@@ -98,21 +98,21 @@
<script>
$.ajax("/admin/api/refreshUpdates.php", {
success: (data) => {
- document.getElementById("checking").innerText = "Checking for Ubuntu upgrades...";
+ document.getElementById("checking").innerText = "<?= l("Checking for Ubuntu upgrades", "Recherche de mises à niveau d'Ubuntu") ?>...";
$.ajax("/admin/api/getUbuntuUpgrades.php", {
success: (data) => {
document.getElementById("checking").innerHTML = data;
document.getElementById("checking2").style.display = "";
- document.getElementById("checking2").innerText = "Reading package lists...";
+ document.getElementById("checking2").innerText = "<?= l("Reading package lists", "Lecture des listes de paquets") ?>...";
$.ajax("/admin/api/getUpdates.php", {
success: (data) => {
- document.getElementById("checking2").innerText = "Please wait...";
+ document.getElementById("checking2").innerText = "<?= l("Please wait", "Patientez") ?>...";
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>`
+ 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><?= l("Provided by", "Fourni par ") ?>: <code>${item.repos}</code>, <?= l("target architecture", "architecture cible ") ?>: <code>${item.architecture}</code></li>`
}
document.getElementById("updates-list").innerHTML = dom;
@@ -121,17 +121,17 @@
document.getElementById("found").style.display = "";
},
error: () => {
- document.getElementById("checking2").innerText = "An error occurred while loading this content";
+ document.getElementById("checking2").innerText = "<?= l("An error occurred while loading this content, perhaps you don't have permission to access it", "Une erreur s'est produite lors du chargement de ce contenu, peut-être que vous n'avez pas la permission d'y accéder") ?>";
}
});
},
error: () => {
- document.getElementById("checking").innerText = "An error occurred while loading this content";
+ document.getElementById("checking").innerText = "<?= l("An error occurred while loading this content, perhaps you don't have permission to access it", "Une erreur s'est produite lors du chargement de ce contenu, peut-être que vous n'avez pas la permission d'y accéder") ?>";
}
});
},
error: () => {
- document.getElementById("checking").innerText = "An error occurred while loading this content";
+ document.getElementById("checking").innerText = "<?= l("An error occurred while loading this content, perhaps you don't have permission to access it", "Une erreur s'est produite lors du chargement de ce contenu, peut-être que vous n'avez pas la permission d'y accéder") ?>";
}
});
</script>
diff --git a/admin/private/header.api.php b/admin/private/header.api.php
index 132e75f..a8fdee8 100644
--- a/admin/private/header.api.php
+++ b/admin/private/header.api.php
@@ -8,4 +8,18 @@ if (!isset($_COOKIE["ADMIN_TOKEN"])) {
} else {
header("Location: https://jetbrains.minteck.ro.lt:1024/hub/hub/api/rest/oauth2/auth?client_id=36245ba5-ee9f-44c1-a149-ab2006fcb226&response_type=code&redirect_uri=https://minteck.ro.lt/admin/callback&scope=hub&request_credentials=default&access_type=offline");
die();
+}
+
+$_PERMSFORAPI = true;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/permissions.php";
+
+function l($en, $fr = null) {
+ global $lang;
+
+ if ((($lang === "fr" && isset($fr)) || (isset($_GET['fr']) && isset($fr) || isset($_COOKIE['fr']))) && !isset($_GET['en']) && !isset($_COOKIE['en']) && isset($fr)) {
+ setlocale(LC_TIME, array('fr_FR.UTF-8','fr_FR@euro','fr_FR','french'));
+ return $fr;
+ } else {
+ return $en;
+ }
} \ No newline at end of file
diff --git a/admin/private/header.php b/admin/private/header.php
index ddbee58..454fa7d 100644
--- a/admin/private/header.php
+++ b/admin/private/header.php
@@ -10,13 +10,31 @@ if (!isset($_COOKIE["ADMIN_TOKEN"])) {
die();
}
+$_PERMSFORAPI = false;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/permissions.php";
+
+if (!function_exists("l")) {
+ function l($en, $fr = null) {
+ global $lang;
+
+ if ((($lang === "fr" && isset($fr)) || (isset($_GET['fr']) && isset($fr) || isset($_COOKIE['fr']))) && !isset($_GET['en']) && !isset($_COOKIE['en']) && isset($fr)) {
+ setlocale(LC_TIME, array('fr_FR.UTF-8','fr_FR@euro','fr_FR','french'));
+ return $fr;
+ } else {
+ return $en;
+ }
+ }
+}
+
+ob_start();
+
?>
<!DOCTYPE html>
<html lang="en" style="height:100%;">
<head>
<meta charset="UTF-8">
- <title>Minteck Admin</title>
+ <title>Minteck Cloud Admin Console</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="/logo.svg">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
diff --git a/admin/private/header.sso.php b/admin/private/header.sso.php
new file mode 100644
index 0000000..5911f62
--- /dev/null
+++ b/admin/private/header.sso.php
@@ -0,0 +1,25 @@
+<?php
+
+if (!isset($_COOKIE["ADMIN_TOKEN"])) {
+ header("Location: https://jetbrains.minteck.ro.lt:1024/hub/hub/api/rest/oauth2/auth?client_id=36245ba5-ee9f-44c1-a149-ab2006fcb226&response_type=code&redirect_uri=https://minteck.ro.lt/admin/callback&scope=hub&request_credentials=default&access_type=offline");
+ die();
+} else if (ctype_xdigit($_COOKIE["ADMIN_TOKEN"]) && file_exists($_SERVER['DOCUMENT_ROOT'] . "/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN'])) {
+ $_DATA = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/tokens/" . $_COOKIE['ADMIN_TOKEN']), true);
+} else {
+ header("Location: https://jetbrains.minteck.ro.lt:1024/hub/hub/api/rest/oauth2/auth?client_id=36245ba5-ee9f-44c1-a149-ab2006fcb226&response_type=code&redirect_uri=https://minteck.ro.lt/admin/callback&scope=hub&request_credentials=default&access_type=offline");
+ die();
+}
+
+$_PERMSFORSSO = true;
+require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/private/permissions.php";
+
+function l($en, $fr = null) {
+ global $lang;
+
+ if ((($lang === "fr" && isset($fr)) || (isset($_GET['fr']) && isset($fr) || isset($_COOKIE['fr']))) && !isset($_GET['en']) && !isset($_COOKIE['en']) && isset($fr)) {
+ setlocale(LC_TIME, array('fr_FR.UTF-8','fr_FR@euro','fr_FR','french'));
+ return $fr;
+ } else {
+ return $en;
+ }
+} \ No newline at end of file
diff --git a/admin/private/permissions.json b/admin/private/permissions.json
new file mode 100644
index 0000000..32be506
--- /dev/null
+++ b/admin/private/permissions.json
@@ -0,0 +1,22 @@
+{
+ "74bca7d2-4694-477c-8bc1-9003315abbee": [
+ "login",
+ "home",
+ "serverTemp",
+ "index",
+ "audit",
+ "getIpLocation",
+ "uptime",
+ "serverTime",
+ "serverLogSummary",
+ "version",
+ "getUbuntuUpgrades",
+ "getUpdates",
+ "refreshUpdates",
+ "unchained",
+ "telemetry",
+ "quotas",
+ "getQuota",
+ "neutroning"
+ ]
+} \ No newline at end of file
diff --git a/admin/private/permissions.php b/admin/private/permissions.php
new file mode 100644
index 0000000..6ad7057
--- /dev/null
+++ b/admin/private/permissions.php
@@ -0,0 +1,37 @@
+<?php
+
+$perms = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/admin/private/permissions.json"), true);
+
+if (isset($_OVERRIDEPERMISSION)) {
+ $requested = $_OVERRIDEPERMISSION;
+} else {
+ $requested = substr(explode("/", $_SERVER["PHP_SELF"])[count(explode("/", $_SERVER["PHP_SELF"])) - 1], 0, -4);
+}
+
+$permsOkay = false;
+foreach ($perms as $user => $uperms) {
+ if ($user === $_DATA['id']) {
+ if (in_array($requested, $uperms)) {
+ $permsOkay = true;
+ }
+ }
+}
+
+if (!$permsOkay && $requested !== "denied") {
+ if (isset($_PERMSFORAPI) && $_PERMSFORAPI) {
+ $_GET['_'] = "api." . $requested;
+ ob_end_clean();
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/panes/denied.php";
+ die();
+ } else if (isset($_PERMSFORSSO) && $_PERMSFORSSO) {
+ $_GET['_'] = "sso." . $requested;
+ ob_end_clean();
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/panes/denied.php";
+ die();
+ } else {
+ $_GET['_'] = "dom." . $requested;
+ ob_end_clean();
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/admin/panes/denied.php";
+ die();
+ }
+} \ No newline at end of file