mirror of
https://github.com/Aviortheking/DeltaCMS.git
synced 2025-07-04 10:39:19 +00:00
too manu changes (will list by files)
.gitignore ignores some launch files changelog.md, readme.md added end file line public.php moved started the work on it router.php added require to functions & moved the function in the file set an ini value to show errors defied some constants moved the public page management to public/public.php exampleModule -> headGenerator.php started working on module management *.json reworked files function.php added this file to manages cores functions website.php the Website Object for theme & modules page.php created a test theme
This commit is contained in:
56
router.php
56
router.php
@ -1,20 +1,33 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* this file initialize some variables and do the first part of the routing (between public pages & admin pages)
|
||||
*/
|
||||
|
||||
require_once "admin/system/functions.php";
|
||||
|
||||
ini_set('display_errors', 'On');
|
||||
|
||||
$url = strtolower(endsWith($_SERVER["REQUEST_URI"], "/") ? $_SERVER["REQUEST_URI"] . "index" : $_SERVER["REQUEST_URI"]);
|
||||
|
||||
define("URL", $url);
|
||||
define("ROOT", __DIR__);
|
||||
|
||||
|
||||
define("SETTINGS", loadJSON(ROOT . "/admin/settings/admin.json"));
|
||||
// $website = new Website();
|
||||
// var_dump(__DIR__);
|
||||
$_SERVER = null;
|
||||
|
||||
if($url == "/test") {
|
||||
require_once "test.php";
|
||||
die;
|
||||
}
|
||||
|
||||
$_SERVER = null;
|
||||
$fileURI = "./pages" . $url . ".json";
|
||||
if(in_array(explode("/", $url)[1], ["login", "admin"])) echo ("this is the login/admin page");
|
||||
elseif (file_exists($fileURI)) {
|
||||
$json = json_decode(file_get_contents($fileURI));
|
||||
echo ($json->title);
|
||||
require_once "public/public.php";
|
||||
} else echo "404";
|
||||
/*
|
||||
|
||||
@ -30,39 +43,4 @@ verify if user is logged in
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function endsWith($haystack, $needle) {
|
||||
$length = strlen($needle);
|
||||
if ($length == 0) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return (substr($haystack, -$length) === $needle);
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
Reference in New Issue
Block a user