Added samuel johnson dictionary to finbrook and "prehp" capabilities
This commit is contained in:
parent
06de890360
commit
506d2605ba
40
router.php
40
router.php
|
@ -79,38 +79,32 @@ function uri_from_file($file) {
|
||||||
return substr($file, 0, strrpos($file, '.'));
|
return substr($file, 0, strrpos($file, '.'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function try_file($uri, $ext) {
|
||||||
|
|
||||||
|
$tryf = "$uri/index";
|
||||||
|
$tryuri = ltrim($tryf, '/');
|
||||||
|
|
||||||
|
if (is_file("$tryf.$ext")) return "$tryf.$ext";
|
||||||
|
else if (is_file("$uri.$ext")) return "$uri.$ext";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
function load_page($tryuri) {
|
function load_page($tryuri) {
|
||||||
global $site;
|
global $site;
|
||||||
|
|
||||||
$mainphp = "";
|
$mainphp = "";
|
||||||
|
$prehp = "";
|
||||||
$jsonf = "";
|
$jsonf = "";
|
||||||
$parsef = "";
|
$parsef = "";
|
||||||
|
|
||||||
/* Looking for 3 things: a base, a content, and a template */
|
/* Looking for 3 things: a base, a content, and a template */
|
||||||
|
|
||||||
$tryf = "$tryuri/index";
|
$jsonf = try_file($tryuri, "json");
|
||||||
$tryf = ltrim($tryf, '/');
|
$mainphp = try_file($tryuri, "php");
|
||||||
|
$parsef = try_file($tryuri, "md");
|
||||||
|
$prehp = try_file($tryuri, "prehp");
|
||||||
|
|
||||||
if (is_file("$tryf.json")) {
|
if (empty($mainphp) && empty($jsonf) && empty($parsef) && empty($prehp)) {
|
||||||
$jsonf = "$tryf.json";
|
|
||||||
} else if (is_file("$tryuri.json")) {
|
|
||||||
$jsonf = "$tryuri.json";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_file("$tryf.php")) {
|
|
||||||
$mainphp = "$tryf.php";
|
|
||||||
}
|
|
||||||
else if (is_file("$tryuri.php")) {
|
|
||||||
$mainphp = "$tryuri.php";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_file("$tryf.md")) {
|
|
||||||
$parsef = "$tryf.md";
|
|
||||||
} else if (is_file("$tryuri.md")) {
|
|
||||||
$parsef = "$tryuri.md";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($mainphp) && empty($jsonf) && empty($parsef)) {
|
|
||||||
load_page("404");
|
load_page("404");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -154,6 +148,8 @@ if (!empty($parsef)) {
|
||||||
$page['title'] = $obj->title ?? $site['title'];
|
$page['title'] = $obj->title ?? $site['title'];
|
||||||
$page['desc'] = $obj->desc ?? $site['desc'];
|
$page['desc'] = $obj->desc ?? $site['desc'];
|
||||||
|
|
||||||
|
if (!empty($prehp)) include $prehp;
|
||||||
|
|
||||||
include "base.php";
|
include "base.php";
|
||||||
|
|
||||||
$tt = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
|
$tt = microtime(true) - $_SERVER['REQUEST_TIME_FLOAT'];
|
||||||
|
|
Loading…
Reference in a new issue