* 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; } // Check if insertion is successful and redirect to the newly created experiment/item in edit mode if (is_pos_int($new_id)) { // info box