} break; case 'create': // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('crontask'); // Check that we have permission to edit options: $current_User->check_perm('options', 'edit', true, NULL); if (!empty($edited_Cronjob)) { // It is a copy action, we should save the fields "controller" & "params" $ctsk_controller = $edited_Cronjob->get('controller'); $ctsk_params = $edited_Cronjob->get('params'); } // CREATE OBJECT: load_class('/cron/model/_cronjob.class.php', 'Cronjob'); $edited_Cronjob = new Cronjob(); if ($edited_Cronjob->load_from_Request($cron_job_names, $cron_job_params)) { // We could load data from form without errors: if (!empty($ctsk_controller)) { // Save controller field from copied object $edited_Cronjob->set('controller', $ctsk_controller); } if (!empty($ctsk_params)) { // Save params field from copied object $edited_Cronjob->set('params', $ctsk_params); } // Save to DB: $edited_Cronjob->dbinsert(); $Messages->add(T_('New job has been scheduled.'), 'success'); // Redirect so that a reload doesn't write to the DB twice: header_redirect('?ctrl=crontab', 303); // Will EXIT
} break; case 'create': // Check that this action request is not a CSRF hacked request: $Session->assert_received_crumb('crontask'); // Check that we have permission to edit options: $current_User->check_perm('options', 'edit', true, NULL); if (!empty($edited_Cronjob)) { // It is a copy action, we should save the fields "key" & "params" $ctsk_key = $edited_Cronjob->get('key'); $ctsk_params = $edited_Cronjob->get('params'); } // CREATE OBJECT: load_class('/cron/model/_cronjob.class.php', 'Cronjob'); $edited_Cronjob = new Cronjob(); if ($edited_Cronjob->load_from_Request()) { // We could load data from form without errors: if (!empty($ctsk_key)) { // Save controller field from copied object $edited_Cronjob->set('key', $ctsk_key); } if (!empty($ctsk_params)) { // Save params field from copied object $edited_Cronjob->set('params', $ctsk_params); } // Save to DB: $edited_Cronjob->dbinsert(); $Messages->add(T_('New job has been scheduled.'), 'success'); // Redirect so that a reload doesn't write to the DB twice: header_redirect('?ctrl=crontab', 303); // Will EXIT