diff --git a/htdocs/admin/security_file.php b/htdocs/admin/security_file.php index 4b665123e4f..daa43110529 100644 --- a/htdocs/admin/security_file.php +++ b/htdocs/admin/security_file.php @@ -154,6 +154,9 @@ if (ini_get('safe_mode') && !empty($conf->global->MAIN_ANTIVIRUS_COMMAND)) } } print ''; +if (defined('MAIN_ANTIVIRUS_COMMAND')) { + print '
'.$langs->trans("ValueIsForcedBySystem").''; +} print ""; print ''; @@ -165,6 +168,9 @@ print ''.$langs->trans("AntiVirusParamExample").''; print ''; print ''; +if (defined('MAIN_ANTIVIRUS_PARAM')) { + print '
'.$langs->trans("ValueIsForcedBySystem").''; +} print ""; print ''; diff --git a/htdocs/conf/conf.php.example b/htdocs/conf/conf.php.example index 6b1b5e0ea0a..02cc5bae399 100644 --- a/htdocs/conf/conf.php.example +++ b/htdocs/conf/conf.php.example @@ -287,6 +287,18 @@ $dolibarr_cron_allow_cli='0'; // Examples: '-1' (sending by cli is forbidden) // $dolibarr_mailing_limit_sendbycli='0'; +// MAIN_ANTIVIRUS_COMMAND (as a constant) +// Force a value for the antivirus command line tool so setup for admin user interface has no effect. +// Default value: '' +// Example: '/usr/bin/clamdscan'; +// define('MAIN_ANTIVIRUS_COMMAND', '/usr/bin/clamdscan'); + +// MAIN_ANTIVIRUS_PARAM (as a constant) +// Force a value for the antivirus parameters on command line so setup for admin user interface has no effect. +// Default value: '' +// Example: '--fdpass'; +// define('MAIN_ANTIVIRUS_PARAM', '--fdpass'); + //################## // Other diff --git a/htdocs/core/class/conf.class.php b/htdocs/core/class/conf.class.php index 8cfeea86d95..32d7b145a41 100644 --- a/htdocs/core/class/conf.class.php +++ b/htdocs/core/class/conf.class.php @@ -684,6 +684,9 @@ class Conf // If we are in develop mode, we activate the option MAIN_SECURITY_CSRF_WITH_TOKEN to 1 if not already defined. if (!isset($this->global->MAIN_SECURITY_CSRF_WITH_TOKEN) && $this->global->MAIN_FEATURES_LEVEL >= 2) $this->global->MAIN_SECURITY_CSRF_WITH_TOKEN = 1; + if (defined('MAIN_ANTIVIRUS_COMMAND')) $this->global->MAIN_ANTIVIRUS_COMMAND = constant('MAIN_ANTIVIRUS_COMMAND'); + if (defined('MAIN_ANTIVIRUS_PARAM')) $this->global->MAIN_ANTIVIRUS_PARAM = constant('MAIN_ANTIVIRUS_PARAM'); + // For backward compatibility if (isset($this->product)) $this->produit = $this->product; if (isset($this->facture)) $this->invoice = $this->facture; diff --git a/htdocs/core/lib/files.lib.php b/htdocs/core/lib/files.lib.php index aecf488d2b7..7f2fd4ce70d 100644 --- a/htdocs/core/lib/files.lib.php +++ b/htdocs/core/lib/files.lib.php @@ -1075,13 +1075,11 @@ function dol_move_uploaded_file($src_file, $dest_file, $allowoverwrite, $disable } } - if ($reshook < 0) // At least one blocking error returned by one hook - { + if ($reshook < 0) { // At least one blocking error returned by one hook $errmsg = join(',', $hookmanager->errors); if (empty($errmsg)) $errmsg = 'ErrorReturnedBySomeHooks'; // Should not occurs. Added if hook is bugged and does not set ->errors when there is error. return $errmsg; - } elseif (empty($reshook)) - { + } elseif (empty($reshook)) { // The file functions must be in OS filesystem encoding. $src_file_osencoded = dol_osencode($src_file); $file_name_osencoded = dol_osencode($file_name); @@ -1535,6 +1533,8 @@ function dol_add_file_process($upload_dir, $allowoverwrite = 0, $donotupdatesess $nbok = 0; for ($i = 0; $i < $nbfile; $i++) { + if (empty($TFile['name'][$i])) continue; // For example, when submitting a form with no file name + // Define $destfull (path to file including filename) and $destfile (only filename) $destfull = $upload_dir."/".$TFile['name'][$i]; $destfile = $TFile['name'][$i]; diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang index 7b2aaae4c68..8d64fe1a8d6 100644 --- a/htdocs/langs/en_US/admin.lang +++ b/htdocs/langs/en_US/admin.lang @@ -1221,7 +1221,8 @@ RestoreDesc=To restore a Dolibarr backup, two steps are required. RestoreDesc2=Restore the backup file (zip file for example) of the "documents" directory to a new Dolibarr installation or into this current documents directory (%s). RestoreDesc3=Restore the database structure and data from a backup dump file into the database of the new Dolibarr installation or into the database of this current installation (%s). Warning, once the restore is complete, you must use a login/password, that existed from the backup time/installation to connect again.
To restore a backup database into this current installation, you can follow this assistant. RestoreMySQL=MySQL import -ForcedToByAModule= This rule is forced to %s by an activated module +ForcedToByAModule=This rule is forced to %s by an activated module +ValueIsForcedBySystem=This value is forced by the system. You can't change it. PreviousDumpFiles=Existing backup files PreviousArchiveFiles=Existing archive files WeekStartOnDay=First day of the week