diff --git a/htdocs/admin/security_other.php b/htdocs/admin/security_other.php
index 389387c359b..3d60db2e9ef 100644
--- a/htdocs/admin/security_other.php
+++ b/htdocs/admin/security_other.php
@@ -25,6 +25,7 @@
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
+require_once(DOL_DOCUMENT_ROOT."/html.formfile.class.php");
$langs->load("users");
$langs->load("admin");
@@ -32,10 +33,38 @@ $langs->load("other");
if (!$user->admin) accessforbidden();
+$upload_dir=$conf->admin->dir_temp;
+
/*
* Actions
*/
+
+if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
+{
+ /*
+ * Creation repertoire si n'existe pas
+ */
+ if (! is_dir($upload_dir)) create_exdir($upload_dir);
+
+ if (is_dir($upload_dir))
+ {
+ @dol_delete_file($upload_dir . "/" . $_FILES['userfile']['name'],1);
+
+ if (dol_move_uploaded_file($_FILES['userfile']['tmp_name'], $upload_dir . "/" . $_FILES['userfile']['name'],0) > 0)
+ {
+ $mesg = '
'.$langs->trans("FileTransferComplete").'
';
+ //print_r($_FILES);
+ }
+ else
+ {
+ // Echec transfert (fichier depassant la limite ?)
+ $mesg = ''.$langs->trans("ErrorFileNotUploaded").'
';
+ // print_r($_FILES);
+ }
+ }
+}
+
if ($_GET["action"] == 'set_main_upload_doc')
{
if (! dolibarr_set_const($db, 'MAIN_UPLOAD_DOC',$_POST["MAIN_UPLOAD_DOC"],'chaine',0,'',$conf->entity))
@@ -89,11 +118,20 @@ else if ($_GET["action"] == 'disable_avscan')
exit;
}
+if ($_GET["action"] == 'MAIN_ANTIVIRUS_COMMAND')
+{
+ dolibarr_set_const($db, "MAIN_ANTIVIRUS_COMMAND", $_POST["MAIN_ANTIVIRUS_COMMAND"],'chaine',0,'',$conf->entity);
+ Header("Location: security_other.php");
+ exit;
+}
+
/*
* Affichage onglet
*/
+$form = new Form($db);
+
llxHeader('',$langs->trans("Miscellanous"));
print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
@@ -101,55 +139,21 @@ print_fiche_titre($langs->trans("SecuritySetup"),'','setup');
print $langs->trans("MiscellanousDesc")."
\n";
print "
\n";
-
$head=security_prepare_head();
dol_fiche_head($head, 'misc', $langs->trans("Security"));
-$var=false;
-$form = new Form($db);
-
+// Timeout
+$var=true;
print '';
print '';
-print '| '.$langs->trans("Parameter").' | ';
+print ''.$langs->trans("Parameters").' | ';
print ''.$langs->trans("Value").' | ';
print ' | ';
print "
\n";
-
-print '';
-
-$var=!$var;
-print '';
-
$var=!$var;
if (empty($conf->global->MAIN_SESSION_TIMEOUT)) $conf->global->MAIN_SESSION_TIMEOUT=ini_get("session.gc_maxlifetime");
print '';
@@ -172,7 +176,6 @@ print '
';
// Other Options
-
$var=true;
print '';
@@ -220,64 +223,77 @@ print '
';
print '
';
-// Antivirus options
-$var=true;
+// Upload options
+$var=false;
print '';
print '';
-print '| '.$langs->trans("AntiVirus").' | ';
-print ''.$langs->trans("Activated").' | ';
-print ''.$langs->trans("Action").' | ';
+print ''.$langs->trans("Parameters").' | ';
+print ''.$langs->trans("Value").' | ';
print '
';
-// Enable AV scanner
-$var=!$var;
-print "";
-print '| '.$langs->trans("UseAvToScanUploadedFiles");
-if($conf->global->MAIN_USE_AVSCAN == 1)
-{
- print ' : ';
- // Clamav
- if (function_exists("cl_scanfile"))
- {
- print cl_info();
- }
-}
+print '';
+
+$var=!$var;
+print '';
+
+// Use anti virus
+$var=!$var;
+print '';
print ' |
';
print '';
+
+// Form to test upload
+if ($mesg) print $mesg;
+
+// Affiche formulaire upload
+print '
';
+$formfile=new FormFile($db);
+$formfile->form_attach_new_file(DOL_URL_ROOT.'/admin/security_other.php',$langs->trans("FormToTestFileUploadForm"),0,0,1);
+
+
$db->close();
llxFooter('$Date$ - $Revision$');
diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index 413626b5178..16337edcdbd 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -34,6 +34,7 @@ ExternalUsers=External users
GlobalSetup=Global setup
GUISetup=Display
SetupArea=Setup area
+FormToTestFileUploadForm=Form to test file upload (according to setup)
IfModuleEnabled=Note: yes is effective only if module %s is enabled
RemoveLock=Remove file %s if it exists to allow the update tool.
RestoreLock=Replace a file %s with read permission only on file to disable any usage of update tool.
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index a14178036f9..a35ee7936e8 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -34,6 +34,7 @@ ExternalUsers = Utilisateurs externes
GlobalSetup = Général
GUISetup = Affichage
SetupArea = Espace configuration
+FormToTestFileUploadForm=Formulaire de test d'upload de fichier (selon options choisies)
IfModuleEnabled = Rem: oui est effectif uniquement si le module %s est activé
RemoveLock = Effacer le fichier %s s'il existe afin d'autoriser l'outil de mise a jour.
RestoreLock = Replacer un fichier %s en ne donnant des droits que de lecture sur ce fichier afin d'interdire à nouveau les mises à jour.
diff --git a/htdocs/product/document.php b/htdocs/product/document.php
index 9f8939b3c0a..9be98fe6326 100755
--- a/htdocs/product/document.php
+++ b/htdocs/product/document.php
@@ -74,10 +74,11 @@ $modulepart='produit';
/*
* Action envoie fichier
*/
+
if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
{
/*
- * Creation r�pertoire si n'existe pas
+ * Creation repertoire si n'existe pas
*/
if (! is_dir($upload_dir)) create_exdir($upload_dir);
@@ -90,7 +91,7 @@ if ($_POST["sendit"] && ! empty($conf->global->MAIN_UPLOAD_DOC))
}
else
{
- // Echec transfert (fichier d�passant la limite ?)
+ // Echec transfert (fichier depassant la limite ?)
$mesg = ''.$langs->trans("ErrorFileNotUploaded").'
';
// print_r($_FILES);
}