Updated compatibility of WebComponent.

- Now uses latest libraries of FuzeWorks.
This commit is contained in:
Abel Hoogeveen 2021-11-29 22:47:45 +01:00
parent af25072b24
commit 444f614c48
Signed by: abelhooge
GPG Key ID: C540221690CBFFBA
4 changed files with 14 additions and 22 deletions

View File

@ -4,21 +4,19 @@
"license": ["MIT"], "license": ["MIT"],
"authors": [ "authors": [
{ {
"name": "TechFuze", "name": "Abel Hoogeveen",
"homepage": "https://techfuze.net" "homepage": "https://i15.nl"
},
{
"name": "FuzeWorks Community",
"homepage": "https://techfuze.net/fuzeworks/contributors"
} }
], ],
"require": { "require": {
"php": ">=7.4.0", "php": ">=7.4.0",
"fuzeworks/mvcr": "~1.3.1", "fuzeworks/core": "~1.3.0",
"fuzeworks/core": "~1.2.6" "fuzeworks/mvcr": "~1.3.0",
"fuzeworks/objectstorage": "~1.3.0"
}, },
"require-dev": { "require-dev": {
"fuzeworks/layout": "~1.2.0" "fuzeworks/layout": "~1.3.0",
"fuzeworks/tracycomponent": "~1.3.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -327,7 +327,6 @@ class Input
/** /**
* Fetch the HTTP_USER_AGENT variable from the $_SERVER array * Fetch the HTTP_USER_AGENT variable from the $_SERVER array
* *
* @param string|array|null $index
* @param bool $xssClean * @param bool $xssClean
* @return mixed * @return mixed
*/ */
@ -339,7 +338,6 @@ class Input
/** /**
* Fetch the REQUEST_METHOD variable from the $_SERVER array * Fetch the REQUEST_METHOD variable from the $_SERVER array
* *
* @param string|array|null $index
* @param bool $xssClean * @param bool $xssClean
* @return mixed * @return mixed
*/ */

View File

@ -289,13 +289,13 @@ class Output
$getParams = $this->input->get(); $getParams = $this->input->get();
// Determine the identifier // Determine the identifier
$identier = md5($uri . '|' . serialize($getParams)); $identifier = md5($uri . '|' . serialize($getParams));
// Determine the file that holds the cache // Determine the file that holds the cache
if ($this->compressOutput) if ($this->compressOutput)
$file = $cachePath . DS . $identier . '_gzip.fwcache'; $file = $cachePath . DS . $identifier . '_gzip.fwcache';
else else
$file = $cachePath . DS . $identier . '.fwcache'; $file = $cachePath . DS . $identifier . '.fwcache';
// If compression is enabled, compress the output // If compression is enabled, compress the output

View File

@ -60,7 +60,7 @@ class WebComponent implements iComponent
* *
* @var bool * @var bool
*/ */
public static $willHandleRequest = false; public static bool $willHandleRequest = false;
public function getName(): string public function getName(): string
{ {
@ -93,10 +93,8 @@ class WebComponent implements iComponent
// If WebComponent will handle a request, add some calls to the configurator // If WebComponent will handle a request, add some calls to the configurator
if (self::$willHandleRequest) if (self::$willHandleRequest)
{
// Invoke methods to prepare system for HTTP calls // Invoke methods to prepare system for HTTP calls
$configurator->call('logger', 'setLoggerTemplate', null, 'logger_http'); $configurator->call('logger', 'setLoggerTemplate', null, 'logger_http');
}
} }
public function onCreateContainer(Factory $container) public function onCreateContainer(Factory $container)
@ -124,14 +122,14 @@ class WebComponent implements iComponent
} }
/** /**
* Disable the WebComponent so it won't prepare for handling requests * Disable the WebComponent, so it won't prepare for handling requests
*/ */
public function disableComponent() public function disableComponent()
{ {
self::$willHandleRequest = false; self::$willHandleRequest = false;
} }
public function shutdownEventListener(Event $event) public function shutdownEventListener(Event $event): Event
{ {
/** @var Output $output */ /** @var Output $output */
Logger::logInfo("Parsing output..."); Logger::logInfo("Parsing output...");
@ -314,7 +312,6 @@ class WebComponent implements iComponent
*/ */
public function callViewEventListener(RouterCallViewEvent $event, SecurityException $exception) public function callViewEventListener(RouterCallViewEvent $event, SecurityException $exception)
{ {
/** @var RouterCallViewEvent $event */
// If the securityExceptionHandler method exists, cancel based on that methods output // If the securityExceptionHandler method exists, cancel based on that methods output
if (method_exists($event->view, 'securityExceptionHandler')) if (method_exists($event->view, 'securityExceptionHandler'))
$event->setCancelled(!$event->view->securityExceptionHandler($exception)); $event->setCancelled(!$event->view->securityExceptionHandler($exception));
@ -329,7 +326,7 @@ class WebComponent implements iComponent
* *
* Fired when FuzeWorks halts it's execution. Loads an error 500 page. * Fired when FuzeWorks halts it's execution. Loads an error 500 page.
* *
* @param $event * @param HaltExecutionEvent $event
* @throws EventException * @throws EventException
* @throws FactoryException * @throws FactoryException
* @TODO remove FuzeWorks\Layout dependency * @TODO remove FuzeWorks\Layout dependency
@ -388,7 +385,6 @@ class WebComponent implements iComponent
$security = Factory::getInstance()->security; $security = Factory::getInstance()->security;
$config = Factory::getInstance()->config; $config = Factory::getInstance()->config;
/** @var LayoutLoadEvent $event */
$event->assign('csrfHash', $security->get_csrf_hash()); $event->assign('csrfHash', $security->get_csrf_hash());
$event->assign('csrfTokenName', $security->get_csrf_token_name()); $event->assign('csrfTokenName', $security->get_csrf_token_name());
$event->assign('siteURL', $config->getConfig('web')->get('base_url')); $event->assign('siteURL', $config->getConfig('web')->get('base_url'));