From ae535719f24ddd292194daa54509eaaccbb43836 Mon Sep 17 00:00:00 2001 From: Avior Date: Thu, 25 Apr 2019 10:26:11 +0200 Subject: [PATCH] Moved index & htaccess to public folder --- .htaccess => public/.htaccess | 11 ++++------- {src => public}/index.php | 13 ++++++++++--- 2 files changed, 14 insertions(+), 10 deletions(-) rename .htaccess => public/.htaccess (68%) rename {src => public}/index.php (94%) diff --git a/.htaccess b/public/.htaccess similarity index 68% rename from .htaccess rename to public/.htaccess index eadd3fa..b9204c7 100644 --- a/.htaccess +++ b/public/.htaccess @@ -3,18 +3,15 @@ RewriteEngine On - RewriteCond %{REQUEST_FILENAME} !-f [OR] - RewriteCond %{REQUEST_FILENAME} -f + RewriteCond %{REQUEST_FILENAME} !-f - RewriteRule ^(.*)$ src/index.php [L] + RewriteRule ^(.*)$ index.php [L] - -# RedirectMatch 403 ^/vendor/*$ -ErrorDocument 403 /src/index.php +ErrorDocument 403 /index.php - + Order Allow,Deny Deny from all diff --git a/src/index.php b/public/index.php similarity index 94% rename from src/index.php rename to public/index.php index d7c0ef2..614421b 100644 --- a/src/index.php +++ b/public/index.php @@ -16,6 +16,11 @@ $ap = AdminPanel::getInstance(); 2: match routes directly with modules */ $cache = $ap->getCache(); + +if (!$ap->isCacheEnabled()) { + $cache->clear(); +} + $caches = $cache->getMultiple(array( 'routes', 'templates', @@ -24,8 +29,9 @@ $caches = $cache->getMultiple(array( //if cache don't exist create it! $cachesBool = $caches["routes"] === null || $caches['templates'] === null || $caches['forms'] === null; -if (!($ap->isCacheEnabled()) || $cachesBool) { - $modulesDIR = __DIR__ . "/Modules"; +if (!$ap->isCacheEnabled() || $cachesBool) { + $cache->clear(); + $modulesDIR = dirname(__DIR__) . "/src/Modules"; $modules = array_diff(scandir($modulesDIR), array('..', '.')); /** @var string $module */ foreach ($modules as $module) { @@ -65,7 +71,8 @@ if (!($ap->isCacheEnabled()) || $cachesBool) { } $caches = $cache->getMultiple(array( 'routes', - 'templates' + 'templates', + 'forms' )); } //load each templates