Fix upload of module file
This commit is contained in:
parent
7785f3e3e2
commit
d59097f65c
@ -141,6 +141,12 @@ if ($action=='install')
|
|||||||
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors');
|
setEventMessages($langs->trans("ErrorFilenameDosNotMatchDolibarrPackageRules",$original_file, 'module_*-x.y*.zip'), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
|
if (empty($_FILES['fileinstall']['tmp_name']))
|
||||||
|
{
|
||||||
|
$langs->load("errors");
|
||||||
|
setEventMessages($langs->trans("ErrorFileNotUploaded"), null, 'errors');
|
||||||
|
$error++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -151,14 +157,14 @@ if ($action=='install')
|
|||||||
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
|
dol_mkdir($conf->admin->dir_temp.'/'.$original_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
$tmpdir=preg_replace('/\.zip$/','',$original_file).'.dir';
|
$tmpdir=preg_replace('/\.zip$/i','',$original_file).'.dir';
|
||||||
if ($tmpdir)
|
if ($tmpdir)
|
||||||
{
|
{
|
||||||
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
|
@dol_delete_dir_recursive($conf->admin->dir_temp.'/'.$tmpdir);
|
||||||
dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
|
dol_mkdir($conf->admin->dir_temp.'/'.$tmpdir);
|
||||||
}
|
}
|
||||||
|
|
||||||
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'],$newfile,1,0,$_FILES['fileinstall']['error']);
|
$result=dol_move_uploaded_file($_FILES['fileinstall']['tmp_name'], $newfile, 1, 0, $_FILES['fileinstall']['error']);
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
$result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
|
$result=dol_uncompress($newfile,$conf->admin->dir_temp.'/'.$tmpdir);
|
||||||
@ -206,6 +212,7 @@ if ($action=='install')
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
setEventMessages($langs->trans("ErrorFailToRenameFile", $_FILES['fileinstall']['tmp_name'], $newfile), null, 'errors');
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1002,6 +1009,7 @@ if ($mode == 'deploy')
|
|||||||
print '<br>';
|
print '<br>';
|
||||||
|
|
||||||
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
print '<form enctype="multipart/form-data" method="POST" class="noborder" action="'.$_SERVER["PHP_SELF"].'" name="forminstall">';
|
||||||
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
||||||
print '<input type="hidden" name="action" value="install">';
|
print '<input type="hidden" name="action" value="install">';
|
||||||
print '<input type="hidden" name="mode" value="deploy">';
|
print '<input type="hidden" name="mode" value="deploy">';
|
||||||
|
|
||||||
@ -1027,6 +1035,20 @@ if ($mode == 'deploy')
|
|||||||
|
|
||||||
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
print '<input type="submit" name="send" value="'.dol_escape_htmltag($langs->trans("Send")).'" class="button">';
|
||||||
|
|
||||||
|
if (! empty($conf->global->MAIN_UPLOAD_DOC))
|
||||||
|
{
|
||||||
|
if ($user->admin)
|
||||||
|
{
|
||||||
|
$langs->load('other');
|
||||||
|
print ' ';
|
||||||
|
print info_admin($langs->trans("ThisLimitIsDefinedInSetup",$max,$maxphp),1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print ' ('.$langs->trans("UploadDisabled").')';
|
||||||
|
}
|
||||||
|
|
||||||
print '</form>';
|
print '</form>';
|
||||||
|
|
||||||
print '<br>';
|
print '<br>';
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user