2023-01-06 04:01:00 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
error_reporting(E_ALL);
|
2023-01-07 02:25:28 +00:00
|
|
|
ini_set('display_errors', '1');
|
2023-01-06 04:01:00 +00:00
|
|
|
|
2023-01-08 17:14:40 +00:00
|
|
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
2023-01-09 07:43:17 +00:00
|
|
|
require_once __DIR__ . DIRECTORY_SEPARATOR . 'Constants.php';
|
2023-01-06 04:01:00 +00:00
|
|
|
|
2023-05-05 02:36:15 +00:00
|
|
|
$classMapPath = __DIR__ . DIRECTORY_SEPARATOR . 'Cache' . DIRECTORY_SEPARATOR . 'classMap.php';
|
2023-05-27 09:14:33 +00:00
|
|
|
$loader = new AntCMS\AntLoader(['path' => $classMapPath]);
|
|
|
|
$loader->addNamespace('AntCMS\\', __DIR__ . DIRECTORY_SEPARATOR . 'AntCMS');
|
2023-05-05 02:36:15 +00:00
|
|
|
$loader->checkClassMap();
|
|
|
|
$loader->register();
|
|
|
|
|
2023-01-06 10:46:38 +00:00
|
|
|
use AntCMS\AntCMS;
|
2023-01-06 22:17:33 +00:00
|
|
|
use AntCMS\AntConfig;
|
2023-01-06 10:46:38 +00:00
|
|
|
|
2023-01-07 20:15:29 +00:00
|
|
|
if (!file_exists(antConfigFile)) {
|
2023-01-06 22:17:33 +00:00
|
|
|
AntConfig::generateConfig();
|
|
|
|
}
|
|
|
|
|
2023-01-07 20:15:29 +00:00
|
|
|
if (!file_exists(antPagesList)) {
|
2023-05-26 12:44:27 +00:00
|
|
|
\AntCMS\AntPages::generatePages();
|
2023-01-07 00:16:11 +00:00
|
|
|
}
|
|
|
|
|
2023-03-07 10:09:32 +00:00
|
|
|
$antCms = new AntCMS();
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
$requestUri = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
|
|
|
$baseUrl = AntConfig::currentConfig('baseURL');
|
|
|
|
$antRouting = new \AntCMS\AntRouting($baseUrl, $requestUri);
|
2023-01-07 20:15:29 +00:00
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if (AntConfig::currentConfig('forceHTTPS') && !\AntCMS\AntEnviroment::isCli()) {
|
|
|
|
$antRouting->redirectHttps();
|
2023-01-06 22:17:33 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->checkMatch('/themes/*/assets')) {
|
|
|
|
$antCms->serveContent(AntDir . $requestUri);
|
2023-01-08 01:44:16 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->checkMatch('/.well-known/acme-challenge/*')) {
|
|
|
|
$antCms->serveContent(AntDir . $requestUri);
|
2023-01-08 01:44:16 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->checkMatch('/sitemap.xml')) {
|
|
|
|
$antRouting->setRequestUri('/plugin/sitemap');
|
2023-01-14 07:46:17 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->checkMatch('/robots.txt')) {
|
|
|
|
$antRouting->setRequestUri('/plugin/robotstxt');
|
2023-01-14 08:30:29 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->checkMatch('/admin/*')) {
|
|
|
|
$antRouting->requestUriUnshift('plugin');
|
2023-03-07 10:09:32 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->checkMatch('/profile/*')) {
|
|
|
|
$antRouting->requestUriUnshift('plugin');
|
2023-03-07 10:09:32 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->checkMatch('/plugin/*')) {
|
|
|
|
$antRouting->routeToPlugin();
|
2023-01-08 16:54:54 +00:00
|
|
|
}
|
|
|
|
|
2023-05-26 12:44:27 +00:00
|
|
|
if ($antRouting->isIndex()) {
|
2023-03-07 10:09:32 +00:00
|
|
|
// If the users list hasn't been created, redirect to the first-time setup
|
|
|
|
if (!file_exists(antUsersList)) {
|
|
|
|
AntCMS::redirect('/profile/firsttime');
|
|
|
|
}
|
|
|
|
|
2023-01-09 18:47:55 +00:00
|
|
|
echo $antCms->renderPage('/');
|
2023-01-08 01:44:16 +00:00
|
|
|
exit;
|
2023-01-06 04:01:00 +00:00
|
|
|
} else {
|
2023-05-26 12:44:27 +00:00
|
|
|
echo $antCms->renderPage($requestUri);
|
2023-01-08 01:44:16 +00:00
|
|
|
exit;
|
2023-01-06 04:01:00 +00:00
|
|
|
}
|