* License along with eLabFTW. If not, see <http://www.gnu.org/licenses/>. * * * ********************************************************************************/ require_once '../inc/common.php'; $msg_arr = array(); $creator = new \Elabftw\Elabftw\Create(); // Check ID if (isset($_GET['id']) && !empty($_GET['id']) && is_pos_int($_GET['id'])) { $id = $_GET['id']; } else { die(_("The id parameter is not valid!")); } if ($_GET['type'] === 'exp') { $new_id = $creator->duplicateExperiment($_GET['id']); } elseif ($_GET['type'] === 'db') { $new_id = $creator->duplicateItem($_GET['id']); } else { die(_("The type parameter is not valid.")); } if (is_pos_int($new_id)) { if ($_GET['type'] === 'exp') { $msg_arr[] = _('Experiment successfully duplicated.'); $_SESSION['infos'] = $msg_arr; header('location: ../experiments.php?mode=edit&id=' . $new_id . ''); exit; } else { $msg_arr[] = _('Database entry successfully duplicated.'); $_SESSION['infos'] = $msg_arr; header('location: ../database.php?mode=edit&id=' . $new_id . ''); exit; }