summaryrefslogtreecommitdiff
path: root/includes/short.inc
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
committerMinteck <contact@minteck.org>2022-10-10 20:51:39 +0200
commit108525534c28013cfe1897c30e4565f9893f3766 (patch)
treedd3e5132971f96ab5f05e7f3f8f6dbbf379a19bd /includes/short.inc
parent2162eaa06f7e4764eb3dcfe130ec2c711d0c62ab (diff)
downloadpluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.gz
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.tar.bz2
pluralconnect-108525534c28013cfe1897c30e4565f9893f3766.zip
Update
Diffstat (limited to 'includes/short.inc')
-rw-r--r--includes/short.inc52
1 files changed, 52 insertions, 0 deletions
diff --git a/includes/short.inc b/includes/short.inc
new file mode 100644
index 0000000..66d749d
--- /dev/null
+++ b/includes/short.inc
@@ -0,0 +1,52 @@
+<?php
+
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/functions.inc";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/bitset.inc";
+require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/score.inc";
+
+global $toplevel;
+
+header("Content-Type: text/plain");
+$members = scoreOrderGlobal();
+$list = [
+ "rd" => "/raindrops",
+ "cb" => "/cloudburst",
+ "minty" => "/cloudydreams",
+ "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"] = "/cloudy";
+
+if (in_array($toplevel, array_keys($list)) && $list[$toplevel]) {
+ if ($toplevel !== "unknown") {
+ header("Location: " . $list[$toplevel]);
+ } else {
+ header("Location: /?error=Page not found: " . strip_tags($toplevel)) and die();
+ }
+} else {
+ header("Location: /?error=Page not found: " . strip_tags($toplevel)) and die();
+} \ No newline at end of file