41  public $errors = array();
 
   77    if (preg_match(
'/\.virus$/i', $file)) {
 
   78      $this->errors[] = 
'File has an extension saying file is a virus';
 
   87    $safemode = ini_get(
"safe_mode");
 
   89    dol_syslog(
"AntiVir::dol_avscan_file Run command=".$fullcommand.
" with safe_mode ".($safemode ? 
"on" : 
"off"));
 
   91    include_once DOL_DOCUMENT_ROOT.
'/core/class/utils.class.php';
 
   92    $utils = 
new Utils($this->db);
 
   93    $outputfile = 
$conf->user->dir_temp.
'/antivir.tmp';
 
   95    $result = $utils->executeCLI($fullcommand, $outputfile);
 
   97    $return_var = $result[
'result'];
 
   98    $output = $result[
'output'];
 
   99    $errorstring = $result[
'error'];
 
  101    if (is_null($output)) {
 
  105    dol_syslog(
"AntiVir::dol_avscan_file Result return_var=".$return_var.
" output=".$output);
 
  107    $returncodevirus = 1;
 
  108    if ($return_var == $returncodevirus) {  
 
  109      $this->errors = array($errorstring, $output);
 
  113    if ($return_var > 0) {          
 
  114      $this->errors = array($errorstring, $output);
 
 
  135    $bz2archivememlim = 0; 
 
  136    $maxfilesize = 10485760; 
 
  141    $param = preg_replace(
'/%maxreclevel/', (
string) $maxreclevel, $param);
 
  142    $param = preg_replace(
'/%maxfiles/', (
string) $maxfiles, $param);
 
  143    $param = preg_replace(
'/%maxratio/', (
string) $maxratio, $param);
 
  144    $param = preg_replace(
'/%bz2archivememlim/', (
string) $bz2archivememlim, $param);
 
  145    $param = preg_replace(
'/%maxfilesize/', (
string) $maxfilesize, $param);
 
  146    $param = preg_replace(
'/%file/', trim($file), $param);
 
  149      $param = $param.
" ".escapeshellarg(trim($file));
 
  152    if (preg_match(
"/\s/", $command)) {
 
  153      $command = escapeshellarg($command); 
 
  156    $forbidden_chars_to_replace = array(
"*", 
"?", 
"\"", 
"<", 
">", 
"|", 
"[", 
"]", 
";", 
'°', 
'$');
 
 
 
__construct($db)
Constructor.
 
dol_avscan_file($file)
Scan a file with antivirus.
 
getCliCommand($file)
Get full Command Line to run.
 
Class to manage utility methods.
 
dol_string_nospecial($str, $newstr='_', $badcharstoreplace='', $badcharstoremove='', $keepspaces=0)
Clean a string from all punctuation characters to use it as a ref or login.
 
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
 
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
 
dol_sanitizePathName($str, $newstr='_', $unaccent=1)
Clean a string to use it as a path name.
 
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...