Esempio n. 1
0
/**
 * Check correction of input data
 * @param EasySCP_TemplateEngine $tpl
 */
function check_data_iscorrect($tpl)
{
    global $hp_name, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl;
    global $hp_sub, $hp_als, $hp_mail;
    global $hp_ftp, $hp_sql_db, $hp_sql_user;
    global $hp_traff, $hp_disk, $hp_countbackup;
    global $hpid;
    global $price, $setup_fee;
    global $hp_backup, $hp_dns;
    $ahp_error = array();
    $hp_name = clean_input($_POST['hp_name']);
    $hp_sub = clean_input($_POST['hp_sub']);
    $hp_als = clean_input($_POST['hp_als']);
    $hp_mail = clean_input($_POST['hp_mail']);
    $hp_ftp = clean_input($_POST['hp_ftp']);
    $hp_sql_db = clean_input($_POST['hp_sql_db']);
    $hp_sql_user = clean_input($_POST['hp_sql_user']);
    $hp_traff = clean_input($_POST['hp_traff']);
    $hp_disk = clean_input($_POST['hp_disk']);
    $price = clean_input($_POST['hp_price']);
    $setup_fee = clean_input($_POST['hp_setupfee']);
    if (isset($_SESSION['hpid'])) {
        $hpid = $_SESSION['hpid'];
    } else {
        $ahp_error[] = tr('Undefined reference to data!');
    }
    // put hosting plan id into session value
    $_SESSION['hpid'] = $hpid;
    // Get values from previous page and check him correction
    if (isset($_POST['php'])) {
        $hp_php = $_POST['php'];
    }
    if (isset($_POST['php_edit'])) {
        $hp_phpe = $_POST['php_edit'];
    }
    if (isset($_POST['cgi'])) {
        $hp_cgi = $_POST['cgi'];
    }
    if (isset($_POST['ssl'])) {
        $hp_ssl = $_POST['ssl'];
    }
    if (isset($_POST['dns'])) {
        $hp_dns = $_POST['dns'];
    }
    if (isset($_POST['backup'])) {
        $hp_backup = $_POST['backup'];
    }
    if (isset($_POST['countbackup'])) {
        $hp_countbackup = $_POST['countbackup'];
    }
    list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions');
    if ($rsub_max == "-1") {
        $hp_sub = "-1";
    } elseif (!easyscp_limit_check($hp_sub, -1)) {
        $ahp_error[] = tr('Incorrect subdomains limit!');
    }
    if ($rals_max == "-1") {
        $hp_als = "-1";
    } elseif (!easyscp_limit_check($hp_als, -1)) {
        $ahp_error[] = tr('Incorrect aliases limit!');
    }
    if ($rmail_max == "-1") {
        $hp_mail = "-1";
    } elseif (!easyscp_limit_check($hp_mail, -1)) {
        $ahp_error[] = tr('Incorrect mail accounts limit!');
    }
    if ($rftp_max == "-1") {
        $hp_ftp = "-1";
    } elseif (!easyscp_limit_check($hp_ftp, -1)) {
        $ahp_error[] = tr('Incorrect FTP accounts limit!');
    }
    if ($rsql_db_max == "-1") {
        $hp_sql_db = "-1";
    } elseif (!easyscp_limit_check($hp_sql_db, -1)) {
        $ahp_error[] = tr('Incorrect SQL users limit!');
    } else {
        if ($hp_sql_db == -1 && $hp_sql_user != -1) {
            $ahp_error[] = tr('SQL databases limit is <em>disabled</em>!');
        }
    }
    if ($rsql_user_max == "-1") {
        $hp_sql_user = "******";
    } elseif (!easyscp_limit_check($hp_sql_user, -1)) {
        $ahp_error[] = tr('Incorrect SQL databases limit!');
    } else {
        if ($hp_sql_user == -1 && $hp_sql_db != -1) {
            $ahp_error[] = tr('SQL users limit is <em>disabled</em>!');
        }
    }
    if (!easyscp_limit_check($hp_traff, null)) {
        $ahp_error[] = tr('Incorrect traffic limit!');
    }
    if (!easyscp_limit_check($hp_disk, null)) {
        $ahp_error[] = tr('Incorrect disk quota limit!');
    }
    if (!is_numeric($price)) {
        $ahp_error[] = tr('Price must be a number!');
    }
    if (!is_numeric($setup_fee)) {
        $ahp_error[] = tr('Setup fee must be a number!');
    }
    if (empty($ahp_error)) {
        return true;
    } else {
        set_page_message(format_message($ahp_error), 'error');
        return false;
    }
}
Esempio n. 2
0
/**
 * Check input data
 * @param int $reseller_id
 * @param int $user_id
 */
