diff --git a/htdocs/admin/system/phpinfo.php b/htdocs/admin/system/phpinfo.php index 09da33c071e..9471a682116 100644 --- a/htdocs/admin/system/phpinfo.php +++ b/htdocs/admin/system/phpinfo.php @@ -2,7 +2,8 @@ /* Copyright (C) 2001-2002 Rodolphe Quiedeville * Copyright (C) 2004-2012 Laurent Destailleur * Copyright (C) 2005-2012 Regis Houssin - * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2016 Juanjo Menent + * Copyright (C) 2020 Tobias Sekan * * 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 @@ -68,9 +69,9 @@ if ($maxphp > 0 && $maxphp2 > 0 && $maxphp > $maxphp2) print '
'; } + print ''; print ''; -print "\n"; $ErrorPicturePath = "../../theme/eldy/img/error.png"; $WarningPicturePath = "../../theme/eldy/img/warning.png"; @@ -79,18 +80,19 @@ $OkayPicturePath = "../../theme/eldy/img/tick.png"; print ''; @@ -98,12 +100,12 @@ print ''; @@ -111,35 +113,11 @@ print ''; -print ''; -print ''; @@ -147,40 +125,78 @@ print ''; -print '
'.$langs->trans("Parameter").''.$langs->trans("Value").'
'.$langs->trans("Version").''; $arrayphpminversionerror = array(5,5,0); -$arrayphpminversionwarning = array(5,5,0); +$arrayphpminversionwarning = array(5,6,0); + if (versioncompare(versionphparray(), $arrayphpminversionerror) < 0) { - print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); + print 'Error '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionerror)); } elseif (versioncompare(versionphparray(), $arrayphpminversionwarning) < 0) { - print 'Warning '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); + print 'Warning '.$langs->trans("ErrorPHPVersionTooLow", versiontostring($arrayphpminversionwarning)); } else { - print 'Ok '.versiontostring(versionphparray()); + print 'Ok '.versiontostring(versionphparray()); } print '
GET and POST support'; if (! isset($_GET["testget"]) && ! isset($_POST["testpost"]) && ! isset($_GET["mainmenu"])) { - print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); - print ' ('.$langs->trans("Recheck").')'; + print 'Warning '.$langs->trans("PHPSupportPOSTGETKo"); + print ' ('.$langs->trans("Recheck").')'; } else { - print 'Ok '.$langs->trans("PHPSupportPOSTGETOk"); + print 'Ok '.$langs->trans("PHPSupportPOSTGETOk"); } print '
Sessions support'; if (! function_exists("session_id")) { - print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); + print 'Error '.$langs->trans("ErrorPHPDoesNotSupportSessions"); } else { - print 'Ok '.$langs->trans("PHPSupportSessions"); -} - -print '
GD support'; - -if (! function_exists("imagecreate")) -{ - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportGD"); -} -else -{ - print 'Ok '.$langs->trans("PHPSupportGD"); -} - -print '
Curl support'; - -if (! function_exists("curl_init")) -{ - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportCurl"); -} -else -{ - print 'Ok '.$langs->trans("PHPSupportCurl"); + print 'Ok '.$langs->trans("PHPSupportSessions"); } print '
UTF-8 support'; if (! function_exists("utf8_encode")) { - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); + print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportUTF8"); } else { - print 'Ok '.$langs->trans("PHPSupportUTF8"); + print 'Ok '.$langs->trans("PHPSupportUTF8"); } print '
Intl support'; +print '
'; + +print '
'; + +$activatedExtensions = array_map('strtolower', getActivatedExtensions()); +$loadedExtensions = array_map('strtolower', get_loaded_extensions(false)); + +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; +print ''; + +$functions = ["imagecreate"]; +$name = "GD"; + +print ""; +print ""; +print getTableColumn($name, $activatedExtensions); +print getTableColumn($name, $loadedExtensions); +print getTableColumnFunction($functions); +print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); +print ""; + +$functions = ["curl_init"]; +$name = "Curl"; + +print ""; +print ""; +print getTableColumn($name, $activatedExtensions); +print getTableColumn($name, $loadedExtensions); +print getTableColumnFunction($functions); +print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); +print ""; if (empty($_SERVER["SERVER_ADMIN"]) || $_SERVER["SERVER_ADMIN"] != 'doliwamp@localhost') { - if (! function_exists("locale_get_primary_language") || ! function_exists("locale_get_region")) - { - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupportIntl"); - } - else - { - print 'Ok '.$langs->trans("PHPSupportIntl"); - } + $functions = ["locale_get_primary_language", "locale_get_region"]; + $name = "Intl"; + + print ""; + print ""; + print getTableColumn($name, $activatedExtensions); + print getTableColumn($name, $loadedExtensions); + print getTableColumnFunction($functions); + print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); + + print ""; } -print '"; +print ""; +print getTableColumn($name, $activatedExtensions); +print getTableColumn($name, $loadedExtensions); +print getTableColumnFunction($functions); +print getResultColumn($name, $activatedExtensions, $loadedExtensions, $functions); +print ""; -print ''; print '
'.$langs->trans("Extension").''.$langs->trans("EnabledInSetup").''.$langs->trans("Loaded").''.$langs->trans("FunctionTest").''.$langs->trans("Result").'
".$name."
".$name."
".$name."
Zip support'; +$functions = array(); +$name = "xDebug"; -if (!class_exists('ZipArchive')) -{ - print 'Warning '.$langs->trans("ErrorPHPDoesNotSupport", "Zip"); -} -else -{ - print 'Ok '.$langs->trans("PHPSupport", "Zip"); -} +print "
".$name."
'; print '
'; @@ -189,8 +205,8 @@ print '
'; $phparray=phpinfo_array(); foreach($phparray as $key => $value) { - print '
'; - print ''; + print '
'; + print '
'; print ''; //print ''; print ''; @@ -240,3 +256,169 @@ foreach($phparray as $key => $value) // End of page llxFooter(); $db->close(); + +/** + * Return all list with all activated, but possible not loaded PHP extensions + * + * @return array + */ +function getActivatedExtensions() +{ + $file = getConfigFilePath(); + $handle = fopen(GetConfigFilePath(), "r"); + $content = fread($handle, filesize($file)); + + fclose($handle); + + $configLines = explode("\r", $content); + + $extensions = array(); + $lastLine = ""; + + foreach($configLines as $line) + { + $line = trim($line); + + // ignore comment lines + if(substr($line, 0, 1) === ";") + { + continue; + } + + // extension + if(substr($line, 0, 9) === "extension" && substr($line, 0, 10) !== "extension_") + { + $value = trim(end(explode("=", $line))); + + $extensions[] = $value === "gd2" ? "gd" : $value; + } + + // zend_extension + if(substr($line, 0, 14) === "zend_extension") + { + $extensions[] = str_replace("[", "", str_replace("]", "", $lastLine)); + } + + $lastLine = $line; + } + + return array_unique($extensions); +} + +/** + * Return the path to the current used php config file + * + * @return string + */ +function getConfigFilePath() +{ + $phparray = phpinfo_array(); + + foreach($phparray as $value) + { + foreach($value as $keyparam => $keyvalue) + { + if(strtolower($keyparam) !== "loaded configuration file") + { + continue; + } + + return $keyvalue; + } + } + + return ""; +} + +/** + * Return a table column with a indicator (okay or warning), based on the given name and list + * + * @param string $name The name to check inside the given list + * @param array $list A list that should contains the given name + * + * @return string + */ +function getTableColumn($name, array $list) +{ + $name = strtolower($name); + $html = ""; + + return $html; +} + +/** + * Return a table column with a indicator (okay or warning), based on the given functions to check + * + * @param array $functions A list with functions to check + * + * @return string + */ +function getTableColumnFunction(array $functions) +{ + if(count($functions) < 1) + { + return ""; + } + + $result = true; + $html = ""; + + return $html; +} + +/** + * Return a result column with a translated result text + * + * @param string $name The name of the PHP extension + * @param array $activated A list with all activated PHP extensions + * @param array $loaded A list with all loaded PHP extensions + * @param array $functions A list with all PHP functions to check + * + * @return array + */ +function getResultColumn($name, array $activated, array $loaded, array $functions) +{ + global $langs; + + $result = true; + $result = $result && in_array(strtolower($name), $activated); + $result = $result && in_array(strtolower($name), $loaded); + + foreach($functions as $function) + { + $result = $result && function_exists($function); + } + + $html = ""; + + return $html; +} diff --git a/htdocs/langs/de_DE/install.lang b/htdocs/langs/de_DE/install.lang index eef58425e45..3638d1a5e3a 100644 --- a/htdocs/langs/de_DE/install.lang +++ b/htdocs/langs/de_DE/install.lang @@ -16,16 +16,18 @@ PHPSupportCurl=Ihre PHP-Konfiguration unterstützt cURL. PHPSupportCalendar=Ihre PHP-Konfiguration unterstützt die Kalender-Erweiterungen. PHPSupportUTF8=Ihre PHP-Konfiguration unterstützt die UTF8-Funktionen. PHPSupportIntl=Ihre PHP-Konfiguration unterstützt die Internationalisierungs-Funktionen. +PHPSupportxDebug=Ihre PHP-Konfiguration unterstützt erweiterte Fehleranalyse-Funktionen. PHPSupport=Dieses PHP unterstützt %s-Funktionen. PHPMemoryOK=Die Sitzungsspeicherbegrenzung ihrer PHP-Konfiguration steht auf %s. Dies sollte ausreichend sein. PHPMemoryTooLow=Der maximale PHP-Sitzungsspeicher ist auf %s Bytes gesetzt. Dieser Wert ist zu niedrig. Ändern sie den Parameter memory_limit in der php.ini auf mindestens %s Bytes! Recheck=Klicken Sie hier für einen detailierteren Test. -ErrorPHPDoesNotSupportSessions=Ihre PHP-Installation unterstützt die Sitzungs-Funktionen nicht. Diese Funktion wird jedoch für Dolibarr benötigt. Bitte prüfen sie das PHP-Setup und die Zugriffsrechte auf das Sitzungs-Verzeichnis. -ErrorPHPDoesNotSupportGD=Ihre PHP-Installation unterstützt die GD Grafik-Funktionen nicht. Grafiken werden nicht verfügbar sein. -ErrorPHPDoesNotSupportCurl=Ihre PHP-Version unterstützt die Erweiterung Curl nicht -ErrorPHPDoesNotSupportCalendar=Ihre PHP-Installation unterstützt die Kalender-Erweiterungen nicht. -ErrorPHPDoesNotSupportUTF8=Ihre PHP-Installation unterstützt die UTF8-Funktionen nicht. Dolibarr wird nicht korrekt funktionieren. Beheben Sie das Problem vor der Installation. +ErrorPHPDoesNotSupportSessions=Ihre PHP-Konfiguration unterstützt die Sitzungs-Funktionen nicht. Diese Funktion wird jedoch für Dolibarr benötigt. Bitte prüfen sie das PHP-Setup und die Zugriffsrechte auf das Sitzungs-Verzeichnis. +ErrorPHPDoesNotSupportGD=Ihre PHP-Konfiguration unterstützt die GD Grafik-Funktionen nicht. Grafiken werden nicht verfügbar sein. +ErrorPHPDoesNotSupportCurl=Ihre PHP-Konfiguration unterstützt die Erweiterung Curl nicht +ErrorPHPDoesNotSupportCalendar=Ihre PHP-Konfiguration unterstützt die Kalender-Erweiterungen nicht. +ErrorPHPDoesNotSupportUTF8=Ihre PHP-Konfiguration unterstützt die UTF8-Funktionen nicht. Dolibarr wird nicht korrekt funktionieren. Beheben Sie das Problem vor der Installation. ErrorPHPDoesNotSupportIntl=Ihre PHP-Konfiguration unterstützt keine Internationalisierungsfunktion (intl-extension). +ErrorPHPDoesNotSupportxDebug=Ihre PHP-Konfiguration unterstützt keine erweiterte Fehleranalyse-Funktionen. ErrorPHPDoesNotSupport=Ihre PHP-Installation unterstützt keine %s-Funktionen. ErrorDirDoesNotExists=Das Verzeichnis %s existiert nicht. ErrorGoBackAndCorrectParameters=Gehen Sie zurück und prüfen/korrigieren Sie die Parameter. @@ -217,3 +219,5 @@ YouTryInstallDisabledByDirLock=Die Anwendung hat versucht, sich selbst zu aktual YouTryInstallDisabledByFileLock=Die Anwendung hat versucht, sich selbst zu aktualisieren, aber die Installations-/Upgrade-Seiten wurden aus Sicherheitsgründen deaktiviert (durch die Existenz einer Sperrdatei install.lock im Dokumenten-Verzeichnis).
ClickHereToGoToApp=Hier klicken um zu Ihrer Anwendung zu kommen ClickOnLinkOrRemoveManualy=Klicken Sie auf den folgenden Link. Wenn Sie immer die gleiche Seite sehen, müssen Sie die Datei install.lock im Dokumenten-Verzeichnis entfernen/umbenennen. +Loaded=Geladen +FunctionTest=Funktionstest diff --git a/htdocs/langs/en_US/install.lang b/htdocs/langs/en_US/install.lang index bf9c08c4ba7..f67dff57184 100644 --- a/htdocs/langs/en_US/install.lang +++ b/htdocs/langs/en_US/install.lang @@ -16,6 +16,7 @@ PHPSupportCurl=This PHP supports Curl. PHPSupportCalendar=This PHP supports calendars extensions. PHPSupportUTF8=This PHP supports UTF8 functions. PHPSupportIntl=This PHP supports Intl functions. +PHPSupportxDebug=This PHP supports extended debug functions. PHPSupport=This PHP supports %s functions. PHPMemoryOK=Your PHP max session memory is set to %s. This should be enough. PHPMemoryTooLow=Your PHP max session memory is set to %s bytes. This is too low. Change your php.ini to set memory_limit parameter to at least %s bytes. @@ -26,6 +27,7 @@ ErrorPHPDoesNotSupportCurl=Your PHP installation does not support Curl. ErrorPHPDoesNotSupportCalendar=Your PHP installation does not support php calendar extensions. ErrorPHPDoesNotSupportUTF8=Your PHP installation does not support UTF8 functions. Dolibarr cannot work correctly. Resolve this before installing Dolibarr. ErrorPHPDoesNotSupportIntl=Your PHP installation does not support Intl functions. +ErrorPHPDoesNotSupportxDebug=Your PHP installation does not support extend debug functions. ErrorPHPDoesNotSupport=Your PHP installation does not support %s functions. ErrorDirDoesNotExists=Directory %s does not exist. ErrorGoBackAndCorrectParameters=Go back and check/correct the parameters. @@ -217,3 +219,5 @@ YouTryInstallDisabledByDirLock=The application tried to self-upgrade, but the in YouTryInstallDisabledByFileLock=The application tried to self-upgrade, but the install/upgrade pages have been disabled for security (by the existence of a lock file install.lock in the dolibarr documents directory).
ClickHereToGoToApp=Click here to go to your application ClickOnLinkOrRemoveManualy=Click on the following link. If you always see this same page, you must remove/rename the file install.lock in the documents directory. +Loaded=Loaded +FunctionTest=Function test
'.$langs->trans("Parameter").''.$key.'"; + + if(in_array($name, $list)) + { + $html .= 'Ok'; + } + else + { + $html .= 'Warning'; + } + + $html .= "-"; + + foreach($functions as $function) + { + $result = $result && function_exists($function); + } + + if($result) + { + $html .= 'Ok'; + } + else + { + $html .= 'Warning'; + } + + $html .= ""; + $html .= $result ? $langs->trans("PHPSupport".$name) : $langs->trans("ErrorPHPDoesNotSupport".$name); + $html .= "