PageRenderTime 3ms CodeModel.GetById 177ms app.highlight 36ms RepoModel.GetById 110ms app.codeStats 0ms

/htdocs/admin/system/dolibarr.php

https://github.com/asterix14/dolibarr
PHP | 221 lines | 161 code | 22 blank | 38 comment | 29 complexity | 6bd8c93a1eb5b33257a1637cd23b4e43 MD5 | raw file
  1<?php
  2/* Copyright (C) 2005-2011 Laurent Destailleur  <eldy@users.sourceforge.net>
  3 * Copyright (C) 2007      Rodolphe Quiedeville <rodolphe@quiedeville.org>
  4 *
  5 * This program is free software; you can redistribute it and/or modify
  6 * it under the terms of the GNU General Public License as published by
  7 * the Free Software Foundation; either version 2 of the License, or
  8 * (at your option) any later version.
  9 *
 10 * This program is distributed in the hope that it will be useful,
 11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 13 * GNU General Public License for more details.
 14 *
 15 * You should have received a copy of the GNU General Public License
 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 17 */
 18
 19/**
 20 *  \file       htdocs/admin/system/dolibarr.php
 21 *  \brief      Page to show Dolibarr informations
 22 */
 23
 24require("../../main.inc.php");
 25require_once(DOL_DOCUMENT_ROOT."/core/lib/memory.lib.php");
 26require_once(DOL_DOCUMENT_ROOT."/core/lib/date.lib.php");
 27
 28$langs->load("admin");
 29$langs->load("install");
 30$langs->load("other");
 31
 32if (!$user->admin)
 33  accessforbidden();
 34
 35
 36/*
 37 * View
 38 */
 39
 40$form=new Form($db);
 41
 42llxHeader();
 43
 44print_fiche_titre("Dolibarr",'','setup');
 45
 46// Version
 47$var=true;
 48print '<table class="noborder" width="100%">';
 49print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
 50$var=!$var;
 51print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
 52$var=!$var;
 53print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionLastUpgrade").'</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
 54$var=!$var;
 55print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionProgram").'</td><td>'.DOL_VERSION;
 56// If current version differs from last upgrade
 57if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
 58{
 59	// Compare version with last install database version (upgrades never occured)
 60	if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_INSTALL));
 61}
 62else
 63{
 64	// Compare version with last upgrade database version
 65	if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE));
 66}
 67print '</td></tr>'."\n";
 68print '</table>';
 69print '<br>';
 70
 71// Session
 72$var=true;
 73print '<table class="noborder" width="100%">';
 74print '<tr class="liste_titre"><td>'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
 75$var=!$var;
 76print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
 77$var=!$var;
 78print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
 79$var=!$var;
 80print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
 81$var=!$var;
 82print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentSessionTimeOut").'</td><td>'.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds");
 83print '</td><td align="right">';
 84print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
 85print "</td></tr>\n";
 86$var=!$var;
 87print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTheme").'</td><td colspan="2">'.$conf->theme.'</td></tr>'."\n";
 88$var=!$var;
 89print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">';
 90if (preg_match('/^smartphone/',$conf->smart_menu) && isset($conf->browser->phone)) print $conf->smart_menu;
 91else print $conf->top_menu;
 92print '</td></tr>'."\n";
 93print '</table>';
 94print '<br>';
 95
 96
 97// Shmop
 98if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
 99{
100	$shmoparray=dol_listshmop();
101
102	$var=true;
103	print '<table class="noborder" width="100%">';
104	print '<tr class="liste_titre">';
105	print '<td>'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
106	print '<td>'.$langs->trans("NbOfEntries").'</td>';
107	print '<td align="right">'.$langs->trans("Address").'</td>';
108	print '</tr>'."\n";
109
110	foreach($shmoparray as $key => $val)
111	{
112		$var=!$var;
113		print '<tr '.$bc[$var].'><td width="300">'.$key.'</td>';
114		print '<td>'.count($val).'</td>';
115		print '<td align="right">'.dol_getshmopaddress($key).'</td>';
116		print '</tr>'."\n";
117	}
118
119	print '</table>';
120	print '<br>';
121}
122
123
124// Localisation
125$var=true;
126print '<table class="noborder" width="100%">';
127print '<tr class="liste_titre"><td>'.$langs->trans("LocalisationDolibarrParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
128$var=!$var;
129print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
130$var=!$var;
131print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
132// Thousands
133$var=!$var;
134$thousand=$langs->trans("SeparatorThousand");
135if ($thousand == 'SeparatorThousand') $thousand=' ';	// ' ' does not work on trans method
136if ($thousand == 'None') $thousand='';
137print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorThousand").'</td><td>'.($thousand==' '?$langs->trans("Space"):$thousand).'</td></tr>'."\n";
138// Decimals
139$var=!$var;
140$dec=$langs->trans("SeparatorDecimal");
141print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorDecimal").'</td><td>'.$dec.'</td></tr>'."\n";
142// Show results of functions to see if everything works
143$var=!$var;
144print '<tr '.$bc[$var].'><td width="300">&nbsp; => price2num(1233.56+1)</td><td>'.price2num(1233.56+1,'2').'</td></tr>';
145$var=!$var;
146print "<tr ".$bc[$var].'><td width=\"300\">&nbsp; => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td>";
147if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
148{
149	$var=!$var;
150	print "<tr ".$bc[$var].'><td width=\"300\">&nbsp; => price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
151	print "</tr>\n";
152}
153$var=!$var;
154print '<tr '.$bc[$var].'><td width="300">&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td>';
155// Timezone
156$txt =$langs->trans("OSTZ").' (variable system TZ): '.($_ENV["TZ"]?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n";
157$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
158if (function_exists('date_default_timezone_get'))
159{
160	$var=!$var;
161	print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>';	// Timezone server PHP
162	$a=date_default_timezone_get();
163	$a.=' '.getCurrentTimeZone();
164	$a.=' ('.(-dol_mktime(0,0,0,1,1,1970)>0?'+':'').(-dol_mktime(0,0,0,1,1,1970)).')';
165    print $form->textwithtooltip($a,$txt,2,1,img_info(''));
166	print '</td></tr>'."\n";	// value defined in http://fr3.php.net/manual/en/timezones.europe.php
167}
168else
169{
170    $var=!$var;
171    print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("PHPServerOffsetWithGreenwich").'</td><td>';
172    $a=(-dol_mktime(0,0,0,1,1,1970)>0?'+':'').(-dol_mktime(0,0,0,1,1,1970));
173    print $form->textwithtooltip($a,$txt,2,1,img_info(''));
174    print '</td></tr>'."\n";
175}
176$var=!$var;
177print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
178$var=!$var;
179print '<tr '.$bc[$var].'><td width="300">&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0,"dayhourtext").'</td>';
180$var=!$var;
181print '<tr '.$bc[$var].'><td width="300">&nbsp; => dol_get_first_day(1970,1,false)</td><td>'.dol_get_first_day(1970,1,false).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,false),'dayhour').')</td>';
182$var=!$var;
183print '<tr '.$bc[$var].'><td width="300">&nbsp; => dol_get_first_day(1970,1,true)</td><td>'.dol_get_first_day(1970,1,true).' &nbsp; &nbsp; (=> dol_print_date() or idate() of this value = '.dol_print_date(dol_get_first_day(1970,1,true),'dayhour').')</td>';
184// Parent company
185$var=!$var;
186print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CompanyTZ").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
187$var=!$var;
188print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("CompanyHour").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
189// Client
190$var=!$var;
191print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("ClientTZ").'</td><td>'.($_SESSION['dol_tz']!=''?($_SESSION['dol_tz']>=0?'+':'').$_SESSION['dol_tz']:'').' ('.($_SESSION['dol_tz']>=0?'+':'').($_SESSION['dol_tz']*60*60).')</td></tr>'."\n";
192//$var=!$var;
193//print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("ClientOffsetWithGreenwich").'</td><td>'..'</td></tr>'."\n";
194$var=!$var;
195print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("DaylingSavingTime").'</td><td>';
196if ($_SESSION['dol_dst']>0)
197{
198    print ($_SESSION['dol_dst']>0?'+':'').($_SESSION['dol_dst']).' ('.($_SESSION['dol_dst']>0?'+':'').($_SESSION['dol_dst']*60*60).')';
199}
200else print yn(0);
201if (isset($_SESSION['dol_dst_first'])) print ' &nbsp; &nbsp; ('.dol_print_date(dol_stringtotime($_SESSION['dol_dst_first']),'dayhour','gmt').' - '.dol_print_date(dol_stringtotime($_SESSION['dol_dst_second']),'dayhour','gmt').')';
202print '</td></tr>'."\n";
203$var=!$var;
204print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";
205
206$var=!$var;
207$filesystemencoding=ini_get("unicode.filesystem_encoding");	// Disponible avec PHP 6.0
208print '<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
209
210$var=!$var;
211$tmp=ini_get("unicode.filesystem_encoding");						// Disponible avec PHP 6.0
212if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1';	// By default for windows
213if (empty($tmp)) $tmp='utf-8';										// By default for other
214if (! empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp=$conf->global->MAIN_FILESYSTEM_ENCODING;
215print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$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
216
217print '</table>';
218print '<br>';
219
220llxFooter();
221?>