Compare commits
15
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ec313ff269 | ||
|
|
347e3c3b6c | ||
|
|
6b1be4d245 | ||
|
|
4834404575 | ||
|
|
90a2f4d083 | ||
|
|
c181cdfb28 | ||
|
|
77a13960f2 | ||
|
|
b6212b3662 | ||
|
|
7e86c0265d | ||
|
|
86fba55a30 | ||
|
|
78d2d9d291 | ||
|
|
fdca37a79d | ||
|
|
74a56bd72f | ||
|
|
990f57b94e | ||
|
|
dc52c88c03 |
No files matched your search
+39
-11
@@ -21,21 +21,49 @@
|
||||
"laminas/laminas-httphandlerrunner": "2.14.x-dev",
|
||||
"vlucas/phpdotenv": "^3.4@dev",
|
||||
"middlewares/whoops": "dev-master",
|
||||
"mcnd/dump": "~1.0.0",
|
||||
"mcnd/storage": "~1.0.0",
|
||||
"mcnd/event": "~1.0.0",
|
||||
"mcnd/tell": "~1.0.0",
|
||||
"mcnd/ulmus": "^1.0 || ^2.0",
|
||||
"mcnd/kash": "~1.0.0",
|
||||
"mcnd/taxus": "1.1.0",
|
||||
"mcnd/notes": "^2.1.1",
|
||||
"mcnd/thebugs": "^1.0.0",
|
||||
"mcnd/storage": "dev-master",
|
||||
"mcnd/lean-console": "dev-master",
|
||||
"mcnd/ulmus": "dev-master",
|
||||
"mcnd/tell": "dev-master",
|
||||
"mcnd/dump": "dev-master",
|
||||
"mcnd/event": "dev-master",
|
||||
"mcnd/thebugs": "dev-master",
|
||||
"mcnd/taxus": "dev-master",
|
||||
"mcnd/notes": "dev-master",
|
||||
"psr/simple-cache": "*"
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://git.mcnd.ca/api/packages/mcndave/composer"
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/event.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/the-bugs.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/storage.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/ulmus.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/notes.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/tell.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/lean-console.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/dump.git"
|
||||
}
|
||||
],
|
||||
"autoload": {
|
||||
|
||||
@@ -1,61 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
|
||||
use Ulmus\User\{
|
||||
Authorize\CookieAuthentication,
|
||||
Authorize\HeaderAuthentication,
|
||||
Entity,
|
||||
|
||||
use Ulmus\User\{Entity,
|
||||
Lib\Authenticate,
|
||||
Lib\Authorize,
|
||||
Middleware\AuthenticationMiddleware,
|
||||
Middleware\HeaderAuthenticationMiddleware,
|
||||
Middleware\CookieAuthenticationMiddleware,
|
||||
Middleware\PostRequestAuthenticationMiddleware,
|
||||
Middleware\LocalMacAddressMiddleware,
|
||||
Authorize\MacAddressAuthentication,
|
||||
Authorize\PostRequestAuthentication};
|
||||
|
||||
use Picea\Picea;
|
||||
|
||||
use Storage\{ Cookie, Session };
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use function DI\{get, autowire, create};
|
||||
use function DI\{get, create};
|
||||
|
||||
return [
|
||||
Authorize::class => create(Authorize::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
|
||||
|
||||
Authenticate::class => create(Authenticate::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
|
||||
|
||||
AuthenticationMiddleware::class => create(AuthenticationMiddleware::class)->constructor(get(Authorize::class), get('authorize.error')),
|
||||
Authorize::class => create(Authorize::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
|
||||
|
||||
HeaderAuthentication::class => autowire(HeaderAuthentication::class),
|
||||
HeaderAuthenticationMiddleware::class => create(HeaderAuthenticationMiddleware::class)->constructor(get(Authorize::class), get(Entity\UserInterface::class), get('authorize.error')),
|
||||
|
||||
HeaderAuthenticationMiddleware::class => create(HeaderAuthenticationMiddleware::class)->constructor(get(HeaderAuthentication::class)),
|
||||
PostRequestAuthentication::class => create(PostRequestAuthentication::class)->constructor(get(Authenticate::class), "email", "email", "password"),
|
||||
|
||||
CookieAuthentication::class => autowire(CookieAuthentication::class),
|
||||
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(PostRequestAuthentication::class)),
|
||||
|
||||
CookieAuthenticationMiddleware::class => create(CookieAuthenticationMiddleware::class)->constructor(get(CookieAuthentication::class), get(Cookie::class)),
|
||||
MacAddressAuthentication::class => create(MacAddressAuthentication::class)->constructor(get(Authenticate::class), "mac"),
|
||||
|
||||
PostRequestAuthentication::class => create(PostRequestAuthentication::class)->constructor("email", "email", "password"),
|
||||
|
||||
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(PostRequestAuthentication::class)),
|
||||
LocalMacAddressMiddleware::class => create(LocalMacAddressMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(MacAddressAuthentication::class)),
|
||||
|
||||
'authentication.method' => null,
|
||||
|
||||
'authorize.error' => function(ContainerInterface $c) {
|
||||
'authorize.error' => function($c) {
|
||||
return function(array $errorData) use ($c) {
|
||||
return $c->get(HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
||||
'api.error' => "Authorization failed",
|
||||
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
||||
], 403);
|
||||
return $c->get(\Lean\Factory\HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
||||
'api.error' => "Authorization failed",
|
||||
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
||||
], 403);
|
||||
};
|
||||
},
|
||||
|
||||
'authentication.error' => function($c, Picea $picea) {
|
||||
return function($message) use ($c, $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
|
||||
return function($message) use ($picea, $c) {
|
||||
return $c->get(\Lean\Factory\HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
'title' => "Authentication failed",
|
||||
'subtitle' => "",
|
||||
'message' => $message,
|
||||
|
||||
@@ -1,17 +1,11 @@
|
||||
<?php
|
||||
|
||||
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
|
||||
use function DI\autowire, DI\create, DI\get;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterInterface, HttpHandlerRunner\Emitter\SapiEmitter };
|
||||
use Lean\Factory\{ HttpFactory, HttpFactoryInterface };
|
||||
use Picea\Picea;
|
||||
use Storage\Cookie,
|
||||
Storage\Session,
|
||||
Storage\SessionMiddleware;
|
||||
|
||||
use function DI\{ autowire, create, get };
|
||||
use Laminas\{ Diactoros\ServerRequestFactory, HttpHandlerRunner\Emitter\EmitterInterface, HttpHandlerRunner\Emitter\SapiEmitter };
|
||||
|
||||
return [
|
||||
ServerRequestInterface::class => function ($c) {
|
||||
@@ -21,38 +15,8 @@ return [
|
||||
},
|
||||
|
||||
EmitterInterface::class => create(SapiEmitter::class),
|
||||
|
||||
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
|
||||
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
|
||||
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
|
||||
|
||||
HttpFactoryInterface::class => create(HttpFactory::class),
|
||||
|
||||
Cookie::class => create(Cookie::class)->constructor([
|
||||
'secure' => true,
|
||||
'path' => getenv('URL_BASE') ?: '/',
|
||||
'httponly' => true,
|
||||
'samesite'=> "Lax",
|
||||
], getenv("LEAN_RANDOM")),
|
||||
|
||||
Session::class => create(Session::class)->constructor(get(Cookie::class), [ 'path' => getenv('URL_BASE') ?: '/', ]),
|
||||
|
||||
SessionMiddleware::class => create(SessionMiddleware::class)->constructor(get(Cookie::class), [
|
||||
'name' => "lean_sess_" . substr(md5(getenv("LEAN_RANDOM")), 0, 12),
|
||||
'path' => getenv('URL_BASE') ?: '/',
|
||||
'samesite' => getenv("LEAN_COOKIE_SAMESITE") ?? "Lax",
|
||||
'secure' => (bool) getenv('LEAN_COOKIE_SECURE') ?? false
|
||||
]),
|
||||
|
||||
'error.401' => function(ContainerInterface $c, Picea $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/401", []), 401);
|
||||
},
|
||||
|
||||
'error.404' => function(ContainerInterface $c, Picea $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/404", []), 404);
|
||||
},
|
||||
|
||||
'error.500' => function(ContainerInterface $c, Picea $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml("lean/error/500", []), 500);
|
||||
},
|
||||
];
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
use Tell\I18n;
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Notes\Tell\LanguageHandler;
|
||||
|
||||
use function DI\autowire, DI\create, DI\get, DI\add;
|
||||
|
||||
|
||||
@@ -15,10 +15,7 @@ use Notes\Breadcrumb\Breadcrumb;
|
||||
|
||||
use Storage\SessionMiddleware;
|
||||
|
||||
use Ulmus\User\Middleware\{
|
||||
HeaderAuthenticationMiddleware,
|
||||
PostRequestAuthenticationMiddleware
|
||||
};
|
||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||
|
||||
return [
|
||||
Lean\Routing::class => autowire(Lean\Routing::class),
|
||||
@@ -68,8 +65,7 @@ return [
|
||||
}
|
||||
}
|
||||
|
||||
$router->addPatternMatcher('email', '[^@ \t\r\n/]+@[^@ \t\r\n/]+\.[^@ \t\r\n/]+');
|
||||
$router->addPatternMatcher('ids', '\b\d[\d,]*\b');
|
||||
$router->addPatternMatcher('email', '[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n]+');
|
||||
|
||||
$routing = $container->get(Lean\Routing::class);
|
||||
$routing->registerRoute($container, getenv('URL_BASE'));
|
||||
@@ -77,4 +73,4 @@ return [
|
||||
return $router;
|
||||
};
|
||||
},
|
||||
];
|
||||
];
|
||||
@@ -6,6 +6,9 @@ use TheBugs\JavascriptMiddleware;
|
||||
|
||||
use Lean\Lean;
|
||||
|
||||
use Storage\Cookie,
|
||||
Storage\Session,
|
||||
Storage\SessionMiddleware;
|
||||
|
||||
use function DI\autowire, DI\create, DI\get, DI\add;
|
||||
|
||||
@@ -75,6 +78,12 @@ return [
|
||||
|
||||
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
|
||||
|
||||
Cookie::class => create(Cookie::class)->constructor([ 'secure' => true, 'path' => getenv('URL_BASE') ?: '/', ], getenv("LEAN_RANDOM")),
|
||||
|
||||
Session::class => create(Session::class)->constructor(get(Cookie::class), [ 'path' => getenv('URL_BASE') ?: '/', ]),
|
||||
|
||||
SessionMiddleware::class => create(SessionMiddleware::class)->constructor(get(Cookie::class), [ 'name' => "lean_sess_" . substr(md5(getenv("LEAN_RANDOM")), 0, 12), 'path' => getenv('URL_BASE') ?: '/' ]),
|
||||
|
||||
'git.commit' => function($c) {
|
||||
if ( getenv("DEBUG") ) {
|
||||
return uniqid("debug_");
|
||||
|
||||
+15
-15
@@ -5,8 +5,7 @@ CRON_KEY = dev
|
||||
|
||||
# Route
|
||||
URL_BASE = ""
|
||||
APP_URL = "myapp.ca"
|
||||
ASSET_PATH = "static/"
|
||||
APP_URL = "dev.mcnd.ca"
|
||||
|
||||
# Path
|
||||
CACHE_DIR = "var/cache"
|
||||
@@ -24,18 +23,19 @@ DEFAULT_TIME = "fr.UTF-8"
|
||||
DEFAULT_TIME_FALLBACK = "french.UTF-8"
|
||||
|
||||
# Database
|
||||
SQLITE_PATH = "var/myapp.sqlite3"
|
||||
SQLITE_ADAPTER = "SQLite"
|
||||
SQLITE_PRAGMA_BEGIN = "foreign_keys=ON,synchronous=NORMAL"
|
||||
SQLITE_PRAGMA_DEBUG_BEGIN = "journal_mode=WAL"
|
||||
SQLITE_PRAGMA_CLOSE = "analysis_limit=500,optimize"
|
||||
#SQLITE_PATH = "var/home.sqlite3"
|
||||
#SQLITE_ADAPTER = "SQLite"
|
||||
#SQLITE_PRAGMA_BEGIN = "foreign_keys=ON,synchronous=NORMAL"
|
||||
#SQLITE_PRAGMA_DEBUG_BEGIN = "journal_mode=WAL"
|
||||
#SQLITE_PRAGMA_CLOSE = "analysis_limit=500,optimize"
|
||||
|
||||
#DATABASE_PORT = ""
|
||||
#DATABASE_HOST = ""
|
||||
#DATABASE_NAME = ""
|
||||
#DATABASE_USERNAME = ""
|
||||
#DATABASE_PASSWORD = ""
|
||||
#DATABASE_CHARSET = "utf8"
|
||||
#DATABASE_ADAPTER = "MariaDB"
|
||||
DATABASE_PORT = ""
|
||||
DATABASE_HOST = ""
|
||||
DATABASE_NAME = ""
|
||||
DATABASE_USERNAME = ""
|
||||
DATABASE_PASSWORD = ""
|
||||
DATABASE_CHARSET = "utf8"
|
||||
DATABASE_ADAPTER = "MariaDB"
|
||||
|
||||
LEAN_RANDOM = "%RAND64%"
|
||||
|
||||
LEAN_RANDOM = "%RAND64%"
|
||||
Regular → Executable
File mode changed.
@@ -25,20 +25,20 @@
|
||||
"league/oauth2-client": "dev-master",
|
||||
"php-di/php-di": "dev-master",
|
||||
"league/commonmark": "^2.7@dev",
|
||||
"assets-package/ace": "1.0.0",
|
||||
"assets-package/ace": "dev-master",
|
||||
"mcnd/dump": "dev-master",
|
||||
"mcnd/storage": "dev-master",
|
||||
"mcnd/cli": "dev-master",
|
||||
"mcnd/event": "dev-master",
|
||||
"mcnd/ulmus": "^1.0 || ^2.0",
|
||||
"mcnd/ulmus-api": "^1.3.0",
|
||||
"mcnd/ulmus-user": "~1.1.2",
|
||||
"mcnd/ulmus": "dev-master",
|
||||
"mcnd/ulmus-api": "dev-master",
|
||||
"mcnd/ulmus-user": "dev-master",
|
||||
"mcnd/picea": "dev-master",
|
||||
"mcnd/picea-ui": "dev-master",
|
||||
"mcnd/picea-asset": "~1.0.2",
|
||||
"mcnd/picea-asset": "dev-master",
|
||||
"mcnd/cronard": "dev-master",
|
||||
"mcnd/lean-api": "dev-master",
|
||||
"mcnd/lean-console": "~1.3.2",
|
||||
"mcnd/lean-console": "dev-master",
|
||||
"mcnd/kash": "dev-master",
|
||||
"mcnd/taxus": "dev-master",
|
||||
"mcnd/notes": "dev-master",
|
||||
@@ -47,12 +47,8 @@
|
||||
},
|
||||
"repositories": [
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://git.mcnd.ca/api/packages/mcndave/composer"
|
||||
},
|
||||
{
|
||||
"type": "composer",
|
||||
"url": "https://git.mcnd.ca/api/packages/assets-package/composer"
|
||||
"type": "vcs",
|
||||
"url": "https://git.mcnd.ca/mcndave/cronard.git"
|
||||
},
|
||||
{
|
||||
"type": "vcs",
|
||||
|
||||
@@ -10,7 +10,7 @@ return [
|
||||
],
|
||||
|
||||
'keys' => (function() {
|
||||
return explode(',', getenvonce('KEYS') ?? "") ;
|
||||
return explode(',', getenv('KEYS') ?? "") ;
|
||||
})(),
|
||||
|
||||
'meta' => [
|
||||
@@ -19,7 +19,7 @@ return [
|
||||
|
||||
'ulmus' => [
|
||||
'connections' => [
|
||||
/*'default' => [
|
||||
'default' => [
|
||||
'adapter' => getenv("DATABASE_ADAPTER"),
|
||||
'host' => getenv("DATABASE_HOST"),
|
||||
'port' => getenv("DATABASE_PORT"),
|
||||
@@ -29,18 +29,18 @@ return [
|
||||
'settings' => [
|
||||
'charset' => getenv("DATABASE_CHARSET"),
|
||||
],
|
||||
],*/
|
||||
],
|
||||
|
||||
'default' => [
|
||||
'sqlite' => [
|
||||
'adapter' => getenv("SQLITE_ADAPTER"),
|
||||
'path' => getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . getenv("SQLITE_PATH"),
|
||||
'pragma' => explode(',', getenv("SQLITE_PRAGMA")),
|
||||
'pragma_begin' => array_merge(
|
||||
explode(',', getenv("SQLITE_PRAGMA_BEGIN")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_BEGIN") : "")
|
||||
),
|
||||
'pragma_close' => array_merge(
|
||||
explode(',', getenv("SQLITE_PRAGMA_CLOSE")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_CLOSE") : "")
|
||||
),
|
||||
explode(',', getenv("SQLITE_PRAGMA_BEGIN")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_BEGIN") : "")
|
||||
),
|
||||
'pragma_close' => array_merge(
|
||||
explode(',', getenv("SQLITE_PRAGMA_CLOSE")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_CLOSE") : "")
|
||||
),
|
||||
],
|
||||
]
|
||||
]
|
||||
|
||||
@@ -4,7 +4,6 @@ use function DI\autowire, DI\create, DI\get;
|
||||
|
||||
use %NAMESPACE%\Entity;
|
||||
|
||||
use Psr\Container\ContainerInterface;
|
||||
use Psr\Http\Message\ServerRequestInterface;
|
||||
|
||||
use Ulmus\Entity\Field\Datetime,
|
||||
@@ -22,18 +21,16 @@ use TheBugs\Email\{ EmailConfiguration, MailerInterface, SwiftMailer };
|
||||
|
||||
use Taxus\{ Taxus, PermissionGrantInterface };
|
||||
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
|
||||
return [
|
||||
\Ulmus\User\Entity\UserInterface::class => autowire(Entity\User::class),
|
||||
|
||||
SecurityHandler::class => create(SecurityHandler::class)->constructor(function(ContainerInterface $c) {
|
||||
return $c->get(HttpFactoryInterface::class)::createRedirectResponse(getenv("URL_BASE")."/login");
|
||||
SecurityHandler::class => create(SecurityHandler::class)->constructor(function() {
|
||||
return Lean\Factory\HttpFactory::createRedirectResponse(getenv("URL_BASE")."/login");
|
||||
}, get('authentication.unauthorize'), get(Taxus::class)),
|
||||
|
||||
'authentication.unauthorize' => function(ContainerInterface $c, Picea $picea) {
|
||||
return function($message) use ($c, $picea) {
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/401', [
|
||||
'authentication.unauthorize' => function($c, Picea $picea) {
|
||||
return function($message) use ($picea) {
|
||||
return Lean\Factory\HttpFactory::createHtmlResponse($picea->renderHtml('lean/error/401', [
|
||||
'title' => "",
|
||||
'subtitle' => "",
|
||||
'message' => $message,
|
||||
|
||||
+4
-4
@@ -4,7 +4,7 @@ use Picea\Picea;
|
||||
|
||||
use Negundo\Client\{ NegundoMiddleware, SoftwareConfig };
|
||||
|
||||
use Lean\Factory\HttpFactoryInterface;
|
||||
use Lean\Factory\HttpFactory;
|
||||
|
||||
use Psr\Http\Server\MiddlewareInterface,
|
||||
Psr\Http\Message\ServerRequestInterface,
|
||||
@@ -31,11 +31,11 @@ return [
|
||||
|
||||
"errorHandler" => create(NegundoMiddleware::class)->constructor(get(SoftwareConfig::class), null, get('app.errorhandler.html')),
|
||||
|
||||
'app.errorhandler.html' => function(\Psr\Container\ContainerInterface $c, Picea $picea) {
|
||||
return function(\Throwable $exception) use ($c, $picea) {
|
||||
'app.errorhandler.html' => function($c, Picea $picea) {
|
||||
return function(\Throwable $exception) use ($picea) {
|
||||
error_log($exception->getMessage());
|
||||
|
||||
return $c->get(HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
return HttpFactory::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||
'title' => "Une erreur s'est produite lors de l'exécution du script.",
|
||||
'subtitle' => "Êtes-vous connecté avec le bon compte ?",
|
||||
'message' => $exception->getMessage(),
|
||||
|
||||
@@ -8,7 +8,7 @@ try {
|
||||
new class($projectPath) extends %NAMESPACE%\Kernel {};
|
||||
}
|
||||
catch(\Throwable $t) {
|
||||
echo sprintf("%s<hr><small>%s:%d</small><br><pre>%s</pre>", $t->getMessage(), $t->getFile(), $t->getLine(), getenv('DEBUG') ? var_export($t->getTrace(), true) : "");
|
||||
echo sprintf("%s in <strong>%s</strong> <pre>%s</pre>", $t->getMessage(), $t->getFile() . ":" . $t->getLine(), getenv('DEBUG') ? $t->getTraceAsString() : "");
|
||||
error_log($t->getMessage());
|
||||
header("HTTP/1.1 500 Internal Server Error");
|
||||
}
|
||||
}
|
||||
@@ -7,7 +7,6 @@ use Storage\Session;
|
||||
use Ulmus\User\Entity\User;
|
||||
use Notes\Route\Attribute\Object\Route;
|
||||
use Notes\Security\Attribute\Security;
|
||||
use DI\Attribute\Inject;
|
||||
|
||||
use %NAMESPACE%\{ Entity, Lib, Form };
|
||||
|
||||
@@ -19,9 +18,9 @@ use Notes\Attribute\Ignore;use Ulmus\User\Entity\UserInterface;
|
||||
trait ControllerTrait {
|
||||
use \Lean\ControllerTrait;
|
||||
|
||||
#[Inject]
|
||||
#[Ignore]
|
||||
public ? UserInterface $user;
|
||||
|
||||
#[Inject]
|
||||
#[Ignore]
|
||||
protected EventManager $eventManager;
|
||||
}
|
||||
@@ -38,37 +38,4 @@ class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
||||
{
|
||||
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
|
||||
}
|
||||
|
||||
/*<<<<<<< HEAD
|
||||
/*=======
|
||||
public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface
|
||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
||||
{
|
||||
if (php_sapi_name() !== 'cli' and ! defined('STDIN')) {
|
||||
return $this->throw404($request);
|
||||
}
|
||||
|
||||
return $handler->handle($request);;
|
||||
}
|
||||
|
||||
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
||||
{
|
||||
if ( getenv('DEBUG') && $this->di->has(\Picea\Asset\Asset::class) ) {
|
||||
$params = $request->getServerParams();
|
||||
|
||||
$scpName = basename(explode('?', $params['REQUEST_URI'] ?? "", 2)[0]);
|
||||
list(, $ext) = array_pad(explode('.', $scpName), 2, null);
|
||||
|
||||
if ($ext && in_array($ext, ApplicationStrategy::ASSET_TRIGGER_UPDATE)) {
|
||||
$this->di->get(\Picea\Asset\Asset::class)->launchInstall();
|
||||
}
|
||||
}
|
||||
|
||||
return $this->di->get('error.404');
|
||||
}
|
||||
};
|
||||
<<<<<<< HEAD
|
||||
}
|
||||
|
||||
>>>>>>> af8b686 (- WIP on ulmus-user mechanics updates)*/
|
||||
}
|
||||
@@ -39,7 +39,7 @@ class NotFoundDecorator implements NotFoundDecoratorInterface
|
||||
|
||||
public function throw404(ServerRequestInterface $request) : ResponseInterface
|
||||
{
|
||||
return $this->checkAssetTrigger($request) ?: $this->container->get('error.404');
|
||||
return $this->checkAssetTrigger($request) ?: $this->httpFactory->createHtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
|
||||
}
|
||||
|
||||
protected function checkAssetTrigger(ServerRequestInterface $request) : false|ResponseInterface
|
||||
|
||||
@@ -9,7 +9,6 @@ use Notes\Route\Attribute\Object\Route;
|
||||
use Notes\Security\Attribute\Security;
|
||||
use Picea, Picea\Ui\Method\FormContext;
|
||||
use Picea\Ui\Method\FormContextInterface;
|
||||
use Picea\Ui\Method\FormInterface;
|
||||
use TheBugs\Email\MailerInterface;
|
||||
use Storage\{ Cookie, Session };
|
||||
use League\CommonMark\CommonMarkConverter;
|
||||
@@ -211,16 +210,6 @@ trait ControllerTrait {
|
||||
return $this->picea->compiler->getExtensionFromToken('route')->buildRouteUrl($name, $parameters);
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function form(FormInterface $form, ? FormContextInterface $formContext = null) : Picea\Ui\Method\FormHandler
|
||||
{
|
||||
if (! $this->picea ) {
|
||||
throw new \Exception("A picea object must be provided on class initialization to use this method.");
|
||||
}
|
||||
|
||||
return $this->picea->compiler->getExtensionInstanceOf(Picea\Ui\Method\Form::class)->formClass($form, $formContext);
|
||||
}
|
||||
|
||||
#[Ignore]
|
||||
public function json($data, int $flags = 0) : string
|
||||
{
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
namespace Lean\Factory;
|
||||
|
||||
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, RedirectResponse, TextResponse};
|
||||
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
|
||||
use Laminas\Diactoros\Response;
|
||||
use Psr\Http\Message\ResponseInterface;
|
||||
use Psr\Http\Message\StreamInterface;
|
||||
|
||||
@@ -17,5 +20,6 @@ interface HttpFactoryInterface
|
||||
public static function createDownloadableResponse(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
public static function createImageResponse(string $data, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
public static function createFileDownloadResponse(string $path, int $code = 200, array $headers = []) : ResponseInterface;
|
||||
|
||||
public static function createStream(string $content) : StreamInterface;
|
||||
}
|
||||
}
|
||||
+5
-9
@@ -24,7 +24,7 @@ class Kernel
|
||||
|
||||
public array $paths = [];
|
||||
|
||||
public int $errorReportingDev = -1 & ~E_USER_DEPRECATED & ~E_DEPRECATED ;
|
||||
public int $errorReportingDev = -1;
|
||||
|
||||
public int $errorReportingProd = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED /*& ~E_NOTICE*/;
|
||||
|
||||
@@ -34,12 +34,10 @@ class Kernel
|
||||
|
||||
public function __construct(
|
||||
public string $projectPath
|
||||
) {
|
||||
)
|
||||
{
|
||||
# Still not sure about adding a folder check each call just to add a basic project setup error ...
|
||||
# File::assertFolderExists($this->projectPath);
|
||||
|
||||
define('IS_CLI', php_sapi_name() === 'cli' OR defined('STDIN'));
|
||||
|
||||
$this->setEnvironment();
|
||||
$this->initializeEngine();
|
||||
$this->setupContainer();
|
||||
@@ -80,10 +78,8 @@ class Kernel
|
||||
$path = getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . getenv($envkey);
|
||||
|
||||
if (getenv('DEBUG') && ! file_exists($path)) {
|
||||
if (false === @mkdir($path, 0755, true)) {
|
||||
if (! IS_CLI) {
|
||||
throw new \Exception(sprintf("Folder '%s' could not be created", $path));
|
||||
}
|
||||
if (false === mkdir($path, 0755, true)) {
|
||||
throw new \Exception(sprintf("Folder '%s' could not be created", $path));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -44,11 +44,6 @@ class Routing {
|
||||
|
||||
$container->set(ServerRequestInterface::class, $request);
|
||||
|
||||
# Decoding arguments received from the router
|
||||
foreach($arguments as &$arg) {
|
||||
$arg = urldecode($arg);
|
||||
}
|
||||
|
||||
return $this->response ?? $object->$method($request, $arguments);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="1022.7" height="785.81" viewBox="0 0 1022.7 785.81" role="img" artist="Katerina Limpitsouni" source="https://undraw.co/"><defs><linearGradient id="af83dc26-9572-4816-b7a1-1af4f72ff554-63" x1="678.2" y1="821.79" x2="678.2" y2="493.4" gradientTransform="translate(-20.24 29.65) rotate(-2.31)" gradientUnits="userSpaceOnUse"><stop offset="0" stop-color="gray" stop-opacity="0.25"/><stop offset="0.54" stop-color="gray" stop-opacity="0.12"/><stop offset="1" stop-color="gray" stop-opacity="0.1"/></linearGradient></defs><title>bug fixing</title><ellipse cx="468.63" cy="660.88" rx="425" ry="33" fill="#6c63ff" opacity="0.1"/><g opacity="0.1"><path d="M933.7,529.93c-2.54-7.71-12.84-11.26-23-7.92a24.76,24.76,0,0,0-4.23,1.83c-.65-.18-1.32-.34-2-.46a22.42,22.42,0,0,0,.63-6.79A24.6,24.6,0,0,0,916,495.12a24.63,24.63,0,0,0,10.86-21.47,23.76,23.76,0,0,0,8.23-9.32c4.9-9.7,2.87-20.6-4.54-24.35s-17.4,1.08-22.3,10.78a23.69,23.69,0,0,0-2.63,12.15,24.63,24.63,0,0,0-10.86,21.47,24.63,24.63,0,0,0-10.86,21.47A24.64,24.64,0,0,0,873,527.33a23.76,23.76,0,0,0-8.23,9.32,25.46,25.46,0,0,0-2.08,5.74,21.18,21.18,0,0,0-4.44-4.73,25.38,25.38,0,0,0-1-4.5c-3.34-10.17-12.3-16.37-20-13.83s-11.26,12.83-7.92,23a23.07,23.07,0,0,0,7.56,11.08,25.38,25.38,0,0,0,1,4.5c1.94,5.9,5.77,10.46,10.15,12.75a23.23,23.23,0,0,0-.83,3.9,25.29,25.29,0,0,0-7.54,14.91,25.27,25.27,0,0,0-7.54,14.92,24.63,24.63,0,0,0-5,6.81c-4.91,9.7-2.88,20.61,4.53,24.35s17.4-1.07,22.31-10.78a24.62,24.62,0,0,0,2.5-8.09,25.29,25.29,0,0,0,7.54-14.91,25.27,25.27,0,0,0,7.54-14.92A25.21,25.21,0,0,0,879,571.94,25.21,25.21,0,0,0,886.56,557a24.11,24.11,0,0,0,3.39-4,23.46,23.46,0,0,0,12.27-.77,24.76,24.76,0,0,0,4.23-1.83,23.2,23.2,0,0,0,13.42-.48C930,546.61,936.23,537.65,933.7,529.93Z" transform="translate(-88.65 -57.09)" fill="#3f3d56"/><g opacity="0.1"><path d="M915.77,499.53a21.5,21.5,0,0,1-3.44,2.75,23,23,0,0,1-1.11,8.43,26.18,26.18,0,0,0,2.1-3.43A24.64,24.64,0,0,0,915.77,499.53Z" transform="translate(-88.65 -57.09)"/><path d="M926.63,478.06a21.5,21.5,0,0,1-3.44,2.75,23,23,0,0,1-1.11,8.43,25.65,25.65,0,0,0,2.1-3.44A24.85,24.85,0,0,0,926.63,478.06Z" transform="translate(-88.65 -57.09)"/><path d="M902,470.07a21.91,21.91,0,0,1,.17-4.41,24.93,24.93,0,0,0-4.78,6.57,25.63,25.63,0,0,0-1.52,3.73A22.75,22.75,0,0,1,902,470.07Z" transform="translate(-88.65 -57.09)"/><path d="M833.07,600a23.59,23.59,0,0,1,2.95-3.38,22.92,22.92,0,0,1,.87-4,25.09,25.09,0,0,0-2.29,3.71A25.59,25.59,0,0,0,833.07,600Z" transform="translate(-88.65 -57.09)"/><path d="M840.61,585.1a23.59,23.59,0,0,1,2.95-3.38,23,23,0,0,1,.83-3.9l0,0a25.68,25.68,0,0,0-2.2,3.59A26.76,26.76,0,0,0,840.61,585.1Z" transform="translate(-88.65 -57.09)"/><path d="M904.9,521a20.82,20.82,0,0,1-3.43,2.74,22.45,22.45,0,0,1-.63,6.79,18.75,18.75,0,0,1,2,.46,24.76,24.76,0,0,1,4.23-1.83c10.18-3.34,20.47.21,23,7.92a11.68,11.68,0,0,1,.32,6c3.35-3.94,4.74-8.74,3.3-13.14-2.54-7.71-12.84-11.26-23-7.92a24.76,24.76,0,0,0-4.23,1.83c-.65-.18-1.32-.34-2-.46C904.65,522.59,904.79,521.8,904.9,521Z" transform="translate(-88.65 -57.09)"/><path d="M829.35,607.49a25.09,25.09,0,0,0-2.29,3.71,26.56,26.56,0,0,0-1.54,3.74,24.48,24.48,0,0,1,3-3.4A22.92,22.92,0,0,1,829.35,607.49Z" transform="translate(-88.65 -57.09)"/><path d="M891.09,491.54a22,22,0,0,1,.17-4.41,24.93,24.93,0,0,0-4.78,6.57,25.63,25.63,0,0,0-1.52,3.73A22.75,22.75,0,0,1,891.09,491.54Z" transform="translate(-88.65 -57.09)"/><path d="M875.4,579.1a24.29,24.29,0,0,1-1,4.38,26.67,26.67,0,0,0,2.09-3.44,25.49,25.49,0,0,0,1.63-4A24.23,24.23,0,0,1,875.4,579.1Z" transform="translate(-88.65 -57.09)"/><path d="M860.32,608.92a24.15,24.15,0,0,1-1,4.38,25.65,25.65,0,0,0,2.1-3.44,26.47,26.47,0,0,0,1.63-4A23.57,23.57,0,0,1,860.32,608.92Z" transform="translate(-88.65 -57.09)"/><path d="M867.86,594a24.11,24.11,0,0,1-1,4.38A26.67,26.67,0,0,0,869,595a25.49,25.49,0,0,0,1.63-4A24.23,24.23,0,0,1,867.86,594Z" transform="translate(-88.65 -57.09)"/><path d="M882.94,564.19a24,24,0,0,1-1,4.37,25.89,25.89,0,0,0,2.09-3.43,25.48,25.48,0,0,0,1.64-4.07A23.22,23.22,0,0,1,882.94,564.19Z" transform="translate(-88.65 -57.09)"/><path d="M833.57,526.48c7.72-2.53,16.68,3.66,20,13.83a25.68,25.68,0,0,1,1,4.51,21.18,21.18,0,0,1,4.44,4.73,25.53,25.53,0,0,1,2.08-5.75c.35-.68.73-1.33,1.12-2a21.07,21.07,0,0,0-4-4.18,25.38,25.38,0,0,0-1-4.5c-3.34-10.17-12.3-16.37-20-13.83-4.4,1.44-7.44,5.41-8.62,10.43A11.69,11.69,0,0,1,833.57,526.48Z" transform="translate(-88.65 -57.09)"/><path d="M869.37,534.48a21.85,21.85,0,0,1,.18-4.4,24.73,24.73,0,0,0-4.79,6.57,25.07,25.07,0,0,0-1.52,3.72A23,23,0,0,1,869.37,534.48Z" transform="translate(-88.65 -57.09)"/><path d="M880.23,513a21.85,21.85,0,0,1,.18-4.4,24.52,24.52,0,0,0-4.79,6.56,25.63,25.63,0,0,0-1.52,3.73A22.75,22.75,0,0,1,880.23,513Z" transform="translate(-88.65 -57.09)"/><path d="M852.78,623.83a24.25,24.25,0,0,1-1,4.39,25.73,25.73,0,0,0,3.73-7.49A23.57,23.57,0,0,1,852.78,623.83Z" transform="translate(-88.65 -57.09)"/></g><path d="M948.52,430.7Line truncated
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="799.031" height="618.112" viewBox="0 0 799.031 618.112" xmlns:xlink="http://www.w3.org/1999/xlink" role="img" artist="Katerina Limpitsouni" source="https://undraw.co/"><g transform="translate(-893 -197)"><path d="M15.18,488.763c0,.872.478,1.573,1.073,1.573h535.1c.6,0,1.073-.7,1.073-1.573s-.478-1.573-1.073-1.573H16.253C15.658,487.191,15.18,487.891,15.18,488.763Z" transform="translate(1007.711 324.776)" fill="#ccc"/><rect width="19.105" height="3.371" transform="translate(1198.162 808.354)" fill="#b6b3c5"/><rect width="19.105" height="3.371" transform="translate(1367.295 808.917)" fill="#b6b3c5"/><path d="M352.955,370.945a27.529,27.529,0,0,1-54.321,0H229.146V521.536h193.3V370.945Z" transform="translate(966.721 287.378)" fill="#d6d6e3"/><rect width="193.296" height="5.242" transform="translate(1196.43 796.983)" fill="#090814"/><path d="M788.255,487.17H10.776A10.788,10.788,0,0,1,0,476.394V32.688A10.788,10.788,0,0,1,10.776,21.911H788.255a10.789,10.789,0,0,1,10.776,10.776V476.394a10.789,10.789,0,0,1-10.776,10.776Z" transform="translate(893 175.089)" fill="#090814"/><rect width="760.822" height="429.297" transform="translate(911.104 213.968)" fill="#fff"/><g transform="translate(20.477 16.308)"><path d="M604.463,379.271H317.442a8.655,8.655,0,0,1-8.645-8.645V273.8a8.655,8.655,0,0,1,8.645-8.645H604.463a8.655,8.655,0,0,1,8.645,8.645v96.826a8.655,8.655,0,0,1-8.645,8.645Z" transform="translate(811.648 85.826)" fill="#6c63ff"/><rect width="76.078" height="8.645" rx="2" transform="translate(1165.4 380.374)" fill="#fff"/><ellipse cx="5.187" cy="5.187" rx="5.187" ry="5.187" transform="translate(1336.576 380.374)" fill="#090814"/><ellipse cx="5.187" cy="5.187" rx="5.187" ry="5.187" transform="translate(1353.865 380.374)" fill="#090814"/><ellipse cx="5.187" cy="5.187" rx="5.187" ry="5.187" transform="translate(1371.156 380.374)" fill="#090814"/></g><ellipse cx="40.952" cy="40.952" rx="40.952" ry="40.952" transform="translate(1404.281 440.452)" fill="#090814"/><path d="M10.863-57.7l-.524-29.6h8.246l-.554,29.6Zm3.613,14.307a4.7,4.7,0,0,1-3.409-1.3,4.368,4.368,0,0,1-1.34-3.278,4.39,4.39,0,0,1,1.34-3.322,4.732,4.732,0,0,1,3.409-1.282,4.732,4.732,0,0,1,3.409,1.282,4.39,4.39,0,0,1,1.34,3.322,4.368,4.368,0,0,1-1.34,3.278A4.7,4.7,0,0,1,14.476-43.394Z" transform="translate(1430.76 546.754)" fill="#fff"/></g></svg>
|
||||
|
Before Width: | Height: | Size: 40 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -5,4 +5,4 @@
|
||||
if ($context && ! in_array($context, $messageList)) {
|
||||
$messageList[] = $context;
|
||||
}
|
||||
%}{% block "lean/block/message", $messageList %}{% endblock %}
|
||||
%}{% block "lean/block/message", $messageList %}{% endblock %}
|
||||
Reference in new issue
Block a user