$predictedSourceType = 'Upload';
}
// Otherwise, must be a file or an URL
if (!$predictedSourceType) {
$predictedSourceType = 'File';
}
return call_user_func(array(__CLASS__, 'loadFrom' . $predictedSourceType), $source);
}
/**
* Create and load an image from a file or URL. The image format is auto-detected.
*
* @param string $uri File or url
* @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage
*/
public static function loadFromFile($uri)
{
$data = file_get_contents($uri);
$handle = @imagecreatefromstring($data);
if (!static::isValidImageHandle($handle)) {
try {
// try to find a mapper first
$mapper = MapperFactory::selectMapper($uri);
if ($mapper) {
$handle = $mapper->load($uri);
}
} catch (UnsupportedFormatException $e) {
// mapper not found
}
// try all custom mappers
if (!static::isValidImageHandle($handle)) {
$custom_mappers = MapperFactory::getCustomMappers();
foreach ($custom_mappers as $mime_type => $mapper_class) {
$mapper = MapperFactory::selectMapper(null, $mime_type);
Arguments
"file_get_contents(/home/stage-aroom/apps/staging-aroomwithazoo-com/releases/20250331120021/data/uploads/images/fmccamapastridentrancehires-1.jpg): failed to open stream: No such file or directory"
$predictedSourceType = 'Upload';
}
// Otherwise, must be a file or an URL
if (!$predictedSourceType) {
$predictedSourceType = 'File';
}
return call_user_func(array(__CLASS__, 'loadFrom' . $predictedSourceType), $source);
}
/**
* Create and load an image from a file or URL. The image format is auto-detected.
*
* @param string $uri File or url
* @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage
*/
public static function loadFromFile($uri)
{
$data = file_get_contents($uri);
$handle = @imagecreatefromstring($data);
if (!static::isValidImageHandle($handle)) {
try {
// try to find a mapper first
$mapper = MapperFactory::selectMapper($uri);
if ($mapper) {
$handle = $mapper->load($uri);
}
} catch (UnsupportedFormatException $e) {
// mapper not found
}
// try all custom mappers
if (!static::isValidImageHandle($handle)) {
$custom_mappers = MapperFactory::getCustomMappers();
foreach ($custom_mappers as $mime_type => $mapper_class) {
$mapper = MapperFactory::selectMapper(null, $mime_type);
Arguments
"/home/stage-aroom/apps/staging-aroomwithazoo-com/releases/20250331120021/data/uploads/images/fmccamapastridentrancehires-1.jpg"
for ($i = 0; $i < $maxlen; $i++) {
if (ord($source[$i]) < 32) {
$predictedSourceType = 'String';
break;
}
}
}
// Uploaded image (array uploads not supported)
if (isset($_FILES[$source]) && isset($_FILES[$source]['tmp_name'])) {
$predictedSourceType = 'Upload';
}
// Otherwise, must be a file or an URL
if (!$predictedSourceType) {
$predictedSourceType = 'File';
}
return call_user_func(array(__CLASS__, 'loadFrom' . $predictedSourceType), $source);
}
/**
* Create and load an image from a file or URL. The image format is auto-detected.
*
* @param string $uri File or url
* @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage
*/
public static function loadFromFile($uri)
{
$data = file_get_contents($uri);
$handle = @imagecreatefromstring($data);
if (!static::isValidImageHandle($handle)) {
try {
// try to find a mapper first
$mapper = MapperFactory::selectMapper($uri);
if ($mapper) {
$handle = $mapper->load($uri);
Arguments
"/home/stage-aroom/apps/staging-aroomwithazoo-com/releases/20250331120021/data/uploads/images/fmccamapastridentrancehires-1.jpg"
for ($i = 0; $i < $maxlen; $i++) {
if (ord($source[$i]) < 32) {
$predictedSourceType = 'String';
break;
}
}
}
// Uploaded image (array uploads not supported)
if (isset($_FILES[$source]) && isset($_FILES[$source]['tmp_name'])) {
$predictedSourceType = 'Upload';
}
// Otherwise, must be a file or an URL
if (!$predictedSourceType) {
$predictedSourceType = 'File';
}
return call_user_func(array(__CLASS__, 'loadFrom' . $predictedSourceType), $source);
}
/**
* Create and load an image from a file or URL. The image format is auto-detected.
*
* @param string $uri File or url
* @return \WideImage\Image|\WideImage\PaletteImage|\WideImage\TrueColorImage
*/
public static function loadFromFile($uri)
{
$data = file_get_contents($uri);
$handle = @imagecreatefromstring($data);
if (!static::isValidImageHandle($handle)) {
try {
// try to find a mapper first
$mapper = MapperFactory::selectMapper($uri);
if ($mapper) {
$handle = $mapper->load($uri);
Arguments
array:2 [
0 => "WideImage\WideImage"
1 => "loadFromFile"
]
"/home/stage-aroom/apps/staging-aroomwithazoo-com/releases/20250331120021/data/uploads/images/fmccamapastridentrancehires-1.jpg"
* @return string
* @throws \Modules\Application\Services\Renderer\ServiceExpectedHtmlRendererException
* @throws \SmartyException
*/
public function render(array $images, $showExtra = false): string
{
$renderer = $this->getHtmlRenderer();
if ($showExtra && count($images) > 3) {
$renderer->assign('extra', count($images) - 3);
}
foreach ($images as &$image) {
// Images
$fileName = $image['filename'];
$image['image_large'] = '/images/lightbox/'. $fileName;
$image['image_small'] = '/images/gallery'. ($showExtra ? '-extra' : '') . '/'. $fileName;
// Large Image Size
$imageSize = WideImage::load(IMAGE_UPLOADS . $fileName);
$image['w'] = $imageSize->getWidth();
$image['h'] = $imageSize->getHeight();
$imageSize->destroy();
}
unset($image);
$renderer->assign('images', $images);
return $renderer->fetch(__DIR__ . '/../../Front/views/default/renderers/gallery.tpl');
}
}
Arguments
"/home/stage-aroom/apps/staging-aroomwithazoo-com/releases/20250331120021/data/uploads/images/fmccamapastridentrancehires-1.jpg"
* @throws \InvalidArgumentException
* @throws ErrorException
* @throws \Exception
* @throws \Inventis\Exception
*
* @return Response
*/
public function detail($id): Response
{
$page = $this->getService('pageDataProvider')->getById($id);
$children = $this->getService('pageDataProvider')->getByParent($id);
$this->getBanner($page);
$this->verifyUrl();
$this->setMetadataFromActiveNode($page);
if (!empty($page['images']) && $imageGalleryRenderer = $this->getService('imageGalleryRenderer', true)) {
$this->assign('imagesRendering', $imageGalleryRenderer->render($page['images']));
}
if (!empty($page['files']) && $fileListingRenderer = $this->getService('fileListingRenderer', true)) {
$this->assign('filesRendering', $fileListingRenderer->render($page['files']));
}
$this->getRooms($page['id']);
$this->getForm($page);
return new Response($this->display('detail', [
'page' => $page,
'noIndex' => $page['do_not_index'] == 1,
'children' => $children
]));
}
protected function getBanner($page)
{
$banner = [
Arguments
array:3 [
0 => array:8 [
"id" => "435"
"filename" => "fmccamapastridentrancehires-1.jpg"
"related_id" => "84"
"alt" => null
"description" => null
"url" => "https://staging.aroomwithazoo.com/images/lightbox/fmccamapastridentrancehires-1.jpg"
"image_large" => "/images/lightbox/fmccamapastridentrancehires-1.jpg"
"image_small" => "/images/gallery/fmccamapastridentrancehires-1.jpg"
]
1 => array:6 [
"id" => "436"
"filename" => "fmccamapcarnotentrancehires-1.jpg"
"related_id" => "84"
"alt" => null
"description" => null
"url" => "https://staging.aroomwithazoo.com/images/lightbox/fmccamapcarnotentrancehires-1.jpg"
]
2 => array:6 [
"id" => "437"
"filename" => "fmccamaphistoricalentrancehires-1.jpg"
"related_id" => "84"
"alt" => null
"description" => null
"url" => "https://staging.aroomwithazoo.com/images/lightbox/fmccamaphistoricalentrancehires-1.jpg"
]
]
if ($this instanceof WebadminController) {
$method = 'Action' . $method;
}
if (\is_callable($method)) {
// Allow anonymous functions as routing destination.
return $method($this->getRoutingResult()->getData());
}
if (!method_exists($this, $method)) {
$controllerName = get_class($this);
throw new ErrorException(
"Failed to dispatch routing to [{$controllerName}] => [{$method}]",
ErrorException::CODE_NOT_FOUND
);
}
return \call_user_func_array([$this, $method], $this->getRoutingResult()->getData());
}
/**
* returns the default viewspace within a module
* front & webadmin should overwrite this
*
* @return string
*/
protected function getViewSpace()
{
return 'views/';
}
/**
* Returns teh moduleDir.
*
* @return string
*/
protected function getModuleDir()
{
Arguments
* @param string $url The link to set after the breadcrumb
*
* @return FrontController
*/
public function addBreadcrumb($name, $url = null): FrontController
{
$this->breadcrumbs[] = [
'name' => $name,
'url' => $url,
];
return $this;
}
/**
* @inheritDoc
*/
public function dispatch(Request $request)
{
$response = parent::dispatch($request);
return ($response instanceof Response) ? $response : new Response($response);
}
/**
* @param string $template
* @param array $vars
* @param null $compileId
*
* @throws \Inventis\Exception
*
* @return string
*/
public function display($template, array $vars = [], $compileId = null): string
{
$settingsManager = $this->getService('settingsManager');
$this->assign('contactSettings', $settingsManager->getSettingsByModule('contact', true));
$totalNews = $this->getService('news')->getTotalNewPublicNews($this->getService('language')->getLanguage());
$this->assign('totalPublicNews', $totalNews);
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
$space = $isWebadmin ? 'Webadmin' : 'Front';
/** @var\Modules\Application\Controller $controller */
$controller = $controllerFactory($routingResult->getModuleName(), $space, $routingResult->getControllerName());
if ($routingResult instanceof RoutingResult) {
$controller->setActiveNode($routingResult->getNode());
}
$controller->setRoutingResult($routingResult);
$controller->init();
if (!$controller instanceof DispatchableInterface) {
$className = get_class($controller);
throw new ErrorException(
"Controller [$className] must implement Inventis\\Application\\DispatchableInterface!"
);
}
return $controller->dispatch($request);
}
/**
* This method opportunisticly finds the best match language for the request. This will also work for error pages in
* same cases.
*
* @throws ErrorException
*
* @param\Modules\Application\Routing\Node $node
*/
protected function setLanguageForRequest($node)
{
$current = $node;
while ($current) {
if ($current->hasOwnLanguage()) {
break;
}
$current = $current->getParent();
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
public static function getInstance()
{
return self::$instance;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$response = null;
try {
$dispatcher = $this->dispatchingProvider->getDispatcher($this);
if (!$dispatcher instanceof DispatchableInterface) {
throw new ErrorException('The returned dispatcher does not realize the correct interface!');
}
$response = $dispatcher->dispatch($request);
} catch (\Throwable $e) {
if (!$catch) {
throw $e;
}
$response = null;
// Make sure the handlers are executed in the correct order based on their sequence.
usort($this->errorDispatchingProviders, function ($a, $b) {
$aSequence = ($a instanceof ErrorDispatchingSequenceProviderInterface ?
$a->getErrorDispatcherSequence() : PHP_INT_MAX);
$bSequence = ($b instanceof ErrorDispatchingSequenceProviderInterface ?
$b->getErrorDispatcherSequence() : PHP_INT_MAX);
return $aSequence - $bSequence;
});
foreach ($this->errorDispatchingProviders as $errorDispatchingProvider) {
$dispatcher = $errorDispatchingProvider->getErrorDispatcher($this, $e);
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
foreach ($this->getRewriteMap() as $expression => $newPattern) {
$match = null;
if (preg_match($expression, $pathInfo, $match) === 1) {
array_shift($match);
$cacheFileLocation = vsprintf($newPattern, $match);
if (file_exists(SRC . 'public' . $cacheFileLocation)) {
return new RedirectResponse(
$request->getUriForPath($cacheFileLocation),
301
);
}
}
}
}
// Nothing to do, let other middleware handle the request.
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
}
// Enable Whoops as error handler. This needs to be done here as Whoops registers PHP error handlers which may
// bypass exception handling. We enable sendToOutput by default as for actual errors, we can't catch them and
// put them in a response.
$this->whoops = new Run();
$this->whoops->pushHandler($prettyPageHandler);
$this->whoops->writeToOutput(true);
$this->whoops->allowQuit(true);
$this->whoops->register();
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
try {
// Let other middleware handle the request first and watch for exceptions.
$response = $this->app->handle($request, $type, $catch);
} catch (Throwable $e) {
$this->whoops->allowQuit(false);
$this->whoops->writeToOutput(false);
if ($request->isXmlHttpRequest()) {
$jsonHandler = new JsonResponseHandler();
$this->whoops->pushHandler($jsonHandler);
}
// You cannot combine nonces with unsafe-inline in modern browsers, so use nonces here.
$styleNonce = random_string(16, true);
$scriptNonce = random_string(16, true);
$this->cspBuilder->nonce('style-src', $styleNonce);
$this->cspBuilder->nonce('script-src', $scriptNonce);
$output = $this->whoops->handleException($e);
$output = str_replace('<style>', '<style nonce="' . $styleNonce . '">', $output);
$output = str_replace('<script>', '<script nonce="' . $scriptNonce . '">', $output);
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
}
$parameters = http_build_query($parameters);
if (strpos($keyUrlMap[$path], '?')) {
$newPath = $keyUrlMap[$path] . '&' . $parameters;
} else {
$newPath = $keyUrlMap[$path] . '?' . $parameters;
}
return new CrossDomainRedirectResponse($newPath, 301);
}
foreach ($config->languageDomains as $d => $v) {
$host = $config->subDomain . '.' . $d;
if ($host !== $HTTP_HOST && isset($v['default'])) {
return new CrossDomainRedirectResponse($config->protocol . '://' . $host, 301);
}
}
// Nothing to do, let other middleware handle the request.
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
*/
public function __construct(HttpKernelInterface $app, ?CookieJarInterface $cookieJar = null)
{
$this->app = $app;
$this->cookieJar = $cookieJar;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
if ($this->cookieJar) {
foreach ($request->cookies->getIterator() as $name => $value) {
$this->cookieJar->setDetected($name, $value);
}
}
// Let other middleware handle the request.
$response = $this->app->handle($request, $type, $catch);
/** @var Cookie $cookie */
foreach ($this->cookieJar->getAllForResponse() as $cookie) {
$response->headers->setCookie($cookie);
}
/** @var Cookie $cookie */
foreach ($this->cookieJar->getAllForRemoval() as $cookie) {
$response->headers->clearCookie(
$cookie->getName(),
$cookie->getPath(),
$cookie->getDomain(),
$cookie->isSecure(),
$cookie->isHttpOnly()
);
}
return $response;
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
* @param array|bool $crossDomainWhiteList this is a whitelist of domains to which you want to allow
* cross-domain redirect, if set to false ALL
* {@see CrossDomainRedirectResponse}'s will be considered valid
*/
public function __construct(HttpKernelInterface $app, array $allowedDomains = [], $crossDomainWhiteList = false)
{
$this->app = $app;
$this->allowedDomains = $allowedDomains;
$this->crossDomainWhiteList = $crossDomainWhiteList;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$schemeAndHttpHost = $request->getSchemeAndHttpHost();
$httpHost = $request->getHttpHost();
$response = $this->app->handle($request, $type, $catch);
if ($locationHeader = $response->headers->get('Location')) {
$matches = [];
if (preg_match('#^(?:https?:)?(?:\/\/)?[^\/\?:]+(?::\d+)?#', $locationHeader, $matches) === 1) {
$redirectUrl = $matches[0];
if (!($response instanceof CrossDomainRedirectResponse)) {
$allowedDomains = $this->allowedDomains;
$allowedDomains[] = $schemeAndHttpHost;
$allowedDomains[] = $httpHost;
$this->guardLocationInList($redirectUrl, $allowedDomains);
} elseif ($this->crossDomainWhiteList) {
$allowedDomains = $response->getAllowedDomains() ?: $this->crossDomainWhiteList;
$allowedDomains[] = $schemeAndHttpHost;
$allowedDomains[] = $httpHost;
$this->guardLocationInList($redirectUrl, $allowedDomains);
}
}
}
return $response;
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
{
$segmentReader = new SegmentReader($request->getPathInfo());
if (!in_array($segmentReader->getSegment(0), ['api', 'webadmin', 'payments', 'images', 'files', 'cron']) &&
$this->config->maintenanceMode === true &&
!$this->config->isDebug(DebugInterface::DEBUG_BYPASS_MAINTENANCE_MODE) &&
!($this->auth->isLoggedIn() && $this->auth->hasPermission('ACCESS_WEBADMIN'))
) {
$this->view->getTranslator()->setLanguage($this->config->defaultLanguage);
$this->view->addTemplatePath(MODULES . 'Application/Front/views/', $this->view->getTheme());
$templatePath = $this->view->locateTemplate('maintenance');
$output = $this->view->fetchTemplate($templatePath);
return new Response($output, Response::HTTP_SERVICE_UNAVAILABLE);
}
// Nothing to do, let other middleware handle the request.
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
* @param HttpKernelInterface $app
* @param CSPBuilder $frontContentSecurityPolicyHeaderBuilder
* @param CSPBuilder $webadminContentSecurityPolicyHeaderBuilder
*/
public function __construct(
HttpKernelInterface $app,
CSPBuilder $frontContentSecurityPolicyHeaderBuilder,
CSPBuilder $webadminContentSecurityPolicyHeaderBuilder
) {
$this->app = $app;
$this->frontContentSecurityPolicyHeaderBuilder = $frontContentSecurityPolicyHeaderBuilder;
$this->webadminContentSecurityPolicyHeaderBuilder = $webadminContentSecurityPolicyHeaderBuilder;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$response = $this->app->handle($request, $type, $catch);
$headers = [];
$pathPrefix = mb_substr($request->getPathInfo(), 0, mb_strlen(self::WEBADMIN_PATH_PREFIX));
if ($pathPrefix === self::WEBADMIN_PATH_PREFIX) {
$headers = $this->webadminContentSecurityPolicyHeaderBuilder->getHeaderArray();
} else {
$headers = $this->frontContentSecurityPolicyHeaderBuilder->getHeaderArray();
}
$response->headers->add($headers);
return $response;
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
default:
$finfo = new finfo(FILEINFO_MIME);
$contentType = $finfo->file($filePath);
}
$response = new BinaryFileResponse($filePath, 200, [
'Content-Type' => $contentType,
]);
// Using X-Sendfile allows the web server to directly serve the file at the specified path rather than
// let PHP read the file, buffer it, and then flush it to the server, which then serves the data.
//$response->trustXSendfileTypeHeader();
$response->prepare($request);
return $response;
}
// Nothing to do, let other middleware handle the request.
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
if ($request->getMethod() !== 'POST'
&& (empty($pathInfo) || mb_substr($pathInfo, -1) !== '/')
&& !$this->isFileUri($pathInfo)
) {
$newRelativePath = $request->getPathInfo() . '/';
$queryString = $request->getQueryString();
if (!empty($queryString)) {
$newRelativePath .= '?' . $queryString;
}
return new RedirectResponse(
$request->getUriForPath($newRelativePath),
301
);
}
// Nothing to do, let other middleware handle the request.
return $this->app->handle($request, $type, $catch);
}
/**
* @param string $pathInfo
*
* @return bool
*/
protected function isFileUri($pathInfo)
{
$lastElement = mb_substr($pathInfo, mb_strrpos($pathInfo, '/') + 1);
return mb_strpos($lastElement, '.') !== false;
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
if (!$path || $path === '/') {
$preferredLanguage = $request->getPreferredLanguage(array_keys($this->languageMap));
$path = $this->defaultLanguage;
if ($preferredLanguage !== $this->defaultLanguage) {
$preferredLanguage = $this->defaultLanguage;
}
if (array_key_exists($preferredLanguage, $this->languageMap)) {
$path = $this->languageMap[$preferredLanguage];
}
$response = new RedirectResponse(sprintf('%s%s/', $this->siteUrl, $path));
$response->setVary(['accept-language']);
return $response;
}
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
public function __construct(HttpKernelInterface $application, $protocol, $httpRedirectStatusCode = 301)
{
$this->app = $application;
$this->protocol = $protocol;
$this->httpRedirectStatusCode = $httpRedirectStatusCode;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
if ($request->getScheme() !== $this->protocol) {
return new RedirectResponse(
$this->protocol . '://' . $request->getHttpHost() . $request->getRequestUri(),
$this->httpRedirectStatusCode
);
}
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
$this->httpRedirectStatusCode = $httpRedirectStatusCode;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$httpHostParts = explode('.', $request->getHttpHost());
if (count($httpHostParts) <= 2) {
array_unshift($httpHostParts, $this->defaultSubdomain);
return new RedirectResponse(
$request->getScheme() . '://' . implode('.', $httpHostParts) . $request->getRequestUri(),
$this->httpRedirectStatusCode
);
}
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
*/
public function __construct(HttpKernelInterface $application, $includeSubDomains, $maxAgeSeconds = 31536000)
{
$this->app = $application;
$this->maxAgeSeconds = $maxAgeSeconds;
$this->includeSubDomains = $includeSubDomains;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$value = 'max-age=' . $this->maxAgeSeconds;
if ($this->includeSubDomains) {
$value .= '; includeSubDomains';
}
$response = $this->app->handle($request, $type, $catch);
$response->headers->set('Strict-Transport-Security', $value);
return $response;
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
/**
* @var HttpKernelInterface
*/
protected $app;
/**
* @param HttpKernelInterface $app
* @param bool $injectDefaultCspHeader
*/
public function __construct(HttpKernelInterface $app)
{
$this->app = $app;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$response = $this->app->handle($request, $type, $catch);
$response->headers->add([
'X-Content-Type-Options' => 'nosniff',
'X-XSS-Protection' => '1; mode=block',
'X-Frame-Options' => 'SAMEORIGIN',
]);
return $response;
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
{
$this->app = $application;
$this->httpRedirectStatusCode = $httpRedirectStatusCode;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$pathInfo = $request->getPathInfo();
$pathInfo = trim($pathInfo, '/');
if ($pathInfo && isset($this->patternMap[$pathInfo])) {
$newUrl = $request->getUriForPath($this->patternMap[$pathInfo]);
return new RedirectResponse($newUrl, $this->httpRedirectStatusCode);
}
return $this->app->handle($request, $type, $catch);
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
{
$this->checkFileListForErrors($request->files->all());
if ($request->getMethod() === 'POST' &&
$request->server->get('CONTENT_LENGTH') > 0 &&
strpos($request->server->get('CONTENT_TYPE'), 'multipart/form-data') !== false &&
empty($request->files->all()) &&
empty($request->request->all())
) {
$responseText = sprintf(
'The server was unable to handle that much POST data (%s bytes) due to its current configuration, '.
'maybe you uploaded a file that is larger than the allowed max_post_size?',
$request->server->get('CONTENT_LENGTH')
);
return new Response($responseText, 500);
}
// Nothing to do, let other middleware handle the request.
return $this->app->handle($request, $type, $catch);
}
/**
* @param UploadedFile[] $fileList
*
* @return Response|null
*/
private function checkFileListForErrors(array $fileList)
{
foreach ($fileList as $file) {
if ($file === null) {
continue; // Optional upload field with no file specified.
} elseif (is_array($file)) {
// Happens when this is an upload field with "multiple" set.
return $this->checkFileListForErrors($file);
}
$error = $this->checkFileForErrors($file);
if ($error !== null) {
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
* @var array
*/
private $userAgentModeList;
/**
* @param HttpKernelInterface $application
* @param array[] $userAgentModeList List of arrays with user agent as first element and mode as second.
*/
public function __construct(HttpKernelInterface $application, array $userAgentModeList)
{
$this->application = $application;
$this->userAgentModeList = $userAgentModeList;
}
/**
* @inheritDoc
*/
public function handle(Request $request, $type = self::MASTER_REQUEST, $catch = true)
{
$response = $this->application->handle($request, $type, $catch);
$response->headers->set('X-UA-Compatible', implode(', ', array_map(function (array $item): string {
[$browser, $mode] = $item;
return "{$browser}={$mode}";
}, $this->userAgentModeList)));
return $response;
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpKernel\TerminableInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
class StackedHttpKernel implements HttpKernelInterface, TerminableInterface
{
private $app;
private $middlewares = array();
public function __construct(HttpKernelInterface $app, array $middlewares)
{
$this->app = $app;
$this->middlewares = $middlewares;
}
public function handle(Request $request, $type = HttpKernelInterface::MASTER_REQUEST, $catch = true)
{
return $this->app->handle($request, $type, $catch);
}
public function terminate(Request $request, Response $response)
{
$prevKernel = null;
foreach ($this->middlewares as $kernel) {
// if prev kernel was terminable we can assume this middleware has already been called
if (!$prevKernel instanceof TerminableInterface && $kernel instanceof TerminableInterface) {
$kernel->terminate($request, $response);
}
$prevKernel = $kernel;
}
}
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}
1
true
<?php
use Modules\Application\Application;
use Modules\Application\ModuleInfoProvider;
use Inventis\Exception\BootstrapException;
use Symfony\Component\HttpFoundation\Request;
try {
require_once '../bootstrap.php';
$moduleInfoProvider = new ModuleInfoProvider(MODULES);
$app = Application::initialize($config, $moduleInfoProvider)->bootstrap();
$request = Request::createFromGlobals();
$response = $app->handle($request);
$response->prepare($request);
$response->send();
$app->terminate($request, $response);
} catch (BootstrapException $e) {
echo $e->getMessage();
}
Arguments
Request {#511
+attributes: ParameterBag {#514}
+request: ParameterBag {#512}
+query: ParameterBag {#513}
+server: ServerBag {#517}
+files: FileBag {#516}
+cookies: ParameterBag {#515}
+headers: HeaderBag {#518}
#content: null
#languages: null
#charsets: null
#encodings: null
#acceptableContentTypes: null
#pathInfo: "/en/practical/about-the-venue/"
#requestUri: "/en/practical/about-the-venue/"
#baseUrl: ""
#basePath: null
#method: "GET"
#format: null
#session: null
#locale: null
#defaultLocale: "en"
-isHostValid: true
-isForwardedValid: true
basePath: ""
format: "html"
}