chore(deps): bump twig/twig from 3.17.1 to 3.19.0 (#7951)
[openemr.git] / interface / reports / cdr_log.php
blobe75b2ad04109d693bbbc32898e2a823df83213b9
1 <?php
3 /**
4 * CDR trigger log report.
6 * @package OpenEMR
7 * @link http://www.open-emr.org
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2015-2018 Brady Miller <brady.g.miller@gmail.com>
10 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
13 require_once("../globals.php");
14 require_once("../../library/patient.inc.php");
15 require_once "$srcdir/options.inc.php";
16 require_once "$srcdir/clinical_rules.php";
18 use OpenEMR\ClinicalDecisionRules\Interface\ControllerRouter;
19 use OpenEMR\Common\Twig\TwigContainer;
20 use Symfony\Component\HttpFoundation\Request;
21 use OpenEMR\Common\Csrf\CsrfInvalidException;
22 use OpenEMR\Common\Acl\AccessDeniedException;
23 use OpenEMR\Common\Logging\SystemLogger;
24 use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
25 use Symfony\Component\HttpFoundation\Response;
27 try {
28 $request = Request::createFromGlobals();
29 if (empty($request->get('action'))) {
30 $request->query->set('action', 'log!view');
32 $controllerRouter = new ControllerRouter();
33 $response = $controllerRouter->route($request);
34 } catch (AccessDeniedException | CsrfInvalidException $e) {
35 // Log the exception
36 (new SystemLogger())->errorLogCaller($e->getMessage(), ['trace' => $e->getTraceAsString()]);
37 $contents = (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('core/unauthorized.html.twig', ['pageTitle' => xl("Alerts Log")]);
38 // Send the error response
39 $response = new Response($contents, 403);
40 } catch (NotFoundHttpException $e) {
41 // Log the exception
42 (new SystemLogger())->errorLogCaller($e->getMessage(), ['trace' => $e->getTraceAsString()]);
43 $contents = (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('error/404.html.twig');
44 // Send the error response
45 $response = new Response($contents, 404);
46 } catch (Exception $e) {
47 // Log the exception
48 (new SystemLogger())->errorLogCaller($e->getMessage(), ['trace' => $e->getTraceAsString()]);
49 $contents = (new TwigContainer(null, $GLOBALS['kernel']))->getTwig()->render('error/general_http_error.html.twig');
50 // Send the error response
51 $response = new Response($contents, 500);
54 // Send the normal response
55 $response->send();
56 exit;