summaryrefslogtreecommitdiff
path: root/app.php
diff options
context:
space:
mode:
authorMinteck <contact@minteck.org>2022-08-10 00:04:25 +0200
committerMinteck <contact@minteck.org>2022-08-10 00:04:25 +0200
commit0417260bf158c5d7b62888dae2e202b0de115a05 (patch)
tree7f54ee56da118813f2d1b3a324d322d0c74fa51b /app.php
downloadpluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.gz
pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.tar.bz2
pluralconnect-0417260bf158c5d7b62888dae2e202b0de115a05.zip
Initial commit
Diffstat (limited to 'app.php')
-rw-r--r--app.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/app.php b/app.php
new file mode 100644
index 0000000..79ed008
--- /dev/null
+++ b/app.php
@@ -0,0 +1,28 @@
+<?php
+
+if (str_ends_with($_GET['_'], "/")) {
+ $pagename = substr($_GET['_'], 0, strlen($_GET['_']) - 1);
+} else {
+ $pagename = $_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();
+ } else {
+ header("Location: /?error=File not found") and die();
+ }
+} elseif ($toplevel === "") {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/home.php";
+} else {
+ if (file_exists($_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php")) {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/" . $toplevel . ".php";
+ } else if ($toplevel === "cloudburst" || $toplevel === "raindrops") {
+ require_once $_SERVER['DOCUMENT_ROOT'] . "/pages/page.php";
+ } else {
+ header("Location: /?error=Page not found: " . strip_tags($pagename)) and die();
+ }
+} \ No newline at end of file