Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e526ba7128 | ||
|
|
ec313ff269 | ||
|
|
347e3c3b6c | ||
|
|
6b1be4d245 | ||
|
|
4834404575 | ||
|
|
90a2f4d083 | ||
|
|
c181cdfb28 | ||
|
|
77a13960f2 | ||
|
|
b6212b3662 | ||
|
|
7e86c0265d | ||
|
|
86fba55a30 | ||
|
|
78d2d9d291 | ||
|
|
fdca37a79d | ||
|
|
74a56bd72f | ||
|
|
990f57b94e | ||
|
|
dc52c88c03 | ||
|
|
7a48d707e0 | ||
|
|
156defddc9 | ||
|
|
42f33d9f13 | ||
|
|
69382f912b | ||
|
|
583580e068 | ||
|
|
5b7da3237f | ||
|
|
2bc0c9e56f | ||
|
|
cebb213830 | ||
|
|
8e29b0513a | ||
|
|
7f549a377a | ||
|
|
f87bccb3ab | ||
|
|
212dbd17c0 | ||
|
|
f462fcc597 | ||
|
|
13d306aec9 | ||
|
|
07613bf1cb | ||
|
|
4e28917b96 | ||
|
|
163df3f4ba | ||
|
|
3320dc47c1 | ||
|
|
4484dc8985 | ||
|
|
1d61ff87e4 | ||
|
|
0cc9a8a893 | ||
|
|
fd8fa7695e | ||
|
|
0581f378a5 | ||
|
|
708af80fa2 | ||
|
|
1f828eb022 | ||
|
|
959a182d16 | ||
|
|
ffe66e522c | ||
|
|
730ce7474e | ||
|
|
97dac9ddc4 | ||
|
|
d9f9c053c3 | ||
|
|
63fde92b68 | ||
|
|
8190d3483b | ||
|
|
38b540bbd8 | ||
|
|
f9c081ff26 | ||
|
|
34ca18f34c | ||
|
|
45ffc6e128 | ||
|
|
a9db9cd846 | ||
|
|
2a18e0cb9a | ||
|
|
ff4c94f820 | ||
|
|
30d0e8a14d | ||
|
|
6c58586823 | ||
|
|
9b795b857a | ||
|
|
bc55a2ab89 | ||
|
|
5f0deef7f8 | ||
|
|
e8c3cf01c9 | ||
|
|
06741d09c0 | ||
|
|
70e7b54c65 | ||
|
|
7b0a0cf333 | ||
|
|
f3c4cbd95a |
No files matched your search
+5
-64
@@ -16,42 +16,23 @@
|
|||||||
"ext-posix": "*",
|
"ext-posix": "*",
|
||||||
"ext-xmlreader": "*",
|
"ext-xmlreader": "*",
|
||||||
"ext-fileinfo": "*",
|
"ext-fileinfo": "*",
|
||||||
"league/route": "^5.0.0-dev",
|
"league/route": "^7.0.0-dev",
|
||||||
"laminas/laminas-diactoros": "2.24.x-dev",
|
"laminas/laminas-diactoros": "3.9.x-dev",
|
||||||
"laminas/laminas-httphandlerrunner": "2.5.x-dev",
|
"laminas/laminas-httphandlerrunner": "2.14.x-dev",
|
||||||
"vlucas/phpdotenv": "^3.4@dev",
|
"vlucas/phpdotenv": "^3.4@dev",
|
||||||
"middlewares/whoops": "dev-master",
|
"middlewares/whoops": "dev-master",
|
||||||
"guzzlehttp/guzzle": "^7@dev",
|
|
||||||
"swiftmailer/swiftmailer": "^6.2@dev",
|
|
||||||
"mcnd/storage": "dev-master",
|
"mcnd/storage": "dev-master",
|
||||||
"mcnd/lean-console": "dev-master",
|
"mcnd/lean-console": "dev-master",
|
||||||
"mcnd/ulmus": "dev-master",
|
"mcnd/ulmus": "dev-master",
|
||||||
"mcnd/picea": "dev-master",
|
|
||||||
"mcnd/picea-ui": "dev-master",
|
|
||||||
"mcnd/cronard": "dev-master",
|
|
||||||
"mcnd/tell": "dev-master",
|
"mcnd/tell": "dev-master",
|
||||||
"mcnd/dump": "dev-master",
|
"mcnd/dump": "dev-master",
|
||||||
"mcnd/event": "dev-master",
|
"mcnd/event": "dev-master",
|
||||||
"mcnd/notes-breadcrumb": "dev-master",
|
|
||||||
"mcnd/notes-cronard": "dev-master",
|
|
||||||
"mcnd/notes-event": "dev-master",
|
|
||||||
"mcnd/notes-tell": "dev-master",
|
|
||||||
"mcnd/notes-route": "dev-master",
|
|
||||||
"mcnd/notes-security": "dev-master",
|
|
||||||
"mcnd/ulmus-user": "dev-master",
|
|
||||||
"mcnd/thebugs": "dev-master",
|
"mcnd/thebugs": "dev-master",
|
||||||
"mcnd/taxus": "dev-master",
|
"mcnd/taxus": "dev-master",
|
||||||
|
"mcnd/notes": "dev-master",
|
||||||
"psr/simple-cache": "*"
|
"psr/simple-cache": "*"
|
||||||
},
|
},
|
||||||
"repositories": [
|
"repositories": [
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/lean-console.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/cronard.git"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/event.git"
|
"url": "https://git.mcnd.ca/mcndave/event.git"
|
||||||
@@ -68,46 +49,10 @@
|
|||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/ulmus.git"
|
"url": "https://git.mcnd.ca/mcndave/ulmus.git"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/ulmus-user.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/picea.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/picea-ui.git"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/notes.git"
|
"url": "https://git.mcnd.ca/mcndave/notes.git"
|
||||||
},
|
},
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/notes-route.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/notes-cronard.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/notes-security.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/notes-breadcrumb.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/notes-event.git"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"type": "vcs",
|
|
||||||
"url": "https://git.mcnd.ca/mcndave/notes-tell.git"
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"type": "vcs",
|
"type": "vcs",
|
||||||
"url": "https://git.mcnd.ca/mcndave/tell.git"
|
"url": "https://git.mcnd.ca/mcndave/tell.git"
|
||||||
@@ -138,18 +83,14 @@
|
|||||||
"lean" : {
|
"lean" : {
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"definitions" : [
|
"definitions" : [
|
||||||
"meta/definitions/software.php",
|
|
||||||
"meta/definitions/authorize.php",
|
"meta/definitions/authorize.php",
|
||||||
"meta/definitions/cli.php",
|
|
||||||
"meta/definitions/cronard.php",
|
|
||||||
"meta/definitions/email.php",
|
"meta/definitions/email.php",
|
||||||
"meta/definitions/event.php",
|
"meta/definitions/event.php",
|
||||||
"meta/definitions/http.php",
|
"meta/definitions/http.php",
|
||||||
|
"meta/definitions/orm.php",
|
||||||
"meta/definitions/language.php",
|
"meta/definitions/language.php",
|
||||||
"meta/definitions/negundo.php",
|
|
||||||
"meta/definitions/routes.php",
|
"meta/definitions/routes.php",
|
||||||
"meta/definitions/software.php",
|
"meta/definitions/software.php",
|
||||||
"meta/definitions/storage.php",
|
|
||||||
"meta/definitions/template.php"
|
"meta/definitions/template.php"
|
||||||
],
|
],
|
||||||
"config": [
|
"config": [
|
||||||
|
|||||||
+1
-12
@@ -1,14 +1,3 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
return [
|
return [];
|
||||||
'ulmus' => [
|
|
||||||
'connections' => [
|
|
||||||
'sqlite' => [
|
|
||||||
'adapter' => 'SQLite',
|
|
||||||
'path' => getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . "var/lean.sqlite3",
|
|
||||||
'pragma_begin' => "journal_mode=WAL",
|
|
||||||
'pragma_close' => "analysis_limit=500,optimize",
|
|
||||||
],
|
|
||||||
],
|
|
||||||
],
|
|
||||||
];
|
|
||||||
@@ -1,46 +1,53 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Lean\Factory\HttpFactory;
|
|
||||||
|
|
||||||
use Ulmus\User\{Entity,
|
use Ulmus\User\{Entity,
|
||||||
Lib\Authenticate,
|
Lib\Authenticate,
|
||||||
|
Lib\Authorize,
|
||||||
Middleware\HeaderAuthenticationMiddleware,
|
Middleware\HeaderAuthenticationMiddleware,
|
||||||
Middleware\PostRequestAuthenticationMiddleware,
|
Middleware\PostRequestAuthenticationMiddleware,
|
||||||
|
Middleware\LocalMacAddressMiddleware,
|
||||||
|
Authorize\MacAddressAuthentication,
|
||||||
Authorize\PostRequestAuthentication};
|
Authorize\PostRequestAuthentication};
|
||||||
|
|
||||||
use Picea\Picea;
|
use Picea\Picea;
|
||||||
|
|
||||||
use Storage\{ Cookie, Session };
|
use Storage\{ Cookie, Session };
|
||||||
|
|
||||||
use function DI\{get, autowire, create};
|
use function DI\{get, create};
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Authenticate::class => create(Authenticate::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')),
|
||||||
|
|
||||||
HeaderAuthenticationMiddleware::class => create(HeaderAuthenticationMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authorize.error')),
|
Authorize::class => create(Authorize::class)->constructor(get(Entity\UserInterface::class), get(Session::class), get(Cookie::class), get('authentication.method')),
|
||||||
|
|
||||||
PostRequestAuthentication::class => create(PostRequestAuthentication::class)->constructor(get(\Ulmus\User\Lib\Authenticate::class), "email", "email", "password"),
|
HeaderAuthenticationMiddleware::class => create(HeaderAuthenticationMiddleware::class)->constructor(get(Authorize::class), get(Entity\UserInterface::class), get('authorize.error')),
|
||||||
|
|
||||||
|
PostRequestAuthentication::class => create(PostRequestAuthentication::class)->constructor(get(Authenticate::class), "email", "email", "password"),
|
||||||
|
|
||||||
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(PostRequestAuthentication::class)),
|
PostRequestAuthenticationMiddleware::class => create(PostRequestAuthenticationMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(PostRequestAuthentication::class)),
|
||||||
|
|
||||||
|
MacAddressAuthentication::class => create(MacAddressAuthentication::class)->constructor(get(Authenticate::class), "mac"),
|
||||||
|
|
||||||
|
LocalMacAddressMiddleware::class => create(LocalMacAddressMiddleware::class)->constructor(get(Entity\UserInterface::class), get('authentication.error'), get(MacAddressAuthentication::class)),
|
||||||
|
|
||||||
'authentication.method' => null,
|
'authentication.method' => null,
|
||||||
|
|
||||||
'authorize.error' => function($c) {
|
'authorize.error' => function($c) {
|
||||||
return function(array $errorData) {
|
return function(array $errorData) use ($c) {
|
||||||
return HttpFactory::createJsonResponse($errorData + [
|
return $c->get(\Lean\Factory\HttpFactoryInterface::class)::createJsonResponse($errorData + [
|
||||||
'api.error' => "Authorization failed",
|
'api.error' => "Authorization failed",
|
||||||
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
'api.datetime' => (new \DateTime)->format(\DateTime::ATOM),
|
||||||
]);
|
], 403);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
'authentication.error' => function($c, Picea $picea) {
|
'authentication.error' => function($c, Picea $picea) {
|
||||||
return function($message) use ($picea) {
|
return function($message) use ($picea, $c) {
|
||||||
return HttpFactory::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
return $c->get(\Lean\Factory\HttpFactoryInterface::class)::createHtmlResponse($picea->renderHtml('lean/error/500', [
|
||||||
'title' => "Authentication failed",
|
'title' => "Authentication failed",
|
||||||
'subtitle' => "",
|
'subtitle' => "",
|
||||||
'message' => $message,
|
'message' => $message,
|
||||||
]));
|
]), 401);
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
|
||||||
|
|
||||||
use Mcnd\CLI\CliMiddleware;
|
|
||||||
|
|
||||||
use Notes\CLI\CommandFetcher;
|
|
||||||
|
|
||||||
use Lean\{ Factory, Lean };
|
|
||||||
|
|
||||||
return [
|
|
||||||
CommandFetcher::class => function($c) {
|
|
||||||
$fetcher = new CommandFetcher(null, null, $c->get('cli.caching'));
|
|
||||||
|
|
||||||
$fetcher->setFolderList(array_map(function($item) {
|
|
||||||
return $item;
|
|
||||||
}, $c->get(Lean::class)->getCli()));
|
|
||||||
|
|
||||||
return $fetcher;
|
|
||||||
},
|
|
||||||
|
|
||||||
CliMiddleware::class => function($c) {
|
|
||||||
return new CliMiddleware($c, $c->get('cli.response:default'), $c->get(CommandFetcher::class));
|
|
||||||
},
|
|
||||||
|
|
||||||
'cli.response:default' => function($c) {
|
|
||||||
return function() {
|
|
||||||
return Factory\HttpFactory::createTextResponse("This is the default response from CLI middleware which indicates that no command were registered for this application.\n");
|
|
||||||
};
|
|
||||||
},
|
|
||||||
];
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
use Cronard\CronardMiddleware,
|
|
||||||
Notes\Cronard\TaskFetcher;
|
|
||||||
|
|
||||||
use Psr\Http\Message\ResponseInterface;
|
|
||||||
|
|
||||||
use Lean\{ Factory, Lean };
|
|
||||||
|
|
||||||
return [
|
|
||||||
CronardMiddleware::class => function($c) {
|
|
||||||
$cronardMiddleware = new CronardMiddleware($c, getenv('CRON_KEY'), function() : ResponseInterface {
|
|
||||||
return Factory\HttpFactory::createHtmlResponse(sprintf("%s - cron task begin...", date('Y-m-d H:i:s')));
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
return $cronardMiddleware->fromFile(getenv("META_PATH")."/crontab.php")->fromAnnotations($c->get(TaskFetcher::class));
|
|
||||||
},
|
|
||||||
|
|
||||||
TaskFetcher::class => function($c) {
|
|
||||||
$fetcher = new TaskFetcher(null, null, $c->get('cronard.caching'));
|
|
||||||
|
|
||||||
$fetcher->setFolderList(array_map(function($item) {
|
|
||||||
return $item;
|
|
||||||
}, $c->get(Lean::class)->getCronard()));
|
|
||||||
|
|
||||||
return $fetcher;
|
|
||||||
},
|
|
||||||
];
|
|
||||||
+28
-12
@@ -1,8 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Picea\Picea;
|
use Picea\Picea;
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
use Lean\{ Lean, Routing, Event\RoutingCompileRoutes, Event\RoutingMapRoutes };
|
use Lean\{ Lean, Routing, Event\RoutingCompileRoutes, Event\RoutingMapRoutes };
|
||||||
use Mcnd\Event;
|
use Mcnd\Event;
|
||||||
use Taxus\Taxus;
|
use Taxus\Taxus;
|
||||||
@@ -11,6 +9,9 @@ use Notes\Route\Attribute\Method\Route;
|
|||||||
use Notes\Security\SecurityHandler;
|
use Notes\Security\SecurityHandler;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
use Ulmus\User\Entity\UserInterface;
|
||||||
|
|
||||||
|
use function DI\autowire, DI\create, DI\get;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Event\EventManager::class => autowire(Event\EventManager::class),
|
Event\EventManager::class => autowire(Event\EventManager::class),
|
||||||
@@ -24,38 +25,53 @@ return [
|
|||||||
},
|
},
|
||||||
|
|
||||||
Event\EventDefinition::class => function($c) {
|
Event\EventDefinition::class => function($c) {
|
||||||
|
$extension = $c->has(\Picea\Extension\UrlExtension::class) ? $c->get(\Picea\Extension\UrlExtension::class) : null;
|
||||||
|
$user = $c->get(UserInterface::class);
|
||||||
|
|
||||||
return new Event\EventDefinition([
|
return new Event\EventDefinition([
|
||||||
new class() implements RoutingCompileRoutes {
|
new class($extension) implements RoutingCompileRoutes {
|
||||||
|
public function __construct(
|
||||||
|
protected ? \Picea\Extension\UrlExtension $extension,
|
||||||
|
) {}
|
||||||
|
|
||||||
public function execute(Routing $routing, Route $attribute) : void
|
public function execute(Routing $routing, Route $attribute) : void
|
||||||
{
|
{
|
||||||
if (null !== ($name = $attribute->name ?? null)) {
|
if (null !== ($name = $attribute->name ?? null)) {
|
||||||
$routing->extension->registerRoute($name, $attribute->getRoute(), $attribute->class, $attribute->classMethod, $attribute->methods ?? (array)$attribute->method);
|
$this->extension->registerRoute($name, $attribute->getRoute(), $attribute->class, $attribute->classMethod, (array) ( $attribute->method ));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
new class() implements RoutingMapRoutes {
|
new class($user) implements RoutingMapRoutes {
|
||||||
|
|
||||||
|
public function __construct(
|
||||||
|
protected UserInterface $user
|
||||||
|
) {}
|
||||||
|
|
||||||
public function execute(Routing $routing, ContainerInterface $container, ServerRequestInterface & $request, Route $attribute) : void
|
public function execute(Routing $routing, ContainerInterface $container, ServerRequestInterface & $request, Route $attribute) : void
|
||||||
{
|
{
|
||||||
$class = $attribute->class;
|
$class = $attribute->class;
|
||||||
$method = $attribute->classMethod;
|
$method = $attribute->classMethod;
|
||||||
$object = $container->get($class);
|
|
||||||
|
|
||||||
$request = $request->withAttribute('lean.route', $attribute);
|
$request = $request->withAttribute('lean.route', $attribute);
|
||||||
|
|
||||||
# Checking if user needs to be logged
|
# Checking if user needs to be logged
|
||||||
if ( $container->has(SecurityHandler::class) ){
|
if ( $container->has(SecurityHandler::class) ){
|
||||||
if ( $redirect = $container->get(SecurityHandler::class)->verify($class, $method) ) {
|
$securityHandler = $container->get(SecurityHandler::class);
|
||||||
if ( empty($object->user) || ! $object->user->logged ) {
|
|
||||||
$routing->session->set('redirectedFrom', (string) $request->getUri());
|
|
||||||
$routing->response = $redirect;
|
|
||||||
|
|
||||||
|
if ( $redirect = $securityHandler->verify($class, $method) ) {
|
||||||
|
if (! $this->user->loggedIn() ) {
|
||||||
|
if ($container->has(Session::class)) {
|
||||||
|
$container->get(Session::class)->set('redirectedFrom', (string)$request->getUri());
|
||||||
|
}
|
||||||
|
|
||||||
|
$routing->response = $redirect;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $container->has(Taxus::class) ) {
|
if ( $securityHandler->isLocked($class, $method) && $container->has(Taxus::class)) {
|
||||||
if ( $forbidden = $container->get(SecurityHandler::class)->taxus($class, $method, $object->user ?? null) ) {
|
if ( $forbidden = $securityHandler->taxus($class, $method, $this->user) ) {
|
||||||
$routing->response = $forbidden;
|
$routing->response = $forbidden;
|
||||||
|
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use Lean\ApplicationStrategy\{ ThrowableHandler, ThrowableHandlerInterface, NotFoundDecoratorInterface, NotFoundDecorator, MethodNotAllowedInterface, };
|
||||||
use function DI\autowire, DI\create, DI\get;
|
use function DI\autowire, DI\create, DI\get;
|
||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
@@ -14,4 +15,8 @@ return [
|
|||||||
},
|
},
|
||||||
|
|
||||||
EmitterInterface::class => create(SapiEmitter::class),
|
EmitterInterface::class => create(SapiEmitter::class),
|
||||||
|
ThrowableHandlerInterface::class => autowire(ThrowableHandler::class),
|
||||||
|
NotFoundDecoratorInterface::class => autowire(NotFoundDecorator::class),
|
||||||
|
# MethodNotAllowedInterface::class => autowire(MethodNotAllowedDecorator::class),
|
||||||
|
|
||||||
];
|
];
|
||||||
@@ -1,32 +1,36 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
use Tell\I18n;
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
use Notes\Tell\LanguageHandler;
|
use function DI\autowire, DI\create, DI\get, DI\add;
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Tell\I18n::class => create( Tell\I18n::class ) ->constructor(
|
I18n::class => function(ContainerInterface $container) {
|
||||||
get(Tell\Reader\JsonReader::class),
|
$i18n = new I18n($container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), $container->get('tell.fallback'));
|
||||||
get(Tell\Reader\PhpReader::class),
|
$i18n->locale(getenv('DEFAULT_LOCAL'));
|
||||||
get('tell.fallback') /* getenv("DEBUG") ? create(Tell\PrintMissingKey::class) : get('tell.fallback') */
|
$i18n->initialize(! getenv("DEBUG"));
|
||||||
),
|
|
||||||
|
|
||||||
'tell.fallback' => function($c) {
|
return $i18n;
|
||||||
$i18n = new Tell\I18n( $c->get(Tell\Reader\JsonReader::class), $c->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
|
},
|
||||||
|
|
||||||
|
'tell.fallback' => function(ContainerInterface $container) {
|
||||||
|
$i18n = new Tell\I18n( $container->get(Tell\Reader\JsonReader::class), $container->get(Tell\Reader\PhpReader::class), new Tell\PrintMissingKey() );
|
||||||
$i18n->locale(getenv('DEFAULT_LOCAL_FALLBACK') ?: "en_US");
|
$i18n->locale(getenv('DEFAULT_LOCAL_FALLBACK') ?: "en_US");
|
||||||
$i18n->initialize(true);
|
$i18n->initialize(true);
|
||||||
|
|
||||||
return $i18n;
|
return $i18n;
|
||||||
},
|
},
|
||||||
|
|
||||||
# TODO -- accept folders from Lean Apps
|
Tell\Reader\PhpReader::class => function(ContainerInterface $container) {
|
||||||
Tell\Reader\PhpReader::class => function($c) {
|
return new Tell\Reader\PhpReader($container->get(Lean\Lean::class)->getI18n('php'), false);
|
||||||
return new Tell\Reader\PhpReader($c->get(Lean\Lean::class)->getI18n('php'), false);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
Tell\Reader\JsonReader::class => function($c) {
|
Tell\Reader\JsonReader::class => function(ContainerInterface $container) {
|
||||||
return new Tell\Reader\JsonReader($c->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
|
return new Tell\Reader\JsonReader($container->get(Lean\Lean::class)->getI18n('json'), true, \JSON_PRETTY_PRINT);
|
||||||
},
|
},
|
||||||
|
|
||||||
LanguageHandler::class => autowire(LanguageHandler::class),
|
'lean.autoload' => add([
|
||||||
|
I18n::class,
|
||||||
|
]),
|
||||||
];
|
];
|
||||||
@@ -1,12 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
use Negundo\Client\{ SoftwareConfig, Dump, Task, NegundoMiddleware };
|
|
||||||
|
|
||||||
return [
|
|
||||||
SoftwareConfig::class => create(SoftwareConfig::class)->constructor(getenv('NEGUNDO_HASH'), getenv('NEGUNDO_SERVER')),
|
|
||||||
NegundoMiddleware::class => autowire(NegundoMiddleware::class),
|
|
||||||
Dump::class => autowire(Dump::class),
|
|
||||||
Task::class => autowire(Task::class),
|
|
||||||
];
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
use Ulmus\Container\AdapterProxy;
|
||||||
|
use Ulmus\ConnectionAdapter;
|
||||||
|
|
||||||
|
use function DI\autowire, DI\create, DI\get, DI\add;
|
||||||
|
|
||||||
|
return [
|
||||||
|
'lean.autoload' => add([
|
||||||
|
AdapterProxy::class,
|
||||||
|
]),
|
||||||
|
|
||||||
|
AdapterProxy::class => function (Psr\Container\ContainerInterface $c) {
|
||||||
|
$proxy = new AdapterProxy();
|
||||||
|
|
||||||
|
$autoload = $c->get(\Lean\Lean::class)->getConnectionAdapters();
|
||||||
|
|
||||||
|
$proxy->push($autoload);
|
||||||
|
|
||||||
|
return $proxy;
|
||||||
|
},
|
||||||
|
];
|
||||||
+10
-11
@@ -1,6 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
use function DI\autowire, DI\create, DI\get, DI\add;
|
||||||
|
|
||||||
use League\Route\Strategy\ApplicationStrategy,
|
use League\Route\Strategy\ApplicationStrategy,
|
||||||
League\Route\Router;
|
League\Route\Router;
|
||||||
@@ -15,10 +15,7 @@ use Notes\Breadcrumb\Breadcrumb;
|
|||||||
|
|
||||||
use Storage\SessionMiddleware;
|
use Storage\SessionMiddleware;
|
||||||
|
|
||||||
use Ulmus\User\Middleware\{
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
HeaderAuthenticationMiddleware,
|
|
||||||
PostRequestAuthenticationMiddleware
|
|
||||||
};
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Lean\Routing::class => autowire(Lean\Routing::class),
|
Lean\Routing::class => autowire(Lean\Routing::class),
|
||||||
@@ -49,17 +46,17 @@ return [
|
|||||||
"dump", "errorHandler", SessionMiddleware::class, CronardMiddleware::class, Mcnd\Event\EventMiddleware::class, Mcnd\CLI\CliMiddleware::class,
|
"dump", "errorHandler", SessionMiddleware::class, CronardMiddleware::class, Mcnd\Event\EventMiddleware::class, Mcnd\CLI\CliMiddleware::class,
|
||||||
],
|
],
|
||||||
|
|
||||||
'app.middlewares' => [
|
'app.middlewares' => add([
|
||||||
HeaderAuthenticationMiddleware::class,
|
# HeaderAuthenticationMiddleware::class,
|
||||||
PostRequestAuthenticationMiddleware::class,
|
# PostRequestAuthenticationMiddleware::class,
|
||||||
],
|
]),
|
||||||
|
|
||||||
'routes.list' => function($c) {
|
Lean\Routing\RouteDefinitionInterface::class => function($c) {
|
||||||
return function (ContainerInterface $container) {
|
return function (ContainerInterface $container) {
|
||||||
$router = $container->get(Router::class);
|
$router = $container->get(Router::class);
|
||||||
|
|
||||||
foreach([ 'routes.middlewares', 'app.middlewares' ] as $key) {
|
foreach([ 'routes.middlewares', 'app.middlewares' ] as $key) {
|
||||||
if ( $container->has($key) ) {
|
if ($container->has($key)) {
|
||||||
foreach ($container->get($key) as $i => $middleware) {
|
foreach ($container->get($key) as $i => $middleware) {
|
||||||
if ($container->has($middleware)) {
|
if ($container->has($middleware)) {
|
||||||
$router->middleware($container->get($middleware));
|
$router->middleware($container->get($middleware));
|
||||||
@@ -68,6 +65,8 @@ return [
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$router->addPatternMatcher('email', '[^@ \t\r\n]+@[^@ \t\r\n]+\.[^@ \t\r\n/]+');
|
||||||
|
|
||||||
$routing = $container->get(Lean\Routing::class);
|
$routing = $container->get(Lean\Routing::class);
|
||||||
$routing->registerRoute($container, getenv('URL_BASE'));
|
$routing->registerRoute($container, getenv('URL_BASE'));
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
use Storage\Session;
|
|
||||||
|
|
||||||
use Taxus\{ Privilege, Taxus, PermissionGrantInterface, DefaultPermissionGrant };
|
|
||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
|
||||||
|
|
||||||
return [
|
|
||||||
Taxus::class => function ($c) {
|
|
||||||
return ( new Taxus( $c->get(PermissionGrantInterface::class) ) )->add(
|
|
||||||
[ new Privilege("dev", "Is a developper of this application."), "is_dev" ],
|
|
||||||
[ new Privilege("admin", "Can manage mostly everything from this application."), "is_admin" ],
|
|
||||||
[ new Privilege("user", "Is an authenticated user."), "is_user" ],
|
|
||||||
[ new Privilege("anonymous", "Is an anonymous (unauthenticated) user."), "is_anonymous" ],
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
PermissionGrantInterface::class => create(DefaultPermissionGrant::class)->constructor(get(ServerRequestInterface::class), get(Session::class)),
|
|
||||||
];
|
|
||||||
@@ -1,7 +1,6 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Taxus\Privilege;
|
use Tell\I18n;
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
use TheBugs\JavascriptMiddleware;
|
use TheBugs\JavascriptMiddleware;
|
||||||
|
|
||||||
@@ -11,12 +10,14 @@ use Storage\Cookie,
|
|||||||
Storage\Session,
|
Storage\Session,
|
||||||
Storage\SessionMiddleware;
|
Storage\SessionMiddleware;
|
||||||
|
|
||||||
|
use function DI\autowire, DI\create, DI\get, DI\add;
|
||||||
|
|
||||||
$dir = dirname(__DIR__, 2);
|
$dir = dirname(__DIR__, 2);
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'lean.default' => [
|
'lean.default' => [
|
||||||
'picea' => [
|
'picea' => [
|
||||||
'context' => "Lean\\View",
|
'context' => \Lean\View::class,
|
||||||
|
|
||||||
'view' => [
|
'view' => [
|
||||||
[
|
[
|
||||||
@@ -25,7 +26,7 @@ return [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'path' => implode(DIRECTORY_SEPARATOR, [ $dir, "view", '' ]),
|
'path' => implode(DIRECTORY_SEPARATOR, [ $dir, "view", '' ]),
|
||||||
'order' => 99,
|
'order' => 1000,
|
||||||
],
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
@@ -65,15 +66,14 @@ return [
|
|||||||
'routes' => [],
|
'routes' => [],
|
||||||
|
|
||||||
'cronard' => [],
|
'cronard' => [],
|
||||||
|
|
||||||
'taxus' => [
|
|
||||||
[ new Privilege("dev", "Is a developper of this application."), "is_dev" ],
|
|
||||||
[ new Privilege("admin", "Can manage mostly everything from this application."), "is_admin" ],
|
|
||||||
[ new Privilege("user", "Is an authenticated user."), "is_user" ],
|
|
||||||
[ new Privilege("anonymous", "Is an anonymous (unauthenticated) user."), "is_anonymous" ],
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
|
|
||||||
|
'lean.autoload' => add([
|
||||||
|
Lean::class,
|
||||||
|
]),
|
||||||
|
|
||||||
|
\Lean\Factory\HttpFactoryInterface::class => autowire(\Lean\Factory\HttpFactory::class),
|
||||||
|
|
||||||
Lean::class => autowire(Lean::class),
|
Lean::class => autowire(Lean::class),
|
||||||
|
|
||||||
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
|
JavascriptMiddleware::class => create(JavascriptMiddleware::class),
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use Psr\Container\ContainerInterface;
|
use Ulmus\{ ConnectionAdapter, Container\AdapterProxy };
|
||||||
|
use Lean\Lean;
|
||||||
use Ulmus\ConnectionAdapter,
|
|
||||||
Ulmus\Container\AdapterProxy;
|
|
||||||
|
|
||||||
use Storage\Session;
|
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'lean:adapter.sqlite' => function($c) {
|
'lean:adapter.sqlite' => function($c) {
|
||||||
|
|||||||
@@ -2,68 +2,13 @@
|
|||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
use function DI\autowire, DI\create, DI\get;
|
||||||
|
|
||||||
use Picea\{
|
use Picea\{ Language\LanguageRegistration, };
|
||||||
Language\LanguageRegistration,
|
|
||||||
Caching\Cache,
|
|
||||||
Caching\Opcache,
|
|
||||||
Compiler,
|
|
||||||
Compiler\Context,
|
|
||||||
Compiler\BaseContext,
|
|
||||||
FileFetcher,
|
|
||||||
Method\Request};
|
|
||||||
|
|
||||||
use Picea\Extension\{ LanguageHandlerInterface, LanguageExtension, TitleExtension, NumberExtension, UrlExtension };
|
use Picea\Extension\{ LanguageHandlerInterface, };
|
||||||
|
|
||||||
use Picea\Ui\{ Method, Ui };
|
use Picea\Ui\{ Ui };
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Picea\Picea::class => function($c) {
|
|
||||||
return new Picea\Picea($c->get(Context::class), $c->get(Cache::class), $c->get(Compiler::class), null, $c->get(FileFetcher::class), null, getenv("DEBUG"));
|
|
||||||
},
|
|
||||||
|
|
||||||
Context::class => function($c) {
|
|
||||||
return new BaseContext($c->get(Lean\Lean::class)->getPiceaContext());
|
|
||||||
},
|
|
||||||
|
|
||||||
Ui::class => autowire(Ui::class),
|
|
||||||
|
|
||||||
Compiler::class => autowire(Compiler::class),
|
|
||||||
|
|
||||||
Request::class => autowire(Request::class),
|
|
||||||
|
|
||||||
Method\Form::class => autowire(Method\Form::class),
|
|
||||||
|
|
||||||
Method\Pagination::class => autowire(Method\Pagination::class),
|
|
||||||
|
|
||||||
LanguageExtension::class => create(LanguageExtension::class)->constructor(get(LanguageHandlerInterface::class)),
|
|
||||||
|
|
||||||
LanguageHandlerInterface::class => autowire(\Lean\LanguageHandler::class),
|
LanguageHandlerInterface::class => autowire(\Lean\LanguageHandler::class),
|
||||||
|
|
||||||
LanguageRegistration::class => create(\Lean\PiceaDefaultRegistration::class)->constructor(get('picea.extensions'), [], [], get(Ui::class), null),
|
LanguageRegistration::class => create(\Lean\PiceaDefaultRegistration::class)->constructor(get('picea.extensions'), [], [], get(Ui::class), null),
|
||||||
|
|
||||||
'picea.extensions' => function(\Psr\Container\ContainerInterface $c) {
|
|
||||||
return array_merge([
|
|
||||||
$c->get(LanguageExtension::class),
|
|
||||||
$c->get(TitleExtension::class),
|
|
||||||
$c->get(NumberExtension::class),
|
|
||||||
$c->get(UrlExtension::class),
|
|
||||||
$c->get(Method\Form::class),
|
|
||||||
$c->get(Method\Pagination::class),
|
|
||||||
$c->get(Request::class),
|
|
||||||
], class_exists(\Taxus\Picea\Extension::class) ? [ $c->get(\Taxus\Picea\Extension::class) ] : [],
|
|
||||||
array_map(fn($class) => $c->get($class), $c->get(Lean\Lean::class)->getPiceaExtensions())
|
|
||||||
);
|
|
||||||
},
|
|
||||||
|
|
||||||
TitleExtension::class => autowire(TitleExtension::class),
|
|
||||||
|
|
||||||
NumberExtension::class => autowire(NumberExtension::class),
|
|
||||||
|
|
||||||
UrlExtension::class => create(UrlExtension::class)->constructor(getenv("URL_BASE"), get('git.commit'), explode(',', getenv('APP_URL')), (bool) getenv('FORCE_SSL')),
|
|
||||||
|
|
||||||
Cache::class => create(Opcache::class)->constructor(getenv("CACHE_PATH"), get(Context::class)),
|
|
||||||
|
|
||||||
FileFetcher::class => function($c) {
|
|
||||||
return new FileFetcher($c->get(Lean\Lean::class)->getViewPaths());
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
@@ -5,6 +5,15 @@
|
|||||||
"week": "week"
|
"week": "week"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"interval": {
|
||||||
|
"years": "{$years} year(s)",
|
||||||
|
"months": "{$months} month(s)",
|
||||||
|
"days": "{$days} day(s)",
|
||||||
|
"hours": "{$hours} hour(s)",
|
||||||
|
"minutes": "{$minutes} minutes(s)",
|
||||||
|
"seconds": "{$seconds} second(s)"
|
||||||
|
},
|
||||||
|
|
||||||
"month": {
|
"month": {
|
||||||
"list": [
|
"list": [
|
||||||
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Décember"
|
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "Décember"
|
||||||
|
|||||||
@@ -4,6 +4,15 @@
|
|||||||
"week": "semaine"
|
"week": "semaine"
|
||||||
},
|
},
|
||||||
|
|
||||||
|
"interval": {
|
||||||
|
"years": "{$years} années(s)",
|
||||||
|
"months": "{$months} mois",
|
||||||
|
"days": "{$days} jour(s)",
|
||||||
|
"hours": "{$hours} heure(s)",
|
||||||
|
"minutes": "{$minutes} minutes(s)",
|
||||||
|
"seconds": "{$seconds} seconde(s)"
|
||||||
|
},
|
||||||
|
|
||||||
"month": {
|
"month": {
|
||||||
"list": [
|
"list": [
|
||||||
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
|
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
|
||||||
|
|||||||
+15
-9
@@ -5,7 +5,8 @@ CRON_KEY = dev
|
|||||||
|
|
||||||
# Route
|
# Route
|
||||||
URL_BASE = ""
|
URL_BASE = ""
|
||||||
APP_URL = "dev.mcnd.ca"
|
APP_URL = "myapp.ca"
|
||||||
|
ASSET_PATH = "static/"
|
||||||
|
|
||||||
# Path
|
# Path
|
||||||
CACHE_DIR = "var/cache"
|
CACHE_DIR = "var/cache"
|
||||||
@@ -23,13 +24,18 @@ DEFAULT_TIME = "fr.UTF-8"
|
|||||||
DEFAULT_TIME_FALLBACK = "french.UTF-8"
|
DEFAULT_TIME_FALLBACK = "french.UTF-8"
|
||||||
|
|
||||||
# Database
|
# Database
|
||||||
DATABASE_PORT = ""
|
SQLITE_PATH = "var/myapp.sqlite3"
|
||||||
DATABASE_HOST = ""
|
SQLITE_ADAPTER = "SQLite"
|
||||||
DATABASE_NAME = ""
|
SQLITE_PRAGMA_BEGIN = "foreign_keys=ON,synchronous=NORMAL"
|
||||||
DATABASE_USERNAME = ""
|
SQLITE_PRAGMA_DEBUG_BEGIN = "journal_mode=WAL"
|
||||||
DATABASE_PASSWORD = ""
|
SQLITE_PRAGMA_CLOSE = "analysis_limit=500,optimize"
|
||||||
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%"
|
||||||
|
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
.idea
|
||||||
|
.env
|
||||||
|
composer.lock
|
||||||
|
/private/
|
||||||
|
/public/static/
|
||||||
|
/public/.htaccess
|
||||||
|
/vendor/
|
||||||
|
/var/
|
||||||
File renamed without changes.
@@ -0,0 +1,176 @@
|
|||||||
|
{
|
||||||
|
"name": "my_namespace/my_project",
|
||||||
|
"description": "",
|
||||||
|
"type": "app",
|
||||||
|
"license": "MIT",
|
||||||
|
"authors": [
|
||||||
|
|
||||||
|
],
|
||||||
|
"minimum-stability": "dev",
|
||||||
|
"require": {
|
||||||
|
"php": "^8.4",
|
||||||
|
"ext-apcu": "*",
|
||||||
|
"ext-sodium": "*",
|
||||||
|
"ext-bcmath": "*",
|
||||||
|
"ext-json": "*",
|
||||||
|
"ext-readline": "*",
|
||||||
|
"league/route": "^5.0.0-dev",
|
||||||
|
"laminas/laminas-diactoros": "2.24.x-dev",
|
||||||
|
"laminas/laminas-httphandlerrunner": "2.5.x-dev",
|
||||||
|
"vlucas/phpdotenv": "^3.4@dev",
|
||||||
|
"middlewares/whoops": "dev-master",
|
||||||
|
"ralouphie/getallheaders": "3.x",
|
||||||
|
"guzzlehttp/guzzle": "7.9.x-dev",
|
||||||
|
"symfony/mailer": "6.3.x-dev",
|
||||||
|
"league/oauth2-client": "dev-master",
|
||||||
|
"php-di/php-di": "dev-master",
|
||||||
|
"league/commonmark": "^2.7@dev",
|
||||||
|
"assets-package/ace": "dev-master",
|
||||||
|
"mcnd/dump": "dev-master",
|
||||||
|
"mcnd/storage": "dev-master",
|
||||||
|
"mcnd/cli": "dev-master",
|
||||||
|
"mcnd/event": "dev-master",
|
||||||
|
"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": "dev-master",
|
||||||
|
"mcnd/cronard": "dev-master",
|
||||||
|
"mcnd/lean-api": "dev-master",
|
||||||
|
"mcnd/lean-console": "dev-master",
|
||||||
|
"mcnd/kash": "dev-master",
|
||||||
|
"mcnd/taxus": "dev-master",
|
||||||
|
"mcnd/notes": "dev-master",
|
||||||
|
"mcnd/thebugs": "dev-master",
|
||||||
|
"mcnd/negundo-client": "dev-master"
|
||||||
|
},
|
||||||
|
"repositories": [
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/cronard.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/cli.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/dump.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/storage.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/lean.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/lean-api.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/lean-console.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/ulmus.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/ulmus-api.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/ulmus-user.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/ulmus-api-gitea.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/picea.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/storage.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/picea-ui.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/picea-asset.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/notes.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/the-bugs.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/tell.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/taxus.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/dump.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/kash.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/event.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/mcndave/negundo-client.git"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"type": "vcs",
|
||||||
|
"url": "https://git.mcnd.ca/assets-package/ace.git"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"MyProject\\Namespace": "src/"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"scripts": {
|
||||||
|
"post-install-cmd": [
|
||||||
|
"Lean\\Composer::postInstall"
|
||||||
|
],
|
||||||
|
"post-update-cmd": [
|
||||||
|
"Lean\\Composer::postUpdate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"extra" : {
|
||||||
|
"lean" : {
|
||||||
|
"autoload": {
|
||||||
|
"order": 1000,
|
||||||
|
"definitions" : [
|
||||||
|
"meta/definitions/definitions.php",
|
||||||
|
"meta/definitions/storage.php",
|
||||||
|
"meta/definitions/security.php",
|
||||||
|
"meta/definitions/auth.php",
|
||||||
|
"meta/definitions/env.php"
|
||||||
|
],
|
||||||
|
"config" : [
|
||||||
|
"meta/config.php"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -19,7 +19,7 @@ return [
|
|||||||
|
|
||||||
'ulmus' => [
|
'ulmus' => [
|
||||||
'connections' => [
|
'connections' => [
|
||||||
'default' => [
|
/*'default' => [
|
||||||
'adapter' => getenv("DATABASE_ADAPTER"),
|
'adapter' => getenv("DATABASE_ADAPTER"),
|
||||||
'host' => getenv("DATABASE_HOST"),
|
'host' => getenv("DATABASE_HOST"),
|
||||||
'port' => getenv("DATABASE_PORT"),
|
'port' => getenv("DATABASE_PORT"),
|
||||||
@@ -29,18 +29,18 @@ return [
|
|||||||
'settings' => [
|
'settings' => [
|
||||||
'charset' => getenv("DATABASE_CHARSET"),
|
'charset' => getenv("DATABASE_CHARSET"),
|
||||||
],
|
],
|
||||||
],
|
],*/
|
||||||
|
|
||||||
'sqlite' => [
|
'default' => [
|
||||||
'adapter' => getenv("SQLITE_ADAPTER"),
|
'adapter' => getenv("SQLITE_ADAPTER"),
|
||||||
'path' => getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . getenv("SQLITE_PATH"),
|
'path' => getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . getenv("SQLITE_PATH"),
|
||||||
'pragma' => explode(',', getenv("SQLITE_PRAGMA")),
|
'pragma' => explode(',', getenv("SQLITE_PRAGMA")),
|
||||||
'pragma_begin' => array_merge(
|
'pragma_begin' => array_merge(
|
||||||
explode(',', getenv("SQLITE_PRAGMA_BEGIN")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_BEGIN") : "")
|
explode(',', getenv("SQLITE_PRAGMA_BEGIN")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_BEGIN") : "")
|
||||||
),
|
),
|
||||||
'pragma_close' => array_merge(
|
'pragma_close' => array_merge(
|
||||||
explode(',', getenv("SQLITE_PRAGMA_CLOSE")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_CLOSE") : "")
|
explode(',', getenv("SQLITE_PRAGMA_CLOSE")), explode(',', getenv('DEBUG') ? getenv("SQLITE_PRAGMA_DEBUG_CLOSE") : "")
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
]
|
]
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ return [
|
|||||||
|
|
||||||
EmailConfiguration::class => function($c) {
|
EmailConfiguration::class => function($c) {
|
||||||
$email = new EmailConfiguration( EmailConfiguration::AUTH_TYPE_SMTP );
|
$email = new EmailConfiguration( EmailConfiguration::AUTH_TYPE_SMTP );
|
||||||
$email->smtpHost = getenv('SMTP_HOSTNAME');
|
$email->smtpHost = getenv('SMTP_HOST');
|
||||||
$email->smtpPort = getenv('SMTP_PORT');
|
$email->smtpPort = getenv('SMTP_PORT');
|
||||||
$email->smtpUsername = getenv('SMTP_USERNAME');
|
$email->smtpUsername = getenv('SMTP_USERNAME');
|
||||||
$email->smtpPassword = getenv('SMTP_PASSWORD');
|
$email->smtpPassword = getenv('SMTP_PASSWORD');
|
||||||
|
|||||||
@@ -1,57 +1,53 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
use Taxus\Privilege;
|
||||||
|
|
||||||
$dir = getenv("META_PATH") . "/definitions";
|
use function DI\{ autowire, add, create, get };
|
||||||
|
|
||||||
return array_merge(
|
$dir = dirname(__DIR__, 2);
|
||||||
Lean\Lean::definitions(),
|
|
||||||
|
|
||||||
Lean\Lean::autoloadDefinitionsFromComposerExtra(),
|
return [
|
||||||
|
\%NAMESPACE%\Factory\FormFactoryInterface::class => autowire(\%NAMESPACE%\Factory\FormFactory::class),
|
||||||
|
\Lean\Api\Factory\MessageFactoryInterface::class => autowire(\%NAMESPACE%\Lib\Message::class),
|
||||||
|
|
||||||
[
|
|
||||||
'%APPKEY%' => [
|
|
||||||
'picea' => [
|
|
||||||
'context' => "%ESCAPED_NAMESPACE%\\View",
|
|
||||||
'asset' => [],
|
|
||||||
'extensions' => [],
|
|
||||||
|
|
||||||
],
|
'%APPKEY%' => [
|
||||||
|
'picea' => [
|
||||||
'ulmus' => [
|
'context' => "%ESCAPED_NAMESPACE%\\View",
|
||||||
'entities' => [ '%ESCAPED_NAMESPACE%\\Entity' => getenv("PROJECT_PATH") . '/src/Entity/' ],
|
'asset' => [],
|
||||||
],
|
'extensions' => [],
|
||||||
|
|
||||||
'routes' => [
|
|
||||||
'%ESCAPED_NAMESPACE%\\Controller' => getenv("PROJECT_PATH") . '/src/Controller/',
|
|
||||||
],
|
|
||||||
|
|
||||||
'events' => [
|
|
||||||
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ getenv("PROJECT_PATH"), 'src', 'Controller', '' ]),
|
|
||||||
],
|
|
||||||
|
|
||||||
'cronard' => [
|
|
||||||
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ getenv("PROJECT_PATH"), 'src', 'Controller', '' ]),
|
|
||||||
],
|
|
||||||
|
|
||||||
'cli' => [
|
|
||||||
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ getenv("PROJECT_PATH"), 'src', 'Controller', '' ]),
|
|
||||||
],
|
|
||||||
],
|
],
|
||||||
|
|
||||||
'app.middlewares' => [],
|
'ulmus' => [
|
||||||
|
'entities' => [ '%ESCAPED_NAMESPACE%\\Entity' => implode(DIRECTORY_SEPARATOR, [ $dir, 'src', 'Entity', '' ]) ],
|
||||||
|
],
|
||||||
|
|
||||||
|
'routes' => [
|
||||||
|
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ $dir, 'src', 'Controller', '' ]),
|
||||||
|
],
|
||||||
|
|
||||||
|
'events' => [
|
||||||
|
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ $dir, 'src', 'Controller', '' ]),
|
||||||
|
],
|
||||||
|
|
||||||
|
'cronard' => [
|
||||||
|
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ $dir, 'src', 'Controller', '' ]),
|
||||||
|
],
|
||||||
|
|
||||||
|
'cli' => [
|
||||||
|
'%ESCAPED_NAMESPACE%\\Controller' => implode(DIRECTORY_SEPARATOR, [ $dir, 'src', 'Controller', '' ]),
|
||||||
|
],
|
||||||
|
|
||||||
|
'taxus' => [
|
||||||
|
'is_dev' => [ 'dev' => "Can manage almost everything in this application."],
|
||||||
|
'is_admin' => [ 'admin' => "Can manage almost everything in this application."],
|
||||||
|
'is_moderator' => [ 'moderator' => "Can moderate this application."],
|
||||||
|
'is_user' => [ 'user' => "Is an authenticated user."],
|
||||||
|
'is_anonymous' => [ 'anonymous' => "Is an anonymous (unauthenticated) user."],
|
||||||
|
]
|
||||||
],
|
],
|
||||||
|
|
||||||
require("$dir/auth.php"),
|
'app.middlewares' => \DI\add([
|
||||||
require("$dir/storage.php"),
|
Ulmus\User\Middleware\RememberMeMiddleware::class,
|
||||||
require("$dir/security.php"),
|
]),
|
||||||
require("$dir/env/" . getenv('APP_ENV') . ".php"),
|
];
|
||||||
[
|
|
||||||
'config' => function () {
|
|
||||||
return array_merge_recursive(
|
|
||||||
Lean\Lean::autoloadConfigFromComposerExtra(),
|
|
||||||
require(getenv("META_PATH")."/config.php")
|
|
||||||
);
|
|
||||||
}
|
|
||||||
]
|
|
||||||
);
|
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
if (! function_exists('getenvonce')) {
|
||||||
|
function getenvonce(string $name) : array|string|false
|
||||||
|
{
|
||||||
|
$value = getenv($name);
|
||||||
|
unset($_ENV[$name], $_SERVER[$name]);
|
||||||
|
putenv($name . "=");
|
||||||
|
return $value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return require("env/" . ( getenv('APP_ENV') ?? 'prod' ) . ".php");
|
||||||
+3
-3
@@ -4,7 +4,7 @@ use Picea\Picea;
|
|||||||
|
|
||||||
use Negundo\Client\{ NegundoMiddleware, SoftwareConfig };
|
use Negundo\Client\{ NegundoMiddleware, SoftwareConfig };
|
||||||
|
|
||||||
use Laminas\Diactoros\Response\HtmlResponse;
|
use Lean\Factory\HttpFactory;
|
||||||
|
|
||||||
use Psr\Http\Server\MiddlewareInterface,
|
use Psr\Http\Server\MiddlewareInterface,
|
||||||
Psr\Http\Message\ServerRequestInterface,
|
Psr\Http\Message\ServerRequestInterface,
|
||||||
@@ -13,7 +13,7 @@ use Psr\Http\Server\MiddlewareInterface,
|
|||||||
|
|
||||||
use function DI\{ create, get, autowire };
|
use function DI\{ create, get, autowire };
|
||||||
|
|
||||||
error_reporting(getenv('ERROR_REPORTING') ?: ( E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE ));
|
error_reporting(getenv('ERROR_REPORTING') ?: ( E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_NOTICE ));
|
||||||
|
|
||||||
return [
|
return [
|
||||||
/* do nothing in production !*/
|
/* do nothing in production !*/
|
||||||
@@ -35,7 +35,7 @@ return [
|
|||||||
return function(\Throwable $exception) use ($picea) {
|
return function(\Throwable $exception) use ($picea) {
|
||||||
error_log($exception->getMessage());
|
error_log($exception->getMessage());
|
||||||
|
|
||||||
return new HtmlResponse($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.",
|
'title' => "Une erreur s'est produite lors de l'exécution du script.",
|
||||||
'subtitle' => "Êtes-vous connecté avec le bon compte ?",
|
'subtitle' => "Êtes-vous connecté avec le bon compte ?",
|
||||||
'message' => $exception->getMessage(),
|
'message' => $exception->getMessage(),
|
||||||
|
|||||||
@@ -6,17 +6,28 @@ use Taxus\{ Privilege, Taxus, PermissionGrantInterface, DefaultPermissionGrant }
|
|||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
|
||||||
use function DI\autowire, DI\create, DI\get;
|
use function DI\{ create, get, add };
|
||||||
|
|
||||||
return [
|
return [
|
||||||
Taxus::class => function ($c) {
|
Taxus::class => function ($c) {
|
||||||
return ( new Taxus( $c->get(PermissionGrantInterface::class) ) )->add(
|
$taxus = new Taxus( ... $c->get('taxus.gates') );
|
||||||
[ new Privilege("dev", "Is a developper of this application."), "is_dev" ],
|
|
||||||
[ new Privilege("admin", "Can manage mostly everything from this application."), "is_admin" ],
|
$list = [];
|
||||||
[ new Privilege("user", "Is an authenticated user."), "is_user" ],
|
|
||||||
[ new Privilege("anonymous", "Is an anonymous (unauthenticated) user."), "is_anonymous" ],
|
foreach($c->get(Lean\Lean::class)->getTaxusPrivileges() as $key => $privilege) {
|
||||||
);
|
foreach($privilege as $name => $description) {
|
||||||
|
$list[] = [ new Privilege($name, $description), $key ];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$taxus->add(... $list);
|
||||||
|
|
||||||
|
return $taxus;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
'taxus.gates' => add([
|
||||||
|
get(PermissionGrantInterface::class),
|
||||||
|
]),
|
||||||
|
|
||||||
PermissionGrantInterface::class => create(%NAMESPACE%\PrivilegeGrantAccess::class)->constructor(get(ServerRequestInterface::class), get(Session::class)),
|
PermissionGrantInterface::class => create(%NAMESPACE%\PrivilegeGrantAccess::class)->constructor(get(ServerRequestInterface::class), get(Session::class)),
|
||||||
];
|
];
|
||||||
@@ -16,10 +16,4 @@ return [
|
|||||||
|
|
||||||
return $adapter;
|
return $adapter;
|
||||||
},
|
},
|
||||||
|
|
||||||
AdapterProxy::class => function (ContainerInterface $c) {
|
|
||||||
return new AdapterProxy(
|
|
||||||
$c->get(ConnectionAdapter::class)
|
|
||||||
);
|
|
||||||
},
|
|
||||||
];
|
];
|
||||||
@@ -1,12 +1,22 @@
|
|||||||
<IfModule mod_rewrite.c>
|
<IfModule mod_rewrite.c>
|
||||||
RewriteEngine On
|
RewriteEngine On
|
||||||
|
# RewriteBase /
|
||||||
|
|
||||||
# Force HTTPS (disabled by default)
|
# Force HTTPS (disabled by default)
|
||||||
# RewriteCond %{HTTPS} off
|
# RewriteCond %{HTTPS} off
|
||||||
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||||
|
|
||||||
|
# Reverse Proxy ; Force HTTPS (disabled by default)
|
||||||
|
# RewriteCond %{HTTP:X-Forwarded-SSL} off
|
||||||
|
# RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
|
||||||
|
|
||||||
# Remove trailing slashes from request URL
|
# Remove trailing slashes from request URL
|
||||||
|
#RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
|
#RewriteCond %{REQUEST_URI} (.+)/$
|
||||||
|
#RewriteRule ^ %1 [R=301,L]
|
||||||
|
|
||||||
|
# Redirect everything into app
|
||||||
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteCond %{REQUEST_URI} (.+)/$
|
RewriteRule ^([^?]*)$ %1 [NC,L,QSA]
|
||||||
RewriteRule ^ %1 [R=301,L]
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
@@ -1,8 +1,14 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
try {
|
try {
|
||||||
require_once("../src/Kernel.php");
|
$projectPath = dirname(__DIR__);
|
||||||
|
|
||||||
|
require_once $projectPath . '/vendor/autoload.php';
|
||||||
|
|
||||||
|
new class($projectPath) extends %NAMESPACE%\Kernel {};
|
||||||
}
|
}
|
||||||
catch(\Throwable $t) {
|
catch(\Throwable $t) {
|
||||||
echo $t->getMessage();
|
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");
|
||||||
}
|
}
|
||||||
@@ -1,45 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<configuration>
|
|
||||||
<system.webServer>
|
|
||||||
<rewrite>
|
|
||||||
<rules>
|
|
||||||
<rule name="Remove trailing slash" stopProcessing="true">
|
|
||||||
<match url="(.*)/$" />
|
|
||||||
<conditions>
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
|
|
||||||
</conditions>
|
|
||||||
<action type="Redirect" redirectType="Permanent" url="{R:1}" />
|
|
||||||
</rule>
|
|
||||||
<rule name="Framework Routing" stopProcessing="true">
|
|
||||||
<match url="." ignoreCase="false" />
|
|
||||||
<conditions logicalGrouping="MatchAll">
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
|
|
||||||
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" ignoreCase="false" negate="true" />
|
|
||||||
</conditions>
|
|
||||||
<action type="Rewrite" url="index.php" />
|
|
||||||
</rule>
|
|
||||||
</rules>
|
|
||||||
</rewrite>
|
|
||||||
<staticContent>
|
|
||||||
<remove fileExtension=".js" />
|
|
||||||
<mimeMap fileExtension=".js" mimeType="application/x-javascript; charset=UTF-8" />
|
|
||||||
<remove fileExtension=".css" />
|
|
||||||
<mimeMap fileExtension=".css" mimeType="text/css; charset=UTF-8" />
|
|
||||||
<remove fileExtension=".woff" />
|
|
||||||
<remove fileExtension=".eot" />
|
|
||||||
<remove fileExtension=".ttf" />
|
|
||||||
<remove fileExtension=".svg" />
|
|
||||||
|
|
||||||
<mimeMap fileExtension=".eot" mimeType="application/vnd.ms-fontobject" />
|
|
||||||
<mimeMap fileExtension=".ttf" mimeType="application/font-sfnt" />
|
|
||||||
<mimeMap fileExtension=".svg" mimeType="image/svg+xml" />
|
|
||||||
<mimeMap fileExtension=".woff" mimeType="application/font-woff" />
|
|
||||||
</staticContent>
|
|
||||||
<handlers>
|
|
||||||
<remove name="PHP7.3" />
|
|
||||||
<add name="PHP7.3" path="*.php" verb="*" modules="FastCgiModule" scriptProcessor="C:\php\7.4.0\php-cgi.exe" resourceType="File" requireAccess="Script" />
|
|
||||||
</handlers>
|
|
||||||
<httpErrors errorMode="Detailed" />
|
|
||||||
</system.webServer>
|
|
||||||
</configuration>
|
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace %NAMESPACE%\Factory;
|
||||||
|
|
||||||
|
use Lean\Api\Factory\MessageFactoryInterface;
|
||||||
|
use Lean\LanguageHandler;
|
||||||
|
use Picea\Ui\Method\FormContextInterface;
|
||||||
|
use Picea\Ui\Method\FormInterface;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Storage\Session;
|
||||||
|
use Ulmus\Entity\EntityInterface;
|
||||||
|
use Ulmus\User\Entity\UserInterface;
|
||||||
|
use Ulmus\User\Lib\Authenticate;
|
||||||
|
|
||||||
|
class FormFactory implements FormFactoryInterface
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
public function __construct(
|
||||||
|
protected ServerRequestInterface $request,
|
||||||
|
protected Authenticate $authenticate,
|
||||||
|
protected Session $session,
|
||||||
|
protected LanguageHandler $languageHandler,
|
||||||
|
protected MessageFactoryInterface $messageFactory,
|
||||||
|
) {}
|
||||||
|
|
||||||
|
public function save(EntityInterface $entity): FormInterface
|
||||||
|
{
|
||||||
|
return new Form\Save($this->languageHandler, $this->messageFactory, $entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function saveContext(? ServerRequestInterface $request = null, ? string $formName = null): FormContextInterface
|
||||||
|
{
|
||||||
|
return new Form\SaveContext($request ?: $this->request, $formName);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function delete(EntityInterface $entity): FormInterface
|
||||||
|
{
|
||||||
|
return new Form\Delete($this->languageHandler, $this->messageFactory, $entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function deleteContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface
|
||||||
|
{
|
||||||
|
return new Lib\FormContext($request, $formName);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace %NAMESPACE%\Factory;
|
||||||
|
|
||||||
|
use Lean\Api\Factory\MessageFactoryInterface;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Picea\Ui\Method\{ FormInterface, FormContextInterface };
|
||||||
|
use Storage\Session;
|
||||||
|
use Lean\LanguageHandler;
|
||||||
|
use Ulmus\Entity\EntityInterface;
|
||||||
|
use Ulmus\User\Entity\UserInterface;
|
||||||
|
use Ulmus\User\Lib\Authenticate;
|
||||||
|
|
||||||
|
interface FormFactoryInterface
|
||||||
|
{
|
||||||
|
/* public function __construct(ServerRequestInterface $request, Authenticate $authenticate, Session $session, LanguageHandler $languageHandler, MessageFactoryInterface $messageFactory,);
|
||||||
|
|
||||||
|
public function save(EntityInterface $entity): FormInterface;
|
||||||
|
|
||||||
|
public function saveContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface;
|
||||||
|
|
||||||
|
public function delete(EntityInterface $entity): FormInterface;
|
||||||
|
|
||||||
|
public function deleteContext(?ServerRequestInterface $request = null, ?string $formName = null): FormContextInterface;*/
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace %NAMESPACE%;
|
namespace %NAMESPACE%;
|
||||||
|
|
||||||
|
use Lean\Lean;
|
||||||
use Ulmus\ConnectionAdapter;
|
use Ulmus\ConnectionAdapter;
|
||||||
|
|
||||||
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
require_once dirname(__DIR__) . '/vendor/autoload.php';
|
||||||
@@ -22,8 +23,6 @@ new class(dirname(__DIR__)) extends \Lean\Kernel {
|
|||||||
{
|
{
|
||||||
$this->errorLogPath = getenv("LOGS_PATH") . DIRECTORY_SEPARATOR. date("Y-m").".log";
|
$this->errorLogPath = getenv("LOGS_PATH") . DIRECTORY_SEPARATOR. date("Y-m").".log";
|
||||||
|
|
||||||
$this->definitionFilePath = implode(DIRECTORY_SEPARATOR, [ getenv('META_PATH'), 'definitions', 'definitions.php' ]);
|
|
||||||
|
|
||||||
return parent::initializeEngine();
|
return parent::initializeEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace %NAMESPACE%\Lib;
|
||||||
|
|
||||||
|
use Picea\Picea;
|
||||||
|
use Storage\Session;
|
||||||
|
use Mcnd\Event\EventManager;
|
||||||
|
use Notes\{ Attribute\Ignore, Route\Attribute\Object\Route, Security\Attribute\Security };
|
||||||
|
use Ulmus\User\Entity\{ User, UserInterface };
|
||||||
|
|
||||||
|
use %NAMESPACE%\{ Entity, Lib, Form, Factory };
|
||||||
|
|
||||||
|
#[Security(locked: false)]
|
||||||
|
#[Route(base: "/api", method: [ "GET", "POST", "PUT", "PATCH", "DELETE", ])]
|
||||||
|
trait ApiTrait {
|
||||||
|
use \Lean\ControllerTrait, \Lean\Api\LeanApiTrait {
|
||||||
|
\Lean\Api\LeanApiTrait::renderMarkdown insteadof \Lean\ControllerTrait;
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
|
public UserInterface $user;
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
|
protected EventManager $eventManager;
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
|
protected Factory\FormFactoryInterface $formFactory;
|
||||||
|
}
|
||||||
@@ -7,31 +7,21 @@ use Storage\Session;
|
|||||||
use Ulmus\User\Entity\User;
|
use Ulmus\User\Entity\User;
|
||||||
use Notes\Route\Attribute\Object\Route;
|
use Notes\Route\Attribute\Object\Route;
|
||||||
use Notes\Security\Attribute\Security;
|
use Notes\Security\Attribute\Security;
|
||||||
|
use DI\Attribute\Inject;
|
||||||
|
|
||||||
use %NAMESPACE%\{ Entity, Lib, Form };
|
use %NAMESPACE%\{ Entity, Lib, Form };
|
||||||
|
|
||||||
use Mcnd\Event\EventManager;
|
use Mcnd\Event\EventManager;
|
||||||
use Ulmus\User\Entity\UserInterface;
|
use Notes\Attribute\Ignore;use Ulmus\User\Entity\UserInterface;
|
||||||
|
|
||||||
#[Security(locked: false)]
|
#[Security(locked: false)]
|
||||||
#[Route(method: ['GET', 'POST', ])]
|
#[Route(method: ['GET', 'POST', ])]
|
||||||
trait ControllerTrait {
|
trait ControllerTrait {
|
||||||
use \Lean\ControllerTrait;
|
use \Lean\ControllerTrait;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
public ? UserInterface $user;
|
public ? UserInterface $user;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
protected EventManager $eventManager;
|
protected EventManager $eventManager;
|
||||||
|
|
||||||
public function __construct(Picea $picea, Session $session, UserInterface $user, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
|
||||||
$this->initializeController($picea, $session, $user, $breadcrumb, $eventManager);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function initializeController(Picea $picea, Session $session, UserInterface $user, \Notes\Breadcrumb\Breadcrumb $breadcrumb, EventManager $eventManager) {
|
|
||||||
$this->picea = $picea;
|
|
||||||
$this->session = $session;
|
|
||||||
$this->eventManager = $eventManager;
|
|
||||||
$this->breadcrumb = $breadcrumb;
|
|
||||||
$this->user = $user;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,10 @@
|
|||||||
|
|
||||||
namespace %NAMESPACE%\Lib;
|
namespace %NAMESPACE%\Lib;
|
||||||
|
|
||||||
|
use Lean\Api\Factory\MessageFactoryInterface;
|
||||||
use Picea\Ui\Method\FormMessage;
|
use Picea\Ui\Method\FormMessage;
|
||||||
|
|
||||||
class Message implements FormMessage {
|
class Message implements FormMessage, MessageFactoryInterface {
|
||||||
|
|
||||||
const MESSAGE_TYPE = [
|
const MESSAGE_TYPE = [
|
||||||
'success' => [
|
'success' => [
|
||||||
@@ -34,7 +35,7 @@ class Message implements FormMessage {
|
|||||||
|
|
||||||
public ? string $header = null;
|
public ? string $header = null;
|
||||||
|
|
||||||
public function __construct(string $message, string $type = "error", ? string $header = null, ? string $class = null)
|
public function __construct(string $message = "", string $type = "error", ? string $header = null, ? string $class = null)
|
||||||
{
|
{
|
||||||
$this->message = $message;
|
$this->message = $message;
|
||||||
|
|
||||||
@@ -86,18 +87,33 @@ class Message implements FormMessage {
|
|||||||
return $this->type === "error";
|
return $this->type === "error";
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateSuccess(string $message, ? string $header = null, ? string $class = null) : self
|
public static function generateSuccess(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||||
{
|
{
|
||||||
return new static($message, 'success', $header, $class);
|
return new static($message, 'success', $header, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateError(string $message, ? string $header = null, ? string $class = null) : self
|
public static function generateError(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||||
{
|
{
|
||||||
return new static($message, 'error', $header, $class);
|
return new static($message, 'error', $header, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function generateWarning(string $message, ? string $header = null, ? string $class = null) : self
|
public static function generateWarning(string $message, ? string $header = null, ? string $class = null) : MessageFactoryInterface
|
||||||
{
|
{
|
||||||
return new static($message, 'warning', $header, $class);
|
return new static($message, 'warning', $header, $class);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function generateInformation(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||||
|
{
|
||||||
|
return new static($message, 'information', $header, $class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function generateDebug(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||||
|
{
|
||||||
|
return new static($message, 'debug', $header, $class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function generateTrace(string $message, ?string $header = null, ?string $class = null): MessageFactoryInterface
|
||||||
|
{
|
||||||
|
return new static($message, 'trace', $header, $class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
+27
-11
@@ -22,12 +22,16 @@ class Application
|
|||||||
|
|
||||||
public array $entities;
|
public array $entities;
|
||||||
|
|
||||||
|
public array $connectionAdapters;
|
||||||
|
|
||||||
public array $events;
|
public array $events;
|
||||||
|
|
||||||
public array $tellJson;
|
public array $tellJson;
|
||||||
|
|
||||||
public array $tellPhp;
|
public array $tellPhp;
|
||||||
|
|
||||||
|
public array $taxus;
|
||||||
|
|
||||||
public array $data = [];
|
public array $data = [];
|
||||||
|
|
||||||
public function __construct(string $name) {
|
public function __construct(string $name) {
|
||||||
@@ -38,7 +42,14 @@ class Application
|
|||||||
{
|
{
|
||||||
$this->data = array_replace($this->data, $data);
|
$this->data = array_replace($this->data, $data);
|
||||||
|
|
||||||
if (is_array($picea = $data['picea'] ?? false)) {
|
$this->loadData();
|
||||||
|
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function loadData() : static
|
||||||
|
{
|
||||||
|
if (is_array($picea = $this->data['picea'] ?? false)) {
|
||||||
if ($picea['context'] ?? false ) {
|
if ($picea['context'] ?? false ) {
|
||||||
$this->piceaContext = $picea['context'];
|
$this->piceaContext = $picea['context'];
|
||||||
}
|
}
|
||||||
@@ -56,13 +67,14 @@ class Application
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($ulmus = $data['ulmus'] ?? false)) {
|
if (is_array($ulmus = $this->data['ulmus'] ?? false)) {
|
||||||
if ($ulmus['entities'] ?? false) {
|
if ($ulmus['entities'] ?? false) {
|
||||||
$this->entities = $ulmus['entities'];
|
$this->entities = $ulmus['entities'];
|
||||||
|
$this->connectionAdapters = $ulmus['adapters'] ?? [];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($tell = $data['tell'] ?? false)) {
|
if (is_array($tell = $this->data['tell'] ?? false)) {
|
||||||
if ($tell['json'] ?? false) {
|
if ($tell['json'] ?? false) {
|
||||||
$this->tellJson = $tell['json'];
|
$this->tellJson = $tell['json'];
|
||||||
}
|
}
|
||||||
@@ -72,20 +84,24 @@ class Application
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($data['routes'] ?? false)) {
|
if (is_array($this->data['routes'] ?? false)) {
|
||||||
$this->routes = $data['routes'];
|
$this->routes = $this->data['routes'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($data['cronard'] ?? false)) {
|
if (is_array($this->data['cronard'] ?? false)) {
|
||||||
$this->cronard = $data['cronard'];
|
$this->cronard = $this->data['cronard'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($data['events'] ?? false)) {
|
if (is_array($this->data['events'] ?? false)) {
|
||||||
$this->events = $data['events'];
|
$this->events = $this->data['events'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_array($data['cli'] ?? false)) {
|
if (is_array($this->data['cli'] ?? false)) {
|
||||||
$this->cli = $data['cli'];
|
$this->cli = $this->data['cli'];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($this->data['taxus'] ?? false)) {
|
||||||
|
$this->taxus = $this->data['taxus'];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
|
|||||||
+18
-38
@@ -2,60 +2,40 @@
|
|||||||
|
|
||||||
namespace Lean;
|
namespace Lean;
|
||||||
|
|
||||||
|
use League\Route\Http\Exception\MethodNotAllowedException;
|
||||||
use League\Route\Strategy;
|
use League\Route\Strategy;
|
||||||
|
|
||||||
use League\Route\Http\Exception\NotFoundException;
|
use League\Route\Http\Exception\NotFoundException;
|
||||||
use Picea\Asset\Asset;
|
use Lean\ApplicationStrategy\MethodNotAllowedInterface;
|
||||||
|
use Lean\ApplicationStrategy\NotFoundDecoratorInterface;
|
||||||
|
use Lean\ApplicationStrategy\ThrowableHandlerInterface;
|
||||||
|
use Lean\Factory\HttpFactoryInterface;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
use Psr\Http\Server\MiddlewareInterface;
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
use Picea\Picea;
|
|
||||||
use Psr\Http\Server\RequestHandlerInterface;
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
use function DI\get;
|
use function DI\get;
|
||||||
|
|
||||||
class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
class ApplicationStrategy extends Strategy\ApplicationStrategy {
|
||||||
|
|
||||||
public const ASSET_TRIGGER_UPDATE = [
|
|
||||||
"js", "mjs", "manifest", "webmanifest", "css", "png", "ico",
|
|
||||||
"jpg", "jpeg", "gif", "webp", "woff", "woff2", "eot", "svg",
|
|
||||||
"ttf"
|
|
||||||
];
|
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
protected Picea $picea,
|
ContainerInterface $di,
|
||||||
protected ContainerInterface $di,
|
) {
|
||||||
) {}
|
$this->setContainer($di);
|
||||||
|
}
|
||||||
|
|
||||||
public function getNotFoundDecorator(NotFoundException $exception): MiddlewareInterface
|
public function getNotFoundDecorator(NotFoundException $exception): MiddlewareInterface
|
||||||
{
|
{
|
||||||
return new class($this->picea, $this->di) implements MiddlewareInterface {
|
return $this->getContainer()->get(NotFoundDecoratorInterface::class);
|
||||||
|
}
|
||||||
|
|
||||||
public function __construct(
|
public function getThrowableHandler(): MiddlewareInterface
|
||||||
protected Picea $picea,
|
{
|
||||||
protected ContainerInterface $di,
|
return $this->getContainer()->get(ThrowableHandlerInterface::class);
|
||||||
) { }
|
}
|
||||||
|
|
||||||
public function process(ServerRequestInterface $request, RequestHandlerInterface $handler): ResponseInterface
|
public function getMethodNotAllowedDecorator(MethodNotAllowedException $exception): MiddlewareInterface
|
||||||
{
|
{
|
||||||
return $this->throw404($request);
|
return $this->getContainer()->has(MethodNotAllowedInterface::class) ? $this->getContainer()->get(MethodNotAllowedInterface::class) : parent::getMethodNotAllowedDecorator($exception);
|
||||||
}
|
|
||||||
|
|
||||||
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 new \Laminas\Diactoros\Response\HtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\ApplicationStrategy;
|
||||||
|
|
||||||
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
|
|
||||||
|
interface MethodNotAllowedInterface extends MiddlewareInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,62 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\ApplicationStrategy;
|
||||||
|
|
||||||
|
use DI\Attribute\Inject;
|
||||||
|
use Lean\ApplicationStrategy;
|
||||||
|
use Lean\Factory\HttpFactoryInterface;
|
||||||
|
use Picea\Picea;
|
||||||
|
use Psr\Container\ContainerInterface;
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
|
|
||||||
|
class NotFoundDecorator implements NotFoundDecoratorInterface
|
||||||
|
{
|
||||||
|
#[Inject]
|
||||||
|
protected Picea $picea;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
protected ContainerInterface $container;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
protected HttpFactoryInterface $httpFactory;
|
||||||
|
|
||||||
|
public const ASSET_TRIGGER_UPDATE = [
|
||||||
|
"js", "mjs", "manifest", "webmanifest", "css", "png", "ico",
|
||||||
|
"jpg", "jpeg", "gif", "webp", "woff", "woff2", "eot", "svg",
|
||||||
|
"ttf"
|
||||||
|
];
|
||||||
|
|
||||||
|
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
|
||||||
|
{
|
||||||
|
return $this->checkAssetTrigger($request) ?: $this->httpFactory->createHtmlResponse($this->picea->renderHtml("lean/error/404", [], $this), 404);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function checkAssetTrigger(ServerRequestInterface $request) : false|ResponseInterface
|
||||||
|
{
|
||||||
|
if (getenv('DEBUG') && $this->container->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, static::ASSET_TRIGGER_UPDATE)) {
|
||||||
|
$this->container->get(\Picea\Asset\Asset::class)->launchInstall();
|
||||||
|
|
||||||
|
return $this->httpFactory->createTextResponse("Asset updated");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\ApplicationStrategy;
|
||||||
|
|
||||||
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
|
|
||||||
|
interface NotFoundDecoratorInterface extends MiddlewareInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\ApplicationStrategy;
|
||||||
|
|
||||||
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
|
use Psr\Http\Server\RequestHandlerInterface;
|
||||||
|
|
||||||
|
class ThrowableHandler implements ThrowableHandlerInterface
|
||||||
|
{
|
||||||
|
public function process(
|
||||||
|
ServerRequestInterface $request,
|
||||||
|
RequestHandlerInterface $handler
|
||||||
|
): ResponseInterface {
|
||||||
|
try {
|
||||||
|
return $handler->handle($request);
|
||||||
|
} catch (Throwable $e) {
|
||||||
|
throw $e;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\ApplicationStrategy;
|
||||||
|
|
||||||
|
use Psr\Http\Server\MiddlewareInterface;
|
||||||
|
|
||||||
|
interface ThrowableHandlerInterface extends MiddlewareInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
+8
-3
@@ -27,7 +27,8 @@ class Composer
|
|||||||
$source = static::createPath('vendor', 'mcnd', 'lean', 'skeleton');
|
$source = static::createPath('vendor', 'mcnd', 'lean', 'skeleton');
|
||||||
$dest = static::createPath('skeleton');
|
$dest = static::createPath('skeleton');
|
||||||
|
|
||||||
`cp -a $source $dest`;
|
shell_exec("cp -a $source $dest");
|
||||||
|
#`cp -a $source $dest`;
|
||||||
|
|
||||||
$iterator = new \RecursiveDirectoryIterator($dest);
|
$iterator = new \RecursiveDirectoryIterator($dest);
|
||||||
$iterator->setFlags(\RecursiveDirectoryIterator::SKIP_DOTS);
|
$iterator->setFlags(\RecursiveDirectoryIterator::SKIP_DOTS);
|
||||||
@@ -73,6 +74,10 @@ class Composer
|
|||||||
if ( file_exists($container = static::createPath('var/cache/di/CompiledContainer.php')) ) {
|
if ( file_exists($container = static::createPath('var/cache/di/CompiledContainer.php')) ) {
|
||||||
unlink($container);
|
unlink($container);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (function_exists("apcu_clear_cache")) {
|
||||||
|
apcu_clear_cache();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function readComposerLock() : false|array
|
public static function readComposerLock() : false|array
|
||||||
@@ -98,7 +103,7 @@ class Composer
|
|||||||
throw new \UnexpectedValueException("Composer file 'composer.json' could not be found within your project's root folder.");
|
throw new \UnexpectedValueException("Composer file 'composer.json' could not be found within your project's root folder.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true) : false;
|
return $content ??= file_exists($path) ? json_decode(file_get_contents($path), true, 512, \JSON_THROW_ON_ERROR) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
protected static function getNamespaceFromAutoload(Event $event) : ? string
|
||||||
@@ -121,7 +126,7 @@ class Composer
|
|||||||
|
|
||||||
$event->getIO()->writeError("Your composer file do not seem to contains a valid psr-4 project pointing to the src folder.");
|
$event->getIO()->writeError("Your composer file do not seem to contains a valid psr-4 project pointing to the src folder.");
|
||||||
|
|
||||||
return null;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function createPath(... $path) : string
|
protected static function createPath(... $path) : string
|
||||||
|
|||||||
+61
-25
@@ -2,30 +2,40 @@
|
|||||||
|
|
||||||
namespace Lean;
|
namespace Lean;
|
||||||
|
|
||||||
|
use DI\Attribute\Inject;
|
||||||
use Lean\Factory\HttpFactory;
|
use Lean\Factory\HttpFactory;
|
||||||
|
use Notes\Attribute\Ignore;
|
||||||
use Notes\Route\Attribute\Object\Route;
|
use Notes\Route\Attribute\Object\Route;
|
||||||
use Notes\Security\Attribute\Security;
|
use Notes\Security\Attribute\Security;
|
||||||
use Picea, Picea\Ui\Method\FormContext;
|
use Picea, Picea\Ui\Method\FormContext;
|
||||||
|
use Picea\Ui\Method\FormContextInterface;
|
||||||
use TheBugs\Email\MailerInterface;
|
use TheBugs\Email\MailerInterface;
|
||||||
use Storage\Session;
|
use Storage\{ Cookie, Session };
|
||||||
|
use League\CommonMark\CommonMarkConverter;
|
||||||
|
|
||||||
use Psr\Http\Message\{ ServerRequestInterface, ResponseInterface };
|
use Psr\Http\Message\{ ServerRequestInterface, ResponseInterface };
|
||||||
|
|
||||||
use function file_get_contents;
|
use function file_get_contents;
|
||||||
|
|
||||||
#[Security(locked: true)]
|
#[Security(locked: false, realm: "Protected Area")]
|
||||||
#[Route(method: [ "GET", "POST", "DELETE" ])]
|
#[Route(method: [ "GET", "POST" ])]
|
||||||
trait ControllerTrait {
|
trait ControllerTrait {
|
||||||
public ? \Notes\Breadcrumb\Breadcrumb $breadcrumb;
|
|
||||||
|
|
||||||
public ? Session $session;
|
#[Inject]
|
||||||
|
public Session $session;
|
||||||
|
|
||||||
public ? Picea\Picea $picea;
|
#[Inject]
|
||||||
|
public Cookie $cookie;
|
||||||
|
|
||||||
public ? MailerInterface $mailer;
|
#[Inject]
|
||||||
|
public Picea\Picea $picea;
|
||||||
|
|
||||||
|
#[Inject]
|
||||||
|
public MailerInterface $mailer;
|
||||||
|
|
||||||
public array $contextList = [];
|
public array $contextList = [];
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function exportJson(ServerRequestInterface $request, string $entityClass, bool $includeRelations = true, ? callable $callback = null) : ResponseInterface
|
public function exportJson(ServerRequestInterface $request, string $entityClass, bool $includeRelations = true, ? callable $callback = null) : ResponseInterface
|
||||||
{
|
{
|
||||||
foreach($entityClass::repository()->filterServerRequest( $entityClass::searchRequest()->fromRequest($request->withQueryParams($request->getQueryParams() + ['limit' => PHP_INT_MAX,])) )->loadAll() as $entity) {
|
foreach($entityClass::repository()->filterServerRequest( $entityClass::searchRequest()->fromRequest($request->withQueryParams($request->getQueryParams() + ['limit' => PHP_INT_MAX,])) )->loadAll() as $entity) {
|
||||||
@@ -35,6 +45,7 @@ trait ControllerTrait {
|
|||||||
return $this->renderJson( array_filter($data ?? [], function($row) { return $row !== null; }));
|
return $this->renderJson( array_filter($data ?? [], function($row) { return $row !== null; }));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function renderRawView(string $view, ?array $variables = null) : string
|
public function renderRawView(string $view, ?array $variables = null) : string
|
||||||
{
|
{
|
||||||
if ( null === $content = $this->picea->renderHtml($view, $variables ?? [], $this) ) {
|
if ( null === $content = $this->picea->renderHtml($view, $variables ?? [], $this) ) {
|
||||||
@@ -44,6 +55,7 @@ trait ControllerTrait {
|
|||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function renderView(string $view, ?array $variables = null) : ResponseInterface
|
public function renderView(string $view, ?array $variables = null) : ResponseInterface
|
||||||
{
|
{
|
||||||
return static::renderHtml(
|
return static::renderHtml(
|
||||||
@@ -51,6 +63,7 @@ trait ControllerTrait {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function renderError(string $errorCode, ?array $variables = null) : ResponseInterface
|
public function renderError(string $errorCode, ?array $variables = null) : ResponseInterface
|
||||||
{
|
{
|
||||||
return static::renderHtml(
|
return static::renderHtml(
|
||||||
@@ -58,75 +71,96 @@ trait ControllerTrait {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function renderDocumentation(string $filename) : ResponseInterface
|
public function renderDocumentation(string $filename) : ResponseInterface
|
||||||
{
|
{
|
||||||
return $this->renderMarkdown( file_get_contents(getenv("PROJECT_PATH") . "/meta/doc/$filename.md") );
|
return $this->renderMarkdown( file_get_contents(getenv("PROJECT_PATH") . "/meta/doc/$filename.md") );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
protected function redirect(string $url, int $code = 302, array $headers = []) {
|
protected function redirect(string $url, int $code = 302, array $headers = []) {
|
||||||
return HttpFactory::createRedirectResponse($url, $code, $headers);
|
return HttpFactory::createRedirectResponse($url, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
|
protected function refresh(int $code = 204, array $headers = []) {
|
||||||
|
return static::renderNothing($code, [
|
||||||
|
'Refresh' => 0
|
||||||
|
] + $headers);
|
||||||
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public static function renderNothing(int $code = 204, array $headers = []) : ResponseInterface
|
public static function renderNothing(int $code = 204, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createEmptyResponse($code, $headers);
|
return HttpFactory::createEmptyResponse($code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public static function renderText(string $text, int $code = 200, array $headers = []) : ResponseInterface
|
public static function renderText(string $text, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createTextResponse($text, $code, $headers);
|
return HttpFactory::createTextResponse($text, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public static function renderHtml(string $html, int $code = 200, array $headers = []) : ResponseInterface
|
public static function renderHtml(string $html, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createHtmlResponse($html, $code, $headers);
|
return HttpFactory::createHtmlResponse($html, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public static function renderJson(mixed $data, int $code = 200, array $headers = []) : ResponseInterface
|
public static function renderJson(mixed $data, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createJsonResponse($data, $code, $headers);
|
return HttpFactory::createJsonResponse($data, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function renderPdf($rawdata, int $status = 200, array $headers = []) : ResponseInterface
|
public function renderPdf($rawdata, int $status = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createPdfResponse($rawdata, $status, $headers);
|
return HttpFactory::createPdfResponse($rawdata, $status, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public static function renderDownloadable(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface
|
public static function renderDownloadable(string $data, string $filename, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createDownloadableResponse($data, $filename, $code, $headers);
|
return HttpFactory::createDownloadableResponse($data, $filename, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public static function renderImage(string $data, int $code = 200, array $headers = []) : ResponseInterface
|
public static function renderImage(string $data, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createImageResponse($data, $code, $headers);
|
return HttpFactory::createImageResponse($data, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public static function renderAsset(string $path, int $code = 200, array $headers = []) : ResponseInterface
|
public static function renderAsset(string $path, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return HttpFactory::createFileDownloadResponse($path, $code, $headers);
|
return HttpFactory::createFileDownloadResponse($path, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function renderMarkdown(string $filepath, int $code = 200, array $headers = []) : ResponseInterface
|
public function renderMarkdown(string $filepath, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
if ( ! class_exists(CommonMarkConverter::class)) {
|
if ( ! class_exists(CommonMarkConverter::class)) {
|
||||||
throw new \BadFunctionCallException("League\CommonMark seems to be missing, please install dependency before trying to render Markdown content");
|
throw new \BadFunctionCallException("League\CommonMark seems to be missing, please install dependency before trying to render Markdown content");
|
||||||
}
|
}
|
||||||
|
|
||||||
$markdown = ( new CommonMarkConverter() )->convertToHtml(file_get_contents($filepath));
|
$markdown = ( new CommonMarkConverter() )->convert(file_get_contents($filepath));
|
||||||
|
|
||||||
return $this->renderView("docs", get_defined_vars());
|
return $this->renderView("lean/layout/docs", get_defined_vars());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function renderCLI(ServerRequestInterface $request, mixed $data) : ResponseInterface
|
public function renderCLI(ServerRequestInterface $request, mixed $data) : ResponseInterface
|
||||||
{
|
{
|
||||||
if ($data instanceof \JsonSerializable ) {
|
if (! $data instanceof \Stringable) {
|
||||||
return $this->renderJson(
|
if ($data instanceof \JsonSerializable) {
|
||||||
$data
|
return $this->renderJson(
|
||||||
);
|
$data
|
||||||
}
|
);
|
||||||
elseif ( is_array($data) ) {
|
}
|
||||||
var_export($data);
|
elseif (is_iterable($data) || is_object($data)) {
|
||||||
|
return $this->renderText(var_export($data, true));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->renderText(
|
return $this->renderText(
|
||||||
@@ -134,6 +168,7 @@ trait ControllerTrait {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function fromResponse(ResponseInterface $response)
|
public function fromResponse(ResponseInterface $response)
|
||||||
{
|
{
|
||||||
if ( $response->getStatusCode() === 200 ) {
|
if ( $response->getStatusCode() === 200 ) {
|
||||||
@@ -145,6 +180,7 @@ trait ControllerTrait {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function asset(string $url, array $parameters = []) : string
|
public function asset(string $url, array $parameters = []) : string
|
||||||
{
|
{
|
||||||
if (! $this->picea ) {
|
if (! $this->picea ) {
|
||||||
@@ -154,6 +190,7 @@ trait ControllerTrait {
|
|||||||
return $this->picea->compiler->getExtensionFromToken('asset')->buildAssetUrl($url, $parameters);
|
return $this->picea->compiler->getExtensionFromToken('asset')->buildAssetUrl($url, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function url(string $url, array $parameters = []) : string
|
public function url(string $url, array $parameters = []) : string
|
||||||
{
|
{
|
||||||
if (! $this->picea ) {
|
if (! $this->picea ) {
|
||||||
@@ -163,6 +200,7 @@ trait ControllerTrait {
|
|||||||
return $this->picea->compiler->getExtensionFromToken('url')->buildUrl($url, $parameters);
|
return $this->picea->compiler->getExtensionFromToken('url')->buildUrl($url, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function route(string $name, array $parameters = []) : string
|
public function route(string $name, array $parameters = []) : string
|
||||||
{
|
{
|
||||||
if (! $this->picea ) {
|
if (! $this->picea ) {
|
||||||
@@ -172,31 +210,29 @@ trait ControllerTrait {
|
|||||||
return $this->picea->compiler->getExtensionFromToken('route')->buildRouteUrl($name, $parameters);
|
return $this->picea->compiler->getExtensionFromToken('route')->buildRouteUrl($name, $parameters);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function json($data, int $flags = 0) : string
|
public function json($data, int $flags = 0) : string
|
||||||
{
|
{
|
||||||
return htmlentities(json_encode($data, $flags), ENT_QUOTES, 'UTF-8');
|
return htmlentities(json_encode($data, $flags), ENT_QUOTES, 'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function pushContext(FormContext $context) : FormContext
|
#[Ignore]
|
||||||
|
public function pushContext(FormContextInterface $context) : FormContextInterface
|
||||||
{
|
{
|
||||||
$this->contextList[$context->formName ?? uniqid("context_")] = $context;
|
$this->contextList[$context->formName ?? uniqid("context_")] = $context;
|
||||||
|
|
||||||
return $context;
|
return $context;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function context(? string $name = null) : ? FormContext
|
#[Ignore]
|
||||||
|
public function context(? string $name = null) : ? FormContextInterface
|
||||||
{
|
{
|
||||||
return $name ? $this->contextList[$name] : array_values($this->contextList)[0] ?? null;
|
return $name ? $this->contextList[$name] : array_values($this->contextList)[0] ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[Ignore]
|
||||||
public function isRoute(mixed $name, ServerRequestInterface $request) : bool
|
public function isRoute(mixed $name, ServerRequestInterface $request) : bool
|
||||||
{
|
{
|
||||||
foreach((array) $name as $item) {
|
return $request->getAttribute('lean.route')->match($name);
|
||||||
if ( fnmatch($item, $request->getAttribute('lean.route')->name) ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6,6 +6,7 @@ use Lean\Routing;
|
|||||||
use Notes\Route\Attribute\Method\Route;
|
use Notes\Route\Attribute\Method\Route;
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
use Psr\Http\Message\{ ResponseInterface, ServerRequestInterface };
|
||||||
|
use Ulmus\User\Entity\UserInterface;
|
||||||
|
|
||||||
interface RoutingMapRoutes {
|
interface RoutingMapRoutes {
|
||||||
public function execute(Routing $routing, ContainerInterface $container, ServerRequestInterface & $request, Route $attribute) : void;
|
public function execute(Routing $routing, ContainerInterface $container, ServerRequestInterface & $request, Route $attribute) : void;
|
||||||
|
|||||||
@@ -4,10 +4,18 @@ namespace Lean\Factory;
|
|||||||
|
|
||||||
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, RedirectResponse, TextResponse};
|
use Laminas\Diactoros\Response\{EmptyResponse, HtmlResponse, JsonResponse, RedirectResponse, TextResponse};
|
||||||
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
|
use Lean\Response\{ DownloadResponse, ImageResponse, FileDownloadResponse, PdfResponse };
|
||||||
|
use Laminas\Diactoros\Response;
|
||||||
|
use Laminas\Diactoros\StreamFactory;
|
||||||
use Psr\Http\Message\ResponseInterface;
|
use Psr\Http\Message\ResponseInterface;
|
||||||
|
use Psr\Http\Message\StreamInterface;
|
||||||
|
|
||||||
class HttpFactory
|
class HttpFactory implements HttpFactoryInterface
|
||||||
{
|
{
|
||||||
|
public static function createResponse(mixed $body = 'php://memory', int $code = 200, array $headers = []) : ResponseInterface
|
||||||
|
{
|
||||||
|
return new Response($body, $code, $headers);
|
||||||
|
}
|
||||||
|
|
||||||
public static function createRedirectResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface
|
public static function createRedirectResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return new RedirectResponse($url, $code, $headers);
|
return new RedirectResponse($url, $code, $headers);
|
||||||
@@ -33,7 +41,7 @@ class HttpFactory
|
|||||||
return new EmptyResponse($code, $headers);
|
return new EmptyResponse($code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function createPdfResponse(\Stringable $binary, int $code = 200, array $headers = []) : ResponseInterface
|
public static function createPdfResponse(\Stringable|string $binary, int $code = 200, array $headers = []) : ResponseInterface
|
||||||
{
|
{
|
||||||
return new PdfResponse((string) $binary, $code, $headers);
|
return new PdfResponse((string) $binary, $code, $headers);
|
||||||
}
|
}
|
||||||
@@ -52,4 +60,9 @@ class HttpFactory
|
|||||||
{
|
{
|
||||||
return new FileDownloadResponse($path, $code, $headers);
|
return new FileDownloadResponse($path, $code, $headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function createStream(string $content): StreamInterface
|
||||||
|
{
|
||||||
|
return new StreamFactory()->createStream($content);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
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;
|
||||||
|
|
||||||
|
interface HttpFactoryInterface
|
||||||
|
{
|
||||||
|
public static function createResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface;
|
||||||
|
public static function createRedirectResponse(string $url, int $code = 302, array $headers = []) : ResponseInterface;
|
||||||
|
public static function createHtmlResponse(string $html, int $code = 200, array $headers = []) : ResponseInterface;
|
||||||
|
public static function createTextResponse(string $text, int $code = 200, array $headers = []) : ResponseInterface;
|
||||||
|
public static function createJsonResponse(mixed $data, int $code = 200, array $headers = []) : ResponseInterface;
|
||||||
|
public static function createEmptyResponse(int $code = 204, array $headers = []) : ResponseInterface;
|
||||||
|
public static function createPdfResponse(\Stringable|string $binary, int $code = 200, array $headers = []) : ResponseInterface;
|
||||||
|
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;
|
||||||
|
}
|
||||||
+37
-5
@@ -14,20 +14,20 @@ class File
|
|||||||
$beginning = false;
|
$beginning = false;
|
||||||
$text = array();
|
$text = array();
|
||||||
|
|
||||||
while ($counter && ! $beginning) {
|
while ($counter && !$beginning) {
|
||||||
$t = "";
|
$t = "";
|
||||||
|
|
||||||
while ($t !== PHP_EOL) {
|
while ($t !== PHP_EOL) {
|
||||||
if(fseek($handle, $pos, SEEK_END) == -1) {
|
if (fseek($handle, $pos, SEEK_END) == -1) {
|
||||||
$beginning = true;
|
$beginning = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
$t = fgetc($handle);
|
$t = fgetc($handle);
|
||||||
$pos --;
|
$pos--;
|
||||||
}
|
}
|
||||||
|
|
||||||
$counter --;
|
$counter--;
|
||||||
|
|
||||||
if ($beginning) {
|
if ($beginning) {
|
||||||
rewind($handle);
|
rewind($handle);
|
||||||
@@ -36,8 +36,40 @@ class File
|
|||||||
$text[$lines - $counter - 1] = fgets($handle);
|
$text[$lines - $counter - 1] = fgets($handle);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose ($handle);
|
fclose($handle);
|
||||||
|
|
||||||
return array_reverse($text);
|
return array_reverse($text);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function sanitizeFilePath($path) : string
|
||||||
|
{
|
||||||
|
// Remove null bytes
|
||||||
|
$path = str_replace("\0", "", $path);
|
||||||
|
|
||||||
|
$path = str_replace([ "\\", "/" ], DIRECTORY_SEPARATOR, $path);
|
||||||
|
|
||||||
|
$path = preg_replace('#' . DIRECTORY_SEPARATOR . '+#', DIRECTORY_SEPARATOR, $path);
|
||||||
|
|
||||||
|
// Remove . and .. directory traversal attempts
|
||||||
|
$path = preg_replace('#\.{1,2}/#', '', $path);
|
||||||
|
|
||||||
|
$path = trim($path, '/\\');
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function assertFileExists(string $filepath) : void
|
||||||
|
{
|
||||||
|
if (! is_file($filepath)) {
|
||||||
|
throw new \InvalidArgumentException("File does not exist: {$filepath}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function assertFolderExists(string $path) : void
|
||||||
|
{
|
||||||
|
if (! is_dir($path)) {
|
||||||
|
throw new \InvalidArgumentException("Folder does not exist: {$path}");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
+63
-42
@@ -11,36 +11,33 @@ use League\Route\Strategy\ApplicationStrategy;
|
|||||||
|
|
||||||
use Psr\Http\Message\ServerRequestInterface;
|
use Psr\Http\Message\ServerRequestInterface;
|
||||||
|
|
||||||
use Tell\I18n;
|
|
||||||
use Ulmus\Container\AdapterProxy;
|
|
||||||
|
|
||||||
use Laminas\Diactoros\ServerRequestFactory,
|
use Laminas\Diactoros\ServerRequestFactory,
|
||||||
Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
|
Laminas\HttpHandlerRunner\Emitter\EmitterInterface;
|
||||||
|
|
||||||
use Ulmus\Ulmus;
|
use Ulmus\Ulmus;
|
||||||
|
|
||||||
class Kernel {
|
class Kernel
|
||||||
|
{
|
||||||
protected Container $container;
|
protected Container $container;
|
||||||
|
|
||||||
protected string $locale;
|
protected string $locale;
|
||||||
|
|
||||||
public array $paths = [];
|
public array $paths = [];
|
||||||
|
|
||||||
public int $errorReporting = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE;
|
public int $errorReportingDev = -1;
|
||||||
|
|
||||||
public string $definitionFilePath;
|
public int $errorReportingProd = E_ALL & ~E_USER_DEPRECATED & ~E_DEPRECATED /*& ~E_NOTICE*/;
|
||||||
|
|
||||||
|
public array $definitionFilePaths;
|
||||||
|
|
||||||
public string $errorLogPath;
|
public string $errorLogPath;
|
||||||
|
|
||||||
public string $projectPath;
|
public function __construct(
|
||||||
|
public string $projectPath
|
||||||
public string $routeDefinitionList = 'routes.list';
|
)
|
||||||
|
|
||||||
public function __construct(string $projectPath)
|
|
||||||
{
|
{
|
||||||
$this->projectPath = $projectPath;
|
# Still not sure about adding a folder check each call just to add a basic project setup error ...
|
||||||
|
# File::assertFolderExists($this->projectPath);
|
||||||
$this->setEnvironment();
|
$this->setEnvironment();
|
||||||
$this->initializeEngine();
|
$this->initializeEngine();
|
||||||
$this->setupContainer();
|
$this->setupContainer();
|
||||||
@@ -48,21 +45,27 @@ class Kernel {
|
|||||||
$this->handleRequest();
|
$this->handleRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function putenv($var, $value)
|
public static function putenv($var, $value) : void
|
||||||
{
|
{
|
||||||
putenv("$var=$value");
|
putenv("$var=$value");
|
||||||
$_ENV[$var] = $value;
|
$_ENV[$var] = $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function setEnvironment() {
|
protected function setEnvironment() : void
|
||||||
|
{
|
||||||
static::putenv('PROJECT_PATH', $this->projectPath);
|
static::putenv('PROJECT_PATH', $this->projectPath);
|
||||||
|
|
||||||
// Environment vars (accessible from \DI\env(), getenv(), $_ENV and $_SERVER)
|
// Environment vars (accessible from \DI\env(), getenv(), $_ENV and $_SERVER)
|
||||||
Dotenv::create(getenv("PROJECT_PATH"))->load();
|
Dotenv::create(getenv("PROJECT_PATH"))->load();
|
||||||
|
|
||||||
// Override using headers
|
// Override using headers
|
||||||
if ( ( $keys = getenv('KEYS') ) && ( $auth = $_SERVER["HTTP_X_DEV_AUTH"] ?? null ) && in_array($auth, explode(',', $keys)) ) {
|
if (($keys = getenv('KEYS')) && ($auth = $_SERVER["HTTP_X_DEV_AUTH"] ?? null) && in_array($auth, explode(',', $keys))) {
|
||||||
foreach (['APP_ENV', 'DEBUG',] as $env) {
|
unset($_SERVER["HTTP_X_DEV_AUTH"]);
|
||||||
|
|
||||||
|
unset($_ENV['KEYS'], $_SERVER['KEYS']);
|
||||||
|
putenv("KEYS=");
|
||||||
|
|
||||||
|
foreach(['APP_ENV', 'DEBUG',] as $env) {
|
||||||
if (null !== $value = $_SERVER["HTTP_X_$env"] ?? null) {
|
if (null !== $value = $_SERVER["HTTP_X_$env"] ?? null) {
|
||||||
static::putenv($env, $value);
|
static::putenv($env, $value);
|
||||||
}
|
}
|
||||||
@@ -71,11 +74,13 @@ class Kernel {
|
|||||||
|
|
||||||
// Paths and directories
|
// Paths and directories
|
||||||
foreach($this->paths as $name => $envkey) {
|
foreach($this->paths as $name => $envkey) {
|
||||||
if ( ! getenv($name) ) {
|
if (!getenv($name)) {
|
||||||
$path = getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . getenv($envkey);
|
$path = getenv("PROJECT_PATH") . DIRECTORY_SEPARATOR . getenv($envkey);
|
||||||
|
|
||||||
if (getenv('DEBUG') && ! file_exists($path)) {
|
if (getenv('DEBUG') && ! file_exists($path)) {
|
||||||
mkdir($path, 0755, true);
|
if (false === mkdir($path, 0755, true)) {
|
||||||
|
throw new \Exception(sprintf("Folder '%s' could not be created", $path));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static::putenv($name, realpath($path));
|
static::putenv($name, realpath($path));
|
||||||
@@ -91,15 +96,20 @@ class Kernel {
|
|||||||
setlocale(LC_ALL, $this->locale = getenv("DEFAULT_LOCAL"));
|
setlocale(LC_ALL, $this->locale = getenv("DEFAULT_LOCAL"));
|
||||||
setlocale(LC_TIME, getenv("DEFAULT_TIME"), getenv("DEFAULT_TIME_FALLBACK"));
|
setlocale(LC_TIME, getenv("DEFAULT_TIME"), getenv("DEFAULT_TIME_FALLBACK"));
|
||||||
|
|
||||||
if ( class_exists('Locale') ) {
|
if (class_exists('Locale')) {
|
||||||
\Locale::setDefault($this->locale);
|
\Locale::setDefault($this->locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
ini_set("log_errors", "1");
|
ini_set("error_log", $this->errorLogPath ?? getenv("LOGS_PATH") . DIRECTORY_SEPARATOR. date("Y-m").".log");
|
||||||
ini_set("error_log", $this->errorLogPath);
|
ini_set("log_errors", true);
|
||||||
ini_set('display_errors', getenv("DEBUG") ? 'on' : 'on');
|
ini_set('display_errors', getenv("DEBUG") ? 'on' : 'off');
|
||||||
|
|
||||||
error_reporting($this->errorReporting);
|
if (getenv("DEBUG")) {
|
||||||
|
error_reporting(getenv('ERROR_REPORTING_DEV') ?: $this->errorReportingDev);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
error_reporting(getenv('ERROR_REPORTING_PROD') ?: $this->errorReportingProd);
|
||||||
|
}
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
@@ -108,9 +118,12 @@ class Kernel {
|
|||||||
{
|
{
|
||||||
$containerBuilder = new ContainerBuilder();
|
$containerBuilder = new ContainerBuilder();
|
||||||
|
|
||||||
|
$containerBuilder->useAttributes(true);
|
||||||
|
|
||||||
if (getenv("APP_ENV") === "prod") {
|
if (getenv("APP_ENV") === "prod") {
|
||||||
if (getenv("CACHE_PATH")) {
|
if (getenv("CACHE_PATH")) {
|
||||||
# check if ACPU is there first, $containerBuilder->enableDefinitionCache();
|
# check if ACPU is there first,
|
||||||
|
# $containerBuilder->enableDefinitionCache(); # Do not work .. ?
|
||||||
|
|
||||||
$containerBuilder->enableCompilation(getenv("CACHE_PATH") . "/di/");
|
$containerBuilder->enableCompilation(getenv("CACHE_PATH") . "/di/");
|
||||||
# No proxies yet... $containerBuilder->writeProxiesToFile(true, getenv("CACHE_PATH") . "/di/");
|
# No proxies yet... $containerBuilder->writeProxiesToFile(true, getenv("CACHE_PATH") . "/di/");
|
||||||
@@ -119,17 +132,27 @@ class Kernel {
|
|||||||
else {
|
else {
|
||||||
$compiled = getenv("CACHE_PATH") . "/di/CompiledContainer.php";
|
$compiled = getenv("CACHE_PATH") . "/di/CompiledContainer.php";
|
||||||
|
|
||||||
if ( file_exists($compiled) ) {
|
if (file_exists($compiled)) {
|
||||||
unlink($compiled);
|
unlink($compiled);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
# $containerBuilder->useAnnotations(false);
|
foreach(Lean::getDefinitionsPathsFromComposer() as $path) {
|
||||||
|
$containerBuilder->addDefinitions($path);
|
||||||
if ($this->definitionFilePath ?? false) {
|
|
||||||
$containerBuilder->addDefinitions(require($this->definitionFilePath));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach($this->definitionFilePaths ?? [] as $path) {
|
||||||
|
$containerBuilder->addDefinitions($path);
|
||||||
|
}
|
||||||
|
|
||||||
|
$containerBuilder->addDefinitions([
|
||||||
|
'config' => function () {
|
||||||
|
return array_merge_recursive(
|
||||||
|
Lean::autoloadConfigFromComposerExtra(), []
|
||||||
|
);
|
||||||
|
}
|
||||||
|
]);
|
||||||
|
|
||||||
$this->container = $containerBuilder->build();
|
$this->container = $containerBuilder->build();
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
@@ -137,16 +160,15 @@ class Kernel {
|
|||||||
|
|
||||||
protected function serviceContainer() : self
|
protected function serviceContainer() : self
|
||||||
{
|
{
|
||||||
$this->container->has(AdapterProxy::class) and $this->container->get(AdapterProxy::class);
|
if ($this->container->has('lean.autoload')) {
|
||||||
$this->container->has('ulmus.caching') and ( Ulmus::$cache = $this->container->get('ulmus.caching') );
|
foreach($this->container->get('lean.autoload') as $class) {
|
||||||
$this->container->has(Lean::class) and $this->container->get(Lean::class);
|
$this->container->get($class);
|
||||||
|
}
|
||||||
if ($this->container->has(I18n::class)) {
|
|
||||||
$i18n = $this->container->get(I18n::class);
|
|
||||||
$i18n->locale($this->locale);
|
|
||||||
$i18n->initialize(!getenv("DEBUG"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Must be removed from KERNEL !
|
||||||
|
$this->container->has('ulmus.caching') and (Ulmus::$cache = $this->container->get('ulmus.caching'));
|
||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -154,8 +176,7 @@ class Kernel {
|
|||||||
{
|
{
|
||||||
ServerRequestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
|
ServerRequestFactory::fromGlobals($_SERVER, $_GET, $_POST, $_COOKIE, $_FILES);
|
||||||
|
|
||||||
// Router
|
$routeFactory = $this->container->get(Routing\RouteDefinitionInterface::class);
|
||||||
$routeFactory = $this->container->get($this->routeDefinitionList);
|
|
||||||
|
|
||||||
$router = $routeFactory($this->container);
|
$router = $routeFactory($this->container);
|
||||||
|
|
||||||
@@ -169,4 +190,4 @@ class Kernel {
|
|||||||
|
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
+73
-43
@@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
namespace Lean;
|
namespace Lean;
|
||||||
|
|
||||||
use Psr\Container\ContainerInterface;
|
use Psr\Container\ContainerInterface;
|
||||||
@@ -22,13 +21,16 @@ class Lean
|
|||||||
|
|
||||||
protected function loadApplications() : void
|
protected function loadApplications() : void
|
||||||
{
|
{
|
||||||
$list = $this->container->get('config')['lean']['autoload'] ?? [];
|
$list = array_filter($this->container->get('config')['lean']['autoload'] ?? []);
|
||||||
|
|
||||||
if (! $list ) {
|
if (! $list ) {
|
||||||
throw new \Exception("You must provide at least one application to autoload within your config file ( 'lean' => 'autoload' => [] )");
|
throw new \Exception("You must provide at least one application to autoload within your config file ( 'lean' => 'autoload' => [] )");
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach(array_filter($list) as $application) {
|
# Allows 'lean.default' and [ 'lean.default', 100 ] which allows ordering of apps loading.
|
||||||
|
usort($list, fn($e1, $e2) => ( is_array($e1) ? $e1[1] : 0 ) <=> ( is_array($e2) ? $e2[1] : 0 ));
|
||||||
|
|
||||||
|
foreach(array_map(fn($item) => is_array($item) ? $item[0] : $item, $list) as $application) {
|
||||||
if ( $this->container->has($application) ) {
|
if ( $this->container->has($application) ) {
|
||||||
$this->applications[] = ( new Application($application) )->fromArray($this->container->get($application));
|
$this->applications[] = ( new Application($application) )->fromArray($this->container->get($application));
|
||||||
}
|
}
|
||||||
@@ -75,37 +77,42 @@ class Lean
|
|||||||
|
|
||||||
public function getRoutable() : array
|
public function getRoutable() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->routes ?? [], $this->applications));
|
return array_merge(...array_map(fn(Application $app) => $app->routes ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCronard() : array
|
public function getCronard() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->cronard ?? [], $this->applications));
|
return array_merge(...array_map(fn(Application $app) => $app->cronard ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getCLI() : array
|
public function getCLI() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->cli ?? [], $this->applications));
|
return array_merge(...array_map(fn(Application $app) => $app->cli ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEvents() : array
|
public function getEvents() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->events ?? [], $this->applications));
|
return array_merge(...array_map(fn(Application $app) => $app->events ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getTaxusPrivileges() : array
|
public function getTaxusPrivileges() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->taxus ?? [], $this->applications));
|
return array_merge(...array_map(fn(Application $app) => $app->taxus ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getEntities() : array
|
public function getEntities() : array
|
||||||
{
|
{
|
||||||
return array_merge(...array_map(fn($app) => $app->entities ?? [], $this->applications));
|
return array_merge(...array_map(fn(Application $app) => $app->entities ?? [], $this->applications));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getConnectionAdapters() : array
|
||||||
|
{
|
||||||
|
return array_merge(...array_map(fn(Application $app) => $app->connectionAdapters ?? [], $this->applications));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getViewPaths() : array
|
public function getViewPaths() : array
|
||||||
{
|
{
|
||||||
$list = array_merge(...array_map(fn($app) => $app->views ?? [], $this->applications));
|
$list = array_merge(...array_map(fn(Application $app) => $app->views ?? [], $this->applications));
|
||||||
|
|
||||||
$this->verifyPathList($list);
|
$this->verifyPathList($list);
|
||||||
|
|
||||||
@@ -116,7 +123,7 @@ class Lean
|
|||||||
|
|
||||||
public function getAssetPaths() : array
|
public function getAssetPaths() : array
|
||||||
{
|
{
|
||||||
$list = array_merge(...array_map(fn($app) => $app->piceaAssets ?? [], $this->applications));
|
$list = array_merge(...array_map(fn(Application $app) => $app->piceaAssets ?? [], $this->applications));
|
||||||
|
|
||||||
$this->verifyPathList($list);
|
$this->verifyPathList($list);
|
||||||
|
|
||||||
@@ -138,12 +145,12 @@ class Lean
|
|||||||
{
|
{
|
||||||
switch($reader) {
|
switch($reader) {
|
||||||
case "php":
|
case "php":
|
||||||
$list = array_merge(...array_map(fn($app) => $app->tellPhp ?? [], $this->applications));
|
$list = array_merge(...array_map(fn(Application $app) => $app->tellPhp ?? [], $this->applications));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "json":
|
case "json":
|
||||||
$list = array_merge(...array_map(fn($app) => $app->tellJson ?? [], $this->applications));
|
$list = array_merge(...array_map(fn(Application $app) => $app->tellJson ?? [], $this->applications));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $list ?? false ) {
|
if ( $list ?? false ) {
|
||||||
@@ -155,39 +162,34 @@ class Lean
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[\Deprecated("Definitions are now loaded automatically from composer extra array.")]
|
||||||
public static function definitions() : array
|
public static function definitions() : array
|
||||||
{
|
{
|
||||||
return [];
|
return [];
|
||||||
|
|
||||||
$path = dirname(__DIR__) . "/meta/definitions/";
|
|
||||||
|
|
||||||
return array_replace(
|
|
||||||
require($path . "authorize.php"),
|
|
||||||
class_exists(\Mcnd\CLI\CliMiddleware::class) ? require($path . "cli.php") : [],
|
|
||||||
class_exists(\Cronard\CronardMiddleware::class) ? require($path . "cronard.php") : [],
|
|
||||||
require($path . "email.php"),
|
|
||||||
require($path . "event.php"),
|
|
||||||
require($path . "http.php"),
|
|
||||||
require($path . "language.php"),
|
|
||||||
class_exists(\Negundo\Client\NegundoMiddleware::class) ? require($path . "negundo.php") : [],
|
|
||||||
require($path . "routes.php"),
|
|
||||||
require($path . "software.php"),
|
|
||||||
require($path . "storage.php"),
|
|
||||||
class_exists(\Picea\Picea::class) ? require($path . "template.php") : [],
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function autoloadDefinitionsFromComposerExtra() : array
|
public static function getDefinitionsPathsFromComposer() : array
|
||||||
{
|
{
|
||||||
$list = [];
|
$list = [];
|
||||||
|
|
||||||
foreach(Composer::readComposerLock()['packages'] as $package) {
|
foreach(Composer::readComposerLock()['packages'] as $package) {
|
||||||
|
$order = $package['extra']['lean']['autoload']['order'] ?? 0;
|
||||||
|
|
||||||
foreach($package['extra']['lean']['autoload']['definitions'] ?? [] as $autoload) {
|
foreach($package['extra']['lean']['autoload']['definitions'] ?? [] as $autoload) {
|
||||||
$list = array_replace($list, static::loadFromPackage($package, $autoload));
|
$list[] = [ static::pathFromPackage($package, $autoload), $order ];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $list;
|
foreach(Composer::readComposerJson()['extra']['lean']['autoload']['definitions'] ?? [] as $autoload) {
|
||||||
|
$order = $package['extra']['lean']['autoload']['order'] ?? 1000;
|
||||||
|
|
||||||
|
$list[] = [ getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . $autoload, $order ];
|
||||||
|
}
|
||||||
|
|
||||||
|
# Allows 'lean.default' and [ 'lean.default', 100 ] which allows ordering of apps loading.
|
||||||
|
usort($list, fn($e1, $e2) => $e1[1] <=> $e2[1]);
|
||||||
|
|
||||||
|
return array_column($list, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function autoloadConfigFromComposerExtra() : array
|
public static function autoloadConfigFromComposerExtra() : array
|
||||||
@@ -200,16 +202,36 @@ class Lean
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach(Composer::readComposerJson()['extra']['lean']['autoload']['config'] ?? [] as $autoload) {
|
||||||
|
$list = array_merge_recursive($list, static::loadFromPackage(null, $autoload));
|
||||||
|
}
|
||||||
|
|
||||||
return $list;
|
return $list;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static function loadFromPackage(array $package, array|string $autoload) : false|array
|
protected static function pathFromPackage(?array $package, array|string $autoload) : string
|
||||||
|
{
|
||||||
|
if ($package === null) {
|
||||||
|
$filepath = getenv('PROJECT_PATH') . DIRECTORY_SEPARATOR . $autoload;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$vendor = getenv('VENDOR_DIR') ? getenv('VENDOR_PATH') : dirname(__DIR__, 3);
|
||||||
|
$filepath = $vendor . DIRECTORY_SEPARATOR . $package['name'] . DIRECTORY_SEPARATOR . $autoload;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (! file_exists($filepath)) {
|
||||||
|
throw new \InvalidArgumentException("Given definition filepath do not exists '$filepath'");
|
||||||
|
}
|
||||||
|
|
||||||
|
return $filepath;
|
||||||
|
}
|
||||||
|
|
||||||
|
protected static function loadFromPackage(? array $package, array|string $autoload) : false|array
|
||||||
{
|
{
|
||||||
$list = [];
|
$list = [];
|
||||||
|
|
||||||
if (is_string($autoload)) {
|
if (is_string($autoload)) {
|
||||||
$vendor = getenv('VENDOR_DIR') ? getenv('VENDOR_PATH') : dirname(__DIR__, 3);
|
$file = static::pathFromPackage($package, $autoload);
|
||||||
$file = $vendor . DIRECTORY_SEPARATOR . $package['name'] . DIRECTORY_SEPARATOR . $autoload;
|
|
||||||
|
|
||||||
if ( ! file_exists($file) ) {
|
if ( ! file_exists($file) ) {
|
||||||
throw new \InvalidArgumentException(sprintf("Given autoload file `%s` from package `%s` was not found or is unreachable", $autoload, $package['name']));
|
throw new \InvalidArgumentException(sprintf("Given autoload file `%s` from package `%s` was not found or is unreachable", $autoload, $package['name']));
|
||||||
@@ -217,12 +239,20 @@ class Lean
|
|||||||
|
|
||||||
return require($file);
|
return require($file);
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
$func = implode('::', array_merge([ key($autoload) ], $autoload));
|
|
||||||
|
|
||||||
return call_user_func($func);
|
$func = implode('::', array_merge([ key($autoload) ], $autoload));
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
return call_user_func($func);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function path(...$parts) : string
|
||||||
|
{
|
||||||
|
return implode(DIRECTORY_SEPARATOR, $parts);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static function rawPath(...$parts) : string
|
||||||
|
{
|
||||||
|
return implode(DIRECTORY_SEPARATOR, $parts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -43,7 +43,6 @@ class FileDownloadResponse extends Response
|
|||||||
else {
|
else {
|
||||||
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
$finfo = finfo_open(FILEINFO_MIME_TYPE);
|
||||||
$mime = finfo_file($finfo, $filepath);
|
$mime = finfo_file($finfo, $filepath);
|
||||||
finfo_close($finfo);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
parent::__construct(
|
parent::__construct(
|
||||||
|
|||||||
+49
-35
@@ -2,67 +2,45 @@
|
|||||||
|
|
||||||
namespace Lean;
|
namespace Lean;
|
||||||
|
|
||||||
use Notes\Annotation;
|
|
||||||
use Taxus\Taxus;
|
|
||||||
|
|
||||||
use League\Route\RouteGroup,
|
use League\Route\RouteGroup,
|
||||||
League\Route\Router;
|
League\Route\Router;
|
||||||
|
|
||||||
|
use Notes\Route\Attribute\Method\Route;
|
||||||
use Psr\Http\Message\ServerRequestInterface,
|
use Psr\Http\Message\ServerRequestInterface,
|
||||||
Psr\Http\Message\ResponseInterface,
|
Psr\Http\Message\ResponseInterface,
|
||||||
Psr\Container\ContainerInterface;
|
Psr\Container\ContainerInterface;
|
||||||
|
|
||||||
use Notes\Route\RouteFetcher;
|
use Notes\Route\RouteFetcher;
|
||||||
|
|
||||||
use Notes\Security\SecurityHandler;
|
|
||||||
|
|
||||||
use Notes\Tell\LanguageHandler;
|
|
||||||
|
|
||||||
use Picea\Picea,
|
|
||||||
Picea\Extension\UrlExtension;
|
|
||||||
|
|
||||||
use Storage\Cookie,
|
|
||||||
Storage\Session;
|
|
||||||
|
|
||||||
use Mcnd\Event\EventManager;
|
use Mcnd\Event\EventManager;
|
||||||
|
|
||||||
use function DI\autowire, DI\create;
|
|
||||||
|
|
||||||
class Routing {
|
class Routing {
|
||||||
|
|
||||||
public Annotation $selectedRoute;
|
|
||||||
|
|
||||||
public ResponseInterface $response;
|
public ResponseInterface $response;
|
||||||
|
|
||||||
|
public array $overriddenRoutes = [];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
public Session $session,
|
|
||||||
public Cookie $cookie,
|
|
||||||
public UrlExtension $extension,
|
|
||||||
public Router $router,
|
public Router $router,
|
||||||
public RouteFetcher $fetcher,
|
public RouteFetcher $fetcher,
|
||||||
public SecurityHandler $security,
|
|
||||||
public LanguageHandler $language,
|
|
||||||
public Taxus $taxus,
|
|
||||||
public EventManager $eventManager,
|
public EventManager $eventManager,
|
||||||
) { }
|
) { }
|
||||||
|
|
||||||
public function registerRoute(ContainerInterface $container, string $urlBase) {
|
public function registerRoute(ContainerInterface $container, string $urlBase) {
|
||||||
$this->router->group(rtrim($urlBase, "/"), function (RouteGroup $route) use ($container) {
|
$this->router->group(rtrim($urlBase, "/"), function (RouteGroup $route) use ($container) {
|
||||||
foreach($this->fetcher->compile() as $annotation) {
|
foreach($this->fetchRoutesAttributes() as $attribute) {
|
||||||
$this->eventManager->execute(Event\RoutingCompileRoutes::class, $this, $annotation);
|
$this->eventManager->execute(Event\RoutingCompileRoutes::class, $this, $attribute);
|
||||||
|
|
||||||
/* @deprecated annotation->method will become standard when using native attributes */
|
# Mapping every URLs from attributes in searched folders (Api, Controller, etc...)
|
||||||
foreach((array) ( $annotation->method ?? $annotation->methods ) as $method) {
|
foreach((array) $attribute->method as $method) {
|
||||||
# Mapping every URLs from annotations in searched folders (Api, Controller, etc...)
|
$route->map(strtoupper($method), $attribute->getRegistrableRoute(), function (ServerRequestInterface $request, array $arguments) use (
|
||||||
$route->map(strtoupper($method), $annotation->getRoute(), function (ServerRequestInterface $request, array $arguments) use (
|
$container, $route, $attribute
|
||||||
$container, $route, $annotation
|
) : ResponseInterface {
|
||||||
) : ResponseInterface
|
$class = $attribute->class;
|
||||||
{
|
$method = $attribute->classMethod;
|
||||||
$class = $annotation->class;
|
|
||||||
$method = $annotation->classMethod;
|
|
||||||
$object = $container->get($class);
|
$object = $container->get($class);
|
||||||
|
|
||||||
$this->eventManager->execute(Event\RoutingMapRoutes::class, $this, $container, $request, $annotation);
|
$this->eventManager->execute(Event\RoutingMapRoutes::class, $this, $container, $request, $attribute);
|
||||||
|
|
||||||
$container->set(ServerRequestInterface::class, $request);
|
$container->set(ServerRequestInterface::class, $request);
|
||||||
|
|
||||||
@@ -72,4 +50,40 @@ class Routing {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function fetchRoutesAttributes() : iterable
|
||||||
|
{
|
||||||
|
static $list = [];
|
||||||
|
|
||||||
|
if ($list) {
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
foreach($this->fetcher->compile() as $routeAttribute) {
|
||||||
|
# Routes with differents methods can have the same name
|
||||||
|
$key = sprintf('{%s}~{%s}', $routeAttribute->name, $this->serializeMethods((array) $routeAttribute->method));
|
||||||
|
|
||||||
|
if ( isset($list[$key]) ) {
|
||||||
|
$this->overriddenRoutes[$key] = $list[$key];
|
||||||
|
}
|
||||||
|
|
||||||
|
$list[$key] = $routeAttribute;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $list;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findOverriddenRoute(Route $route) : false|iterable
|
||||||
|
{
|
||||||
|
return array_filter($this->overriddenRoutes, fn($e) => $route->name === $e->name);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function serializeMethods(array $methods) : string
|
||||||
|
{
|
||||||
|
$methods = array_map('strtolower', $methods);
|
||||||
|
|
||||||
|
sort($methods);
|
||||||
|
|
||||||
|
return implode(':', $methods);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace Lean\Routing;
|
||||||
|
|
||||||
|
interface RouteDefinitionInterface {}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
{% arguments array $contextList %}
|
||||||
|
|
||||||
|
{% if $contextList %}
|
||||||
|
<div class="message-wrapper">{% php
|
||||||
|
foreach($contextList as $name => $context) {
|
||||||
|
foreach($context->formContextMessages ?? [] as $message) {
|
||||||
|
echo $message->render();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
%}</div>
|
||||||
|
{% endif %}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
{% arguments \DateInterval $interval %}
|
||||||
|
|
||||||
|
{% if $interval->y %}
|
||||||
|
{% lang "lean.date.interval.years", [ 'years' => $interval->y ] %},
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if $interval->m %}
|
||||||
|
{% lang "lean.date.interval.months", [ 'months' => $interval->m ] %},
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if $interval->d %}
|
||||||
|
{% lang "lean.date.interval.days", [ 'days' => $interval->d ] %},
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if $interval->h %}
|
||||||
|
{% lang "lean.date.interval.hours", [ 'hours' => $interval->h ] %},
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
{% if $interval->i %}
|
||||||
|
{% lang "lean.date.interval.minutes", [ 'minutes' => $interval->i ] %}
|
||||||
|
{% else %}
|
||||||
|
{% lang "lean.date.interval.seconds", [ 'seconds' => $interval->s ] %}
|
||||||
|
{% endif %}
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
<div class="title">{% _ "title" %}</div>
|
<div class="title">{% _ "title" %}</div>
|
||||||
<div class="subtitle">{% _ "subtitle" %}</div>
|
<div class="subtitle">{% _ "subtitle" %}</div>
|
||||||
<div class="content">{% _ "message" %}</div>
|
<div class="content">{% _ "message" %}</div>
|
||||||
<u><a href="#" onclick="history.back()">{% _ "back" %}</a></u>
|
<u><a href="{% url %}">{% _ "back" %}</a></u>
|
||||||
</div>
|
</div>
|
||||||
{% endsection %}
|
{% endsection %}
|
||||||
|
|
||||||
@@ -22,5 +22,5 @@
|
|||||||
{% section "head.css" %}
|
{% section "head.css" %}
|
||||||
.title {font-size:2rem}
|
.title {font-size:2rem}
|
||||||
.subtitle {font-size:1.25rem; padding-top: 1rem;}
|
.subtitle {font-size:1.25rem; padding-top: 1rem;}
|
||||||
.content {padding-top:1rem}
|
.content {background: #f7f7f7;padding: 7px;color: #8c3c3c;max-height:300px;overflow-y:auto}
|
||||||
{% endsection %}
|
{% endsection %}
|
||||||
@@ -18,9 +18,3 @@
|
|||||||
{% view "lean/picto/undraw_lost" %}
|
{% view "lean/picto/undraw_lost" %}
|
||||||
</div>
|
</div>
|
||||||
{% endsection %}
|
{% endsection %}
|
||||||
|
|
||||||
{% section "head.css" %}
|
|
||||||
.title {font-size:2rem}
|
|
||||||
.subtitle {font-size:1.25rem; padding-top: 1rem;}
|
|
||||||
.content {padding-top:1rem}
|
|
||||||
{% endsection %}
|
|
||||||
@@ -18,9 +18,3 @@
|
|||||||
{% view "lean/picto/undraw_error" %}
|
{% view "lean/picto/undraw_error" %}
|
||||||
</div>
|
</div>
|
||||||
{% endsection %}
|
{% endsection %}
|
||||||
|
|
||||||
{% section "head.css" %}
|
|
||||||
.title {font-size:2rem}
|
|
||||||
.subtitle {font-size:1.25rem; padding-top: 1rem;}
|
|
||||||
.content {background: #f7f7f7;padding: 7px;color: #8c3c3c;max-height:300px;overflow-y:auto}
|
|
||||||
{% endsection %}
|
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
{% title "Documentation" %}
|
||||||
|
|
||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="fr">
|
||||||
|
{% section "head" %}
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
|
<title>{% section "head.title" %}{{ title() }}{% endsection %}</title>
|
||||||
|
|
||||||
|
<link rel="apple-touch-icon" sizes="180x180" href="{% asset 'static/favicon/apple-touch-icon.png' %}">
|
||||||
|
<link rel="icon" type="image/png" sizes="32x32" href="{% asset 'static/favicon/favicon-32x32.png' %}">
|
||||||
|
<link rel="icon" type="image/png" sizes="16x16" href="{% asset 'static/favicon/favicon-16x16.png' %}">
|
||||||
|
<link rel="manifest" href="{% asset 'static/favicon/site.webmanifest' %}">
|
||||||
|
<link rel="mask-icon" href="{% asset 'static/favicon/safari-pinned-tab.svg' %}" color="#5bbad5">
|
||||||
|
<meta name="msapplication-TileColor" content="#2d89ef">
|
||||||
|
<meta name="theme-color" content="#ffffff">
|
||||||
|
|
||||||
|
<style>
|
||||||
|
a{color:#e44a00}h3{background:#e1e1e1;padding:6px 12px}ul{background:#e9e9fd;padding-top:20px;padding-bottom:20px;border:1px solid #e3e3ec}ul li + li{margin-top:8px}li > em{font-size:0.75rem;color:gray}body{font-family:Helvetica, 'Helvetica Neuve', Arial, Tahoma, sans-serif;font-size:17px;color:#333}h1,h2,h3,h4,h5,h6{color:#222;margin:0 0 20px}dl,ol,p,pre,table,ul{margin:0 0 20px}h1,h2,h3{line-height:1.1}h1{font-size:20px;text-align:right;color:#387eea;font-weight:bold}h2{color:#393939}h3,h4,h5,h6{color:#494949}h3{display:flex}h3 > code{margin-right:5px;color:#b52dac}h3 > strong{margin-left:auto}a{color:#39c;font-weight:400;text-decoration:none}a small{font-size:11px;color:#777;margin-top:-0.6em;display:block}.wrapper{width:860px;margin:0 auto}blockquote{border-left:1px solid #e5e5e5;margin:0;padding:0 0 0 20px;font-style:italic}code,pre{font-size:12px}pre{padding:8px 15px;background:#f8f8f8;border-radius:5px;border:1px solid #e5e5e5;overflow-x:auto}table{width:100%;border-collapse:collapse}td,th{text-align:left;padding:5px 10px;border-bottom:1px solid #e5e5e5}dt{color:#444;font-weight:700}th{color:#444}img{max-width:100%}header{width:270px;float:left;position:fixed}header ul{list-style:none;height:40px;padding:0;background:#eee;background:-moz-linear-gradient(top, #f8f8f8 0%, #dddddd 100%);background:-webkit-gradient(linear, left top, left bottom, color-stop(0%,#f8f8f8), color-stop(100%,#dddddd));background:-webkit-linear-gradient(top, #f8f8f8 0%,#dddddd 100%);background:-o-linear-gradient(top, #f8f8f8 0%,#dddddd 100%);background:-ms-linear-gradient(top, #f8f8f8 0%,#dddddd 100%);background:linear-gradient(top, #f8f8f8 0%,#dddddd 100%);border-radius:5px;border:1px solid #d2d2d2;box-shadow:inset #fff 0 1px 0, inset rgba(0,0,0,0.03) 0 -1px 0;width:270px}header li{width:89px;float:left;border-right:1px solid #d2d2d2;height:40px}header ul a{line-height:1;font-size:11px;color:#999;display:block;text-align:center;padding-top:6px;height:40px}strong{color:#222;font-weight:700}header ul li + li{width:88px;border-left:1px solid #fff}header ul li + li + li{border-right:none;width:89px}header ul a strong{font-size:14px;display:block;color:#222}section{width:500px;float:right;padding-bottom:50px}small{font-size:11px}hr{border:0;background:#e5e5e5;height:1px;margin:0 0 20px}footer{width:270px;float:left;position:fixed;bottom:50px}@media print, screen and (max-width: 960px){div.wrapper{width:auto;margin:0}footer,header,section{float:none;position:static;width:auto}header{padding-right:320px}section{border:1px solid #e5e5e5;border-width:1px 0;padding:20px 0;margin:0 0 20px}header a small{display:inline}header ul{position:absolute;right:50px;top:52px}}@media print, screen and (max-width: 720px){body{word-wrap:break-word}header{padding:0}header p.view,header ul{position:static}code,pre{word-wrap:normal}}@media print, screen and (max-width: 480px){body{padding:15px}header ul{display:none}}@media print{body{padding:0.4in;font-size:12pt;color:#444}}#wrapper{margin-left:auto;margin-right:auto;background-color:white}.ca-menu{list-style:none;padding:0;margin:20px auto}#navi{padding-top:15px;padding-right:15px;float:right;width:420px}#title{padding-left:15px;width:460px;float:left}div.clear{clear:both}h2{font-size:2em}h3{font-size:1.5em}h4{font-size:1.2em}h5{font-size:1em;font-weight:bold}h6{font-size:1em;font-weight:bold}h1,h2,h3,h4,h5,h6{font-weight:normal;line-height:2.5rem;margin:1rem 0}.post p{max-width:580px}ol.list,ul.list{padding-left:3.333em;max-width:580px}.post h2{border-bottom:1px solid #EDEDED}h1:nth-child(1),h2:nth-child(1),h3:nth-child(1),h4:nth-child(1),h5:nth-child(1),h6:nth-child(1){margin-top:0}body{padding:1em}#wrapper{padding:1em}@media (min-width: 43.75em){body{padding:2em}#wrapper{padding:2em}}@media (min-width: 62em){body{padding:3em}#wrapper{max-width:740px;padding:3em}}
|
||||||
|
ol{background: #eff4f2;padding-top:20px;padding-bottom:20px;border:1px solid #e3e3ec}
|
||||||
|
h4{background:#e0f7ed;padding:6px 12px; font-weight: bold!important;font-size:100%;margin-top:0}
|
||||||
|
h5{text-decoration: underline}
|
||||||
|
li.odd-even{border-top:1px solid #ccc;margin:10px 0;padding:15px 15px 10px 5px}
|
||||||
|
li.odd-even:first-child{border:0}
|
||||||
|
input, button {padding:5px; font-size:1em;margin-top:10px}
|
||||||
|
ul ul {margin: 0;border: 0;padding: 5px 30px;}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
{% endsection %}
|
||||||
|
|
||||||
|
{% section "body" %}
|
||||||
|
<body>
|
||||||
|
{% section "body.header" %}{% endsection %}
|
||||||
|
|
||||||
|
{% section "header" %}{% endsection %}
|
||||||
|
|
||||||
|
{% section "message" %}
|
||||||
|
{% view "lean/widget/message" %}
|
||||||
|
{% endsection %}
|
||||||
|
|
||||||
|
<main role="main" class="content">
|
||||||
|
{% section "main" %}
|
||||||
|
<div>{{= $markdown }}</div>
|
||||||
|
{% endsection %}
|
||||||
|
</main>
|
||||||
|
|
||||||
|
<footer>{% section "footer" %}{% endsection %}</footer>
|
||||||
|
|
||||||
|
{% section "body.footer" %}{% endsection %}
|
||||||
|
</body>
|
||||||
|
{% endsection %}
|
||||||
|
</html>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
|
<meta charset="UTF-8" />
|
||||||
<meta http-equiv="Content-Type" content="text/html; ">
|
<meta http-equiv="Content-Type" content="text/html; ">
|
||||||
<meta name="viewport" content="width=device-width">
|
<meta name="viewport" content="width=device-width">
|
||||||
<title>{{ title() }}</title>
|
<title>{{ title() }}</title>
|
||||||
@@ -10,14 +11,14 @@
|
|||||||
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.1/css/bulma.min.css">
|
||||||
|
|
||||||
<style>
|
<style>
|
||||||
body {background:#272822}
|
body {background:#272822;min-height:100vh;}
|
||||||
#main-content {min-height: 100vh;width: 100vw;align-items:center;justify-content: center;}
|
#main-content {min-height: 100vh;width: 100vw;align-items:center;justify-content: center;}
|
||||||
#wrapper-content {max-width:960px; max-height:65vh;flex-direction:row-reverse; margin:0 10vw}
|
#wrapper-content {max-width:960px; max-height:65vh;flex-direction:row-reverse; margin:0 10vw}
|
||||||
#wrapper-content .content-right {background:#efefef;padding:5vh 2vw;align-items:center;display:flex;justify-content:center; width:100%;border-radius:6px 0 0 6px}
|
#wrapper-content .content-right {background:#efefef;padding:5vh 2vw;align-items:center;display:flex;justify-content:center; width:100%;border-radius:6px 0 0 6px}
|
||||||
#wrapper-content .content-left {background:#ffffff;padding:5vh 2vw;border-radius:0 6px 6px 0;display:flex;align-items:center;justify-content: center}
|
#wrapper-content .content-left {background:#ffffff;padding:5vh 2vw;border-radius:0 6px 6px 0;display:flex;align-items:center;justify-content: center}
|
||||||
|
|
||||||
.form-user-login {width:80%;}
|
.form-user-login {width:80%;}
|
||||||
.picto-login svg {max-width:100%;}
|
.picto-login svg {max-width:100%;width:100%;max-height:33vh}
|
||||||
|
|
||||||
{% section "head.css" %}{% endsection %}
|
{% section "head.css" %}{% endsection %}
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg id="e7dedc5b-fca6-4313-b5a0-e6297481e8ae" data-name="Layer 1" 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"><defs><linearGradient id="af83dc26-9572-4816-b7a1-1af4f72ff554" 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.71a23.68,23Line 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: 39 KiB After Width: | Height: | Size: 2.3 KiB |
@@ -1 +1 @@
|
|||||||
<svg id="a63b68c9-40cd-4f97-89ed-e7d494eb42f9" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" width="742.41705" height="712.57302" viewBox="0 0 742.41705 712.57302"><path id="aa38b2e7-2ea9-4025-adcf-83f87c0cfc4a" data-name="Path 968" d="M853.60644,262.60547h-3.9v-106.977a61.915,61.915,0,0,0-61.915-61.915h-226.65a61.915,61.915,0,0,0-61.916,61.914v586.884a61.915,61.915,0,0,0,61.915,61.915h226.648a61.915,61.915,0,0,0,61.915-61.915v-403.758h3.9Z" transform="translate(-228.79147 -93.71349)" fill="#3f3d56"/><path id="f27259c2-0089-4137-bfd8-cb22dff914f1" data-name="Path 969" d="M837.00647,151.48149v595.175a46.959,46.959,0,0,1-46.942,46.952h-231.3a46.966,46.966,0,0,1-46.973-46.952v-595.175a46.965,46.965,0,0,1,46.971-46.951h28.058a22.329,22.329,0,0,0,20.656,30.74h131.868a22.329,22.329,0,0,0,20.656-30.74h30.055a46.959,46.959,0,0,1,46.951,46.942Z" transform="translate(-228.79147 -93.71349)" fill="#fff"/><circle id="fc31cc31-f989-45cc-bd1e-521a0ee1871b" data-name="Ellipse 18" cx="445.56497" cy="200.129" r="96.565" fill="#6c63ff"/><path id="a573942c-3bf3-4c43-b474-689725a927f7" data-name="Path 39" d="M779.67245,494.30947h-205.537a3.81,3.81,0,0,1-3.806-3.806V439.51949a3.811,3.811,0,0,1,3.806-3.806h205.537a3.811,3.811,0,0,1,3.806,3.806v50.985a3.811,3.811,0,0,1-3.806,3.806Zm-205.537-57.074a2.286,2.286,0,0,0-2.284,2.284v50.985a2.286,2.286,0,0,0,2.284,2.284h205.537a2.286,2.286,0,0,0,2.284-2.284v-50.985a2.286,2.286,0,0,0-2.284-2.284Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="fb5feb1e-1fe2-48fa-806d-0a2b51d12b49" data-name="Path 40" d="M637.69945,454.07448a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.00221-.11713-.0019h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="bcb9932f-0864-4b7e-b0ed-f7254bb9b8bf" data-name="Path 41" d="M637.69945,470.05846a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.00219-.11713-.00189h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="f88e2a8b-becc-4da9-bd36-af011daaaaf2" data-name="Path 42" d="M779.67245,579.28947h-205.537a3.81,3.81,0,0,1-3.806-3.806V524.49949a3.811,3.811,0,0,1,3.806-3.806h205.537a3.811,3.811,0,0,1,3.806,3.806v50.985A3.811,3.811,0,0,1,779.67245,579.28947Zm-205.537-57.074a2.286,2.286,0,0,0-2.284,2.284v50.985a2.286,2.286,0,0,0,2.284,2.284h205.537a2.286,2.286,0,0,0,2.284-2.284v-50.985a2.286,2.286,0,0,0-2.284-2.284Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="e192d34f-2ccc-4f79-b47a-46430e4d87f6" data-name="Path 43" d="M637.69945,539.33047a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.087-5.328h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="b230677c-48cc-4ee6-87d6-a753204ffe47" data-name="Path 44" d="M637.69945,555.3185a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.087-5.328h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="b88a2a79-0ae3-4fd9-9894-02e0db9a2271" data-name="Path 39-2" d="M779.67245,664.54748h-205.537a3.81,3.81,0,0,1-3.806-3.806V609.7575a3.811,3.811,0,0,1,3.806-3.806h205.537a3.811,3.811,0,0,1,3.806,3.806v50.985a3.811,3.811,0,0,1-3.806,3.806Zm-205.537-57.074a2.286,2.286,0,0,0-2.284,2.284v50.985a2.286,2.286,0,0,0,2.284,2.284h205.537a2.286,2.286,0,0,0,2.284-2.284v-50.985a2.286,2.286,0,0,0-2.284-2.284Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="aa2394a9-8b56-4a12-a2cd-a583e6ea12eb" data-name="Path 40-2" d="M637.69945,624.59148a2.66449,2.66449,0,1,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.00219-.11713-.00189h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="bc352cb2-8959-4b51-bd18-df6817a9a47e" data-name="Path 41-2" d="M637.69945,640.57846a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.0022-.11713-.00189h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="b30ee82f-5b3a-4aa4-9db7-ead828191937" data-name="Path 970" d="M969.27042,806.28651h-738.541c-1.071,0-1.938-.468-1.938-1.045s.868-1.045,1.938-1.045H969.27054c1.06994,0,1.938.468,1.938,1.045S970.34146,806.28651,969.27042,806.28651Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><g id="f24cf2fd-107c-4150-a0f1-6f6b12d88bf3" data-name="Group 58"><path id="a2b576eb-bb95-4480-aa60-cd8aa023fe61" data-name="Path 438" d="M937.99248,765.52151a19.4741,19.4741,0,0,1-18.806-3.313c-6.587-5.528-8.652-14.636-10.332-23.07l-4.97-24.945,10.405,7.165c7.483,5.152,15.134,10.47,20.316,17.933s7.443,17.651,3.28,25.726" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="fe1c5433-44e0-47a6-8430-329cbd7c4dea" data-name="Path 439" d="M936.38547,797.45852c1.31-9.542,2.657-19.206,1.738-28.849-.816-8.565-3.429-16.93-8.749-23.789a39.57365,39.57365,0,0,0-10.153-9.2c-1.015-.641-1.95.968-.939,1.606a37.62192,37.62192,0,0,1,14.881,17.956c3.24,8.241,3.76,17.224,3.2,25.977-.338,5.294-1.053,10.553-1.774,15.805a.964.964,0,0,0,.6Line truncated
|
<svg width="742" height="712" id="a63b68c9-40cd-4f97-89ed-e7d494eb42f9" data-name="Layer 1" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 742.41705 712.57302"><path id="aa38b2e7-2ea9-4025-adcf-83f87c0cfc4a" data-name="Path 968" d="M853.60644,262.60547h-3.9v-106.977a61.915,61.915,0,0,0-61.915-61.915h-226.65a61.915,61.915,0,0,0-61.916,61.914v586.884a61.915,61.915,0,0,0,61.915,61.915h226.648a61.915,61.915,0,0,0,61.915-61.915v-403.758h3.9Z" transform="translate(-228.79147 -93.71349)" fill="#3f3d56"/><path id="f27259c2-0089-4137-bfd8-cb22dff914f1" data-name="Path 969" d="M837.00647,151.48149v595.175a46.959,46.959,0,0,1-46.942,46.952h-231.3a46.966,46.966,0,0,1-46.973-46.952v-595.175a46.965,46.965,0,0,1,46.971-46.951h28.058a22.329,22.329,0,0,0,20.656,30.74h131.868a22.329,22.329,0,0,0,20.656-30.74h30.055a46.959,46.959,0,0,1,46.951,46.942Z" transform="translate(-228.79147 -93.71349)" fill="#fff"/><circle id="fc31cc31-f989-45cc-bd1e-521a0ee1871b" data-name="Ellipse 18" cx="445.56497" cy="200.129" r="96.565" fill="#6c63ff"/><path id="a573942c-3bf3-4c43-b474-689725a927f7" data-name="Path 39" d="M779.67245,494.30947h-205.537a3.81,3.81,0,0,1-3.806-3.806V439.51949a3.811,3.811,0,0,1,3.806-3.806h205.537a3.811,3.811,0,0,1,3.806,3.806v50.985a3.811,3.811,0,0,1-3.806,3.806Zm-205.537-57.074a2.286,2.286,0,0,0-2.284,2.284v50.985a2.286,2.286,0,0,0,2.284,2.284h205.537a2.286,2.286,0,0,0,2.284-2.284v-50.985a2.286,2.286,0,0,0-2.284-2.284Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="fb5feb1e-1fe2-48fa-806d-0a2b51d12b49" data-name="Path 40" d="M637.69945,454.07448a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.00221-.11713-.0019h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="bcb9932f-0864-4b7e-b0ed-f7254bb9b8bf" data-name="Path 41" d="M637.69945,470.05846a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.00219-.11713-.00189h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="f88e2a8b-becc-4da9-bd36-af011daaaaf2" data-name="Path 42" d="M779.67245,579.28947h-205.537a3.81,3.81,0,0,1-3.806-3.806V524.49949a3.811,3.811,0,0,1,3.806-3.806h205.537a3.811,3.811,0,0,1,3.806,3.806v50.985A3.811,3.811,0,0,1,779.67245,579.28947Zm-205.537-57.074a2.286,2.286,0,0,0-2.284,2.284v50.985a2.286,2.286,0,0,0,2.284,2.284h205.537a2.286,2.286,0,0,0,2.284-2.284v-50.985a2.286,2.286,0,0,0-2.284-2.284Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="e192d34f-2ccc-4f79-b47a-46430e4d87f6" data-name="Path 43" d="M637.69945,539.33047a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.087-5.328h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="b230677c-48cc-4ee6-87d6-a753204ffe47" data-name="Path 44" d="M637.69945,555.3185a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.087-5.328h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="b88a2a79-0ae3-4fd9-9894-02e0db9a2271" data-name="Path 39-2" d="M779.67245,664.54748h-205.537a3.81,3.81,0,0,1-3.806-3.806V609.7575a3.811,3.811,0,0,1,3.806-3.806h205.537a3.811,3.811,0,0,1,3.806,3.806v50.985a3.811,3.811,0,0,1-3.806,3.806Zm-205.537-57.074a2.286,2.286,0,0,0-2.284,2.284v50.985a2.286,2.286,0,0,0,2.284,2.284h205.537a2.286,2.286,0,0,0,2.284-2.284v-50.985a2.286,2.286,0,0,0-2.284-2.284Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="aa2394a9-8b56-4a12-a2cd-a583e6ea12eb" data-name="Path 40-2" d="M637.69945,624.59148a2.66449,2.66449,0,1,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.00219-.11713-.00189h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="bc352cb2-8959-4b51-bd18-df6817a9a47e" data-name="Path 41-2" d="M637.69945,640.57846a2.66449,2.66449,0,0,0,0,5.329h125.605a2.665,2.665,0,0,0,.2041-5.32611q-.0585-.0022-.11713-.00189h-125.692Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="b30ee82f-5b3a-4aa4-9db7-ead828191937" data-name="Path 970" d="M969.27042,806.28651h-738.541c-1.071,0-1.938-.468-1.938-1.045s.868-1.045,1.938-1.045H969.27054c1.06994,0,1.938.468,1.938,1.045S970.34146,806.28651,969.27042,806.28651Z" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><g id="f24cf2fd-107c-4150-a0f1-6f6b12d88bf3" data-name="Group 58"><path id="a2b576eb-bb95-4480-aa60-cd8aa023fe61" data-name="Path 438" d="M937.99248,765.52151a19.4741,19.4741,0,0,1-18.806-3.313c-6.587-5.528-8.652-14.636-10.332-23.07l-4.97-24.945,10.405,7.165c7.483,5.152,15.134,10.47,20.316,17.933s7.443,17.651,3.28,25.726" transform="translate(-228.79147 -93.71349)" fill="#e6e6e6"/><path id="fe1c5433-44e0-47a6-8430-329cbd7c4dea" data-name="Path 439" d="M936.38547,797.45852c1.31-9.542,2.657-19.206,1.738-28.849-.816-8.565-3.429-16.93-8.749-23.789a39.57365,39.57365,0,0,0-10.153-9.2c-1.015-.641-1.95.968-.939,1.606a37.62192,37.62192,0,0,1,14.881,17.956c3.24,8.241,3.76,17.224,3.2,25.977-.338,5.294-1.053,10.553-1.774,15.805a.964.964,0,0,0,.65,1.144.936.Line truncated
|
||||||
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 11 KiB |
@@ -1,28 +1,33 @@
|
|||||||
<ol class="breadcrumb ">
|
{% if isset($this->breadcrumb) %}
|
||||||
<li class="breadcrumb-item"><a href="{% url '' %}"><i class="fas fa-fw fa-tachometer-alt"></i> Tableau de bord</a></li>
|
{% php $routeTree = $this->breadcrumb->getRouteTree($this->session->get('lean.route')) %}
|
||||||
|
|
||||||
{% foreach $this->breadcrumb ?? [] as $crumb %}
|
{% if count($routeTree) %}
|
||||||
<li class="breadcrumb-item {{ ( $crumb['active'] ?? false ) ? 'active' : '' }}">
|
<ol class="breadcrumb mb-4 px-3 py-2">
|
||||||
{% if ! ($crumb['active'] ?? false) %}
|
{% foreach $routeTree as $index => $crumb %}
|
||||||
{? $last = $crumb ?}
|
<li class="breadcrumb-item {% if $crumb->current %}active{% endif %}">
|
||||||
|
{% if ! $crumb->current %}
|
||||||
|
{% php $last = $crumb %}
|
||||||
|
|
||||||
<a href="{% url $crumb['url'] %}">
|
<a href="{% route $crumb->routeAnnotation->name %}">
|
||||||
{% if $crumb['icon'] ?? false %}
|
{% if $crumb->icon ?? false %}
|
||||||
<i class="fa fa-{{ $crumb['icon'] }}"></i>
|
<i class="fa fa-{{ $crumb->icon }}"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ $crumb['title'] }}
|
<span>{{ lang($crumb->lang, get_defined_vars()) }}</span>
|
||||||
</a>
|
</a>
|
||||||
{% else %}
|
{% else %}
|
||||||
{% if $crumb['icon'] ?? false %}
|
{% if $crumb->icon ?? false %}
|
||||||
<i class="fa fa-{{ $crumb['icon'] }}"></i>
|
<i class="fa fa-{{ $crumb->icon }}"></i>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<span>{{ $crumb['title'] }}</span>
|
|
||||||
{% endif %}
|
|
||||||
</li>
|
|
||||||
{% endforeach %}
|
|
||||||
|
|
||||||
{% if $last ?? false %}
|
<span>{{ lang($crumb->lang, get_defined_vars()) }}</span>
|
||||||
<li class="breadcrumb-last-item ml-auto"><a href="{{ url( $last['url']) }}"><i class="fas fa-chevron-circle-left"></i> Retour</a></li>
|
{% endif %}
|
||||||
|
</li>
|
||||||
|
{% endforeach %}
|
||||||
|
|
||||||
|
{# if $last ?? false %}
|
||||||
|
<li class="breadcrumb-last-item ml-auto"><a href="{{ ( $last['route'] ?? false ) ? $last['route'] : url($last['url']) }}"><i class="fas fa-chevron-circle-left"></i> Retour</a></li>
|
||||||
|
{% endif #}
|
||||||
|
</ol>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</ol>
|
{% endif %}
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
{% slot "week.heading", $day, $month, $year %}
|
{% slot "week.heading", $day, $month, $year %}
|
||||||
<div class="day-box">
|
<div class="day-box">
|
||||||
{# Random calendar date that starts on a sunday #}
|
{# Random calendar date that starts on a sunday #}
|
||||||
{{ substr(( new Date("2019-12-$day") )->formatLocale("%A"), 0, 3) }}
|
{{ new Date("2019-12-$day")->formatLocaleIntl(\IntlDateFormatter::SHORT, \IntlDateFormatter::NONE, 'EEE') }}
|
||||||
</div>
|
</div>
|
||||||
{% endslot %}
|
{% endslot %}
|
||||||
{% endforeach %}
|
{% endforeach %}
|
||||||
@@ -31,15 +31,17 @@
|
|||||||
{% foreach range(0, 5) as $week %}
|
{% foreach range(0, 5) as $week %}
|
||||||
<div class="week">
|
<div class="week">
|
||||||
{% foreach range(0, 6) as $day %}
|
{% foreach range(0, 6) as $day %}
|
||||||
|
{% php $dayType = in_array($day, [0, 6]) ? 'week-end' : 'week-day' %}
|
||||||
|
|
||||||
{% if ( $week * 6 + $day >= $index ) && ( $currentDay < $dayCount ) %}
|
{% if ( $week * 6 + $day >= $index ) && ( $currentDay < $dayCount ) %}
|
||||||
{% php $currentDay++; %}
|
{% php $currentDay++; %}
|
||||||
|
|
||||||
{% slot "day.content", new \DateTime("$year-$month-$currentDay"), date("$year-$month-$currentDay") === date('Y-n-j') %}
|
{% slot "day.content", new \DateTime("$year-$month-$currentDay"), date("$year-$month-$currentDay") === date('Y-n-j') %}
|
||||||
<div class="day-box {{ $today ? 'today' : '' }}">{{ $date->format('d') }}</div>
|
<div class="day-box {{ $today ? 'today' : '' }} {{ $dayType }}">{{ $date->format('d') }}</div>
|
||||||
{% endslot %}
|
{% endslot %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% slot "day.empty", $day, $month, $year %}
|
{% slot "day.empty", $day, $month, $year %}
|
||||||
<div class="day-box"></div>
|
<div class="day-box {{ $dayType }}"></div>
|
||||||
{% endslot %}
|
{% endslot %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endforeach %}
|
{% endforeach %}
|
||||||
|
|||||||
@@ -5,14 +5,4 @@
|
|||||||
if ($context && ! in_array($context, $messageList)) {
|
if ($context && ! in_array($context, $messageList)) {
|
||||||
$messageList[] = $context;
|
$messageList[] = $context;
|
||||||
}
|
}
|
||||||
%}
|
%}{% block "lean/block/message", $messageList %}{% endblock %}
|
||||||
|
|
||||||
{% if $messageList %}
|
|
||||||
<div class="message-wrapper">{% php
|
|
||||||
foreach($messageList as $name => $context) {
|
|
||||||
foreach($context->messages ?? [] as $message) {
|
|
||||||
echo $message->render();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
%}</div>
|
|
||||||
{% endif %}
|
|
||||||
@@ -6,9 +6,11 @@
|
|||||||
|
|
||||||
<li class="page-item {{ $page === 1 ? 'active' : '' }}"><a class="page-link" href="{% url.parameters $url, [ 'page' => 1 ] + get() %}">1</a></li>
|
<li class="page-item {{ $page === 1 ? 'active' : '' }}"><a class="page-link" href="{% url.parameters $url, [ 'page' => 1 ] + get() %}">1</a></li>
|
||||||
|
|
||||||
{% foreach range(2, $pageCount < $maxPage ? $pageCount : $maxPage) as $pageIndex %}
|
{% if $pageCount > 1%}
|
||||||
<li class="page-item {{ $page === $pageIndex ? 'active' : '' }}"><a class="page-link" href="{% url.parameters $url, [ 'page' => $pageIndex ] + get() %}">{{ $pageIndex }}</a></li>
|
{% foreach range(2, $pageCount < $maxPage ? $pageCount : $maxPage) as $pageIndex %}
|
||||||
{% endforeach %}
|
<li class="page-item {{ $page === $pageIndex ? 'active' : '' }}"><a class="page-link" href="{% url.parameters $url, [ 'page' => $pageIndex ] + get() %}">{{ $pageIndex }}</a></li>
|
||||||
|
{% endforeach %}
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<li class="page-item {{ $page === $pageCount ? 'disabled' : '' }}"><a class="page-link" href="{% url.parameters $url, [ 'page' => $page + 1 ] + get() %}">{% lang "lean.widget.pagination.next" %}</a></li>
|
<li class="page-item {{ $page === $pageCount ? 'disabled' : '' }}"><a class="page-link" href="{% url.parameters $url, [ 'page' => $page + 1 ] + get() %}">{% lang "lean.widget.pagination.next" %}</a></li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in new issue
Block a user