Ejemplo n.º 1
0
function check_ftp_acc_data($tpl, $sql, $dmn_id, $dmn_name)
{
    $cfg = EasySCP_Registry::get('Config');
    if (!isset($_POST['username']) || $_POST['username'] === '') {
        set_page_message(tr('Please enter FTP account username!'), 'warning');
        return;
    }
    if (!isset($_POST['pass']) || empty($_POST['pass']) || !isset($_POST['pass_rep']) || $_POST['pass_rep'] === '') {
        set_page_message(tr('Password is missing!'), 'warning');
        return;
    }
    if ($_POST['pass'] !== $_POST['pass_rep']) {
        set_page_message(tr('Entered passwords do not match!'), 'warning');
        return;
    }
    if (!chk_password($_POST['pass'])) {
        if ($cfg->PASSWD_STRONG) {
            set_page_message(sprintf(tr('The password must be at least %s chars long and contain letters and numbers to be valid.'), $cfg->PASSWD_CHARS), 'warning');
        } else {
            set_page_message(sprintf(tr('Password data is shorter than %s signs or includes not permitted signs!'), $cfg->PASSWD_CHARS), 'warning');
        }
        return;
    }
    if ($_POST['dmn_type'] === 'sub' && $_POST['sub_id'] === 'n/a') {
        set_page_message(tr('Subdomain list is empty! You cannot add FTP accounts there!'), 'warning');
        return;
    }
    if ($_POST['dmn_type'] === 'als' && $_POST['als_id'] === 'n/a') {
        set_page_message(tr('Alias list is empty! You cannot add FTP accounts there!'), 'warning');
        return;
    }
    if (isset($_POST['use_other_dir']) && $_POST['use_other_dir'] === 'on' && empty($_POST['other_dir'])) {
        set_page_message(tr('Please specify other FTP account dir!'), 'warning');
        return;
    }
    add_ftp_user($sql, $dmn_name);
}
Ejemplo n.º 2
0
function check_ftp_acc_data(&$tpl, &$sql, $dmn_id, $dmn_name)
{
    if (!isset($_POST['username']) || $_POST['username'] === '') {
        set_page_message(tr('Please enter FTP account username!'));
        return;
    }
    if (!isset($_POST['pass']) || $_POST['pass'] === '' || !isset($_POST['pass_rep']) || $_POST['pass_rep'] === '') {
        set_page_message(tr('Password data is missing!'));
        return;
    }
    if ($_POST['pass'] !== $_POST['pass_rep']) {
        set_page_message(tr('Entered passwords differ from the another!'));
        return;
    }
    if ($_POST['dmn_type'] === 'sub' && $_POST['sub_id'] === 'n/a') {
        set_page_message(tr('Subdomain list is empty! You can not add FTP accounts there!'));
        return;
    }
    if ($_POST['dmn_type'] === 'als' && $_POST['als_id'] === 'n/a') {
        set_page_message(tr('Alias list is empty! You can not add FTP accounts there!'));
        return;
    }
    if (isset($_POST['use_other_dir']) && $_POST['use_other_dir'] === 'on' && $_POST['other_dir'] === '') {
        set_page_message(tr('Please specify other FTP account dir!'));
        return;
    }
    add_ftp_user($sql, $dmn_name);
}