summaryrefslogtreecommitdiff
path: root/pages/api
diff options
context:
space:
mode:
authorRaindropsSys <contact@minteck.org>2023-06-03 14:10:08 +0200
committerRaindropsSys <contact@minteck.org>2023-06-03 14:10:08 +0200
commitcc2a438199b02c78e5b2e2b71de8e56f6617eae9 (patch)
tree7ddbeba11a3c16ada13663e7b3bba9bef0f96ca6 /pages/api
parent48afc99d05c7bcd54231f340635f5102a03fbda4 (diff)
downloadpluralconnect-cc2a438199b02c78e5b2e2b71de8e56f6617eae9.tar.gz
pluralconnect-cc2a438199b02c78e5b2e2b71de8e56f6617eae9.tar.bz2
pluralconnect-cc2a438199b02c78e5b2e2b71de8e56f6617eae9.zip
Updated 15 files (automated)
Diffstat (limited to 'pages/api')
-rw-r--r--pages/api/disconnect.php7
1 files changed, 5 insertions, 2 deletions
diff --git a/pages/api/disconnect.php b/pages/api/disconnect.php
index 13363e6..c4cf0bd 100644
--- a/pages/api/disconnect.php
+++ b/pages/api/disconnect.php
@@ -7,10 +7,13 @@ if (!$isLoggedIn && !$isLowerLoggedIn) {
die();
}
-$list = array_filter([...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), ...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens")], function ($token) use ($_PROFILE) {
+$list = array_filter([...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens"), ...scandir($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens")], function ($token) {
+ global $_PROFILE;
+ if ($token === "." || $token === "..") return false;
+
$session = file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token) ? json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $token), true) : json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/lowertokens/" . $token), true);
- return $token !== "." && $token !== ".." && isset($session["last"]) && isset($session["profile"]) && $session["profile"]["id"] === $_PROFILE["id"];
+ return isset($session["last"]) && isset($session["profile"]) && ($session["profile"]["id"] ?? "") === ($_PROFILE["id"] ?? "");
});
foreach ($list as $token) {