mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-08 04:18:52 +00:00
[ticket/security/275] Add language vars and proper error codes
SECURITY-275
This commit is contained in:
parent
fd550bc25a
commit
e5f069b15b
2 changed files with 31 additions and 8 deletions
|
@ -14,6 +14,7 @@
|
|||
use Symfony\Component\HttpFoundation\RedirectResponse;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\Routing\Exception\ExceptionInterface;
|
||||
use Symfony\Component\Routing\Exception\RouteNotFoundException;
|
||||
|
||||
/**
|
||||
*/
|
||||
|
@ -32,20 +33,38 @@ $get_params_array = $request->get_super_global(\phpbb\request\request_interface:
|
|||
|
||||
/** @var \phpbb\controller\helper $controller_helper */
|
||||
$controller_helper = $phpbb_container->get('controller.helper');
|
||||
$cron_route = 'phpbb_cron_run';
|
||||
|
||||
try
|
||||
{
|
||||
$response = new RedirectResponse(
|
||||
$controller_helper->route('phpbb_cron_run', $get_params_array, false),
|
||||
$controller_helper->route($cron_route, $get_params_array, false),
|
||||
Response::HTTP_MOVED_PERMANENTLY
|
||||
);
|
||||
$response->send();
|
||||
}
|
||||
catch(ExceptionInterface $exception)
|
||||
catch (RouteNotFoundException $exception)
|
||||
{
|
||||
$language = $phpbb_container->get('language');
|
||||
$response = new Response(
|
||||
$language->lang('PAGE_NOT_FOUND'),
|
||||
Response::HTTP_BAD_REQUEST
|
||||
);
|
||||
$response->send();
|
||||
$error = 'ROUTE_NOT_FOUND';
|
||||
$error_parameters = $cron_route;
|
||||
$error_code = Response::HTTP_NOT_FOUND;
|
||||
}
|
||||
catch (ExceptionInterface $exception)
|
||||
{
|
||||
$error = 'ROUTE_INVALID_MISSING_PARAMS';
|
||||
$error_parameters = $cron_route;
|
||||
$error_code = Response::HTTP_BAD_REQUEST;
|
||||
}
|
||||
catch (Throwable $exception)
|
||||
{
|
||||
$error = $exception->getMessage();
|
||||
$error_parameters = [];
|
||||
$error_code = Response::HTTP_INTERNAL_SERVER_ERROR;
|
||||
}
|
||||
|
||||
$language = $phpbb_container->get('language');
|
||||
$response = new Response(
|
||||
$language->lang($error, $error_parameters),
|
||||
$error_code
|
||||
);
|
||||
$response->send();
|
||||
|
|
|
@ -678,6 +678,10 @@ $lang = array_merge($lang, array(
|
|||
'RETURN_TOPIC' => '%sReturn to the topic last visited%s',
|
||||
'RETURN_TO' => 'Return to “%s”',
|
||||
'RETURN_TO_INDEX' => 'Return to Board Index',
|
||||
|
||||
'ROUTE_NOT_FOUND' => 'The requested route "%1$s" could not be found.',
|
||||
'ROUTE_INVALID_MISSING_PARAMS' => 'Invalid or missing parameters passed for route "%1$s".',
|
||||
|
||||
'FEED' => 'Feed',
|
||||
'FEED_NEWS' => 'News',
|
||||
'FEED_TOPICS_ACTIVE' => 'Active Topics',
|
||||
|
|
Loading…
Add table
Reference in a new issue