CodeExplorer XssMiddleware example
$app->
view()->
setData('t',
$translationService);
$app->
view()->
setData('menuHelper',
$menuHelper);
$app->
view()->
setData('selectedLanguage',
$selectedLanguage);
$app->
view()->
setData('translations',
$translations);
$app->
view()->
setData('baseUrl', Utils::
getBaseUrl($app));
$app->
view()->
setData('app',
$app);
$app->
view()->
setData('error', false
);
$app->
view()->
setData('parameters',
$_SESSION['parameters'
]);
$app->
setCookie('installed-locale',
localeForLanguage($selectedLanguage),
time() + 7200, '/'
);
$app->
add(new XssMiddleware());
$app->
error(function DException
$e) use ($app) { if (!
$app->
request()->
isAjax()) { throw $e;
} $response =
$app->
response();
$data =
[ 'code' =>
$e->
getCode(),
'message' =>
$e->
getMessage(),
'file' =>
$e->
getFile(),