summaryrefslogtreecommitdiff
path: root/app.php
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-29 22:05:35 +0100
commit5860551daa0f60103ad24e93da29f401a653f144 (patch)
tree9ad97e04152a6edc11d5096c87880978df39086a /app.php
parenta51979ad60074db84af78a06d30fcb888ccb0b03 (diff)
downloadpluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.gz
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.tar.bz2
pluralconnect-5860551daa0f60103ad24e93da29f401a653f144.zip
Updated 20 files, added 6 files, deleted 144 files and renamed .idea/ponycule.iml (automated)
Diffstat (limited to 'app.php')
-rw-r--r--app.php185
1 files changed, 119 insertions, 66 deletions
diff --git a/app.php b/app.php
index 2a6578a..521ce2f 100644
--- a/app.php
+++ b/app.php
@@ -1,5 +1,55 @@
<?php
+$enable2024Mode = isset($_GET["2024"]) || time() >= 1711929600;
+$defaultMember = <<<EOF
+{
+ "regression": null,
+ "median": false,
+ "marefriends": [],
+ "sisters": [],
+ "caretakers": [],
+ "heat": null,
+ "birth": {
+ "date": "01-01",
+ "year": null,
+ "age": 0
+ },
+ "code": "",
+ "interest": "",
+ "food": 0,
+ "shared_memory": 0,
+ "species": [
+ "earth"
+ ],
+ "alignment": {
+ "sexual": "homo",
+ "romantic": "homo"
+ },
+ "sexfriends": [],
+ "age_regressor": false,
+ "age_spells": false,
+ "host": false,
+ "not_talking": false,
+ "protector": false,
+ "leader": false,
+ "fictive": false,
+ "sexual_features": false,
+ "sexually_active": false,
+ "robot": false,
+ "plush": false,
+ "polyamorous": {
+ "romantic": false,
+ "sexual": false
+ },
+ "non_verbal": false,
+ "less_frequent": false,
+ "persecutor": false,
+ "pacifier": false,
+ "not_fronting": false,
+ "friends": []
+}
+EOF;
+
ob_start();
if (!str_starts_with($_SERVER['REQUEST_URI'], "/api")) {
@@ -32,84 +82,87 @@ if (str_ends_with($_GET['_'], "/")) {
$toplevel = explode("/", $pagename)[0];
-if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
- $filename = explode("/", $pagename)[1];
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $toplevel . "/" . $filename)) {
- header("Location: /assets/" . $toplevel . "/" . $filename) and die();
+if ($enable2024Mode) {
+ if ($toplevel === "api") {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/_main.php";
} else {
- peh_error("File not found", 404);
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/eol.php";
}
-} elseif ($toplevel === "") {
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
- $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
- require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
} else {
- if ($toplevel === "-") {
- $pagename = substr($pagename, 2);
- $toplevel = explode("/", $pagename)[0];
-
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
- $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
- require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
+ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
+ $filename = explode("/", $pagename)[1];
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/assets/" . $toplevel . "/" . $filename)) {
+ header("Location: /assets/" . $toplevel . "/" . $filename) and die();
} else {
- peh_error("Page not found: " . strip_tags($pagename), 404);
- }
- } else if ($toplevel === "api") {
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
- $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
- require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
+ peh_error("File not found", 404);
}
- } else if ($toplevel === "raindrops" || $toplevel === "moonglow" || (($isLoggedIn || $isLowerLoggedIn) && $toplevel === $app["other"]["slug"])) {
- $parts = explode("/", $_GET['_']);
+ } elseif ($toplevel === "") {
+ $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
+ $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
+ } else {
+ if ($toplevel === "-") {
+ $pagename = substr($pagename, 2);
+ $toplevel = explode("/", $pagename)[0];
- if (isset($parts[1]) && $parts[1] !== "-") {
- if ($parts[1] === "unknown") {
- header("Location: /unknown-rd");
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
+ $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
+ $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
} else {
- header("Location: /" . $parts[1]);
+ peh_error("Page not found: " . strip_tags($pagename), 404);
+ }
+ } else if ($toplevel === "api") {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
+ $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
+ $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc";
}
+ } else if ($toplevel === "raindrops" || $toplevel === "moonglow" || (($isLoggedIn || $isLowerLoggedIn) && $toplevel === $app["other"]["slug"])) {
+ $parts = explode("/", $_GET['_']);
- die();
- }
+ if (isset($parts[1]) && $parts[1] !== "-") {
+ if ($parts[1] === "unknown") {
+ header("Location: /unknown-rd");
+ } else {
+ header("Location: /" . $parts[1]);
+ }
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
- $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
- require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
- } else {
- if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
- header("Location: /-/" . $toplevel);
- } else {
- $namesRaindrops = [...array_map(function ($i) {
- return $i['name'];
- }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), function ($i) {
- return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json");
- })), "unknown-rd"];
- $namesMoonglow = array_map(function ($i) {
- return $i['name'];
- }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/members.json"), true), function ($i) {
- return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json");
- }));
- $namesOther = [];
-
- if ($isLoggedIn || $isLowerLoggedIn) {
- $namesOther = [...array_map(function ($i) {
- return $i['name'];
- }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true), function ($i) {
- return file_exists($_SERVER['DOCUMENT_ROOT'] . "/includes/data/metadata/" . $i["id"] . ".json");
- })), $app["other"]["unknown"]];
+ die();
}
- if ((in_array($toplevel, $namesRaindrops) || in_array($toplevel, $namesOther) || in_array($toplevel, $namesMoonglow)) && $toplevel !== "unknown") {
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
- $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
- require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
+ $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
+ $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
+ } else {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".inc")) {
+ header("Location: /-/" . $toplevel);
} else {
- global $toplevel;
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/includes/util/short.inc";
- $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
- require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/short.inc";
+ $namesRaindrops = [...array_map(function ($i) {
+ return $i['name'];
+ }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/gdapd/members.json"), true), function ($i) {
+ return true;
+ })), "unknown-rd"];
+ $namesMoonglow = array_map(function ($i) {
+ return $i['name'];
+ }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/hrbom/members.json"), true), function ($i) {
+ return true;
+ }));
+ $namesOther = [];
+
+ if ($isLoggedIn || $isLowerLoggedIn) {
+ $namesOther = [...array_map(function ($i) {
+ return $i['name'];
+ }, array_filter(json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/data/other/members.json"), true), function ($i) {
+ return true;
+ })), $app["other"]["unknown"]];
+ }
+
+ if ((in_array($toplevel, $namesRaindrops) || in_array($toplevel, $namesOther) || in_array($toplevel, $namesMoonglow)) && $toplevel !== "unknown") {
+ $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
+ $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.inc";
+ }
}
}
}
@@ -117,4 +170,4 @@ if (in_array($toplevel, ["editor", "icons", "species", "uploads"])) {
$output = ob_get_contents();
ob_end_clean();
-echo($output); \ No newline at end of file
+echo($output);