diff --git a/htdocs/core/modules/syslog/mod_syslog_chromephp.php b/htdocs/core/modules/syslog/mod_syslog_chromephp.php index ca257e6b0f6..b2520d27d7b 100644 --- a/htdocs/core/modules/syslog/mod_syslog_chromephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_chromephp.php @@ -94,7 +94,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() { @@ -102,17 +102,11 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface $errors = array(); - $oldinclude = get_include_path(); - set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - - if (!file_exists('ChromePhp.class.php')) + if (! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.php') && ! file_exists($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH.'/ChromePhp.class.php')) { - $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php'); - $errors[] = $langs->trans("IncludePath").' : '.get_include_path(); + $errors[] = $langs->trans("ErrorFailedToOpenFile", 'ChromePhp.class.php or ChromePhp.php'); } - set_include_path($oldinclude); - return $errors; } @@ -129,7 +123,7 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface if (! empty($conf->global->MAIN_SYSLOG_DISABLE_CHROMEPHP)) return; // Global option to disable output of this handler //We check the configuration to avoid showing PHP warnings - if (count($this->checkConfiguration())) return false; + if (count($this->checkConfiguration()) > 0) return false; try { @@ -137,8 +131,10 @@ class mod_syslog_chromephp extends LogHandler implements LogHandlerInterface // database or config file because we must be able to log data before database or config file read. $oldinclude=get_include_path(); set_include_path($conf->global->SYSLOG_CHROMEPHP_INCLUDEPATH); - include_once 'ChromePhp.class.php'; + $res = @include_once('ChromePhp.php'); + if (! $res) $res=@include_once('ChromePhp.class.php'); set_include_path($oldinclude); + ob_start(); // To be sure headers are not flushed until all page is completely processed if ($content['level'] == LOG_ERR) ChromePhp::error($content['message']); elseif ($content['level'] == LOG_WARNING) ChromePhp::warn($content['message']); diff --git a/htdocs/core/modules/syslog/mod_syslog_file.php b/htdocs/core/modules/syslog/mod_syslog_file.php index 318fe30d4f0..92d2302bea7 100644 --- a/htdocs/core/modules/syslog/mod_syslog_file.php +++ b/htdocs/core/modules/syslog/mod_syslog_file.php @@ -74,7 +74,7 @@ class mod_syslog_file extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() { diff --git a/htdocs/core/modules/syslog/mod_syslog_firephp.php b/htdocs/core/modules/syslog/mod_syslog_firephp.php index 013b5de85a7..31addd8b17a 100644 --- a/htdocs/core/modules/syslog/mod_syslog_firephp.php +++ b/htdocs/core/modules/syslog/mod_syslog_firephp.php @@ -86,7 +86,7 @@ class mod_syslog_firephp extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() { diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index a342114a33f..2043225857b 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -73,7 +73,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface /** * Return if configuration is valid * - * @return boolean True if configuration ok + * @return array Array of errors. Empty array if ok. */ public function checkConfiguration() {