drop support for php 7.4 (#5740)
[openemr.git] / interface / modules / zend_modules / public / index.php
blobdde35f4a37a3a980a04d452906428cfce1d9fefe
1 <?php
3 /**
4 * openemr/interface/modules/zend_modules/public/index.php
6 * @package OpenEMR
7 * @link https://www.open-emr.org
8 * @author Jacob T.Paul <jacob@zhservices.com>
9 * @author Shalini Balakrishnan <shalini@zhservices.com>
10 * @copyright Copyright (c) 2013 Z&H Consultancy Services Private Limited <sam@zhservices.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
14 /**
15 * This makes our life easier when dealing with paths. Everything is relative
16 * to the application root now.
19 //fetching controller name and action name from the SOAP request
20 $urlArray = explode('/', ($_SERVER['REQUEST_URI'] ?? ''));
21 $countUrlArray = count($urlArray);
22 preg_match('/\/(\w*)\?/', ($_SERVER['REQUEST_URI'] ?? ''), $matches);
23 $actionName = $matches[1] ?? '';
24 $controllerName = $urlArray[$countUrlArray - 2] ?? '';
26 //skipping OpenEMR authentication if the controller is SOAP and action is INDEX
27 //SOAP authentication is done in the controller EncounterccdadispatchController
28 if (!empty($_REQUEST['recipient']) && ($_REQUEST['recipient'] === 'patient') && $_REQUEST['site'] && $controllerName) {
29 $ignoreAuth_onsite_portal = false;
30 if (!empty($_REQUEST['me'])) {
31 session_id($_REQUEST['me']);
32 session_start();
34 if ($_SESSION['pid'] && $_SESSION['sessionUser'] === '-patient-' && $_SESSION['portal_init']) {
35 // Onsite portal was validated and patient authorized and re-validated via forwarded session.
36 $ignoreAuth_onsite_portal = true;
40 if (!empty($_REQUEST['me']) && $_REQUEST['sent_by_app'] === 'core_api') {
41 // pick up already running session from api's
42 session_id($_REQUEST['me']);
43 session_start();
46 require_once(__DIR__ . "/../../../globals.php");
47 require_once(__DIR__ . "/../../../../library/forms.inc.php");
48 require_once(__DIR__ . "/../../../../library/options.inc.php");
50 chdir(dirname(__DIR__));
52 // Run the application!
53 /** @var OpenEMR/Core/ModulesApplication
54 * Defined in globals.php
56 if (!empty($GLOBALS['modules_application'])) {
57 // $time_start = microtime(true);
58 // run the request lifecycle. The application has already inited in the globals.php
59 $GLOBALS['modules_application']->run();
60 // $time_end = microtime(true);
61 // echo "App runtime: " . ($time_end - $time_start) . "<br />";
62 } else {
63 die("global modules_application is not defined. Cannot run zend module request");