PageRenderTime 51ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/htdocs/admin/system/dolibarr.php

https://bitbucket.org/speedealing/speedealing
PHP | 375 lines | 282 code | 42 blank | 51 comment | 67 complexity | f977b7361c05b52003cb4a4b73eb6685 MD5 | raw file
Possible License(s): LGPL-3.0, LGPL-2.1, GPL-3.0, MIT
  1. <?php
  2. /* Copyright (C) 2005-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. * Copyright (C) 2007 Rodolphe Quiedeville <rodolphe@quiedeville.org>
  4. * Copyright (C) 2007-2012 Regis Houssin <regis.houssin@capnetworks.com>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /**
  20. * \file htdocs/admin/system/dolibarr.php
  21. * \brief Page to show Dolibarr informations
  22. */
  23. require '../../main.inc.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/memory.lib.php';
  25. require_once DOL_DOCUMENT_ROOT.'/core/lib/date.lib.php';
  26. $langs->load("admin");
  27. $langs->load("install");
  28. $langs->load("other");
  29. if (! $user->admin)
  30. accessforbidden();
  31. /*
  32. * View
  33. */
  34. $form=new Form($db);
  35. llxHeader();
  36. print_fiche_titre($langs->trans("InfoSpeedealing"),'','setup');
  37. // Version
  38. $var=true;
  39. print '<table class="noborder" width="100%">';
  40. print '<tr class="liste_titre"><td>'.$langs->trans("Version").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
  41. $var=!$var;
  42. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionLastInstall").'</td><td>'.$conf->global->MAIN_VERSION_LAST_INSTALL.'</td></tr>'."\n";
  43. $var=!$var;
  44. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionLastUpgrade").'</td><td>'.$conf->global->MAIN_VERSION_LAST_UPGRADE.'</td></tr>'."\n";
  45. $var=!$var;
  46. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("VersionProgram").'</td><td>'.DOL_VERSION;
  47. // If current version differs from last upgrade
  48. if (empty($conf->global->MAIN_VERSION_LAST_UPGRADE))
  49. {
  50. // Compare version with last install database version (upgrades never occured)
  51. if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_INSTALL) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_INSTALL));
  52. }
  53. else
  54. {
  55. // Compare version with last upgrade database version
  56. if (DOL_VERSION != $conf->global->MAIN_VERSION_LAST_UPGRADE) print ' '.img_warning($langs->trans("RunningUpdateProcessMayBeRequired",DOL_VERSION,$conf->global->MAIN_VERSION_LAST_UPGRADE));
  57. }
  58. print '</td></tr>'."\n";
  59. print '</table>';
  60. print '<br>';
  61. // Session
  62. $var=true;
  63. print '<table class="noborder" width="100%">';
  64. print '<tr class="liste_titre"><td>'.$langs->trans("Session").'</td><td colspan="2">'.$langs->trans("Value").'</td></tr>'."\n";
  65. $var=!$var;
  66. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionSavePath").'</td><td colspan="2">'.session_save_path().'</td></tr>'."\n";
  67. $var=!$var;
  68. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionName").'</td><td colspan="2">'.session_name().'</td></tr>'."\n";
  69. $var=!$var;
  70. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("SessionId").'</td><td colspan="2">'.session_id().'</td></tr>'."\n";
  71. $var=!$var;
  72. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentSessionTimeOut").'</td><td>'.ini_get('session.gc_maxlifetime').' '.$langs->trans("seconds");
  73. print '</td><td align="right">';
  74. print $form->textwithpicto('',$langs->trans("SessionExplanation",ini_get("session.gc_probability"),ini_get("session.gc_divisor")));
  75. print "</td></tr>\n";
  76. $var=!$var;
  77. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTheme").'</td><td colspan="2">'.$conf->theme.'</td></tr>'."\n";
  78. $var=!$var;
  79. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentMenuHandler").'</td><td colspan="2">';
  80. if (preg_match('/^smartphone/',$conf->smart_menu) && ! empty($conf->browser->phone)) print $conf->smart_menu;
  81. else print $conf->top_menu;
  82. print '</td></tr>'."\n";
  83. print '</table>';
  84. print '<br>';
  85. // Shmop
  86. if (isset($conf->global->MAIN_OPTIMIZE_SPEED) && ($conf->global->MAIN_OPTIMIZE_SPEED & 0x02))
  87. {
  88. $shmoparray=dol_listshmop();
  89. $var=true;
  90. print '<table class="noborder" width="100%">';
  91. print '<tr class="liste_titre">';
  92. print '<td>'.$langs->trans("LanguageFilesCachedIntoShmopSharedMemory").'</td>';
  93. print '<td>'.$langs->trans("NbOfEntries").'</td>';
  94. print '<td align="right">'.$langs->trans("Address").'</td>';
  95. print '</tr>'."\n";
  96. foreach($shmoparray as $key => $val)
  97. {
  98. $var=!$var;
  99. print '<tr '.$bc[$var].'><td width="300">'.$key.'</td>';
  100. print '<td>'.count($val).'</td>';
  101. print '<td align="right">'.dol_getshmopaddress($key).'</td>';
  102. print '</tr>'."\n";
  103. }
  104. print '</table>';
  105. print '<br>';
  106. }
  107. // Localisation
  108. $var=true;
  109. print '<table class="noborder" width="100%">';
  110. print '<tr class="liste_titre"><td>'.$langs->trans("LocalisationSpeedealingParameters").'</td><td>'.$langs->trans("Value").'</td></tr>'."\n";
  111. $var=!$var;
  112. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("LanguageBrowserParameter","HTTP_ACCEPT_LANGUAGE").'</td><td>'.$_SERVER["HTTP_ACCEPT_LANGUAGE"].'</td></tr>'."\n";
  113. $var=!$var;
  114. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentUserLanguage").'</td><td>'.$langs->getDefaultLang().'</td></tr>'."\n";
  115. // Thousands
  116. $var=!$var;
  117. $thousand=$langs->trans("SeparatorThousand");
  118. if ($thousand == 'SeparatorThousand') $thousand=' '; // ' ' does not work on trans method
  119. if ($thousand == 'None') $thousand='';
  120. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorThousand").'</td><td>'.($thousand==' '?$langs->trans("Space"):$thousand).'</td></tr>'."\n";
  121. // Decimals
  122. $var=!$var;
  123. $dec=$langs->trans("SeparatorDecimal");
  124. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentValueSeparatorDecimal").'</td><td>'.$dec.'</td></tr>'."\n";
  125. // Show results of functions to see if everything works
  126. $var=!$var;
  127. print '<tr '.$bc[$var].'><td width="300">&nbsp; => price2num(1233.56+1)</td><td>'.price2num(1233.56+1,'2').'</td></tr>';
  128. $var=!$var;
  129. print "<tr ".$bc[$var].'><td width=\"300\">&nbsp; => price2num('."'1".$thousand."234".$dec."56')</td><td>".price2num("1".$thousand."234".$dec."56",'2')."</td>";
  130. if (($thousand != ',' && $thousand != '.') || ($thousand != ' '))
  131. {
  132. $var=!$var;
  133. print "<tr ".$bc[$var].'><td width=\"300\">&nbsp; => price2num('."'1 234.56')</td><td>".price2num("1 234.56",'2')."</td>";
  134. print "</tr>\n";
  135. }
  136. $var=!$var;
  137. print '<tr '.$bc[$var].'><td width="300">&nbsp; => price(1234.56)</td><td>'.price(1234.56).'</td>';
  138. // Timezone
  139. $txt =$langs->trans("OSTZ").' (variable system TZ): '.(! empty($_ENV["TZ"])?$_ENV["TZ"]:$langs->trans("NotDefined")).'<br>'."\n";
  140. $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
  141. $var=!$var;
  142. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CurrentTimeZone").'</td><td>'; // Timezone server PHP
  143. $a=getServerTimeZoneInt('now');
  144. $b=getServerTimeZoneInt('winter');
  145. $c=getServerTimeZoneInt('summer');
  146. $daylight=(is_numeric($c) && is_numeric($b))?round($c-$b):'unknown';
  147. //print $a." ".$b." ".$c." ".$daylight;
  148. $val=($a>=0?'+':'').$a;
  149. $val.=' ('.($a==='unknown'?'unknown':($a>=0?'+':'').($a*3600)).')';
  150. $val.=' &nbsp; &nbsp; &nbsp; '.getServerTimeZoneString();
  151. $val.=' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': '.($daylight==='unknown'?'unknown':yn($daylight));
  152. print $form->textwithtooltip($val,$txt,2,1,img_info(''));
  153. print '</td></tr>'."\n"; // value defined in http://fr3.php.net/manual/en/timezones.europe.php
  154. $var=!$var;
  155. print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("CurrentHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzserver').'</td></tr>'."\n";
  156. $var=!$var;
  157. print '<tr '.$bc[$var].'><td width="300">&nbsp; => dol_print_date(0,"dayhourtext")</td><td>'.dol_print_date(0,"dayhourtext").'</td>';
  158. $var=!$var;
  159. print '<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>';
  160. $var=!$var;
  161. print '<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>';
  162. // Parent company
  163. /*
  164. $var=!$var;
  165. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("CompanyTZ").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
  166. $var=!$var;
  167. print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("CompanyHour").'</td><td>'.$langs->trans("FeatureNotYetAvailable").'</td></tr>'."\n";
  168. */
  169. // Client
  170. $var=!$var;
  171. $tz=(int) $_SESSION['dol_tz'] + (int) $_SESSION['dol_dst'];
  172. print '<tr '.$bc[$var].'><td width="300">'.$langs->trans("ClientTZ").'</td><td>'.($tz?($tz>=0?'+':'').$tz:'').' ('.($tz>=0?'+':'').($tz*60*60).')';
  173. print ' &nbsp; &nbsp; &nbsp; '.$_SESSION['dol_tz_string'];
  174. print ' &nbsp; &nbsp; &nbsp; '.$langs->trans("DaylingSavingTime").': ';
  175. if ($_SESSION['dol_dst']>0) print yn(1);
  176. else print yn(0);
  177. if (! empty($_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').')';
  178. print '</td></tr>'."\n";
  179. print '</td></tr>'."\n";
  180. $var=!$var;
  181. print '<tr '.$bc[$var].'><td width="300">&nbsp; => '.$langs->trans("ClientHour").'</td><td>'.dol_print_date(dol_now(),'dayhour','tzuser').'</td></tr>'."\n";
  182. $var=!$var;
  183. $filesystemencoding=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
  184. 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
  185. $var=!$var;
  186. $tmp=ini_get("unicode.filesystem_encoding"); // Disponible avec PHP 6.0
  187. if (empty($tmp) && ! empty($_SERVER["WINDIR"])) $tmp='iso-8859-1'; // By default for windows
  188. if (empty($tmp)) $tmp='utf-8'; // By default for other
  189. if (! empty($conf->global->MAIN_FILESYSTEM_ENCODING)) $tmp=$conf->global->MAIN_FILESYSTEM_ENCODING;
  190. print '<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
  191. print '</table>';
  192. print '<br>';
  193. // Parameters in conf.php file (when a parameter start with ?, it is shown only if defined)
  194. $configfileparameters=array(
  195. 'dolibarr_main_url_root' => $langs->trans("URLRoot"),
  196. 'dolibarr_main_url_root_alt' => $langs->trans("URLRoot").' (alt)',
  197. 'dolibarr_main_document_root'=> $langs->trans("DocumentRootServer"),
  198. 'dolibarr_main_document_root_alt' => $langs->trans("DocumentRootServer").' (alt)',
  199. 'dolibarr_main_data_root' => $langs->trans("DataRootServer"),
  200. 'separator' => '',
  201. 'dolibarr_main_db_host' => $langs->trans("DatabaseServer"),
  202. 'dolibarr_main_db_port' => $langs->trans("DatabasePort"),
  203. 'dolibarr_main_db_name' => $langs->trans("DatabaseName"),
  204. 'dolibarr_main_db_type' => $langs->trans("DriverType"),
  205. 'dolibarr_main_db_user' => $langs->trans("DatabaseUser"),
  206. 'dolibarr_main_db_pass' => $langs->trans("DatabasePassword"),
  207. 'dolibarr_main_db_character_set' => $langs->trans("DBStoringCharset"),
  208. 'dolibarr_main_db_collation' => $langs->trans("DBSortingCollation"),
  209. '?dolibarr_main_db_prefix' => $langs->trans("Prefix"),
  210. 'separator' => '',
  211. 'dolibarr_main_authentication' => $langs->trans("AuthenticationMode"),
  212. 'separator'=> '',
  213. '?dolibarr_main_auth_ldap_login_attribute' => 'dolibarr_main_auth_ldap_login_attribute',
  214. '?dolibarr_main_auth_ldap_host' => 'dolibarr_main_auth_ldap_host',
  215. '?dolibarr_main_auth_ldap_port' => 'dolibarr_main_auth_ldap_port',
  216. '?dolibarr_main_auth_ldap_version' => 'dolibarr_main_auth_ldap_version',
  217. '?dolibarr_main_auth_ldap_dn' => 'dolibarr_main_auth_ldap_dn',
  218. '?dolibarr_main_auth_ldap_admin_login' => 'dolibarr_main_auth_ldap_admin_login',
  219. '?dolibarr_main_auth_ldap_admin_pass' => 'dolibarr_main_auth_ldap_admin_pass',
  220. '?dolibarr_main_auth_ldap_debug' => 'dolibarr_main_auth_ldap_debug',
  221. 'separator' => '',
  222. '?dolibarr_lib_ADODB_PATH' => 'dolibarr_lib_ADODB_PATH',
  223. '?dolibarr_lib_TCPDF_PATH' => 'dolibarr_lib_TCPDF_PATH',
  224. '?dolibarr_lib_FPDI_PATH' => 'dolibarr_lib_FPDI_PATH',
  225. '?dolibarr_lib_NUSOAP_PATH' => 'dolibarr_lib_NUSOAP_PATH',
  226. '?dolibarr_lib_PHPEXCEL_PATH' => 'dolibarr_lib_PHPEXCEL_PATH',
  227. '?dolibarr_lib_GEOIP_PATH' => 'dolibarr_lib_GEOIP_PATH',
  228. '?dolibarr_lib_ODTPHP_PATH' => 'dolibarr_lib_ODTPHP_PATH',
  229. '?dolibarr_lib_ODTPHP_PATHTOPCLZIP' => 'dolibarr_lib_ODTPHP_PATHTOPCLZIP',
  230. '?dolibarr_js_CKEDITOR' => 'dolibarr_js_CKEDITOR',
  231. '?dolibarr_js_JQUERY' => 'dolibarr_js_JQUERY',
  232. '?dolibarr_js_JQUERY_UI' => 'dolibarr_js_JQUERY_UI',
  233. '?dolibarr_js_JQUERY_FLOT' => 'dolibarr_js_JQUERY_FLOT',
  234. '?dolibarr_font_DOL_DEFAULT_TTF' => 'dolibarr_font_DOL_DEFAULT_TTF',
  235. '?dolibarr_font_DOL_DEFAULT_TTF_BOLD' => 'dolibarr_font_DOL_DEFAULT_TTF_BOLD',
  236. 'separator' => '',
  237. '?dolibarr_mailing_limit_sendbyweb' => 'Limit nb of email sent by page',
  238. '?dolibarr_strict_mode' => 'Strict mode is on/off'
  239. );
  240. $var=true;
  241. print '<table class="noborder" width="100%">';
  242. print '<tr class="liste_titre">';
  243. print '<td width="300">'.$langs->trans("Parameters").' ';
  244. print $langs->trans("ConfigurationFile").' ('.$conffiletoshowshort.')';
  245. print '</td>';
  246. print '<td>'.$langs->trans("Parameter").'</td>';
  247. print '<td>'.$langs->trans("Value").'</td>';
  248. print '</tr>'."\n";
  249. foreach($configfileparameters as $key => $value)
  250. {
  251. $ignore=0;
  252. if ($key == 'dolibarr_main_url_root_alt' && empty(${$key})) $ignore=1;
  253. if ($key == 'dolibarr_main_document_root_alt' && empty(${$key})) $ignore=1;
  254. if (empty($ignore))
  255. {
  256. $newkey = preg_replace('/^\?/','',$key);
  257. if (preg_match('/^\?/',$key) && empty(${$newkey})) continue; // We discard parametes starting with ?
  258. if ($newkey == 'separator' && $lastkeyshown == 'separator') continue;
  259. $var=!$var;
  260. print "<tr ".$bc[$var].">";
  261. if ($newkey == 'separator')
  262. {
  263. print '<td colspan="3">&nbsp;</td>';
  264. }
  265. else
  266. {
  267. // Label
  268. print "<td>".$value.'</td>';
  269. // Key
  270. print '<td>'.$newkey.'</td>';
  271. // Value
  272. print "<td>";
  273. if ($newkey == 'dolibarr_main_db_pass') print preg_replace('/./i','*',${$newkey});
  274. else if ($newkey == 'dolibarr_main_url_root' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT');
  275. else if ($newkey == 'dolibarr_main_url_root_alt' && preg_match('/__auto__/',${$newkey})) print ${$newkey}.' => '.constant('DOL_MAIN_URL_ROOT_ALT');
  276. else print ${$newkey};
  277. if ($newkey == 'dolibarr_main_url_root' && $newkey != DOL_MAIN_URL_ROOT) print ' (currently overwritten by autodetected value: '.DOL_MAIN_URL_ROOT.')';
  278. print "</td>";
  279. }
  280. print "</tr>\n";
  281. $lastkeyshown=$newkey;
  282. }
  283. }
  284. print '</table>';
  285. print '<br>';
  286. // Parameters in database
  287. print '<table class="noborder">';
  288. print '<tr class="liste_titre">';
  289. print '<td>'.$langs->trans("Parameters").' '.$langs->trans("Database").'</td>';
  290. print '<td>'.$langs->trans("Value").'</td>';
  291. if (empty($conf->multicompany->enabled) || !$user->entity) print '<td align="center">'.$langs->trans("Entity").'</td>'; // If superadmin or multicompany disabled
  292. print "</tr>\n";
  293. $sql = "SELECT";
  294. $sql.= " rowid";
  295. $sql.= ", ".$db->decrypt('name')." as name";
  296. $sql.= ", ".$db->decrypt('value')." as value";
  297. $sql.= ", type";
  298. $sql.= ", note";
  299. $sql.= ", entity";
  300. $sql.= " FROM ".MAIN_DB_PREFIX."const";
  301. if (empty($conf->multicompany->enabled))
  302. {
  303. // If no multicompany mode, admins can see global and their constantes
  304. $sql.= " WHERE entity IN (0,".$conf->entity.")";
  305. }
  306. else
  307. {
  308. // If multicompany mode, superadmin (user->entity=0) can see everything, admin are limited to their entities.
  309. if ($user->entity) $sql.= " WHERE entity IN (".$user->entity.",".$conf->entity.")";
  310. }
  311. $sql.= " ORDER BY entity, name ASC";
  312. $resql = $db->query($sql);
  313. if ($resql)
  314. {
  315. $num = $db->num_rows($resql);
  316. $i = 0;
  317. $var=True;
  318. while ($i < $num)
  319. {
  320. $obj = $db->fetch_object($resql);
  321. $var=!$var;
  322. print '<tr '.$bc[$var].'>';
  323. print '<td>'.$obj->name.'</td>'."\n";
  324. print '<td>'.$obj->value.'</td>'."\n";
  325. if (empty($conf->multicompany->enabled) || !$user->entity) print '<td align="center">'.$obj->entity.'</td>'."\n"; // If superadmin or multicompany disabled
  326. print "</tr>\n";
  327. $i++;
  328. }
  329. }
  330. print '</table>';
  331. llxFooter();
  332. $db->close();
  333. ?>