Esempio n. 1
0
            $cron_job_params[$ctrl_id] = array('ctrl' => $ctrl_id, 'params' => $job['params']);
        }
    }
}
switch ($action) {
    case 'new':
        // Check that we have permission to edit options:
        $current_User->check_perm('options', 'edit', true, NULL);
        load_class('cron/model/_cronjob.class.php', 'Cronjob');
        $edited_Cronjob = new Cronjob();
        break;
    case 'edit':
    case 'copy':
        // Check that we have permission to edit options:
        $current_User->check_perm('options', 'edit', true, NULL);
        if ($action == 'edit' && $edited_Cronjob->get_status() != 'pending' || $action == 'copy' && $edited_Cronjob->get_status() != 'error') {
            // Don't edit cron jobs with not "pending" status
            header_redirect('?ctrl=crontab', 303);
            // Will EXIT
            // We have EXITed already at this point!!
        }
        if ($action == 'copy') {
            // Reset time to now for copied cron job
            global $localtimenow;
            $edited_Cronjob->start_timestamp = $localtimenow;
        }
        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: