From 09bd0164ebc020a54b944b7326dcba496fb5d82c Mon Sep 17 00:00:00 2001 From: Minteck Date: Fri, 26 Aug 2022 22:29:23 +0200 Subject: idk when was the last commit so I'm making a new one - Violet Dawn --- includes/header.php | 329 +++++++++++++++++++++++++++------------------------- 1 file changed, 173 insertions(+), 156 deletions(-) (limited to 'includes/header.php') diff --git a/includes/header.php b/includes/header.php index 59c64b7..8ce8389 100644 --- a/includes/header.php +++ b/includes/header.php @@ -1,138 +1,34 @@ +function error($errno, $errstr, $file, $line) { + echo(' ">
- Error : [:] -
-Error ' . $errno . ': ' . $errstr . ' [' . $file . ':' . $line . '] + '); +} if (isset($_GET['errors'])) { - set_error_handler("error"); + ini_set('display_errors', '1'); + ini_set('display_startup_errors', '1'); + error_reporting(E_ALL); + set_error_handler("error", E_ALL); } +global $_MemberName; +global $_MemberPage; +global $_SystemName; +global $_SystemPage; +global $toplevel; + require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/travelling.php"; global $travelling; require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/score.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/pronouns.php"; require_once $_SERVER["DOCUMENT_ROOT"] . "/includes/bitset.php"; -require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/session.php"; global $isLoggedIn; global $isUserLoggedIn; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/banner.php"; require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/rainbow.php"; - -function getMiniName(string $name) { - $parts = explode(" ", $name); - - if (strlen($parts[0]) > 3 && !str_ends_with($parts[0], "e") && $parts[0] !== "Filly") { - if (str_contains($parts[0], "/")) { - return explode("/", $parts[0])[0]; - } else { - return $parts[0]; - } - } else { - return $name; - } -} - -function getSystemMember(string $system, string $id) { - $systemID = $system; - - $members = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$systemID-members.json"), true); - $member = null; - - foreach ($members as $m) { - if ($m["id"] === $id) $member = $m; - } - - return $member; -} - -function getBrightness(string $hexCode) { - if (str_starts_with("#", $hexCode)) { - $hexCode = substr($hexCode, 1); - } - - $red = hexdec(substr($hexCode, 0, 2)); - $green = hexdec(substr($hexCode, 2, 2)); - $blue = hexdec(substr($hexCode, 4, 2)); - $brightness = $red + $green + $blue; - - return $brightness > 382; -} - -function showMembersFromList(array $list, string $id) { - foreach ($list as $member) { if ($member['name'] !== "unknown") { - echo(' -
- -
' . ($member['display_name'] ?? $member['name']) . '
-
' . ($member['travelling'] ? "+" . ($member['proxy_tags'][0]['prefix'] ?? " ") : ($member['proxy_tags'][0]['prefix'] ?? " ")) . '
-
'); - }} -} - -function showSubsystem(array $data, string $parentSystem) { - $subsystemData = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$parentSystem-subsystem-$data[source].json"), true); - - echo(' -
'); - echo('
'); - - showMembersFromList(scoreOrder(array_map(function ($i) use ($parentSystem) { - return getSystemMember($parentSystem, $i); - }, $data["members"]), $parentSystem), $parentSystem); - - echo('
- -
'); -} - -function showSystem(string $id, string $name, string $color, bool $hideTitle) { - global $travelling; - - if ($hideTitle) { - echo(' -
'); - } else { - echo(' -
'); - } - if (!$hideTitle) echo(' - -

' . $name . '
-
'); - - if ($hideTitle) { - echo('
'); - } else { - echo('
'); - } - - showMembersFromList(scoreOrder([...array_map(function ($i) use ($id) { - $i["travelling"] = false; - $i["system"] = $id; - return $i; - }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/$id-members.json"), true), function ($i) use ($travelling) { - return !$travelling[$i['id']]['travelling']; - })), ...array_map(function ($i) use ($id) { - $i["travelling"] = true; - $i["system"] = ($id === "gdapd" ? "ynmuc" : "gdapd"); - return $i; - }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/" . ($id === "gdapd" ? "ynmuc" : "gdapd") . "-members.json"), true), function ($i) use ($travelling) { - return $travelling[$i['id']]['travelling']; - }))], $id), $id); - - echo('
- -
'); -} - -function cloudburst(bool $hideTitle): void { - showSystem("ynmuc", "Cloudburst System", "#5f08a9a6", $hideTitle); -} - -function raindrops(bool $hideTitle): void { - showSystem("gdapd", "Raindrops System", "#a95f08a6", $hideTitle); -} +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.php"; ?> @@ -142,8 +38,28 @@ function raindrops(bool $hideTitle): void { - <?= $title ? $title . " · " : "" ?>Cuties and Plurality - + <?= $title ? $title . " · " : "" ?>Cold Haze + + + + + + + + + + + + + + + + + + + + + -