-
Notifications
You must be signed in to change notification settings - Fork 5
/
config.inc
219 lines (197 loc) · 9.04 KB
/
config.inc
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
<?php
// Database Parameters => please modify the content of database.inc file, or use the installer
require BASE . '/../database.inc';
// Active Directory vars
$ADLogin = false;
$ADServer = "ldap://domaincontroller.yourcomapany.local";
$ADDomain = "YOURCOMPANY";
// LDAP vars
$ldapLogin = false;
$ldapUrl = "ldap://ldap.yourCompany.com"; // address or IP of LDAP serveur
$ldap_domain = 'DOMAINENAME'; // LDAP domain
$ldapBase = "ou=people,dc=society,dc=com";
$ldapFilter = "(&(objectClass=OpenLDAPperson)(uid={login}))";
$ldap_use_tls = false;
$ldapBindUser;
$ldapBindPassword = '';
// custom variables
define('COMPIL_DIR', BASE . '/../smarty/templates_c/'); // templates compil directory, must have read/write access
define('UPLOAD_DIR', BASE . '/../www/upload/files/'); // upload file directory, must have read/write access
define('SAVE_DIR', BASE . '/../www/upload/backup/'); // backup directory, must have read/write access
// number of results per page
define('NB_RESULT_PER_PAGE', 30);
// define how many items to display in the filter menus in the planning
define('FILTER_NB_USERS_PER_COLUMN', '18');
define('FILTER_NB_PROJECTS_PER_COLUMN', '18');
define('FILTER_NB_AERA_PER_COLUMN', '15');
define('FILTER_NB_RESSOURCES_PER_COLUMN', '15');
define('MIN_CELL_SIZE', '25');
define('MAX_CELL_SIZE', '200');
define('MIN_CODE_SIZE', '3');
define('MAX_CODE_SIZE', '40');
define('MAX_SIZE_UPLOAD', '20971520');
define('DEBUG', false); // put TRUE for debug
define('DEV_MAIL', '[email protected]');
// Redirection
define('HOME_REDIRECTION','Location: ' . BASE);
// ----------------------------------------------------------------------------
// DO NOT MODIFY ANYTHING AFTER THIS LINE
// ----------------------------------------------------------------------------
if(DEBUG) {
error_reporting(E_ALL | E_ERROR | E_WARNING | E_PARSE | E_NOTICE | E_DEPRECATED | E_STRICT);
} else {
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING | E_DEPRECATED));
}
define('CRLF', "\n");
// redirection possible vers installer / upgrade
require BASE . '/../includes/class_version.inc';
$version = new Version();
if($version->checkPhpVersion() !== TRUE) {
echo "<span style=''>PHP Version too old. Now SOPlanning requires PHP 7.2 at least. Contact our support if you need us to host it for you : [email protected]<br><br>Votre version de PHP est trop ancienne. Maintenant SOPlanning requiert la version 7.2 à minima. Contactez notre support si vous avez besoin d'aide pour l'hébergement : [email protected]</span>";
die;
}
require_once BASE . '/../vendor/smarty/smarty/libs/Smarty.class.php';
function autoloadSOPlanning($nomClasse) {
if($nomClasse == 'PHPMailer') {
require BASE . '/../phpmailer/class.phpmailer.php';
}elseif($nomClasse == 'SMTP') {
require BASE . '/../phpmailer/class.smtp.php';
}elseif($nomClasse == 'HTML2PDF_locale') {
require BASE . '/../html2pdf/_class/locale.class.php';
}elseif($nomClasse == 'HTML2PDF_myPdf') {
require BASE . '/../html2pdf/_class/myPdf.class.php';
}elseif($nomClasse == 'HTML2PDF_parsingCss') {
require BASE . '/../html2pdf/_class/parsingCss.class.php';
}elseif($nomClasse == 'HTML2PDF_parsingHtml') {
require BASE . '/../html2pdf/_class/parsingHtml.class.php';
}elseif($nomClasse == 'TCPDF') {
require BASE . '/../html2pdf/vendor/tecnickcom/tcpdf/tcpdf.php';
} elseif (is_file(BASE . '/../includes/class_' . strtolower($nomClasse) . '.inc')) {
require BASE . '/../includes/class_' . strtolower($nomClasse) . '.inc';
}
}
spl_autoload_register("autoloadSOPlanning");
require_once BASE . '/../vendor/autoload.php';
// Librairies
require BASE . '/../includes/lib.inc';
require BASE . '/../includes/xajax_common.inc';
require BASE . '/../includes/db_wrapper.inc';
if($version->checkDBAccess() !== TRUE || $version->checkDatabaseVersion() !== TRUE) {
if(strpos($_SERVER['REQUEST_URI'], '/install/') === FALSE) {
echo "<script>top.location='" . BASE . "/install/'</script>";
exit;
}
} else {
// chargement des données de config
$configs = db_query('SELECT * FROM planning_config');
while($configTemp = db_fetch_array($configs)) {
define('CONFIG_' . $configTemp['cle'], $configTemp['valeur']);
}
// Ouverture de la session
session_name($cfgDatabase . $cfgPrefix);
}
if(defined("CONFIG_TIMEZONE")){
date_default_timezone_set(CONFIG_TIMEZONE);
} else{
date_default_timezone_set('Europe/Paris');
}
header('Content-Type: text/html; charset=iso-8859-1');
header("X-Frame-Options: SAMEORIGIN");
session_start();
if(!isset($_SESSION['CRSF'])){
$_SESSION['CRSF'] = md5(uniqid(mt_rand(), true));
}
// Préférence format date
// on garde le format dd/mm/yyyy partout
if (isset($_SESSION['preferences']['dateformat']) && 1 == 0)
{
switch($_SESSION['preferences']['dateformat']) {
case 'fr':
define ('CONFIG_DATE_LONG','d/m/Y');
define ('CONFIG_DATE_SHORT','d/m/y');
define ('CONFIG_DATE_SHORT2','d/m');
define ('CONFIG_DATE_FIRST_DAY_MONTH','01/m/Y');
define ('CONFIG_DATE_DATEPICKER','dd/mm/yyyy');
define ('CONFIG_DATE_FORMAT','fr');
break;
case 'us':
define ('CONFIG_DATE_LONG','m-d-Y');
define ('CONFIG_DATE_SHORT','m-d-y');
define ('CONFIG_DATE_SHORT2','m-d');
define ('CONFIG_DATE_FIRST_DAY_MONTH','m-01-Y');
define ('CONFIG_DATE_DATEPICKER','mm-dd-yyyy');
define ('CONFIG_DATE_FORMAT','us');
break;
case 'jp':
define ('CONFIG_DATE_LONG','Y-m-d');
define ('CONFIG_DATE_SHORT','y-m-d');
define ('CONFIG_DATE_SHORT2','m-d');
define ('CONFIG_DATE_FIRST_DAY_MONTH','Y-m-01');
define ('CONFIG_DATE_DATEPICKER','yyyy-mm-dd');
define ('CONFIG_DATE_FORMAT','jp');
break;
default :
$_SESSION['preferences']['dateformat']='fr';
define ('CONFIG_DATE_LONG','d/m/Y');
define ('CONFIG_DATE_SHORT','d/m/y');
define ('CONFIG_DATE_SHORT2','d/m');
define ('CONFIG_DATE_FIRST_DAY_MONTH','01/m/Y');
define ('CONFIG_DATE_DATEPICKER','dd/mm/yyyy');
define ('CONFIG_DATE_FORMAT','fr');
break;
}
}else {
$_SESSION['preferences']['dateformat']='fr';
define ('CONFIG_DATE_LONG','d/m/Y');
define ('CONFIG_DATE_SHORT','d/m/y');
define ('CONFIG_DATE_SHORT2','d/m');
define ('CONFIG_DATE_FIRST_DAY_MONTH','01/m/Y');
define ('CONFIG_DATE_DATEPICKER','dd/mm/yyyy');
define ('CONFIG_DATE_FORMAT','fr');
}
// Mobile Detection
$detect = new Mobile_Detect;
if($detect->isMobile())
{
$_SESSION['isMobileOrTablet'] = 1;
} else {
$_SESSION['isMobileOrTablet'] = 0;
}
$cfgAvailableLanguages = array(
'fr' => array('fr([-_][[:alpha:]]{2})?|french', 'fr'),
'it' => array('it([-_][[:alpha:]]{2})?|italian', 'it'),
'en' => array('en([-_][[:alpha:]]{2})?|english', 'en'),
'nl' => array('nl([-_][[:alpha:]]{2})?|nederlands', 'nl'),
'de' => array('de([-_][[:alpha:]]{2})?|german', 'de'),
'es' => array('es([-_][[:alpha:]]{2})?|spanish', 'es'),
'da' => array('da([-_][[:alpha:]]{2})?|danish', 'da'),
'hu' => array('hu([-_][[:alpha:]]{2})?|hungarian', 'hu'),
'pt' => array('pt([-_][[:alpha:]]{2})?|portuguese', 'pt'),
'pl' => array('pl([-_][[:alpha:]]{2})?|polish', 'pl'),
'br' => array('pt-br?|brazilian', 'br'),
'id' => array('id([-_][[:alpha:]]{2})?|indonesian', 'id')
);
$langueDefaut = 'en';
$lang = $langueDefaut;
if(isset($_GET) && !empty($_GET['language']) && in_array($_GET['language'], array('fr', 'en', 'it', 'nl', 'de', 'pt', 'da', 'hu', 'es', 'pl', 'br','id'))){
$_SESSION['language'] = $_GET['language'];
$lang = $_GET['language'];
} elseif (isset($_SESSION['language']) && in_array($_SESSION['language'], array('fr', 'en', 'it', 'nl', 'de', 'pt', 'da', 'hu', 'es', 'pl', 'br','id'))) {
$lang = $_SESSION['language'];
} else {
$_SESSION['language'] = detectLanguage($langueDefaut);
$lang = detectLanguage($langueDefaut);
}
setlocale(LC_ALL, $lang . '_' . strtoupper($lang), $lang . '_' . strtoupper($lang) . '.ISO8859-1', $lang . '_' . strtoupper($lang) . '.ISO-8859-1', $lang . '_' . strtoupper($lang) . '.UTF-8', $lang . '_' . strtoupper($lang) . '.UTF8', $lang);
// possible values for sorting option in the planning
$triPlanningPossibleUser = array('nom asc', 'nom desc', 'user_id asc', 'user_id desc', 'team_nom asc, nom asc', 'team_nom desc, nom desc', 'team_nom asc, user_id asc', 'team_nom desc, user_id desc');
$triPlanningPossibleProjet = array('nom asc', 'nom desc', 'projet_id asc', 'projet_id desc', 'groupe_nom asc, nom asc', 'groupe_nom desc, nom desc', 'groupe_nom asc, projet_id asc', 'groupe_nom desc, projet_id desc');
$triPlanningPossibleAutre = array('nom asc', 'nom desc');
$default_palette="['#aa2e25','#f44336','#f6685e','#a31545','#e91e63','#ed4b82','#6d1b7b','#9c27b0'],
['#af52bf','#482880','#673ab7','#8561c5','#2c387e','#3f51b5','#6573c3','#1769aa'],
['#2196f3','#4dabf5','#0276aa','#03a9f4','#35baf6','#008394','#00bcd4','#33c9dc'],
['#00695f','#009688','#33ab9f','#357a38','#4caf50','#6fbf73','#618833','#8bc34a'],
['#a2cf6e','#8f9a27','#cddc39','#d7e360','#b2a429','#ffeb3b','#ffef62','#b28704'],
['#ffc107','#ffcd38','#b26a00','#ff9800','#ffac33','#b23c17','#ff5722','#ff784e'],
['#ffffff']";
?>