-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
/
dolibarr.php
440 lines (399 loc) · 16.8 KB
/
dolibarr.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
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
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
<?php
/* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
* Copyright (C) 2007-2012 Regis Houssin <regis@dolibarr.fr>
*
* 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 2 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/>.
*/
/**
* \file htdocs/admin/system/dolibarr.php
* \brief Page to show Dolibarr informations
*/
require '../../main.inc.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
$langs->load("admin");
$langs->load("install");
$langs->load("other");
if (! $user->admin)
accessforbidden();
/*
* View
*/
$form=new Form($db);
llxHeader();
print_fiche_titre($langs->trans("InfoDolibarr"),'','setup');
// Version
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionLastUpgrade").'</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionProgram").'</td><td>'.DOL_VERSION;
// If current version differs from last upgrade
if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
{
// Compare version with last install database version (upgrades never occured)
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_INSTALL));
}
else
{
// Compare version with last upgrade database version
if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE));
}
print '</td></tr>'."\n";
print '</table>';
print '<br>';
// Session
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentSessionTimeOut").'</td><td>'.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds");
print '</td><td align="right">';
print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
print "</td></tr>\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTheme").'</td><td colspan="2">'.$conf->theme.'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">';
if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) print $conf->smart_menu;
else print $conf->top_menu;
print '</td></tr>'."\n";
print '</table>';
print '<br>';
// Shmop
if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
{
$shmoparray=dol_listshmop();
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
print '<td>'.$langs->trans("NbOfEntries").'</td>';
print '<td align="right">'.$langs->trans("Address").'</td>';
print '</tr>'."\n";
foreach($shmoparray as $key => $val)
{
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$key.'</td>';
print '<td>'.count($val).'</td>';
print '<td align="right">'.dol_getshmopaddress($key).'</td>';
print '</tr>'."\n";
}
print '</table>';
print '<br>';
}
// Localisation
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre"><td>'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
// Thousands
$var=!$var;
$thousand=$langs->trans("SeparatorThousand");
if ($thousand == 'SeparatorThousand') $thousand=' '; // ' ' does not work on trans method
if ($thousand == 'None') $thousand='';
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorThousand").'</td><td>'.($thousand==' '?$langs->trans("Space"):$thousand).'</td></tr>'."\n";
// Decimals
$var=!$var;
$dec=$langs->trans("SeparatorDecimal");
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorDecimal").'</td><td>'.$dec.'</td></tr>'."\n";
// Show results of functions to see if everything works
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => price2num(1233.56+1)</td><td>'.price2num(1233.56+1,'2').'</td></tr>';
$var=!$var;
print "<tr ".$bc[$var].'><td width=\"300\"> => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td>";
if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
{
$var=!$var;
print "<tr ".$bc[$var].'><td width=\"300\"> => price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
print "</tr>\n";
}
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => price(1234.56)</td><td>'.price(1234.56).'</td>';
// Timezone
$txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n";
$txt.=$langs->trans("PHPTZ").' (php.ini date.timezone): '.(ini_get("date.timezone")?ini_get("date.timezone"):$langs->trans("NotDefined")).''."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
$a=getServerTimeZoneInt('now');
$b=getServerTimeZoneInt('winter');
$c=getServerTimeZoneInt('summer');
$daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
//print $a." ".$b." ".$c." ".$daylight;
$val=($a>=0?'+':'').$a;
$val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
$val.=' '.getServerTimeZoneString();
$val.=' '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight));
print $form->textwithtooltip($val,$txt,2,1,img_info(''));
print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0,"dayhourtext").'</td>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970,1,false).' (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')</td>';
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970,1,true).' (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')</td>';
// Parent company
/*
$var=!$var;
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CompanyTZ").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("CompanyHour").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
*/
// Client
$var=!$var;
$tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("ClientTZ").'</td><td>'.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')';
print ' '.$_SESSION['dol_tz_string'];
print ' '.$langs->trans("DaylingSavingTime").': ';
if ($_SESSION['dol_dst']>0) print yn(1);
else print yn(0);
if (! empty($_SESSION['dol_dst_first'])) print ' ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']),'dayhour','gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']),'dayhour','gmt').')';
print '</td></tr>'."\n";
print '</td></tr>'."\n";
$var=!$var;
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";
$var=!$var;
$filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("File encoding").' (php.ini unicode.filesystem_encoding)</td><td>'.$filesystemencoding.'</td></tr>'."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
$var=!$var;
$tmp=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1'; // By default for windows
if (empty($tmp)) $tmp='utf-8'; // By default for other
if (! empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp=$conf->global->MAIN_FILESYSTEM_ENCODING;
print '<tr '.$bc[$var].'><td width="300"> => '.$langs->trans("File encoding").'</td><td>'.$tmp.'</td></tr>'."\n"; // date.timezone must be in valued defined in http://fr3.php.net/manual/en/timezones.europe.php
print '</table>';
print '<br>';
// Parameters in conf.php file (when a parameter start with ?, it is shown only if defined)
$configfileparameters=array(
'dolibarr_main_url_root',
'dolibarr_main_url_root_alt',
'dolibarr_main_document_root',
'dolibarr_main_document_root_alt',
'dolibarr_main_data_root',
'separator',
'dolibarr_main_db_host',
'dolibarr_main_db_port',
'dolibarr_main_db_name',
'dolibarr_main_db_type',
'dolibarr_main_db_user',
'dolibarr_main_db_pass',
'dolibarr_main_db_character_set',
'dolibarr_main_db_collation',
'?dolibarr_main_db_prefix',
'separator',
'dolibarr_main_authentication',
'separator',
'?dolibarr_main_auth_ldap_login_attribute',
'?dolibarr_main_auth_ldap_host',
'?dolibarr_main_auth_ldap_port',
'?dolibarr_main_auth_ldap_version',
'?dolibarr_main_auth_ldap_dn',
'?dolibarr_main_auth_ldap_admin_login',
'?dolibarr_main_auth_ldap_admin_pass',
'?dolibarr_main_auth_ldap_debug',
'separator',
'?dolibarr_lib_ADODB_PATH',
'?dolibarr_lib_TCPDF_PATH',
'?dolibarr_lib_FPDI_PATH',
'?dolibarr_lib_NUSOAP_PATH',
'?dolibarr_lib_PHPEXCEL_PATH',
'?dolibarr_lib_GEOIP_PATH',
'?dolibarr_lib_ODTPHP_PATH',
'?dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'?dolibarr_js_CKEDITOR',
'?dolibarr_js_JQUERY',
'?dolibarr_js_JQUERY_UI',
'?dolibarr_js_JQUERY_FLOT',
'?dolibarr_font_DOL_DEFAULT_TTF',
'?dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator',
'?dolibarr_mailing_limit_sendbyweb',
'?dolibarr_strict_mode'
);
$configfilelib=array(
// 'separator',
$langs->trans("URLRoot"),
$langs->trans("URLRoot").' (alt)',
$langs->trans("DocumentRootServer"),
$langs->trans("DocumentRootServer").' (alt)',
$langs->trans("DataRootServer"),
'separator',
$langs->trans("DatabaseServer"),
$langs->trans("DatabasePort"),
$langs->trans("DatabaseName"),
$langs->trans("DriverType"),
$langs->trans("DatabaseUser"),
$langs->trans("DatabasePassword"),
$langs->trans("DBStoringCharset"),
$langs->trans("DBSortingCharset"),
$langs->trans("Prefix"),
'separator',
$langs->trans("AuthenticationMode"),
'separator',
'dolibarr_main_auth_ldap_login_attribute',
'dolibarr_main_auth_ldap_host',
'dolibarr_main_auth_ldap_port',
'dolibarr_main_auth_ldap_version',
'dolibarr_main_auth_ldap_dn',
'dolibarr_main_auth_ldap_admin_login',
'dolibarr_main_auth_ldap_admin_pass',
'dolibarr_main_auth_ldap_debug',
'separator',
'dolibarr_lib_ADODB_PATH',
'dolibarr_lib_TCPDF_PATH',
'dolibarr_lib_FPDI_PATH',
'dolibarr_lib_NUSOAP_PATH',
'dolibarr_lib_PHPEXCEL_PATH',
'dolibarr_lib_GEOIP_PATH',
'dolibarr_lib_ODTPHP_PATH',
'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
'dolibarr_js_CKEDITOR',
'dolibarr_js_JQUERY',
'dolibarr_js_JQUERY_UI',
'dolibarr_js_JQUERY_FLOT',
'dolibarr_font_DOL_DEFAULT_TTF',
'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
'separator',
'Limit nb of email sent by page',
'Strict mode is on/off'
);
$var=true;
print '<table class="noborder" width="100%">';
print '<tr class="liste_titre">';
print '<td width="300">'.$langs->trans("Parameters").' ';
print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
print '</td>';
print '<td>'.$langs->trans("Parameter").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
print '</tr>'."\n";
$i=0;
foreach($configfileparameters as $key)
{
$ignore=0;
if ($key == 'dolibarr_main_url_root_alt' && empty(${
$key})) $ignore=1;
if ($key == 'dolibarr_main_document_root_alt' && empty(${
$key})) $ignore=1;
if (empty($ignore))
{
$newkey = preg_replace('/^\?/','',$key);
if (preg_match('/^\?/',$key) && empty(${
$newkey}))
{
$i++;
continue; // We discard parametes starting with ?
}
if ($newkey == 'separator' && $lastkeyshown == 'separator')
{
$i++;
continue;
}
$var=!$var;
print "<tr ".$bc[$var].">";
if ($newkey == 'separator')
{
print '<td colspan="3"> </td>';
}
else
{
// Label
print "<td>".$configfilelib[$i].'</td>';
// Key
print '<td>'.$newkey.'</td>';
// Value
print "<td>";
if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${
$newkey});
else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${
$newkey})) print ${
$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${
$newkey})) print ${
$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
else print ${
$newkey};
if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently used by autodetect: '.DOL_MAIN_URL_ROOT.')';
print "</td>";
}
print "</tr>\n";
$lastkeyshown=$newkey;
}
$i++;
}
print '</table>';
print '<br>';
// Parameters in database
print '<table class="noborder">';
print '<tr class="liste_titre">';
print '<td>'.$langs->trans("Parameters").' '.$langs->trans("Database").'</td>';
print '<td>'.$langs->trans("Value").'</td>';
if (empty($conf->multicompany->enabled) || !$user->entity) print '<td align="center">'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
print "</tr>\n";
$sql = "SELECT";
$sql.= " rowid";
$sql.= ", ".$db->decrypt('name')." as name";
$sql.= ", ".$db->decrypt('value')." as value";
$sql.= ", type";
$sql.= ", note";
$sql.= ", entity";
$sql.= " FROM ".MAIN_DB_PREFIX."const";
if (empty($conf->multicompany->enabled))
{
// If no multicompany mode, admins can see global and their constantes
$sql.= " WHERE entity IN (0,".$conf->entity.")";
}
else
{
// If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
if ($user->entity) $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
}
$sql.= " ORDER BY entity, name ASC";
$resql = $db->query($sql);
if ($resql)
{
$num = $db->num_rows($resql);
$i = 0;
$var=True;
while ($i < $num)
{
$obj = $db->fetch_object($resql);
$var=!$var;
print '<tr '.$bc[$var].'>';
print '<td>'.$obj->name.'</td>'."\n";
print '<td>'.$obj->value.'</td>'."\n";
if (empty($conf->multicompany->enabled) || !$user->entity) print '<td align="center">'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
print "</tr>\n";
$i++;
}
}
print '</table>';
llxFooter();
$db->close();
?>