Highway to PSR2
[openemr.git] / interface / modules / zend_modules / public / index.php
bloba013feb4b55831f5281ac43ced5a58da6e474972
1 <?php
2 /* +-----------------------------------------------------------------------------+
3 * OpenEMR - Open Source Electronic Medical Record
4 * Copyright (C) 2013 Z&H Consultancy Services Private Limited <sam@zhservices.com>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @author Jacob T.Paul <jacob@zhservices.com>
19 * @author Shalini Balakrishnan <shalini@zhservices.com>
20 * +------------------------------------------------------------------------------+
23 /**
24 * This makes our life easier when dealing with paths. Everything is relative
25 * to the application root now.
29 //fetching controller name and action name from the SOAP request
30 $urlArray = explode('/', $_SERVER['REQUEST_URI']);
31 $countUrlArray = count($urlArray);
32 preg_match('/\/(\w*)\?/', $_SERVER['REQUEST_URI'], $matches);
33 $actionName = isset($matches[1]) ? $matches[1] : '';
34 $controllerName = isset($urlArray[$countUrlArray-2]) ? $urlArray[$countUrlArray-2] : '';
36 //skipping OpenEMR authentication if the controller is SOAP and action is INDEX
37 //SOAP authentication is done in the contoller EncounterccdadispatchController
38 if (strtolower($controllerName) == 'soap' && strtolower($actionName) == 'index') {
39 $ignoreAuth_offsite_portal = true;
40 } elseif ($_REQUEST['recipient'] === 'patient' && $_REQUEST['site'] && $controllerName) {
41 session_id($_REQUEST['me']);
42 session_start();
43 $ignoreAuth_onsite_portal_two = false; // eval'ed in globals but why not...
44 if ($_SESSION['pid'] && $_SESSION['sessionUser']=='-patient-' && $_SESSION['portal_init']) {
45 // Onsite portal was validated and patient authorized and re-validated via forwarded session.
46 $ignoreAuth_onsite_portal_two = true;
50 require_once(dirname(__FILE__)."/../../../globals.php");
51 require_once(dirname(__FILE__)."/../../../../library/forms.inc");
52 require_once(dirname(__FILE__)."/../../../../library/options.inc.php");
53 require_once(dirname(__FILE__)."/../../../../library/acl.inc");
54 require_once(dirname(__FILE__)."/../../../../library/log.inc");
56 chdir(dirname(__DIR__));
58 // Run the application!
59 Zend\Mvc\Application::init(require 'config/application.config.php')->run();