= 0) { return $tense = "now"; } elseif ($difference > 0) { $tense = "ago"; } else { $tense = "later"; } for ($j = 0; $difference >= $lengths[$j] && $j < count($lengths)-1; $j++) { $difference /= $lengths[$j]; } $difference = round($difference); $period = $periods[$j]; if ($showTense) { if ($long) { return "{$difference} {$period}" . ($difference > 1 ? "s" : "") . " {$tense}"; } else { return "{$difference} {$period} {$tense}"; } } else { if ($long) { return "{$difference} {$period}" . ($difference > 1 ? "s" : ""); } else { return "{$difference} {$period}"; } } } global $_PROFILE; $_PROFILE = null; if (isset($_COOKIE["WAVY_SESSION_TOKEN"])) { if (!str_contains($_COOKIE["WAVY_SESSION_TOKEN"], ".") && !str_contains($_COOKIE["WAVY_SESSION_TOKEN"], "/")) { if (str_starts_with($_COOKIE["WAVY_SESSION_TOKEN"], "wv_")) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE["WAVY_SESSION_TOKEN"])) { $_PROFILE = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/tokens/" . $_COOKIE["WAVY_SESSION_TOKEN"]), true); } } } } $available = false; global $userPrivacy; $userProfile = []; $userFavorites = []; $userHistory = []; $userLibrary = []; $userSettings = []; if (count($_GET) > 0 && str_starts_with(array_keys($_GET)[0], "/")) { $hasID = true; $selectedId = substr(array_keys($_GET)[0], 1); if (preg_match("/[^a-f0-9-]/m", $selectedId) == 0) { if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $selectedId . "-privacy.json")) { $userPrivacy = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $selectedId . "-privacy.json"), true); $userProfile = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $selectedId . "-profile.json"), true); if ($userPrivacy["profile"] >= 1 && isset($_PROFILE) || $userPrivacy["profile"] === 2 || $_PROFILE["id"] === $userProfile["id"]) { $available = true; $userFavorites = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $selectedId . "-favorites.json"), true); $userHistory = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $selectedId . "-history.json"), true); $userLibrary = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $selectedId . "-library.json"), true); $userSettings = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/users/" . $selectedId . "-profileSettings.json"), true); $userLibrary = array_values(array_filter($userLibrary, function ($i) { global $albums; return isset($albums[$i]); })); $userHistory = array_values(array_filter($userHistory, function ($i) { global $songs; return isset($songs[$i["item"]]); })); $userFavorites = array_values(array_filter($userFavorites, function ($i) { global $songs; return isset($songs[$i]); })); } } } } else { $hasID = false; } if (!$available && $hasID) { header("HTTP/1.1 404 Not Found"); } function allowed(string $item): bool { global $userPrivacy; global $userProfile; global $_PROFILE; return $userPrivacy[$item] >= 1 && isset($_PROFILE) || $userPrivacy[$item] === 2 || $_PROFILE["id"] === $userProfile["id"]; } ?> <?= $available ? $userProfile['name'] . " — Mist" : "Mist" ?> " /> " /> " /> "> " /> " /> " />
"> ?dpr=2&size=32" style="filter: none !important; border-radius: 999px; vertical-align: middle; width: 32px;"> Sign in