Beispiel #1
0
            # удаление
            BeginHtml($Title2, $Title2, "http://" . $DOC_DOMAIN . "/settings/crontab/");
            $perm->ExitIfNotAccess(NC_PERM_CRON, 0, 0, 0, 1);
            while (list($key, $val) = each($_POST)) {
                if (strcmp(substr($key, 0, 6), "Delete") == 0) {
                    DeleteCron($val);
                }
            }
            CrontasksList();
            break;
        case 4:
            # форма изменения
            BeginHtml($Title5, $Title3 . $Delimeter . $Title5, "http://" . $DOC_DOMAIN . "/settings/crontab/");
            $perm->ExitIfNotAccess(NC_PERM_CRON, 0, 0, 0, 0);
            $UI_CONFIG = new ui_config_tool(CRONTAB_TAB_LIST, CRONTAB_TAB_EDIT, 'i_settings_big.gif', 'cron.edit');
            CronForm($CronID);
            break;
        case 5:
            # собственно изменение
            BeginHtml($Title2, $Title2, "http://" . $DOC_DOMAIN . "/settings/crontab/");
            $perm->ExitIfNotAccess(NC_PERM_CRON, 0, 0, 0, 1);
            CronCompleted($CronID, $Cron_Minutes, $Cron_Hours, $Cron_Days, $Cron_Script_URL);
            CrontasksList();
            break;
    }
} else {
    BeginHtml($Title2, $Title2, "http://" . $DOC_DOMAIN . "/settings/crontab/");
    $perm->ExitIfNotAccess(NC_PERM_CRON, 0, 0, 0, 0);
    CrontasksList();
}
EndHtml();
Beispiel #2
0
function CronCompleted($CronID, $Cron_Minutes, $Cron_Hours, $Cron_Days, $Cron_Script_URL)
{
    global $db;
    $Cron_Minutes = intval($Cron_Minutes);
    $Cron_Hours = intval($Cron_Hours);
    $Cron_Days = intval($Cron_Days);
    $Cron_Script_URL = $db->escape($Cron_Script_URL);
    if ($Cron_Minutes == "" and $Cron_Hours == "" and $Cron_Days == "" or $Cron_Script_URL == "") {
        nc_print_status(TOOLS_REDIRECT_CANTBEEMPTY, 'error');
        CronForm($CronID);
    } elseif (!$CronID) {
        $Insert = "insert into CronTasks (Cron_Minutes, Cron_Hours, Cron_Days, Cron_Script_URL) values ('{$Cron_Minutes}', '{$Cron_Hours}', '{$Cron_Days}', '{$Cron_Script_URL}')";
        $Result = $db->query($Insert);
    } else {
        $Insert = "update CronTasks set Cron_Minutes='" . $Cron_Minutes . "', Cron_Hours='" . $Cron_Hours . "', Cron_Days='" . $Cron_Days . "', Cron_Script_URL='" . $Cron_Script_URL . "' WHERE Cron_ID='" . $CronID . "'";
        $Result = $db->query($Insert);
    }
    return $Result;
}