From f4d52a3f0c35968b2007c808da6fd409d50fe8aa Mon Sep 17 00:00:00 2001 From: RaindropsSys Date: Tue, 4 Jul 2023 09:01:50 +0200 Subject: Updated 5 files (automated) --- pages/api/session.php | 36 ++++++++++++++++++++---------------- 1 file changed, 20 insertions(+), 16 deletions(-) (limited to 'pages/api/session.php') diff --git a/pages/api/session.php b/pages/api/session.php index 53e1845..d410c10 100644 --- a/pages/api/session.php +++ b/pages/api/session.php @@ -4,22 +4,26 @@ require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn; header("Content-Type: application/json"); +global $token; -if (!$isLoggedIn || $isLowerLoggedIn) { - die(json_encode([ - "name" => null, - "created" => null, - "last_seen" => null, - "seen_at" => null - ], JSON_PRETTY_PRINT)); -} +if (isset($_GET["raw"])) { + die(json_encode(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token)), true), JSON_PRETTY_PRINT)); +} else { + if (!$isLoggedIn || $isLowerLoggedIn) { + die(json_encode([ + "name" => null, + "created" => null, + "last_seen" => null, + "seen_at" => null + ], JSON_PRETTY_PRINT)); + } -global $token; -$data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token)), true); + $data = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . str_replace("/", "", $token)), true); -die(json_encode([ - "name" => $data["name"], - "created" => date('c', $data["created"]), - "last_seen" => date('c', $data["last"]), - "seen_at" => array_keys($data["addresses"] ?? []) -], JSON_PRETTY_PRINT)); \ No newline at end of file + die(json_encode([ + "name" => $data["name"], + "created" => date('c', $data["created"]), + "last_seen" => date('c', $data["last"]), + "seen_at" => array_keys($data["addresses"] ?? []) + ], JSON_PRETTY_PRINT)); +} \ No newline at end of file -- cgit