function check_user_data($reseller_id, $user_id)
{
    $sql = EasySCP_Registry::get('Db');
    global $sub, $als, $mail, $ftp, $sql_db, $sql_user, $traff, $disk, $domain_php, $domain_php_edit, $domain_cgi, $domain_ssl, $allowbackup, $domain_dns, $domain_expires, $countbackup;
    $domain_expires_date = isset($_POST['dmn_expire_date']) ? clean_input($_POST['dmn_expire_date']) : 0;
    $domain_expires_never = isset($_POST['dmn_expire_never']) ? $_POST['dmn_expire_never'] : "off";
    $sub = clean_input($_POST['dom_sub']);
    $als = clean_input($_POST['dom_alias']);
    $mail = clean_input($_POST['dom_mail_acCount']);
    $ftp = clean_input($_POST['dom_ftp_acCounts']);
    $sql_db = clean_input($_POST['dom_sqldb']);
    $sql_user = clean_input($_POST['dom_sql_users']);
    $traff = clean_input($_POST['dom_traffic']);
    $disk = clean_input($_POST['dom_disk']);
    // $domain_ip = $_POST['domain_ip'];
    $domain_php = preg_replace("/\\_/", "", $_POST['domain_php']);
    $domain_php_edit = preg_replace("/\\_/", "", $_POST['domain_php_edit']);
    $domain_cgi = preg_replace("/\\_/", "", $_POST['domain_cgi']);
    $domain_ssl = preg_replace("/\\_/", "", $_POST['domain_ssl']);
    $domain_dns = preg_replace("/\\_/", "", $_POST['domain_dns']);
    $allowbackup = preg_replace("/\\_/", "", $_POST['backup']);
    $countbackup = preg_replace("/\\_/", "", $_POST['countbackup']);
    $ed_error = '';
    list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions');
    if ($rsub_max == "-1") {
        $sub = "-1";
    } elseif (!easyscp_limit_check($sub, -1)) {
        $ed_error .= tr('Incorrect subdomains limit!');
    }
    if ($rals_max == "-1") {
        $als = "-1";
    } elseif (!easyscp_limit_check($als, -1)) {
        $ed_error .= tr('Incorrect aliases limit!');
    }
    if ($rmail_max == "-1") {
        $mail = "-1";
    } elseif (!easyscp_limit_check($mail, -1)) {
        $ed_error .= tr('Incorrect mail accounts limit!');
    }
    if ($rftp_max == "-1") {
        $ftp = "-1";
    } elseif (!easyscp_limit_check($ftp, -1)) {
        $ed_error .= tr('Incorrect FTP accounts limit!');
    }
    if ($rsql_db_max == "-1") {
        $sql_db = "-1";
    } elseif (!easyscp_limit_check($sql_db, -1)) {
        $ed_error .= tr('Incorrect SQL users limit!');
    } else {
        if ($sql_db == -1 && $sql_user != -1) {
            $ed_error .= tr('SQL databases limit is <em>disabled</em>!');
        }
    }
    if ($rsql_user_max == "-1") {
        $sql_user = "******";
    } elseif (!easyscp_limit_check($sql_user, -1)) {
        $ed_error .= tr('Incorrect SQL databases limit!');
    } else {
        if ($sql_user == -1 && $sql_db != -1) {
            $ed_error .= tr('SQL users limit is <em>disabled</em>!');
        }
    }
    if (!easyscp_limit_check($traff, null)) {
        $ed_error .= tr('Incorrect traffic limit!');
    }
    if (!easyscp_limit_check($disk, null)) {
        $ed_error .= tr('Incorrect disk quota limit!');
    }
    list($usub_current, $usub_max, $uals_current, $uals_max, $umail_current, $umail_max, $uftp_current, $uftp_max, $usql_db_current, $usql_db_max, $usql_user_current, $usql_user_max, $utraff_max, $udisk_max) = generate_user_props($user_id);
    $previous_utraff_max = $utraff_max;
    list($rdmn_current, $rdmn_max, $rsub_current, $rsub_max, $rals_current, $rals_max, $rmail_current, $rmail_max, $rftp_current, $rftp_max, $rsql_db_current, $rsql_db_max, $rsql_user_current, $rsql_user_max, $rtraff_current, $rtraff_max, $rdisk_current, $rdisk_max) = get_reseller_default_props($sql, $reseller_id);
    list(, , , , , , $utraff_current, $udisk_current) = generate_user_traffic($user_id);
    if (empty($ed_error)) {
        calculate_user_dvals($sub, $usub_current, $usub_max, $rsub_current, $rsub_max, $ed_error, tr('Subdomain'));
        calculate_user_dvals($als, $uals_current, $uals_max, $rals_current, $rals_max, $ed_error, tr('Alias'));
        calculate_user_dvals($mail, $umail_current, $umail_max, $rmail_current, $rmail_max, $ed_error, tr('Mail'));
        calculate_user_dvals($ftp, $uftp_current, $uftp_max, $rftp_current, $rftp_max, $ed_error, tr('FTP'));
        calculate_user_dvals($sql_db, $usql_db_current, $usql_db_max, $rsql_db_current, $rsql_db_max, $ed_error, tr('SQL Database'));
    }
    if (empty($ed_error)) {
        $query = "\n\t\t\tSELECT\n\t\t\t\tCOUNT(distinct su.sqlu_name) AS cnt\n\t\t\tFROM\n\t\t\t\t`sql_user` AS su,\n\t\t\t\t`sql_database` AS sd\n\t\t\tWHERE\n\t\t\t\tsu.`sqld_id` = sd.`sqld_id`\n\t\t\tAND\n\t\t\t\tsd.`domain_id` = ?\n\t\t;";
        $rs = exec_query($sql, $query, $_SESSION['edit_id']);
        calculate_user_dvals($sql_user, $rs->fields['cnt'], $usql_user_max, $rsql_user_current, $rsql_user_max, $ed_error, tr('SQL User'));
    }
    if (empty($ed_error)) {
        calculate_user_dvals($traff, $utraff_current / 1024 / 1024, $utraff_max, $rtraff_current, $rtraff_max, $ed_error, tr('Traffic'));
        calculate_user_dvals($disk, $udisk_current / 1024 / 1024, $udisk_max, $rdisk_current, $rdisk_max, $ed_error, tr('Disk'));
    }
    if (empty($ed_error)) {
        // Set domains status to 'change' to update mod_cband's limit
        if ($previous_utraff_max != $utraff_max) {
            $query = "UPDATE `domain` SET `status` = 'change' WHERE `domain_id` = ?";
            exec_query($sql, $query, $user_id);
            $query = "UPDATE `subdomain` SET `status` = 'change' WHERE `domain_id` = ?";
            exec_query($sql, $query, $user_id);
            send_request('110 DOMAIN domain ' . $user_id);
        }
        $user_props = "{$usub_current};{$usub_max};";
        $user_props .= "{$uals_current};{$uals_max};";
        $user_props .= "{$umail_current};{$umail_max};";
        $user_props .= "{$uftp_current};{$uftp_max};";
        $user_props .= "{$usql_db_current};{$usql_db_max};";
        $user_props .= "{$usql_user_current};{$usql_user_max};";
        $user_props .= "{$utraff_max};";
        $user_props .= "{$udisk_max};";
        // $user_props .= "$domain_ip;";
        $user_props .= "{$domain_php};";
        $user_props .= "{$domain_php_edit};";
        $user_props .= "{$domain_cgi};";
        $user_props .= "{$domain_ssl};";
        $user_props .= "{$allowbackup};";
        $user_props .= "{$domain_dns};";
        $user_props .= "{$countbackup}";
        update_user_props($user_id, $user_props);
        $domain_expires = $_SESSION['domain_expires'];
        // Set domain expire date
        if ($domain_expires_never != "on") {
            $domain_expires = strtotime($domain_expires_date);
        } else {
            $domain_expires = "0";
        }
        update_expire_date($user_id, $domain_expires);
        $reseller_props = "{$rdmn_current};{$rdmn_max};";
        $reseller_props .= "{$rsub_current};{$rsub_max};";
        $reseller_props .= "{$rals_current};{$rals_max};";
        $reseller_props .= "{$rmail_current};{$rmail_max};";
        $reseller_props .= "{$rftp_current};{$rftp_max};";
        $reseller_props .= "{$rsql_db_current};{$rsql_db_max};";
        $reseller_props .= "{$rsql_user_current};{$rsql_user_max};";
        $reseller_props .= "{$rtraff_current};{$rtraff_max};";
        $reseller_props .= "{$rdisk_current};{$rdisk_max}";
        if (!update_reseller_props($reseller_id, $reseller_props)) {
            set_page_message(tr('Domain properties could not be updated!'), 'error');
            return false;
        }
        // Backup Settings
        $query = "UPDATE `domain` SET `allowbackup` = ? WHERE `domain_id` = ?";
        exec_query($sql, $query, array($allowbackup, $user_id));
        // update the sql quotas, too
        $query = "SELECT `domain_name` FROM `domain` WHERE `domain_id` = ?";
        $rs = exec_query($sql, $query, array($user_id));
        $temp_dmn_name = $rs->fields['domain_name'];
        $query = "SELECT COUNT(`name`) AS cnt FROM `quotalimits` WHERE `name` = ?";
        $rs = exec_query($sql, $query, $temp_dmn_name);
        if ($rs->fields['cnt'] > 0) {
            // we need to update it
            if ($disk == 0) {
                $dlim = 0;
            } else {
                $dlim = $disk * 1024 * 1024;
            }
            $query = "UPDATE `quotalimits` SET `bytes_in_avail` = ? WHERE `name` = ?";
            exec_query($sql, $query, array($dlim, $temp_dmn_name));
        }
        set_page_message(tr('Domain properties updated successfully!'), 'success');
        return true;
    } else {
        set_page_message($ed_error, 'error');
        return false;
    }
}
Esempio n. 3
0
/**
 * Check validity of input data
 */
