aboutsummaryrefslogtreecommitdiff
path: root/admin/panes/audit.php
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/panes/audit.php
parente255736e3f2a95ee82cadc01b0c70749ab946226 (diff)
downloadmain-94c57fa247ba107fce8fc1d1fc355191229dbddc.tar.gz
main-94c57fa247ba107fce8fc1d1fc355191229dbddc.tar.bz2
main-94c57fa247ba107fce8fc1d1fc355191229dbddc.zip
Permissions system
Diffstat (limited to 'admin/panes/audit.php')
-rw-r--r--admin/panes/audit.php56
1 files changed, 41 insertions, 15 deletions
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++;