diff --git a/.htaccess b/.htaccess
index 70c9ced..659993e 100644
--- a/.htaccess
+++ b/.htaccess
@@ -1,74 +1,3 @@
-
-
-RewriteEngine On
-
-# If your homepage is http://yourdomain.com/yoursite
-# Set the RewriteBase to:
-# RewriteBase /yoursite
-
-# In some environements, an empty RewriteBase is required:
-# RewriteBase /
-
-# Use this to redirect HTTP to HTTPS on apache servers
-# RewriteCond %{HTTPS} off
-# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
-
-# Use this to redirect www to non-wwww on apache servers
-# RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
-# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
-
-# Use this to redirect slash/ to url without slash on apache servers
-# RewriteCond %{REQUEST_FILENAME} !-d
-# RewriteRule ^(.*)/$ /$1 [R=301,L]
-
-# Removes index.php
-RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
-RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
-
-# REWRITE TO INDEX
-
-# If the requested path and file not /index.php
-RewriteCond %{REQUEST_URI} !^/index\.php
-
-# if requested doesn't match a physical file
-RewriteCond %{REQUEST_FILENAME} !-f
-
-# if requested doesn't match a physical folder
-RewriteCond %{REQUEST_FILENAME} !-d
-
-# then rewrite the request to the index.php script
-RewriteRule ^ index.php [QSA,L]
-
-
-# FILE/FOLDER PROTECTION
-
-# Deny access to these file types generally
-RewriteRule ^(.*)?\.yml$ - [F,L]
-Rewriterule ^(.*)?\.yaml$ - [F,L]
-RewriteRule ^(.*)?\.txt$ - [F,L]
-RewriteRule ^(.*)?\.example$ - [F,L]
-RewriteRule ^(.*)?\.git+ - [F,L]
-RewriteRule ^(.*)?\.md - [F,L]
-RewriteCond %{REQUEST_URI} !/index\.php
-RewriteRule ^(.*)?\.ph - [F,L]
-RewriteRule ^(.*)?\.twig - [F,L]
-RewriteRule ^(media\/tmp\/) - [F,L]
-
-# Block access to specific files in the root folder
-RewriteRule ^(composer\.lock|composer\.json|\.htaccess)$ error [F,L]
-
-# block files and folders starting with a dot except for the .well-known folder (Let's Encrypt)
-RewriteRule (^|/)\.(?!well-known\/) index.php [L]
-
-# Allow access to frontend files in author folder
-RewriteRule ^(system\/author\/css\/) - [L]
-RewriteRule ^(system\/author\/img\/) - [L]
-RewriteRule ^(system\/author\/js\/) - [L]
-
-# redirect all other direct requests to the following physical folders to the index.php so pages with same name work
-RewriteRule ^(system|content|data|settings|(media\/files\/)) index.php [QSA,L]
-
-# disallow browsing other folders generally
-Options -Indexes
-
-
\ No newline at end of file
+RewriteEngine on
+RewriteRule ^$ public/ [L]
+RewriteRule (.*) public/$1 [L]
diff --git a/.htaccessold b/.htaccessold
new file mode 100644
index 0000000..70c9ced
--- /dev/null
+++ b/.htaccessold
@@ -0,0 +1,74 @@
+
+
+RewriteEngine On
+
+# If your homepage is http://yourdomain.com/yoursite
+# Set the RewriteBase to:
+# RewriteBase /yoursite
+
+# In some environements, an empty RewriteBase is required:
+# RewriteBase /
+
+# Use this to redirect HTTP to HTTPS on apache servers
+# RewriteCond %{HTTPS} off
+# RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
+
+# Use this to redirect www to non-wwww on apache servers
+# RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
+# RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
+
+# Use this to redirect slash/ to url without slash on apache servers
+# RewriteCond %{REQUEST_FILENAME} !-d
+# RewriteRule ^(.*)/$ /$1 [R=301,L]
+
+# Removes index.php
+RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
+RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]
+
+# REWRITE TO INDEX
+
+# If the requested path and file not /index.php
+RewriteCond %{REQUEST_URI} !^/index\.php
+
+# if requested doesn't match a physical file
+RewriteCond %{REQUEST_FILENAME} !-f
+
+# if requested doesn't match a physical folder
+RewriteCond %{REQUEST_FILENAME} !-d
+
+# then rewrite the request to the index.php script
+RewriteRule ^ index.php [QSA,L]
+
+
+# FILE/FOLDER PROTECTION
+
+# Deny access to these file types generally
+RewriteRule ^(.*)?\.yml$ - [F,L]
+Rewriterule ^(.*)?\.yaml$ - [F,L]
+RewriteRule ^(.*)?\.txt$ - [F,L]
+RewriteRule ^(.*)?\.example$ - [F,L]
+RewriteRule ^(.*)?\.git+ - [F,L]
+RewriteRule ^(.*)?\.md - [F,L]
+RewriteCond %{REQUEST_URI} !/index\.php
+RewriteRule ^(.*)?\.ph - [F,L]
+RewriteRule ^(.*)?\.twig - [F,L]
+RewriteRule ^(media\/tmp\/) - [F,L]
+
+# Block access to specific files in the root folder
+RewriteRule ^(composer\.lock|composer\.json|\.htaccess)$ error [F,L]
+
+# block files and folders starting with a dot except for the .well-known folder (Let's Encrypt)
+RewriteRule (^|/)\.(?!well-known\/) index.php [L]
+
+# Allow access to frontend files in author folder
+RewriteRule ^(system\/author\/css\/) - [L]
+RewriteRule ^(system\/author\/img\/) - [L]
+RewriteRule ^(system\/author\/js\/) - [L]
+
+# redirect all other direct requests to the following physical folders to the index.php so pages with same name work
+RewriteRule ^(system|content|data|settings|(media\/files\/)) index.php [QSA,L]
+
+# disallow browsing other folders generally
+Options -Indexes
+
+
\ No newline at end of file
diff --git a/composer.json b/composer.json
index c77b3ae..2837688 100644
--- a/composer.json
+++ b/composer.json
@@ -9,6 +9,7 @@
"vendor-dir": "system/vendor"
},
"require": {
+ "php": "^8.0",
"slim/slim": "4.*",
"slim/psr7": "^1.5",
"php-di/php-di": "^6.3",
diff --git a/composer.lock b/composer.lock
index c086fc9..71d8f89 100644
--- a/composer.lock
+++ b/composer.lock
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
- "content-hash": "9cb56450ca4ec7e5b572cc5f79181d18",
+ "content-hash": "cec6169bbe69cc122c0c577476c42f23",
"packages": [
{
"name": "akrabat/proxy-detection-middleware",
@@ -1519,20 +1519,20 @@
},
{
"name": "symfony/event-dispatcher",
- "version": "v6.1.0",
+ "version": "v6.0.9",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher.git",
- "reference": "a0449a7ad7daa0f7c0acd508259f80544ab5a347"
+ "reference": "5c85b58422865d42c6eb46f7693339056db098a8"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/a0449a7ad7daa0f7c0acd508259f80544ab5a347",
- "reference": "a0449a7ad7daa0f7c0acd508259f80544ab5a347",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/5c85b58422865d42c6eb46f7693339056db098a8",
+ "reference": "5c85b58422865d42c6eb46f7693339056db098a8",
"shasum": ""
},
"require": {
- "php": ">=8.1",
+ "php": ">=8.0.2",
"symfony/event-dispatcher-contracts": "^2|^3"
},
"conflict": {
@@ -1582,7 +1582,7 @@
"description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/event-dispatcher/tree/v6.1.0"
+ "source": "https://github.com/symfony/event-dispatcher/tree/v6.0.9"
},
"funding": [
{
@@ -1598,24 +1598,24 @@
"type": "tidelift"
}
],
- "time": "2022-05-05T16:51:07+00:00"
+ "time": "2022-05-05T16:45:52+00:00"
},
{
"name": "symfony/event-dispatcher-contracts",
- "version": "v3.1.0",
+ "version": "v3.0.1",
"source": {
"type": "git",
"url": "https://github.com/symfony/event-dispatcher-contracts.git",
- "reference": "02ff5eea2f453731cfbc6bc215e456b781480448"
+ "reference": "7bc61cc2db649b4637d331240c5346dcc7708051"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/02ff5eea2f453731cfbc6bc215e456b781480448",
- "reference": "02ff5eea2f453731cfbc6bc215e456b781480448",
+ "url": "https://api.github.com/repos/symfony/event-dispatcher-contracts/zipball/7bc61cc2db649b4637d331240c5346dcc7708051",
+ "reference": "7bc61cc2db649b4637d331240c5346dcc7708051",
"shasum": ""
},
"require": {
- "php": ">=8.1",
+ "php": ">=8.0.2",
"psr/event-dispatcher": "^1"
},
"suggest": {
@@ -1624,7 +1624,7 @@
"type": "library",
"extra": {
"branch-alias": {
- "dev-main": "3.1-dev"
+ "dev-main": "3.0-dev"
},
"thanks": {
"name": "symfony/contracts",
@@ -1661,7 +1661,7 @@
"standards"
],
"support": {
- "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.1.0"
+ "source": "https://github.com/symfony/event-dispatcher-contracts/tree/v3.0.1"
},
"funding": [
{
@@ -1677,27 +1677,24 @@
"type": "tidelift"
}
],
- "time": "2022-02-25T11:15:52+00:00"
+ "time": "2022-01-02T09:55:41+00:00"
},
{
"name": "symfony/finder",
- "version": "v6.1.0",
+ "version": "v6.0.8",
"source": {
"type": "git",
"url": "https://github.com/symfony/finder.git",
- "reference": "45b8beb69d6eb3b05a65689ebfd4222326773f8f"
+ "reference": "af7edab28d17caecd1f40a9219fc646ae751c21f"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/finder/zipball/45b8beb69d6eb3b05a65689ebfd4222326773f8f",
- "reference": "45b8beb69d6eb3b05a65689ebfd4222326773f8f",
+ "url": "https://api.github.com/repos/symfony/finder/zipball/af7edab28d17caecd1f40a9219fc646ae751c21f",
+ "reference": "af7edab28d17caecd1f40a9219fc646ae751c21f",
"shasum": ""
},
"require": {
- "php": ">=8.1"
- },
- "require-dev": {
- "symfony/filesystem": "^6.0"
+ "php": ">=8.0.2"
},
"type": "library",
"autoload": {
@@ -1725,7 +1722,7 @@
"description": "Finds files and directories via an intuitive fluent interface",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/finder/tree/v6.1.0"
+ "source": "https://github.com/symfony/finder/tree/v6.0.8"
},
"funding": [
{
@@ -1741,7 +1738,7 @@
"type": "tidelift"
}
],
- "time": "2022-04-15T08:08:08+00:00"
+ "time": "2022-04-15T08:07:58+00:00"
},
{
"name": "symfony/polyfill-ctype",
@@ -2072,20 +2069,20 @@
},
{
"name": "symfony/yaml",
- "version": "v6.1.0",
+ "version": "v6.0.3",
"source": {
"type": "git",
"url": "https://github.com/symfony/yaml.git",
- "reference": "84ce4f9d2d68f306f971a39d949d8f4b5550dba2"
+ "reference": "e77f3ea0b21141d771d4a5655faa54f692b34af5"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/symfony/yaml/zipball/84ce4f9d2d68f306f971a39d949d8f4b5550dba2",
- "reference": "84ce4f9d2d68f306f971a39d949d8f4b5550dba2",
+ "url": "https://api.github.com/repos/symfony/yaml/zipball/e77f3ea0b21141d771d4a5655faa54f692b34af5",
+ "reference": "e77f3ea0b21141d771d4a5655faa54f692b34af5",
"shasum": ""
},
"require": {
- "php": ">=8.1",
+ "php": ">=8.0.2",
"symfony/polyfill-ctype": "^1.8"
},
"conflict": {
@@ -2126,7 +2123,7 @@
"description": "Loads and dumps YAML files",
"homepage": "https://symfony.com",
"support": {
- "source": "https://github.com/symfony/yaml/tree/v6.1.0"
+ "source": "https://github.com/symfony/yaml/tree/v6.0.3"
},
"funding": [
{
@@ -2142,7 +2139,7 @@
"type": "tidelift"
}
],
- "time": "2022-04-15T14:25:02+00:00"
+ "time": "2022-01-26T17:23:29+00:00"
},
{
"name": "twig/twig",
@@ -2286,7 +2283,9 @@
"stability-flags": [],
"prefer-stable": true,
"prefer-lowest": false,
- "platform": [],
+ "platform": {
+ "php": "^8.0"
+ },
"platform-dev": [],
"plugin-api-version": "2.3.0"
}
diff --git a/content/02-docs-v2/01-installation.md b/content/02-docs-v2/01-installation.md
new file mode 100644
index 0000000..e69de29
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..11b28de
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,4 @@
+RewriteEngine On
+RewriteCond %{REQUEST_FILENAME} !-f
+RewriteCond %{REQUEST_FILENAME} !-d
+RewriteRule ^ index.php [QSA,L]
\ No newline at end of file
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..3e92aaf
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,3 @@
+getContainer();
+
+$responseFactory = $app->getResponseFactory();
+$routeParser = $app->getRouteCollector()->getRouteParser();
+
+/****************************
+* BASE PATH *
+****************************/
+
+# basepath must always be set in slim 4
+$basepath = preg_replace('/(.*)\/.*/', '$1', $_SERVER['SCRIPT_NAME']);
+
+$container->set('basePath', $basepath);
+
+$app->setBasePath($basepath);
+
+die('hello Typemill V2');
+
+
+/****************************
+* SETTINGS *
+****************************/
+$settings = require __DIR__ . '/settings/settings.php';
+
+$container->set('settings', function() use ($settings)
+{
+ return $settings;
+});
+
+
+# create a session
+ini_set('session.cookie_httponly', 1 );
+ini_set('session.use_strict_mode', 1);
+ini_set('session.cookie_samesite', 'lax');
+if(isset($_SERVER['HTTPS']))
+{
+ ini_set('session.cookie_secure', 1);
+ session_name('__Secure-nquire-session');
+}
+else
+{
+ session_name('nquire-session');
+}
+session_start();
+
+# add flash messsages
+$container->set('flash', function(){
+ return new Messages();
+});
+
+# Register Middleware On Container
+$container->set('csrf', function () use ($responseFactory) {
+ return new Guard($responseFactory);
+});
+
+# Set view in Container
+$container->set('view', function() use ($container) {
+
+ $twig = Twig::create(__DIR__ . DIRECTORY_SEPARATOR . 'views',['cache' => false, 'debug' => true]);
+
+ $twig->getEnvironment()->addGlobal('errors', NULL);
+ $twig->getEnvironment()->addGlobal('flash', NULL);
+
+ $twig->addExtension(new \Twig\Extension\DebugExtension());
+ $twig->addExtension(new \Nquire\Extensions\TwigUserExtension());
+ $twig->addExtension(new \Nquire\Extensions\TwigCsrfExtension($container->get('csrf')));
+
+ return $twig;
+});
+
+/****************************
+* SET ROUTE PARSER TO USE NAMED ROUTES IN CONTROLLER *
+****************************/
+
+$container->set('routeParser', $routeParser);
+
+/****************************
+* MIDDLEWARE *
+****************************/
+
+# Add Validation Errors Middleware
+$app->add(new ValidationErrors($container->get('view')));
+
+# Add Flash Messages Middleware
+$app->add(new FlashMessages($container->get('view')));
+
+# Add csrf middleware globally
+$app->add('csrf');
+
+# Add Twig-View Middleware
+$app->add(TwigMiddleware::createFromContainer($app));
+
+# add JsonBodyParser Middleware
+$app->add(new JsonBodyParser());
+
+/**
+ * The routing middleware should be added earlier than the ErrorMiddleware
+ * Otherwise exceptions thrown from it will not be handled by the middleware
+ */
+$app->addRoutingMiddleware();
+
+/**
+ * Add Error Middleware
+ *
+ * @param bool $displayErrorDetails -> Should be set to false in production
+ * @param bool $logErrors -> Parameter is passed to the default ErrorHandler
+ * @param bool $logErrorDetails -> Display error details in error log
+ * @param LoggerInterface|null $logger -> Optional PSR-3 Logger
+ *
+ * Note: This middleware should be added last. It will not handle any exceptions/errors
+ * for middleware added after it.
+ */
+
+# $errorMiddleware = $app->addErrorMiddleware(true, true, true);
+
+$errorMiddleware = new ErrorMiddleware(
+ $app->getCallableResolver(),
+ $app->getResponseFactory(),
+ true,
+ false,
+ false
+);
+
+# Set the Not Found Handler
+$errorMiddleware->setErrorHandler(HttpNotFoundException::class, function ($request, $exception) use ($container) {
+
+ $response = new NewResponse();
+
+ return $container->get('view')->render($response->withStatus(404), 'errors/404.twig');
+
+});
+
+$app->add($errorMiddleware);
+
+/*
+
+# Set the Not Found Handler
+$errorMiddleware->setErrorHandler(
+ HttpNotFoundException::class,
+ function (ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails) {
+ $response = new Response();
+ $response->getBody()->write('404 NOT FOUND');
+
+ return $response->withStatus(404);
+ }
+);
+
+# Set the Not Allowed Handler
+$errorMiddleware->setErrorHandler(
+ HttpMethodNotAllowedException::class,
+ function (ServerRequestInterface $request, Throwable $exception, bool $displayErrorDetails) {
+ $response = new Response();
+ $response->getBody()->write('405 NOT ALLOWED');
+
+ return $response->withStatus(405);
+ }
+);
+
+# Set the Not Found Handler
+$errorMiddleware->setErrorHandler(
+ HttpNotFoundException::class,
+ function () {
+ die('not found');
+ }
+);
+
+$app->add($ErrorMiddleware);
+
+*/
+
+/************************
+* ADD ROUTES *
+************************/
+
+require __DIR__ . '/routes/api.php';
+require __DIR__ . '/routes/web.php';
+
+$app->run();
\ No newline at end of file
diff --git a/udo a2enmod actions fcgid alias proxy_fcgi b/udo a2enmod actions fcgid alias proxy_fcgi
deleted file mode 100644
index afc4018..0000000
--- a/udo a2enmod actions fcgid alias proxy_fcgi
+++ /dev/null
@@ -1,15 +0,0 @@
-[0;1;32m●[0m php8.1-fpm.service - The PHP 8.1 FastCGI Process Manager
- Loaded: loaded (/lib/systemd/system/php8.1-fpm.service; enabled; vendor preset: enabled)
- Active: [0;1;32mactive (running)[0m since Sun 2022-05-29 22:34:18 CEST; 33s ago
- Docs: man:php-fpm8.1(8)
- Main PID: 110039 (php-fpm8.1)
- Status: "Processes active: 0, idle: 2, Requests: 0, slow: 0, Traffic: 0req/sec"
- Tasks: 3 (limit: 4395)
- Memory: 10.1M
- CGroup: /system.slice/php8.1-fpm.service
- ├─110039 php-fpm: master process (/etc/php/8.1/fpm/php-fpm.conf)
- ├─110044 php-fpm: pool www
- └─110045 php-fpm: pool www
-
-May 29 22:34:18 sebastian-IdeaPad-1 systemd[1]: Starting The PHP 8.1 FastCGI Process Manager...
-May 29 22:34:18 sebastian-IdeaPad-1 systemd[1]: Started The PHP 8.1 FastCGI Process Manager.