Initial website add

This commit is contained in:
John Alanbrook 2022-08-02 12:48:43 +00:00
parent 91d03b12b8
commit e1eaf1a672

65
router.php Normal file
View file

@ -0,0 +1,65 @@
<?php
// router.php
$site = json_decode(file_get_contents("site.json");
echo json_last_error();
echo $site["title"];
/* Overwrite these with the specific content */
$title = $site['title'];
$desc = $site['desc'];
$author = "";
class menu_link {
public $name;
public $url;
}
$menu[0] = new menu_link();
$menu[1] = new menu_link();
$menu[2] = new menu_link();
$menu[0]->name = "Circus of the Stranded";
$menu[0]->url = "/rooms/circus";
$menu[1]->name = "Swan Song";
$menu[1]->url = "/rooms/swan";
$menu[2]->name = "Abstract Larceny";
$menu[2]->url = "/rooms/abstract-larceny";
$mainphp = "";
if (preg_match('/\.(?:jpg|png|css|ico|scss|js|ttf|woff)/', $_SERVER["REQUEST_URI"])) {
return false;
}
$obj = NULL;
$tryuri = ltrim("$_SERVER[REQUEST_URI]", '/');
$tryuri = strtok($tryuri, "?");
$jsonf = "index.json";
$mainphp = "index.php";
do {
$tryf = "$tryuri/index";
if (file_exists("$tryf.json") && $jsonf == "index.json") {
$jsonf = "$tryf.json";
}
if (file_exists("$tryf.php") && $mainphp == "index.php") {
$mainphp = "$tryf.php";
}
$tryuri = substr($tryuri, 0, strrpos($tryuri, '/'));
} while ($tryuri != "" && (!$obj || $mainphp == ""));
$file = file_get_contents($jsonf);
$obj = json_decode($file);
include "base.php";
?>