Пример #1
0
*    it under the terms of the GNU Affero General Public License as             *
*    published by the Free Software Foundation, either version 3 of             *
*    the License, or (at your option) any later version.                        *
*                                                                               *
*    eLabFTW is distributed in the hope that it will be useful,                 *
*    but WITHOUT ANY WARRANTY; without even the implied                         *
*    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR                    *
*    PURPOSE.  See the GNU Affero General Public License for more details.      *
*                                                                               *
*    You should have received a copy of the GNU Affero General Public           *
*    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') {
Пример #2
0
*    it under the terms of the GNU Affero General Public License as             *
*    published by the Free Software Foundation, either version 3 of             *
*    the License, or (at your option) any later version.                        *
*                                                                               *
*    eLabFTW is distributed in the hope that it will be useful,                 *
*    but WITHOUT ANY WARRANTY; without even the implied                         *
*    warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR                    *
*    PURPOSE.  See the GNU Affero General Public License for more details.      *
*                                                                               *
*    You should have received a copy of the GNU Affero General Public           *
*    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();
// What do we create ?
if (isset($_GET['type']) && !empty($_GET['type']) && is_pos_int($_GET['type'])) {
    // $type is int for DB items
    $new_id = $creator->createItem($_GET['type']);
} elseif (isset($_GET['type']) && !empty($_GET['type']) && $_GET['type'] === 'exp') {
    if (isset($_GET['tpl']) && !empty($_GET['tpl'])) {
        $new_id = $creator->createExperiment($_GET['tpl']);
    } else {
        $new_id = $creator->createExperiment();
    }
} else {
    $msg_arr[] = _('Wrong item type!');
    $_SESSION['infos'] = $msg_arr;
    header('location: ../index.php');
    exit;