web.php 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. <?php
  2. /* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/admin/system/web.php
  19. * \brief Page with web server system information
  20. */
  21. // Load Dolibarr environment
  22. require '../../main.inc.php';
  23. require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
  24. require_once DOL_DOCUMENT_ROOT.'/core/lib/security2.lib.php';
  25. $langs->load("admin");
  26. if (!$user->admin) {
  27. accessforbidden();
  28. }
  29. /*
  30. * Action
  31. */
  32. // None
  33. /*
  34. * View
  35. */
  36. llxHeader('', $langs->trans("InfoWebServer"));
  37. print load_fiche_titre($langs->trans("InfoWebServer"), '', 'title_setup');
  38. print '<div class="div-table-responsive-no-min">';
  39. print '<table class="noborder centpercent">';
  40. print '<tr class="liste_titre"><td>'.$langs->trans("Parameter")."</td><td>".$langs->trans("Value")."</td></tr>\n";
  41. print '<tr class="oddeven"><td>'.$langs->trans("Version")."</td><td>".$_SERVER["SERVER_SOFTWARE"]."</td></tr>\n";
  42. print '<tr class="oddeven"><td>'.$langs->trans("VirtualServerName")."</td><td>".$_SERVER["SERVER_NAME"]."</td></tr>\n";
  43. print '<tr class="oddeven"><td>'.$langs->trans("IP")."</td><td>".$_SERVER["SERVER_ADDR"]."</td></tr>\n";
  44. print '<tr><td>'.$langs->trans("Port")."</td><td>".$_SERVER["SERVER_PORT"]."</td></tr>\n";
  45. print '<tr><td>'.$langs->trans("DocumentRootServer")."</td><td>".$_SERVER["DOCUMENT_ROOT"]."</td></tr>\n";
  46. print '<tr><td>'.$langs->trans("DataRootServer")."</td><td>".DOL_DATA_ROOT."</td></tr>\n";
  47. // Web user group by default
  48. $labeluser = dol_getwebuser('user');
  49. $labelgroup = dol_getwebuser('group');
  50. if ($labeluser && $labelgroup) {
  51. print '<tr><td>'.$langs->trans("WebUserGroup")." (env vars)</td><td>".$labeluser.':'.$labelgroup;
  52. if (function_exists('posix_geteuid') && function_exists('posix_getpwuid')) {
  53. $arrayofinfoofuser = posix_getpwuid(posix_geteuid());
  54. print ' <span class="opacitymedium">(POSIX '.$arrayofinfoofuser['name'].':'.$arrayofinfoofuser['gecos'].':'.$arrayofinfoofuser['dir'].':'.$arrayofinfoofuser['shell'].')</span>';
  55. }
  56. print "</td></tr>\n";
  57. }
  58. // Web user group real (detected by 'id' external command)
  59. if (function_exists('exec')) {
  60. $arrayout = array(); $varout = 0;
  61. exec('id', $arrayout, $varout);
  62. print '<tr><td>'.$langs->trans("WebUserGroup")." (real, 'id' command)</td><td>";
  63. if (empty($varout)) { // Test command is ok. Work only on Linux OS.
  64. print join(',', $arrayout);
  65. } else {
  66. $langs->load("errors");
  67. print '<span class="opacitymedium">'.$langs->trans("ErrorExecIdFailed").'</span>';
  68. }
  69. print "</td></tr>\n";
  70. }
  71. print '</table>';
  72. print '</div>';
  73. llxFooter();
  74. $db->close();