Example #1
0
 /**
  * Returns available time rules grid
  * 
  * @return string
  */
 public function renderList()
 {
     $messages = new UbillingMessageHelper();
     $allTariffs = zb_TariffGetPricesAll();
     $query = "SELECT * from `dshape_time` ORDER BY `id` ASC";
     $allrules = simple_queryall($query);
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Time from'));
     $cells .= wf_TableCell(__('Time to'));
     $cells .= wf_TableCell(__('Speed'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($allrules)) {
         foreach ($allrules as $io => $eachrule) {
             $rowClass = isset($allTariffs[$eachrule['tariff']]) ? 'row3' : 'sigdeleteduser';
             $tariffControl = cfr('TARIFFSPEED') ? wf_Link('?module=tariffspeeds&tariff=' . $eachrule['tariff'], $eachrule['tariff'], false) : $eachrule['tariff'];
             $cells = wf_TableCell($eachrule['id']);
             $cells .= wf_TableCell($tariffControl);
             $cells .= wf_TableCell($eachrule['threshold1']);
             $cells .= wf_TableCell($eachrule['threshold2']);
             $cells .= wf_TableCell($eachrule['speed']);
             $actions = wf_JSAlert('?module=dshaper&delete=' . $eachrule['id'], web_delete_icon(), $messages->getDeleteAlert());
             $actions .= wf_JSAlert('?module=dshaper&edit=' . $eachrule['id'], web_edit_icon(), $messages->getEditAlert());
             $cells .= wf_TableCell($actions);
             $rows .= wf_TableRow($cells, $rowClass);
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
Example #2
0
/**
 *  Returns list of lousy tariffs
 *  @return  string
 */
function web_LousyShowAll()
{
    $allousy = zb_LousyTariffGetAll();
    $allTariffs = zb_TariffGetPricesAll();
    $tablecells = wf_TableCell(__('Tariff'));
    $tablecells .= wf_TableCell(__('Actions'));
    $tablerows = wf_TableRow($tablecells, 'row1');
    if (!empty($allousy)) {
        foreach ($allousy as $eachtariff => $id) {
            if (isset($allTariffs[$eachtariff])) {
                $rowClass = 'row3';
            } else {
                $rowClass = 'sigdeleteduser';
            }
            $tablecells = wf_TableCell($eachtariff);
            $dellink = wf_JSAlert('?module=lousytariffs&delete=' . $eachtariff, web_delete_icon(), 'Removing this may lead to irreparable results');
            $tablecells .= wf_TableCell($dellink);
            $tablerows .= wf_TableRow($tablecells, $rowClass);
        }
    }
    $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
    return $result;
}
Example #3
0
 /**
  * loads user data for template processing 
  * 
  * @return void
  */
 public function loadAllUserData()
 {
     $userdata = array();
     $alluserdata = zb_UserGetAllStargazerData();
     $tariffspeeds = zb_TariffGetAllSpeeds();
     $tariffprices = zb_TariffGetPricesAll();
     $multinetdata = zb_MultinetGetAllData();
     $allcontracts = zb_UserGetAllContracts();
     $allcontracts = array_flip($allcontracts);
     $contractDates = $this->getContractDatesAll();
     $allphonedata = zb_UserGetAllPhoneData();
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $allemails = zb_UserGetAllEmails();
     $allnasdata = zb_NasGetAllData();
     $allcfdata = cf_FieldsGetAll();
     $allpdata = zb_UserPassportDataGetAll();
     $curdate = curdate();
     $lastDocId = $this->getDocumentLastId();
     $newDocId = $lastDocId + 1;
     if ($this->altcfg['OPENPAYZ_REALID']) {
         $allopcustomers = zb_TemplateGetAllOPCustomers();
     }
     if (!empty($alluserdata)) {
         foreach ($alluserdata as $io => $eachuser) {
             $userdata[$eachuser['login']]['LOGIN'] = $eachuser['login'];
             $userdata[$eachuser['login']]['PASSWORD'] = $eachuser['Password'];
             $userdata[$eachuser['login']]['USERHASH'] = crc16($eachuser['login']);
             $userdata[$eachuser['login']]['TARIFF'] = $eachuser['Tariff'];
             @($userdata[$eachuser['login']]['TARIFFPRICE'] = $tariffprices[$eachuser['Tariff']]);
             $userdata[$eachuser['login']]['CASH'] = $eachuser['Cash'];
             $userdata[$eachuser['login']]['CREDIT'] = $eachuser['Credit'];
             $userdata[$eachuser['login']]['DOWN'] = $eachuser['Down'];
             $userdata[$eachuser['login']]['PASSIVE'] = $eachuser['Passive'];
             $userdata[$eachuser['login']]['AO'] = $eachuser['AlwaysOnline'];
             @($userdata[$eachuser['login']]['CONTRACT'] = $allcontracts[$eachuser['login']]);
             @($userdata[$eachuser['login']]['CONTRACTDATE'] = $contractDates[$eachuser['login']]['contractdate']);
             @($userdata[$eachuser['login']]['REALNAME'] = $allrealnames[$eachuser['login']]);
             @($userdata[$eachuser['login']]['ADDRESS'] = $alladdress[$eachuser['login']]);
             @($userdata[$eachuser['login']]['EMAIL'] = $allemails[$eachuser['login']]);
             @($userdata[$eachuser['login']]['PHONE'] = $allphonedata[$eachuser['login']]['phone']);
             @($userdata[$eachuser['login']]['MOBILE'] = $allphonedata[$eachuser['login']]['mobile']);
             //openpayz payment ID
             if ($this->altcfg['OPENPAYZ_REALID']) {
                 @($userdata[$eachuser['login']]['PAYID'] = $allopcustomers[$eachuser['login']]);
             } else {
                 @($userdata[$eachuser['login']]['PAYID'] = ip2int($eachuser['IP']));
             }
             //traffic params
             $userdata[$eachuser['login']]['TRAFFIC'] = $eachuser['D0'] + $eachuser['U0'];
             $userdata[$eachuser['login']]['TRAFFICDOWN'] = $eachuser['D0'];
             $userdata[$eachuser['login']]['TRAFFICUP'] = $eachuser['U0'];
             //net params
             @($userdata[$eachuser['login']]['IP'] = $eachuser['IP']);
             @($userdata[$eachuser['login']]['MAC'] = $multinetdata[$eachuser['IP']]['mac']);
             @($userdata[$eachuser['login']]['NETID'] = $multinetdata[$eachuser['IP']]['netid']);
             @($userdata[$eachuser['login']]['HOSTID'] = $multinetdata[$eachuser['IP']]['id']);
             //nas data
             @($usernas = zb_NasGetParams($multinetdata[$eachuser['IP']]['netid'], $allnasdata));
             @($userdata[$eachuser['login']]['NASID'] = $usernas['id']);
             @($userdata[$eachuser['login']]['NASIP'] = $usernas['nasip']);
             @($userdata[$eachuser['login']]['NASNAME'] = $usernas['nasname']);
             @($userdata[$eachuser['login']]['NASTYPE'] = $usernas['nastype']);
             if (isset($tariffspeeds[$eachuser['Tariff']])) {
                 $userdata[$eachuser['login']]['SPEEDDOWN'] = $tariffspeeds[$eachuser['Tariff']]['speeddown'];
                 $userdata[$eachuser['login']]['SPEEDUP'] = $tariffspeeds[$eachuser['Tariff']]['speedup'];
             } else {
                 //if no tariff speed defined zero speed by default
                 $userdata[$eachuser['login']]['SPEEDDOWN'] = 0;
                 $userdata[$eachuser['login']]['SPEEDUP'] = 0;
             }
             //passport data
             @($userdata[$eachuser['login']]['PBIRTH'] = $allpdata[$eachuser['login']]['birthdate']);
             @($userdata[$eachuser['login']]['PNUM'] = $allpdata[$eachuser['login']]['passportnum']);
             @($userdata[$eachuser['login']]['PDATE'] = $allpdata[$eachuser['login']]['passportdate']);
             @($userdata[$eachuser['login']]['PWHO'] = $allpdata[$eachuser['login']]['passportwho']);
             @($userdata[$eachuser['login']]['PCITY'] = $allpdata[$eachuser['login']]['pcity']);
             @($userdata[$eachuser['login']]['PSTREET'] = $allpdata[$eachuser['login']]['pstreet']);
             @($userdata[$eachuser['login']]['PBUILD'] = $allpdata[$eachuser['login']]['pbuild']);
             @($userdata[$eachuser['login']]['PAPT'] = $allpdata[$eachuser['login']]['papt']);
             //other document data
             @($userdata[$eachuser['login']]['CURDATE'] = $curdate);
             @($userdata[$eachuser['login']]['DOCID'] = $newDocId);
         }
     }
     $this->userData = $userdata;
 }
Example #4
0
 /*
  * Connecting to TurboSMS service and loading all of needed data
  */
 //reading config
 $tsms_host = $altercfg['TSMS_GATEWAY'];
 $tsms_db = "passed";
 $tsms_login = "******";
 $tsms_password = $altercfg['TSMS_PASSWORD'];
 $tsms_table = $tsms_login;
 $tsms_prefix = $altercfg['TSMS_PHONEPREFIX'];
 $tsms_phone_key = $altercfg['TSMS_PHONE_KEY'];
 $tsms_msg_key = $altercfg['TSMS_MESSAGE_KEY'];
 //loading ubilling database
 $td_realnames = zb_UserGetAllRealnames();
 $td_realnamestrans = tsms_RealnamesTranslit($td_realnames);
 $td_tariffprices = zb_TariffGetPricesAll();
 $td_tariffperiods = zb_TariffGetPeriodsAll();
 $td_curdate = curdate();
 $td_users = tsms_UserGetAllStargazerData();
 $td_mobiles = tsms_GetAllMobileNumbers();
 $td_alladdress = zb_AddressGetFulladdresslistCached();
 $td_allpayids = tsms_PaymentIDGetAll();
 function tsms_query($query)
 {
     global $tsms_host, $tsms_db, $tsms_login, $tsms_password, $tsms_table;
     log_register("TSMS REQ" . $tsms_host . '?' . $query . '&' . $tsms_password);
     $r = file_get_contents($tsms_host . '?' . $query . '&' . $tsms_password);
     log_register("TSMS RESP" . $r);
     $result = array();
     return $result;
 }
Example #5
0
function web_EasyCreditForm($login, $cash, $credit, $userTariff, $easycreditoption)
{
    /////////////////internal controller
    if (wf_CheckPost(array('easycreditlogin', 'easycreditlimit', 'easycreditexpire'))) {
        global $billing;
        $setCredit = vf($_POST['easycreditlimit']);
        $setLogin = mysql_real_escape_string($_POST['easycreditlogin']);
        $setExpire = mysql_real_escape_string($_POST['easycreditexpire']);
        //set credit
        $billing->setcredit($setLogin, $setCredit);
        log_register('CHANGE Credit (' . $setLogin . ') ON ' . $setCredit);
        //set credit expire date
        $billing->setcreditexpire($setLogin, $setExpire);
        log_register('CHANGE CreditExpire (' . $setLogin . ') ON ' . $setExpire);
        rcms_redirect('?module=userprofile&username='******'-' . $credit) {
        $creditProposal = $tariffPrice;
        $creditNote = __('The amount of money in the account at the moment is sufficient to provide the service. It is therefore proposed to set a credit limit on the fee of the tariff.');
    } else {
        $creditProposal = abs($cash);
        $creditNote = __('At the moment the account have debt. It is proposed to establish credit in its size.');
    }
    //calculate credit expire date
    $nowTimestamp = time();
    $creditSeconds = $easycreditoption * 86400;
    //days*secs
    $creditOffset = $nowTimestamp + $creditSeconds;
    $creditExpireDate = date("Y-m-d", $creditOffset);
    //construct form
    $controlIcon = wf_tag('img', false, '', 'src="skins/icon_calendar.gif" height="10"');
    $inputs = '';
    $inputs .= wf_HiddenInput('easycreditlogin', $login);
    $inputs .= wf_TextInput('easycreditlimit', '', $creditProposal, false, '5') . __('credit limit') . ' ';
    $inputs .= __('until');
    $inputs .= wf_DatePickerPreset('easycreditexpire', $creditExpireDate);
    $inputs .= wf_Submit(__('Save'));
    $form = wf_Form("", 'POST', $inputs, 'glamour');
    $form .= $creditNote;
    $result = wf_modal($controlIcon, __('Change') . ' ' . __('credit limit'), $form, '', '500', '180');
    return $result;
}
Example #6
0
if (cfr('CORPS')) {
    $altcfg = $ubillingConfig->getAlter();
    if ($altcfg['CORPS_ENABLED']) {
        $greed = new Avarice();
        $beggar = $greed->runtime('CORPS');
        if (!empty($beggar)) {
            $corps = new Corps();
            $funds = new FundsFlow();
            //all that we need
            $corpsData = $corps->getCorps();
            $corpUsers = $corps->getUsers();
            $allUserContracts = zb_UserGetAllContracts();
            $allUsersCash = zb_UserGetAllBalance();
            $allUserTariffs = zb_TariffsGetAllUsers();
            $allTariffPrices = zb_TariffGetPricesAll();
            $rows = '';
            $count = 0;
            //showing date search form
            show_window(__('Corporate users') . ' - ' . __('Funds flow'), $funds->renderCorpsFlowsDateForm());
            if (!wf_CheckPost(array('yearsel', 'monthsel'))) {
                $needYear = curyear();
                $needMonth = date("m");
            } else {
                $needYear = $_POST['yearsel'];
                $needMonth = $_POST['monthsel'];
            }
            //setting date filter
            $date = $needYear . '-' . $needMonth . '-';
            if (!empty($corpUsers)) {
                $rows = $funds->renderCorpsFlowsHeaders($needYear, $needMonth);
Example #7
0
/**
 *  Returns all data about current userbase
 *  which used for templatizing functions
 * 
 *  @return  array
 */
function zb_TemplateGetAllUserData()
{
    $altcfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    $userdata = array();
    $alluserdata = zb_UserGetAllStargazerData();
    $tariffspeeds = zb_TariffGetAllSpeeds();
    $tariffprices = zb_TariffGetPricesAll();
    $multinetdata = zb_MultinetGetAllData();
    $allcontracts = zb_UserGetAllContracts();
    $allcontracts = array_flip($allcontracts);
    $allrealnames = zb_UserGetAllRealnames();
    $alladdress = zb_AddressGetFulladdresslist();
    $allemails = zb_UserGetAllEmails();
    $allnasdata = zb_NasGetAllData();
    $allcfdata = cf_FieldsGetAll();
    $allpdata = zb_UserPassportDataGetAll();
    if ($altcfg['OPENPAYZ_REALID']) {
        $allopcustomers = zb_TemplateGetAllOPCustomers();
    }
    if (!empty($alluserdata)) {
        foreach ($alluserdata as $io => $eachuser) {
            $userdata[$eachuser['login']]['login'] = $eachuser['login'];
            $userdata[$eachuser['login']]['password'] = $eachuser['Password'];
            $userdata[$eachuser['login']]['userhash'] = crc16($eachuser['login']);
            $userdata[$eachuser['login']]['tariff'] = $eachuser['Tariff'];
            @($userdata[$eachuser['login']]['tariffprice'] = $tariffprices[$eachuser['Tariff']]);
            $userdata[$eachuser['login']]['cash'] = $eachuser['Cash'];
            $userdata[$eachuser['login']]['credit'] = $eachuser['Credit'];
            $userdata[$eachuser['login']]['down'] = $eachuser['Down'];
            $userdata[$eachuser['login']]['passive'] = $eachuser['Passive'];
            $userdata[$eachuser['login']]['ao'] = $eachuser['AlwaysOnline'];
            @($userdata[$eachuser['login']]['contract'] = $allcontracts[$eachuser['login']]);
            @($userdata[$eachuser['login']]['realname'] = $allrealnames[$eachuser['login']]);
            @($userdata[$eachuser['login']]['address'] = $alladdress[$eachuser['login']]);
            @($userdata[$eachuser['login']]['email'] = $allemails[$eachuser['login']]);
            //openpayz payment ID
            if ($altcfg['OPENPAYZ_REALID']) {
                @($userdata[$eachuser['login']]['payid'] = $allopcustomers[$eachuser['login']]);
            } else {
                @($userdata[$eachuser['login']]['payid'] = ip2int($eachuser['IP']));
            }
            //traffic params
            $userdata[$eachuser['login']]['traffic'] = $eachuser['D0'] + $eachuser['U0'];
            $userdata[$eachuser['login']]['trafficdown'] = $eachuser['D0'];
            $userdata[$eachuser['login']]['trafficup'] = $eachuser['U0'];
            //net params
            $userdata[$eachuser['login']]['ip'] = $eachuser['IP'];
            @($userdata[$eachuser['login']]['mac'] = $multinetdata[$eachuser['IP']]['mac']);
            @($userdata[$eachuser['login']]['netid'] = $multinetdata[$eachuser['IP']]['netid']);
            @($userdata[$eachuser['login']]['hostid'] = $multinetdata[$eachuser['IP']]['id']);
            //nas data
            @($usernas = zb_NasGetParams($multinetdata[$eachuser['IP']]['netid'], $allnasdata));
            @($userdata[$eachuser['login']]['nasid'] = $usernas['id']);
            @($userdata[$eachuser['login']]['nasip'] = $usernas['nasip']);
            @($userdata[$eachuser['login']]['nasname'] = $usernas['nasname']);
            @($userdata[$eachuser['login']]['nastype'] = $usernas['nastype']);
            if (isset($tariffspeeds[$eachuser['Tariff']])) {
                $userdata[$eachuser['login']]['speeddown'] = $tariffspeeds[$eachuser['Tariff']]['speeddown'];
                $userdata[$eachuser['login']]['speedup'] = $tariffspeeds[$eachuser['Tariff']]['speedup'];
            } else {
                //if no tariff speed defined zero speed by default
                $userdata[$eachuser['login']]['speeddown'] = 0;
                $userdata[$eachuser['login']]['speedup'] = 0;
            }
            //CF data
            $usercfdata = zb_cfGetContent($eachuser['login'], $allcfdata);
            if (!empty($usercfdata)) {
                foreach ($usercfdata as $cd => $eachcf) {
                    $userdata[$eachuser['login']]['cf'][$cd] = $eachcf;
                }
            }
            //passport data
            @($userdata[$eachuser['login']]['birthdate'] = $allpdata[$eachuser['login']]['birthdate']);
            @($userdata[$eachuser['login']]['passportnum'] = $allpdata[$eachuser['login']]['passportnum']);
            @($userdata[$eachuser['login']]['passportdate'] = $allpdata[$eachuser['login']]['passportdate']);
            @($userdata[$eachuser['login']]['passportwho'] = $allpdata[$eachuser['login']]['passportwho']);
            @($userdata[$eachuser['login']]['pcity'] = $allpdata[$eachuser['login']]['pcity']);
            @($userdata[$eachuser['login']]['pstreet'] = $allpdata[$eachuser['login']]['pstreet']);
            @($userdata[$eachuser['login']]['pbuild'] = $allpdata[$eachuser['login']]['pbuild']);
            @($userdata[$eachuser['login']]['papt'] = $allpdata[$eachuser['login']]['papt']);
        }
    }
    return $userdata;
}
Example #8
0
 /**
  * Load prices of all available tariffs
  * 
  * @return void
  */
 protected function loadTariffPrices()
 {
     $raw = zb_TariffGetPricesAll();
     if (!empty($raw)) {
         foreach ($raw as $io => $each) {
             $this->tariffPrices[$io] = $each;
         }
     }
 }