From 94c57fa247ba107fce8fc1d1fc355191229dbddc Mon Sep 17 00:00:00 2001 From: Minteck Date: Sun, 8 Aug 2021 22:31:51 +0200 Subject: Permissions system --- admin/panes/audit.php | 56 +++++++++++++++++++++++++++++++++++++-------------- 1 file changed, 41 insertions(+), 15 deletions(-) (limited to 'admin/panes/audit.php') 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 @@
-

Security Audit

+

- - - + + + @@ -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(" - - - + "); $index++; -- cgit
IP addressConnectionsUsername(s) Actions
" . $ip . "
Please wait...");?> +
" . $rip . "
" . l("Please wait", "Patientez") . "...");?> You"); + echo(" " . l("You", "Vous") . ""); } echo("
"); @@ -166,27 +192,27 @@ } } if (count($info["connections"]) === 0) { - echo("Never connected"); + echo("" . l("Never connected", "Jamais connecté") . ""); } else { - echo($success . " succeeded, " . $failed . " failed, " . $invalid . " invalid"); + echo($success . " " . l("succeeded", "réussi") . ", " . $failed . " " . l("failed", "échoué") . ", " . $invalid . " " . l("invalid", "invalide")); } - echo("
Last: "); + echo("
" . l("Last", "Dernier ") . ": "); if ($info["connections"][0]["status"] === "ok") { - echo("Succeeded"); + echo("" . l("Succeeded", "Réussi") . ""); } if ($info["connections"][0]["status"] === "error") { - echo("Failed"); + echo("" . l("Failed", "Échoué") . ""); } if ($info["connections"][0]["status"] === "invalid") { - echo("Invalid"); + echo("" . l("Invalid", "Invalide") . ""); } echo("
Show full list
    "); +
" . l("Show full list", "Afficher la liste") . "
    "); $uniqueUsers = []; $connectionsWithUsers = 0; @@ -208,11 +234,11 @@ } if (count($uniqueUsers) === 0) { - echo("
  • Username was never sent to server
  • "); + echo("
  • " . l("Username was never sent to server", "Le nom d'utilisateur n'a jamais été transmis au service") . "
  • "); } echo("
Details · Report" . l("Report as fraudulent", "Signaler comme fraude") . "