Fix empty module on action and redirection

master
Jean-Christian Paul Denis 2021-09-25 22:50:06 +02:00
parent 071a8bf4ce
commit ce57f296be
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 3 additions and 4 deletions

View File

@ -60,7 +60,7 @@ foreach($modules as $id => $m) {
} }
$combo_modules[$m['name']] = $id; $combo_modules[$m['name']] = $id;
} }
$module = $_POST['module'] ?? ''; $module = $_REQUEST['module'] ?? '';
if (!in_array($module, $combo_modules)) { if (!in_array($module, $combo_modules)) {
$module = '-'; $module = '-';
} }
@ -68,8 +68,7 @@ if (!in_array($module, $combo_modules)) {
if (!empty($_POST['fix'])) { if (!empty($_POST['fix'])) {
if (empty($_POST['actions'])) { if (empty($_POST['actions'])) {
dcPage::addWarningNotice(__('No action selected')); dcPage::addWarningNotice(__('No action selected'));
} } elseif ($module == '-') {
if ($module == '-') {
dcPage::addWarningNotice(__('No module selected')); dcPage::addWarningNotice(__('No module selected'));
} else { } else {
try { try {
@ -93,7 +92,7 @@ if (!empty($_POST['fix'])) {
} }
dcPage::addNotice($notice['type'], sprintf($notice['msg'], $module, $time)); dcPage::addNotice($notice['type'], sprintf($notice['msg'], $module, $time));
$core->adminurl->redirect('admin.plugin.improve', ['type' => $type, 'upd' => $log_id]); $core->adminurl->redirect('admin.plugin.improve', ['type' => $type, 'module' => $module, 'upd' => $log_id]);
} catch (Exception $e) { } catch (Exception $e) {
$core->error->add($e->getMessage()); $core->error->add($e->getMessage());
} }