function check_user_data()
{
    global $hp_name, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl;
    global $hp_sub, $hp_als, $hp_mail;
    global $hp_ftp, $hp_sql_db, $hp_sql_user;
    global $hp_traff, $hp_disk, $hp_countbackup, $hp_dmn, $hp_backup, $hp_dns;
    //$sql = EasySCP_Registry::get('Db');
    $ehp_error = array();
    // Get data for fields from previous page
    if (isset($_POST['template'])) {
        $hp_name = $_POST['template'];
    }
    if (isset($_POST['nreseller_max_domain_cnt'])) {
        $hp_dmn = clean_input($_POST['nreseller_max_domain_cnt']);
    }
    if (isset($_POST['nreseller_max_subdomain_cnt'])) {
        $hp_sub = clean_input($_POST['nreseller_max_subdomain_cnt']);
    }
    if (isset($_POST['nreseller_max_alias_cnt'])) {
        $hp_als = clean_input($_POST['nreseller_max_alias_cnt']);
    }
    if (isset($_POST['nreseller_max_mail_cnt'])) {
        $hp_mail = clean_input($_POST['nreseller_max_mail_cnt']);
    }
    if (isset($_POST['nreseller_max_ftp_cnt']) || $hp_ftp == -1) {
        $hp_ftp = clean_input($_POST['nreseller_max_ftp_cnt']);
    }
    if (isset($_POST['nreseller_max_sql_db_cnt'])) {
        $hp_sql_db = clean_input($_POST['nreseller_max_sql_db_cnt']);
    }
    if (isset($_POST['nreseller_max_sql_user_cnt'])) {
        $hp_sql_user = clean_input($_POST['nreseller_max_sql_user_cnt']);
    }
    if (isset($_POST['nreseller_max_traffic'])) {
        $hp_traff = clean_input($_POST['nreseller_max_traffic']);
    }
    if (isset($_POST['nreseller_max_disk'])) {
        $hp_disk = clean_input($_POST['nreseller_max_disk']);
    }
    if (isset($_POST['php'])) {
        $hp_php = $_POST['php'];
    }
    if (isset($_POST['php_edit'])) {
        $hp_phpe = $_POST['php_edit'];
    }
    if (isset($_POST['cgi'])) {
        $hp_cgi = $_POST['cgi'];
    }
    if (isset($_POST['ssl'])) {
        $hp_ssl = $_POST['ssl'];
    }
    if (isset($_POST['backup'])) {
        $hp_backup = $_POST['backup'];
    }
    if (isset($_POST['countbackup'])) {
        $hp_countbackup = $_POST['countbackup'];
    }
    if (isset($_POST['dns'])) {
        $hp_dns = $_POST['dns'];
    }
    // Begin checking...
    list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions');
    if ($rsub_max == "-1") {
        $hp_sub = "-1";
    } elseif (!easyscp_limit_check($hp_sub, -1)) {
        $ehp_error[] = tr('Incorrect subdomains limit!');
    }
    if ($rals_max == "-1") {
        $hp_als = "-1";
    } elseif (!easyscp_limit_check($hp_als, -1)) {
        $ehp_error[] = tr('Incorrect aliases limit!');
    }
    if ($rmail_max == "-1") {
        $hp_mail = "-1";
    } elseif (!easyscp_limit_check($hp_mail, -1)) {
        $ehp_error[] = tr('Incorrect mail accounts limit!');
    }
    if ($rftp_max == "-1") {
        $hp_ftp = "-1";
    } elseif (!easyscp_limit_check($hp_ftp, -1)) {
        $ehp_error[] = tr('Incorrect FTP accounts limit!');
    }
    if ($rsql_db_max == "-1") {
        $hp_sql_db = "-1";
    } elseif (!easyscp_limit_check($hp_sql_db, -1)) {
        $ehp_error[] = tr('Incorrect SQL databases limit!');
    } else {
        if ($hp_sql_user != -1 && $hp_sql_db == -1) {
            $ehp_error[] = tr('SQL users limit is <em>disabled</em>!');
        }
    }
    if ($rsql_user_max == "-1") {
        $hp_sql_user = "******";
    } elseif (!easyscp_limit_check($hp_sql_user, -1)) {
        $ehp_error[] = tr('Incorrect SQL users limit!');
    } else {
        if ($hp_sql_user == -1 && $hp_sql_db != -1) {
            $ehp_error[] = tr('SQL databases limit is not <em>disabled</em>!');
        }
    }
    if (!easyscp_limit_check($hp_traff, null)) {
        $ehp_error[] = tr('Incorrect traffic limit!');
    }
    if (!easyscp_limit_check($hp_disk, null)) {
        $ehp_error[] = tr('Incorrect disk quota limit!');
    }
    if (empty($ehp_error) && empty($_SESSION['user_page_message'])) {
        // send data through session
        return true;
    } else {
        set_page_message(format_message($ehp_error), 'error');
        return false;
    }
}
Esempio n. 4
0
    user_goto('user_add1.php');
}
// Process the action ...
if (isset($_POST['uaction']) && "user_add3_nxt" === $_POST['uaction'] && !isset($_SESSION['step_two_data'])) {
    if (check_ruser_data($tpl, '_no_')) {
        add_user_data($_SESSION['user_id']);
    }
    set_page_message($_SESSION['Message']);
    unset($_SESSION['Message']);
} else {
    unset($_SESSION['step_two_data']);
    gen_empty_data();
}
gen_user_add3_page($tpl);
gen_page_message($tpl);
if (!check_reseller_permissions($_SESSION['user_id'], 'alias')) {
    $tpl->assign('ALIAS_ADD', '');
}
if ($cfg->DUMP_GUI_DEBUG) {
    dump_gui_debug($tpl);
}
$tpl->display($template);
// FUNCTION declaration
/**
 * Get data from previous page
 */
