diff options
Diffstat (limited to 'includes/util/short.inc')
-rw-r--r-- | includes/util/short.inc | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/includes/util/short.inc b/includes/util/short.inc new file mode 100644 index 0000000..39e42b0 --- /dev/null +++ b/includes/util/short.inc @@ -0,0 +1,55 @@ +<?php + +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/bitset.inc"; +require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/score.inc"; + +global $toplevel; global $lang; global $pages; + +header("Content-Type: text/plain"); +$members = scoreOrderGlobal(); +$list = [ + "rd" => "/raindrops", + "cb" => "/cloudburst", + "minty" => "/cloudydreams", + "twilight" => "/twi", + "luna" => "/princessluna", + "cloudy" => "/cloudydreams", + "zipp" => "/zippstorm", + "babs" => "/babsseed", + "frost" => "/frostcrystals", + "violet" => "/violetdawn" +]; + +foreach ($members as $member) { + for ($i = 1; $i < strlen($member["name"]); $i++) { + $part = substr($member["name"], 0, $i); + + if (in_array($part, array_keys($list))) { + $list[$part] = false; + } else { + $list[$part] = "/" . $member["name"]; + } + } + + foreach ($member["proxy_tags"] as $proxy) { + $system = $member["_system"] === "gdapd" ? "rd" : "cb"; + $list[$system . preg_replace("/[^a-z]/m", "", $proxy["prefix"])] = "/" . $member["name"]; + } + + $list[$member["id"]] = "/" . $member["name"]; + $list[$member["uuid"]] = "/" . $member["name"]; +} + +$list["minty"] = "/cloudydreams"; +$list["twilight"] = "/twi"; + +if (in_array($toplevel, array_keys($list)) && $list[$toplevel]) { + if ($toplevel !== "unknown") { + header("Location: " . $list[$toplevel]); + } else { + peh_error("Page not found: " . strip_tags($toplevel), 404); + } +} else { + peh_error("Page not found: " . strip_tags($toplevel), 404); +}
\ No newline at end of file |