-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·93 lines (72 loc) · 3 KB
/
index.php
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
<?php
/*
* Application - Cashmaster 0.0.1
*/
session_start();
date_default_timezone_set('Europe/Moscow');
//error_reporting( E_ALL );
error_reporting( 0 );
$msie9 = preg_match('/(?i)msie [8-9]/',$_SERVER['HTTP_USER_AGENT']);
include 'app/view/htmlfix.php';
// Global data =============================================================
$program = 'CashMaster';
$data = array();
include 'app/model/directories.php';
// DB connection ===========================================================
include 'app/model/db/connection.php';
// OpenSSL setup ===========================================================
$openssl_pass = DB_PASS;
$openssl_method = 'aes128';
$openssl_iv = "CPI CashMaster 1";
$openssl = true; // FALSE - Отключено шифрование апдейтов
// Loads system configuration into session if it was not loaded
if (!isset($_SESSION[$program]['SystemConfiguration'])) {
include 'app/controller/common/set_systemconfiguration.php';
};
// System localization =====================================================
if (!isset($_SESSION[$program]['lang'])) {
include 'app/model/lang/'.strtolower($_SESSION[$program]['SystemConfiguration']['DefaultLanguage']).'.php';
};
// Autorization check ======================================================
include 'app/controller/auth.php';
// Load user localization if it was not loaded==============================
if (!isset($_SESSION[$program]['lang_loaded'])) {
include 'app/model/lang/'.strtolower($_SESSION[$program]['UserConfiguration']['InterfaceLanguage']).'.php';
$_SESSION[$program]['lang_loaded'] = true;
};
// Controller start ========================================================
$c = (isset($_GET['c'])) ? preg_replace("/[^a-z\_\/0-9]/",'', $_GET['c']) : 'index';
if ($c=='logout') {
include 'app/controller/logout.php';
exit;
};
// Если сервисный режим, то переходим на контроллер восстановления файлов
if ($_SESSION[$program]['SystemConfiguration']['FilesCorrupted']=="1"
AND $_SESSION[$program]['user_role_id']!='5') {
$c = 'restore_scripts';
};
switch ($_SESSION[$program]['user_role_id']) {
case '1':
$c = 'admin/'.$c;
break;
case '2':
$c = 'supervisor/'.$c;
break;
case '3':
$c = 'operator/'.$c;
break;
case '4':
$c = 'inspector/'.$c;
break;
case '5':
$c = 'developer/'.$c;
break;
}
if(file_exists('app/controller/'.$c.'.php')) {
include 'app/controller/'.$c.'.php';
} else {
include './app/view/under_development.php';
//echo 'ERROR 404 <br/> controller "'.htmlspecialchars($c).'" was not found';
//exit;
};
?>