Ejemplo n.º 1
0
/**
 * Shows user register form of express card 
 * 
 * 
 * @return string
 */
function web_ExpressCardRegForm()
{
    $altconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    $allcontracts = zb_UserGetAllContracts();
    //contract proposal
    $top_offset = 100000;
    //contract generation mode default
    if ($altconf['CONTRACT_GENERATION_DEFAULT']) {
        for ($i = 1; $i < $top_offset; $i++) {
            if (!isset($allcontracts[$i])) {
                $contract = $i;
                break;
            }
        }
    } else {
        //alternate generation method
        $max_contract = max(array_keys($allcontracts));
        $contract = $max_contract + 1;
    }
    $mac = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99);
    $phone = '';
    $mobile = '';
    $email = '';
    $notes = '';
    $stgdata = '';
    $currenttariff = '';
    $birthdate = '';
    $passportnum = '';
    $passportdate = '';
    $passportwho = '';
    $pcity = '';
    $pstreet = '';
    $pbuild = '';
    $papt = '';
    $inputs = zb_AjaxLoader() . wf_delimiter();
    $inputs .= __('Contract');
    $inputs .= wf_TextInput('newcontract', '', $contract, false, '10');
    $inputs .= __('Contract date');
    $inputs .= wf_DatePickerPreset('newcontractdate', @$allcontractdates[$contract]);
    $inputs .= wf_delimiter();
    $inputs .= __('Surname');
    $inputs .= wf_TextInput('newsurname', '', '', false, '20');
    $inputs .= __('Name');
    $inputs .= wf_TextInput('newname', '', '', false, '20');
    $inputs .= __('Patronymic');
    $inputs .= wf_TextInput('newpatronymic', '', '', false, '20');
    $inputs .= __('Birth date');
    $inputs .= wf_DatePickerPreset('newbirthdate', $birthdate);
    $inputs .= wf_delimiter();
    $inputs .= __('Passport number');
    $inputs .= wf_TextInput('newpassportnum', '', $passportnum, false, '30');
    $inputs .= __('Date of issue');
    $inputs .= wf_DatePickerPreset('newpassportdate', $passportdate);
    $inputs .= __('Issuing authority');
    $inputs .= wf_TextInput('newpassportwho', '', $passportwho, false, '40');
    $inputs .= wf_delimiter();
    $inputs .= __('Phone');
    $inputs .= wf_TextInput('newphone', '', $phone, false, '20');
    $inputs .= __('Mobile');
    $inputs .= wf_TextInput('newmobile', '', $mobile, false, '20');
    $inputs .= __('email');
    $inputs .= wf_TextInput('newemail', '', $email, false, '20');
    $inputs .= wf_delimiter();
    $inputs .= wf_tag('fieldset');
    //address data form
    $inputs .= __('Address of service') . ' ';
    //new address creation form
    $inputs .= web_ExpressAddressOccupancyForm();
    $inputs .= wf_delimiter();
    //additional address fields
    $inputs .= __('Registration address') . ' ';
    $inputs .= zb_JSHider();
    $inputs .= web_PaddressUnhideBox();
    $inputs .= web_HidingDiv('paddress');
    $inputs .= __('City');
    $inputs .= wf_TextInput('newpcity', '', $pcity, false, '20');
    $inputs .= __('Street');
    $inputs .= wf_TextInput('newpstreet', '', $pstreet, false, '20');
    $inputs .= __('Build');
    $inputs .= wf_TextInput('newpbuild', '', $pbuild, false, '5');
    $inputs .= __('Apartment');
    $inputs .= wf_TextInput('newpapt', '', $papt, false, '5');
    $inputs .= wf_tag('div', true);
    $inputs .= wf_tag('fieldset', true);
    $inputs .= wf_delimiter();
    $inputs .= __('Tariff');
    $inputs .= web_ExpressTariffSelector('newtariff', $currenttariff);
    $inputs .= __('Service');
    $inputs .= web_ExpressServiceSelectorReg();
    $inputs .= __('IP');
    $inputs .= wf_tag('span', false, '', 'id="dipbox"');
    $allservices = multinet_get_services();
    if (!empty($allservices)) {
        $firstService = $allservices[0];
        $firstNet = $firstService['netid'];
        @($ip_proposal = multinet_get_next_freeip('nethosts', 'ip', $firstNet));
        if (empty($ip_proposal)) {
            show_window('', wf_modalOpened(__('Error'), __('No free IP available in selected pool'), '400', '250'));
        }
    } else {
        $ip_proposal = __('Error');
    }
    $inputs .= wf_TextInput('editip', '', $ip_proposal, false, '20');
    $inputs .= wf_tag('span', true);
    //dummy login proposal
    $login = zb_RegLoginProposal('', '', '', '', $ip_proposal);
    $inputs .= __('MAC');
    $inputs .= wf_TextInput('newmac', '', $mac, false, '20');
    $inputs .= __('Login');
    $inputs .= wf_TextInput('newlogin', '', $login, false, '20');
    $inputs .= wf_delimiter();
    $inputs .= __('Notes');
    $inputs .= wf_TextInput('newnotes', '', $notes, false, '120');
    $inputs .= wf_HiddenInput('expresscardreg', 'true');
    $inputs .= wf_delimiter();
    $inputs .= wf_Submit('Let register that user');
    $expresscardform = wf_Form("", "POST", $inputs, 'expresscard');
    show_window(__('Express card user register'), $expresscardform);
}
Ejemplo n.º 2
0
/**
 * Returns register last step form
 * 
 * @param array $newuser_data
 * @return string
 */
