* [ADD] Added URI signature for JS and CSS resources

* [MOD] Improved requests handling. It makes them more testing friendly
* [MOD] Code refactoring
This commit is contained in:
nuxsmin
2018-07-08 23:05:30 +02:00
parent 53a2552c05
commit a97b92131f
63 changed files with 914 additions and 618 deletions

View File

@@ -38,6 +38,7 @@ use SP\Core\Events\EventDispatcher;
use SP\Core\Exceptions\FileNotFoundException;
use SP\Core\UI\Theme;
use SP\DataModel\ProfileData;
use SP\Http\Request;
use SP\Modules\Web\Controllers\Helpers\LayoutHelper;
use SP\Mvc\Controller\ControllerTrait;
use SP\Mvc\View\Template;
@@ -123,12 +124,17 @@ abstract class ControllerBase
* @var
*/
protected $isAjax = false;
/**
* @var Request
*/
protected $request;
/**
* Constructor
*
* @param Container $container
* @param $actionName
*
* @throws \Psr\Container\ContainerExceptionInterface
* @throws \Psr\Container\NotFoundExceptionInterface
*/
@@ -147,6 +153,7 @@ abstract class ControllerBase
$this->acl = $this->dic->get(Acl::class);
$this->router = $this->dic->get(Klein::class);
$this->view = $this->dic->get(Template::class);
$this->request = $this->dic->get(Request::class);
$this->view->setBase(strtolower($this->controllerName));
@@ -272,13 +279,18 @@ abstract class ControllerBase
}
}
$this->checkLoggedInSession($this->session, $this->router);
$this->checkLoggedInSession($this->session, $this->request, function ($redirect) {
$this->router->response()
->redirect($redirect)
->send(true);
});
}
/**
* Comprobar si está permitido el acceso al módulo/página.
*
* @param null $action La acción a comprobar
*
* @return bool
*/
protected function checkAccess($action)