function init_in_values()
{
    global $dmn_name, $dmn_expire, $dmn_user_name, $hpid;
    if (isset($_SESSION['dmn_expire'])) {
        $dmn_expire = strtotime($_SESSION['dmn_expire']);
Esempio n. 5
0
/**
 * Check correction of input data
 * @param EasySCP_TemplateEngine $tpl
 */
function check_data_correction($tpl)
{
    global $hp_name, $description, $hp_php, $hp_phpe, $hp_cgi, $hp_ssl;
    global $hp_sub, $hp_als, $hp_mail;
    global $hp_ftp, $hp_sql_db, $hp_sql_user;
    global $hp_traff, $hp_disk, $hp_countbackup;
    global $price, $setup_fee, $value, $payment, $status;
    global $hp_backup, $hp_dns;
    global $tos;
    $ahp_error = array();
    $hp_name = clean_input($_POST['hp_name']);
    $hp_sub = clean_input($_POST['hp_sub']);
    $hp_als = clean_input($_POST['hp_als']);
    $hp_mail = clean_input($_POST['hp_mail']);
    $hp_ftp = clean_input($_POST['hp_ftp']);
    $hp_sql_db = clean_input($_POST['hp_sql_db']);
    $hp_sql_user = clean_input($_POST['hp_sql_user']);
    $hp_traff = clean_input($_POST['hp_traff']);
    $hp_disk = clean_input($_POST['hp_disk']);
    $value = clean_input($_POST['hp_value']);
    $payment = clean_input($_POST['hp_payment']);
    $status = $_POST['status'];
    $description = clean_input($_POST['hp_description']);
    $tos = clean_input($_POST['hp_tos']);
    if (empty($_POST['hp_price'])) {
        $price = 0;
    } else {
        $price = clean_input($_POST['hp_price']);
    }
    if (empty($_POST['hp_setupfee'])) {
        $setup_fee = 0;
    } else {
        $setup_fee = clean_input($_POST['hp_setupfee']);
    }
    if (isset($_POST['php'])) {
        $hp_php = $_POST['php'];
    }
    if (isset($_POST['php_edit'])) {
        $hp_phpe = $_POST['php_edit'];
    }
    if (isset($_POST['cgi'])) {
        $hp_cgi = $_POST['cgi'];
    }
    if (isset($_POST['ssl'])) {
        $hp_ssl = $_POST['ssl'];
    }
    if (isset($_POST['dns'])) {
        $hp_dns = $_POST['dns'];
    }
    if (isset($_POST['backup'])) {
        $hp_backup = $_POST['backup'];
    }
    if (isset($_POST['countbackup'])) {
        $hp_countbackup = $_POST['countbackup'];
    }
    if ($hp_name == '') {
        $ahp_error[] = tr('Incorrect template name length!');
    }
    if ($description == '') {
        $ahp_error[] = tr('Incorrect template description length!');
    }
    if (!is_numeric($price)) {
        $ahp_error[] = tr('Price must be a number!');
    }
    if (!is_numeric($setup_fee)) {
        $ahp_error[] = tr('Setup fee must be a number!');
    }
    list($rsub_max, $rals_max, $rmail_max, $rftp_max, $rsql_db_max, $rsql_user_max) = check_reseller_permissions($_SESSION['user_id'], 'all_permissions');
    if ($rsub_max == "-1") {
        $hp_sub = "-1";
    } elseif (!easyscp_limit_check($hp_sub, -1)) {
        $ahp_error[] = tr('Incorrect subdomains limit!');
    }
    if ($rals_max == "-1") {
        $hp_als = "-1";
    } elseif (!easyscp_limit_check($hp_als, -1)) {
        $ahp_error[] = tr('Incorrect aliases limit!');
    }
    if ($rmail_max == "-1") {
        $hp_mail = "-1";
    } elseif (!easyscp_limit_check($hp_mail, -1)) {
        $ahp_error[] = tr('Incorrect mail accounts limit!');
    }
    if ($rftp_max == "-1") {
        $hp_ftp = "-1";
    } elseif (!easyscp_limit_check($hp_ftp, -1)) {
        $ahp_error[] = tr('Incorrect FTP accounts limit!');
    }
    if ($rsql_db_max == "-1") {
        $hp_sql_db = "-1";
    } elseif (!easyscp_limit_check($hp_sql_db, -1)) {
        $ahp_error[] = tr('Incorrect SQL users limit!');
    } else {
        if ($hp_sql_user != -1 && $hp_sql_db == -1) {
            $ahp_error[] = tr('SQL users limit is <em>disabled</em>!');
        }
    }
    if ($rsql_user_max == "-1") {
        $hp_sql_user = "******";
    } elseif (!easyscp_limit_check($hp_sql_user, -1)) {
        $ahp_error[] = tr('Incorrect SQL databases limit!');
    } else {
        if ($hp_sql_user == -1 && $hp_sql_db != -1) {
            $ahp_error[] = tr('SQL databases limit is not <em>disabled</em>!');
        }
    }
    if (!easyscp_limit_check($hp_traff, null)) {
        $ahp_error[] = tr('Incorrect traffic limit!');
    }
    if (!easyscp_limit_check($hp_disk, null)) {
        $ahp_error[] = tr('Incorrect disk quota limit!');
    }
    if (empty($ahp_error)) {
        return true;
    } else {
        set_page_message(format_message($ahp_error), 'error');
        return false;
    }
}
Esempio n. 6
0
$cfg = EasySCP_Registry::get('Config');
// Avoid unneeded generation during Ajax request
if (!is_xhr()) {
    $tpl = EasySCP_TemplateEngine::getInstance();
    $template = 'reseller/alias_add.tpl';
    $reseller_id = $_SESSION['user_id'];
    // static page messages
    gen_logged_from($tpl);
    $tpl->assign(array('TR_PAGE_TITLE' => tr('EasySCP Reseller: Add Alias'), 'TR_MANAGE_DOMAIN_ALIAS' => tr('Manage domain alias'), 'TR_ADD_ALIAS' => tr('Add domain alias'), 'TR_DOMAIN_NAME' => tr('Domain name'), 'TR_DOMAIN_ACCOUNT' => tr('User account'), 'TR_MOUNT_POINT' => tr('Directory mount point'), 'TR_DOMAIN_IP' => tr('Domain IP'), 'TR_FORWARD' => tr('Forward to URL'), 'TR_ADD' => tr('Add alias'), 'TR_DMN_HELP' => tr("You do not need 'www.' EasySCP will add it on its own."), 'TR_JS_EMPTYDATA' => tr("Empty data or wrong field!"), 'TR_JS_WDNAME' => tr("Wrong domain name!"), 'TR_JS_MPOINTERROR' => tr("Please write mount point!"), 'TR_ENABLE_FWD' => tr("Enable Forward"), 'TR_ENABLE' => tr("Enable"), 'TR_DISABLE' => tr("Disable"), 'TR_PREFIX_HTTP' => 'http://', 'TR_PREFIX_HTTPS' => 'https://', 'TR_PREFIX_FTP' => 'ftp://'));
    gen_reseller_mainmenu($tpl, 'reseller/main_menu_users_manage.tpl');
    gen_reseller_menu($tpl, 'reseller/menu_users_manage.tpl');
    list($rdmn_current, $rdmn_max, $rsub_current, $rsub_max, $rals_current, $rals_max, $rmail_current, $rmail_max, $rftp_current, $rftp_max, $rsql_db_current, $rsql_db_max, $rsql_user_current, $rsql_user_max, $rtraff_current, $rtraff_max, $rdisk_current, $rdisk_max) = get_reseller_default_props($sql, $_SESSION['user_id']);
    if ($rals_max != 0 && $rals_current >= $rals_max) {
        $_SESSION['almax'] = '_yes_';
    }
    if (!check_reseller_permissions($reseller_id, 'alias') || isset($_SESSION['almax'])) {
        user_goto('alias.php');
    }
}
$err_txt = '_off_';
// Dispatch request
if (isset($_POST['uaction'])) {
    if ($_POST['uaction'] == 'toASCII') {
        // Ajax request
        header('Content-Type: text/plain; charset=utf-8');
        header('Cache-Control: no-cache, private');
        // backward compatibility for HTTP/1.0
        header('Pragma: no-cache');
        header("HTTP/1.0 200 Ok");
        // Todo check return value here before echo...
        echo "/" . encode_idna(strtolower($_POST['domain']));