[
'method' => "DELETE",
'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"]
]
];
$reqContext = stream_context_create($reqOptions);
// No actual data is received on DELETE, so we don't even bother trying to collect req response; if it fails it will put a warning in the logs anyway.
//sleep(1);
//file_get_contents("https://api.pluralkit.me/v2/members/$travellingMember", false, $reqContext);
}
} else {
$travelling[$_GET['member']]["travelling"] = true;
$travelling[$_GET['member']]["equestria"] = $equestria;
$travelling[$_GET['member']]["pluralkit"] = null;
$travelling[$_GET['member']]["history"][] = [
"start" => date("c"),
"end" => null,
"equestria" => $equestria
];
if (!$equestria) {
// Insert code here to run after a travelling member is ADDED.
// $id is the member ID (e.g. rirgf)
// $member is the member
// $system is the system the member comes from
// $metadata is the ponies.equestria.horse metadata
// $travellingMember is unset here
// Store the travelling member ID in $travelling[$id]['pluralkit']
$reqOptions = [
'http' => [
'method' => "POST",
'header' => "Authorization: " . $app["pluralkit"][$travellingSystem === "gdapd" ? "raindrops" : "cloudburst"] . "\r\n" .
"Content-Type: application/json",
'content' => json_encode([
'name' => "$member[name]-travelling",
'display_name' => $member["display_name"],
'color' => $member["color"],
'birthday' => $member["birthday"],
'created' => $member["created"],
'pronouns' => $member["pronouns"],
'avatar_url' => $member["avatar_url"],
'banner' => $member["banner"],
'description' => "**This pony is visiting this system from the " . ($system === "gdapd" ? "Raindrops System" : "Cloudburst System") . ". They are not a permanent member of this system**\n\n$member[description]",
'proxy_tags' => array_map(function ($i) {
$i["prefix"] = "+" . $i['prefix'];
return $i;
}, $member["proxy_tags"]),
'privacy' => $member["privacy"]
])
]
];
$reqContext = stream_context_create($reqOptions);
//sleep(1);
//$member = json_decode(file_get_contents("https://api.pluralkit.me/v2/members", false, $reqContext), true);
// Member exists?
//if (isset($member)) {
//$travelling[$id]['pluralkit'] = $member["id"];
//}
}
}
}
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/navigation.json", "{}");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/cache/home.json", "{}");
createJob("RefreshCache", []);
header("Location: /-/travelling");
file_put_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/travelling/travelling.json", utf8_encode(json_encode($travelling, JSON_PRETTY_PRINT)));
die();
}
global $use2023UI;
require_once $_SERVER['DOCUMENT_ROOT'] . '/includes/components/header.inc';
global $travelling;
?>