function web_UserRegFormNetData($newuser_data)
{
    $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    $safe_mode = $alterconf['SAFE_REGMODE'];
    $citydata = zb_AddressGetCityData($newuser_data['city']);
    $cityalias = zb_TranslitString($citydata['cityalias']);
    $streetdata = zb_AddressGetStreetData($newuser_data['street']);
    $streetalias = zb_TranslitString($streetdata['streetalias']);
    $buildata = zb_AddressGetBuildData($newuser_data['build']);
    $buildnum = zb_TranslitString($buildata['buildnum']);
    if (empty($newuser_data['apt'])) {
        $newuser_data['apt'] = 0;
    }
    $apt = zb_TranslitString($newuser_data['apt']);
    //assign some agent from previously selected form
    if (isset($alterconf['LOGIN_GENERATION'])) {
        if ($alterconf['LOGIN_GENERATION'] == 'DEREBAN') {
            $agentPrefixID = $newuser_data['contrahent'];
        } else {
            $agentPrefixID = '';
        }
    } else {
        $agentPrefixID = '';
    }
    $ip_proposal = multinet_get_next_freeip('nethosts', 'ip', multinet_get_service_networkid($newuser_data['service']));
    $login_proposal = zb_RegLoginProposal($cityalias, $streetalias, $buildnum, $apt, $ip_proposal, $agentPrefixID);
    $password_proposal = zb_RegPasswordProposal();
    if (empty($ip_proposal)) {
        $alert = wf_tag('script', false, '', 'type="text/javascript"');
        $alert .= 'alert("' . __('Error') . ': ' . __('No free IP available in selected pool') . '");';
        $alert .= wf_tag('script', true);
        print $alert;
        rcms_redirect("?module=multinet");
        die;
    }
    //protect important options
    if ($safe_mode) {
        $modifier = 'READONLY';
    } else {
        $modifier = '';
    }
    $form = wf_tag('table', false, 'glamour', 'width="100%" border="0"');
    $form .= wf_tag('form', false, '', ' action="" method="POST"');
    $form .= wf_tag('tr', false, 'row3');
    $form .= wf_tag('td', false, '', 'width="50%"');
    $form .= wf_tag('input', false, '', 'type="text" name="login" value="' . $login_proposal . '" ' . $modifier);
    $form .= wf_tag('td', true);
    $form .= wf_tag('td', false);
    $form .= __('Login') . ' ' . zb_CheckLoginRscriptdCompat($login_proposal);
    $form .= wf_tag('td', true);
    $form .= wf_tag('tr', true);
    $form .= wf_tag('tr', false, 'row3');
    $form .= wf_tag('td', false);
    $form .= wf_tag('input', false, '', 'type="text" name="password" value="' . $password_proposal . '" ' . $modifier);
    $form .= wf_tag('td', true);
    $form .= wf_tag('td', false);
    $form .= __('Password');
    $form .= wf_tag('td', true);
    $form .= wf_tag('tr', true);
    $form .= wf_tag('tr', false, 'row3');
    $form .= wf_tag('td', false);
    $form .= wf_tag('input', false, '', 'type="text" name="IP" value="' . $ip_proposal . '" ' . $modifier);
    $form .= wf_tag('td', true);
    $form .= wf_tag('td', false);
    $form .= __('IP');
    $form .= wf_tag('td', true);
    $form .= wf_tag('tr', true);
    $form .= wf_tag('table', true);
    $form .= wf_HiddenInput('repostdata', base64_encode(serialize($newuser_data)));
    $form .= wf_Submit(__('Let register that user'));
    $form .= wf_tag('form', true);
    $form .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true);
    return $form;
}