diff --git a/htdocs/admin/tools/update.php b/htdocs/admin/tools/update.php
index 3fc2be6d2a3..e978e6a4c37 100644
--- a/htdocs/admin/tools/update.php
+++ b/htdocs/admin/tools/update.php
@@ -25,12 +25,13 @@
require("../../main.inc.php");
include_once $dolibarr_main_document_root."/lib/databases/".$conf->db->type.".lib.php";
+include_once $dolibarr_main_document_root."/lib/files.lib.php";
$langs->load("admin");
$langs->load("other");
if (! $user->admin)
- accessforbidden();
+accessforbidden();
if ($_GET["msg"]) $message='
'.$_GET["msg"].'
';
@@ -45,18 +46,47 @@ $dolibarrroot=preg_replace('/([^\\/]+)$/i','',$dolibarrroot);
/*
-* Actions
-*/
-if ($_POST["action"]=='update')
+ * Actions
+ */
+
+if ($_POST["action"]=='install')
{
+ $error=0;
+ $original_file=basename($_FILES["fileinstall"]["name"]);
+ $newfile=$conf->admin->dir_temp.'/'.$original_file.'/'.$original_file;
+ if (! $original_file)
+ {
+ $mesg=$langs->trans("ErrorFieldRequired",$langs->transnoentities("File"));
+ $error++;
+ }
+ else
+ {
+ if (! preg_match('/\.tgz/i',$original_file))
+ {
+ $mesg=$langs->trans("ErrorFileMustBeADolibarrPackage");
+ $error++;
+ }
+ }
+
+ if (! $error)
+ {
+ @dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$original_file);
+ create_exdir($conf->admin->dir_temp.'/'.$original_file);
+
+ $result=dol_move_uploaded_file($_FILES["fileinstall"]["tmp_name"],$newfile,1,0,$_FILES['fileinstall']['error']);
+ if ($result > 0)
+ {
+ //dol_uncompress($newfile);
+ }
+ }
}
/*
-* View
-*/
+ * View
+ */
$wikihelp='EN:Installation_-_Upgrade|FR:Installation_-_Mise_à_jour|ES:Instalaci&omodulon_-_Actualizaci&omodulon';
llxHeader('',$langs->trans("Upgrade"),$wikihelp);
@@ -67,6 +97,11 @@ print $langs->trans("CurrentVersion").' : '.DOL_VERSION.'
';
print $langs->trans("LastStableVersion").' : '.$langs->trans("FeatureNotYetAvailable").'
';
print '
';
+if ($mesg)
+{
+ print ''.$mesg.'
';
+}
+
print $langs->trans("Upgrade").'
';
print '
';
print $langs->trans("ThisIsProcessToFollow").'
';
@@ -96,6 +131,14 @@ print ''.$langs->trans("StepNb",2).': ';
print $langs->trans("DownloadPackageFromWebSite",$fullurl).'
';
print ''.$langs->trans("StepNb",3).': ';
print $langs->trans("UnpackPackageInDolibarrRoot",$dolibarrroot).'
';
+if (! empty($conf->global->MAIN_ONLINE_INSTALL_MODULE))
+{
+ print '';
+}
print ''.$langs->trans("StepNb",4).': ';
print $langs->trans("SetupIsReadyForUse").'
';