From e4bd75dbdce4fb238c828662fdc422fd093261c6 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Tue, 22 Sep 2020 16:26:53 +0200 Subject: [PATCH] Enhancement for #14589 --- htdocs/admin/syslog.php | 6 ++++++ htdocs/core/modules/syslog/mod_syslog_syslog.php | 2 +- htdocs/langs/en_US/admin.lang | 2 +- htdocs/main.inc.php | 4 +++- 4 files changed, 11 insertions(+), 3 deletions(-) diff --git a/htdocs/admin/syslog.php b/htdocs/admin/syslog.php index 079fb3a6052..60de87d2d2e 100644 --- a/htdocs/admin/syslog.php +++ b/htdocs/admin/syslog.php @@ -212,6 +212,12 @@ foreach ($syslogModules as $moduleName) print ''; print ' '; print $module->getName(); + if ($moduleName == 'mod_syslog_syslog') { + if (! $module->isActive()) { + $langs->load("errors"); + print $form->textwithpicto('', $langs->trans("ErrorPHPNeedModule", 'SysLog')); + } + } print ''; print ''; diff --git a/htdocs/core/modules/syslog/mod_syslog_syslog.php b/htdocs/core/modules/syslog/mod_syslog_syslog.php index 91a3cdb9b44..58fb5f632bf 100644 --- a/htdocs/core/modules/syslog/mod_syslog_syslog.php +++ b/htdocs/core/modules/syslog/mod_syslog_syslog.php @@ -16,7 +16,7 @@ class mod_syslog_syslog extends LogHandler implements LogHandlerInterface */ public function getName() { - return 'Syslog'; + return 'Syslogd'; } /** diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 994683af906..adb53e56edf 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1600,7 +1600,7 @@ SyslogLevel=Level SyslogFilename=File name and path YouCanUseDOL_DATA_ROOT=You can use DOL_DATA_ROOT/dolibarr.log for a log file in Dolibarr "documents" directory. You can set a different path to store this file. ErrorUnknownSyslogConstant=Constant %s is not a known Syslog constant -OnlyWindowsLOG_USER=Windows only supports LOG_USER +OnlyWindowsLOG_USER=On Windows, only the LOG_USER facility will be supported CompressSyslogs=Compression and backup of debug log files (generated by module Log for debug) SyslogFileNumberOfSaves=Number of backup logs to keep ConfigureCleaningCronjobToSetFrequencyOfSaves=Configure cleaning scheduled job to set log backup frequency diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php index be379afd441..940aabee808 100644 --- a/htdocs/main.inc.php +++ b/htdocs/main.inc.php @@ -144,7 +144,9 @@ function analyseVarsForSqlAndScriptsInjection(&$var, $type) $errormessage = 'Access refused to '.$ip.' by SQL or Script injection protection in main.inc.php (type='.htmlentities($type).' key='.htmlentities($key).' value='.htmlentities($value).' page='.htmlentities($_SERVER["REQUEST_URI"]).')'; print $errormessage; // Add entry into error log - error_log($errormessage); + if (function_exists('error_log')) { + error_log($errormessage); + } // TODO Add entry into security audit table exit; }