2
0
forked from Wavyzz/dolibarr

New redirect when deploy module (#31109)

* New redirect when deploy module

* initialize variable

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
lamrani abdelwadoud
2024-09-26 17:43:23 +02:00
committed by GitHub
parent ec07381f2c
commit c4ffa090b2

View File

@@ -165,7 +165,7 @@ if (GETPOST('buttonreset', 'alpha')) {
if ($action == 'install' && $allowonlineinstall) {
$error = 0;
$modulenameval = '';
// $original_file should match format module_modulename-x.y[.z].zip
$original_file = basename($_FILES["fileinstall"]["name"]);
$original_file = preg_replace('/\s*\(\d+\)\.zip$/i', '.zip', $original_file);
@@ -282,8 +282,20 @@ if ($action == 'install' && $allowonlineinstall) {
}
if (!$error) {
$message = $langs->trans("SetupIsReadyForUse", DOL_URL_ROOT.'/admin/modules.php?mainmenu=home', $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules"));
$searchParams = array(
'search_keyword' => $modulenameval,
'search_status' => '-1',
'search_nature' => '-1',
'search_version' => '-1'
);
$queryString = http_build_query($searchParams);
$redirectUrl = DOL_URL_ROOT . '/admin/modules.php?' . $queryString;
$message = $langs->trans("SetupIsReadyForUse", $redirectUrl, $langs->transnoentitiesnoconv("Home").' - '.$langs->transnoentitiesnoconv("Setup").' - '.$langs->transnoentitiesnoconv("Modules"));
setEventMessages($message, null, 'warnings');
header('Location: ' . $redirectUrl);
exit;
}
} elseif ($action == 'install' && !$allowonlineinstall) {
httponly_accessforbidden("You try to bypass the protection to disallow deployment of an external module. Hack attempt ?");