summaryrefslogtreecommitdiff
path: root/app.php
diff options
context:
space:
mode:
authorRaindropsSys <raindrops@equestria.dev>2024-03-30 23:40:33 +0100
committerRaindropsSys <raindrops@equestria.dev>2024-03-30 23:40:33 +0100
commit6b796258d413f00e498ce7f80f73a9f6c061f29c (patch)
tree49e64a5dd4cde2acff7f0a93ed3f8e20e1cb2dc8 /app.php
parent5860551daa0f60103ad24e93da29f401a653f144 (diff)
downloadpluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.gz
pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.tar.bz2
pluralconnect-6b796258d413f00e498ce7f80f73a9f6c061f29c.zip
Updated 5 files, added 2 files, deleted 495 files and renamed 7 files (automated)
Diffstat (limited to 'app.php')
-rw-r--r--app.php164
1 files changed, 7 insertions, 157 deletions
diff --git a/app.php b/app.php
index 521ce2f..4df1aea 100644
--- a/app.php
+++ b/app.php
@@ -1,78 +1,7 @@
<?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")) {
- require_once $_SERVER['DOCUMENT_ROOT'] . "/error.php";
- set_error_handler("ch_error");
-}
-
-$start = microtime(true);
-$GLOBALS["ColdHazeStart"] = microtime(true);
-$GLOBALS["ColdHazePerformance"] = [];
-
-if (!function_exists("formatPonypush")) {
- function formatPonypush($message) {
- return "Update to Ponypush 3.1.0 or later — (\$PA1$\$" . base64_encode($message) . "\$\$)";
- }
-}
-
-$lang = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/i18n/en.json"), true); global $lang; global $pages;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/session.inc"; global $isLoggedIn; global $isLowerLoggedIn;
-require_once $_SERVER['DOCUMENT_ROOT'] . "/includes/util/functions.inc";
-
global $app;
-$app = $GLOBALS["ColdHazeApp"] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/includes/app.json"), true);
+$app = $GLOBALS["ColdHazeApp"] = json_decode(file_get_contents($_SERVER['DOCUMENT_ROOT'] . "/app.json"), true);
if (str_ends_with($_GET['_'], "/")) {
$pagename = substr($_GET['_'], 0, strlen($_GET['_']) - 1);
@@ -82,92 +11,13 @@ if (str_ends_with($_GET['_'], "/")) {
$toplevel = explode("/", $pagename)[0];
-if ($enable2024Mode) {
- if ($toplevel === "api") {
- require_once $_SERVER['DOCUMENT_ROOT'] . "/api/_main.php";
- } else {
- require_once $_SERVER['DOCUMENT_ROOT'] . "/eol.php";
- }
+if ($toplevel === "api") {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/api/_main.php";
} else {
- 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("File not found", 404);
- }
- } elseif ($toplevel === "") {
- $pageFile = $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
- $GLOBALS["ColdHazePerformance"]["router"] = (microtime(true) - $start) * 1000;
- require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/home.inc";
+ if (time() > 1714507200) {
+ header("Location: https://equestria.dev");
+ die();
} 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";
- } 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";
- }
- } else if ($toplevel === "raindrops" || $toplevel === "moonglow" || (($isLoggedIn || $isLowerLoggedIn) && $toplevel === $app["other"]["slug"])) {
- $parts = explode("/", $_GET['_']);
-
- if (isset($parts[1]) && $parts[1] !== "-") {
- if ($parts[1] === "unknown") {
- header("Location: /unknown-rd");
- } else {
- header("Location: /" . $parts[1]);
- }
-
- die();
- }
-
- $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 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";
- }
- }
- }
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/eol.php";
}
}
-
-$output = ob_get_contents();
-ob_end_clean();
-echo($output);