Minor - api_not_allowed show symfony debug if server is in test mode

If portal is in prod mode just show chamilo page with the error message
pull/2528/head
jmontoyaa 7 years ago
parent 222f7ab3fe
commit c6cfa0e1bf
  1. 4
      main/inc/lib/api.lib.php

@ -3676,6 +3676,8 @@ function api_not_allowed(
$message = null,
$responseCode = 0
) {
$debug = api_get_setting('server_type') == 'test';
// Default code is 403 forbidden
$responseCode = empty($responseCode) ? 403 : $responseCode;
$message = empty($message) ? get_lang('NotAuthorized') : $message;
@ -3688,7 +3690,7 @@ function api_not_allowed(
$exception = new Exception($message);
$request = Container::getRequest();
$exception = \Symfony\Component\Debug\Exception\FlattenException::create($exception, $responseCode);
$controller = new \Chamilo\ThemeBundle\Controller\ExceptionController(Container::getTwig(), false);
$controller = new \Chamilo\ThemeBundle\Controller\ExceptionController(Container::getTwig(), $debug);
$response = $controller->showAction($request, $exception);
$response->send();
exit;

Loading…
Cancel
Save