-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
97 lines (91 loc) · 3.42 KB
/
index.php
File metadata and controls
97 lines (91 loc) · 3.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
<?php
/**
* GaiaEHR (Electronic Health Records)
* Copyright (C) 2013 Certun, LLC.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
session_name('PhoneADoctor'); //[Update] : Change Session Name to PhoneADoctor
session_start();
session_cache_limiter('private');
define('_GaiaEXEC', 1);
$_SESSION['version'] = '1.0.000'; //[Update] : PhoneADoctor Version '0.7.210';
$_SESSION['extjs'] = 'extjs-4.1.1a';
//include_once('classes/Mobile_Detect.php');
//$mobile = new Mobile_Detect();
$site = (isset($_GET['site']) ? $_GET['site'] : 'default');
$mDebug = false;
//if($mobile->isMobile() || $mDebug){
// header('Location: _aire/?site='.$site);
//}else{
/**
* Startup the registry
* This contains SESSION Variables to use in the application
* and mobile_detect class is used to detect mobile browsers.
*/
include_once('registry.php');
/**
* set the site using the url parameter site, or default if not given
*/
if(file_exists('sites/' . $site . '/conf.php')){
include_once('sites/' . $site . '/conf.php');
} else {
$_SESSION['site'] = array('error' => 'Site configuration file not found, Please contact Support Desk. Thanks!');
};
/**
* Make the auth process
* lets check for 4 things to allow the user in
* 1. $_SESSION['user'] is set (this helps to app clean of PHP NOTICES)
* 2. $_SESSION['user']['auth'] is true (check if the user is authorized)
* 3. $_SESSION['user']['site'] is $site ($site == $_GET['site] or 'default')
* 4. $_SESSION['inactive']['life'] is less than $_SESSION['inactive']['time']
* (to make sure ths user hasn't been out for a long time)
*
*/
if(isset($_SESSION['user']) && $_SESSION['user']['auth'] == true && $_SESSION['user']['site'] == $site && $_SESSION['inactive']['life'] < $_SESSION['inactive']['time']){
/**
* if mobile go to mobile app, else go to app
*/
$_SESSION['install'] = false;
if(isset($_SESSION['site']['checkInMode']) && $_SESSION['site']['checkInMode']){
include_once('checkin/checkin.php');
} else {
if(isset($_REQUEST['dual']) && $_REQUEST['dual']){
include_once('_dual.php');
}else{
include_once('_app.php');
}
}
} else { // Make the logon process or Setup process
/**
* If no directory is found inside sites dir run the setup wizard,
* if a directory is found inside sites dir run the logon screen
*/
if(count($_SESSION['sites']) < 1){
unset($_SESSION['site']);
$_SESSION['install'] = true;
include_once('_install.php');
} elseif (isset($_SESSION['forgot']) && $_SESSION['forgot'] == true) { // [New] : Added for Forgot Password
$_SESSION['user']['auth'] = false;
$_SESSION['install'] = false;
unset($_SESSION['forgot']);
include_once('_forgot.php');
}else {
$_SESSION['user']['auth'] = false;
$_SESSION['install'] = false;
include_once('_login.php');
}
}
//}
$_SESSION['inactive']['timeout'] = time();