diff --git a/core/ajax/repo.ajax.php b/core/ajax/repo.ajax.php index cc6a8be32e..6ad066d935 100644 --- a/core/ajax/repo.ajax.php +++ b/core/ajax/repo.ajax.php @@ -83,17 +83,22 @@ if (init('action') == 'remove') { unautorizedInDemo(); - $class = 'repo_' . init('repo'); - $repo = $class::byId(init('id')); + $repoName = init('repo'); + $class = 'repo_' . $repoName; + if ($class !== repo_market::class) { + throw new \Exception(__('Impossible de trouver l\'objet associƩ :', __FILE__) . ' ' . $repoName); + } + + $market = $class::byId(init('id')); if (!is_object($market)) { throw new Exception(__('Impossible de trouver l\'objet associƩ :', __FILE__) . ' ' . init('id')); } - $update = update::byTypeAndLogicalId($repo->getType(), $repo->getLogicalId()); + $update = update::byTypeAndLogicalId($market->getType(), $market->getLogicalId()); try { if (is_object($update)) { $update->remove(); } else { - $market->remove(); + $market->remove(); } } catch (Exception $e) { if (is_object($update)) {