/** * Loads custom discounts if its available for all users * * @return void */ protected function loadCustomDiscounts() { if (!empty($this->customDiscountCfId)) { $raw = cf_FieldsGetAll(); if (!empty($raw)) { foreach ($raw as $io => $each) { if ($each['typeid'] == $this->customDiscountCfId) { $discount = vf($each['content'], 3); // numeric int if ($discount) { $this->customDiscounts[$each['login']] = $discount; } } } } } }
/** * 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; }
/** * 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; }