function zb_AnnihilateUser($login) { global $billing; $alter_conf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $user_ip = zb_UserGetIP($login); $user_aptdata = zb_AddressGetAptData($login); @($user_aptid = $user_aptdata['aptid']); zb_AddressDeleteApartment($user_aptid); zb_AddressOrphanUser($login); zb_UserDeleteEmail($login); zb_UserDeleteNotes($login); zb_UserDeletePhone($login); zb_UserDeleteRealName($login); zb_UserDeleteSpeedOverride($login); if (!$alter_conf['STRICT_CONTRACTS_PROTECT']) { zb_UserDeleteContract($login); } zb_VserviceCashClear($login); log_register("DELETE VCASH (" . $login . ")"); cf_FlushAllUserCF($login); zb_FlushAllUserTags($login); vlan_delete_host($login); multinet_delete_host($user_ip); multinet_rebuild_all_handlers(); //destroy stargazer user $billing->deleteuser($login); log_register("StgUser DELETE (" . $login . ")"); }
private function loadConfig() { $altercfg = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini'); if (isset($altercfg['COMPLEX_MASKS']) and isset($altercfg['COMPLEX_CFIDS'])) { //loads tariff masks if (!empty($altercfg['COMPLEX_MASKS'])) { $masksRaw = explode(",", $altercfg['COMPLEX_MASKS']); if (!empty($masksRaw)) { foreach ($masksRaw as $eachmask) { $this->masks[] = "'" . trim($eachmask) . "%'"; } } } else { throw new Exception(self::CPL_EMPTY_EX); } //loads contract and enabled flags CFIDs if (!empty($altercfg['COMPLEX_CFIDS'])) { if (!empty($altercfg['COMPLEX_CFIDS'])) { $cfieldsRaw = explode(',', $altercfg['COMPLEX_CFIDS']); if (sizeof($cfieldsRaw) != '3') { $this->cfields['contract'] = trim($cfieldsRaw[0]); $this->cfields['active'] = trim($cfieldsRaw[1]); } else { throw new Exception(self::CPL_COUNT_EX); } } } else { throw new Exception(self::CPL_EMPTY_EX); } } else { throw new Exception(self::CPL_SETTINGS_EX); } }
/** * Function that shows avatar by user email * * @param string $email user email * @param int $size user avatar size * @return string */ function gravatar_GetAvatar($email, $size = '') { $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $getsize = $size != '' ? '?s=' . $size : ''; if (isset($altercfg['GRAVATAR_DEFAULT'])) { $default = $altercfg['GRAVATAR_DEFAULT']; } else { $default = 'monsterid'; } $url = gravatar_GetUrl($email); $result = wf_img($url . $getsize . '&d=' . $default); return $result; }
public function __construct() { /* Filter NAS'es id: */ $this->_id = filter_input(INPUT_GET, 'nasid', FILTER_SANITIZE_NUMBER_INT); $this->_ip = zb_NasGetIpById($this->_id); /* Load APIs: */ $this->api = new RouterOS(); $this->form = new InputForm(); /* Get NAS current options: */ $this->options = zb_NasOptionsGet($this->_id); /* Get configurtion: */ $alter = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini'); $this->config['PASSWORDSHIDE'] = !empty($alter['PASSWORDSHIDE']) ? true : false; unset($alter); }
/** * Returns array containing all SMS queue data as index=>data * * @return array */ public function getQueueData() { $result = array(); $smsQueue = rcms_scandir(self::QUEUE_PATH); if (!empty($smsQueue)) { foreach ($smsQueue as $io => $eachsmsfile) { $smsDate = date("Y-m-d H:i:s", filectime(self::QUEUE_PATH . $eachsmsfile)); $smsData = rcms_parse_ini_file(self::QUEUE_PATH . $eachsmsfile); $result[$io]['filename'] = $eachsmsfile; $result[$io]['date'] = $smsDate; $result[$io]['number'] = $smsData['NUMBER']; $result[$io]['message'] = $smsData['MESSAGE']; } } return $result; }
/** * Returns array of all parent users * * @return array */ function cu_GetAllParentUsers() { $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $linkfield = $alterconf['USER_LINKING_FIELD']; $linkcfid = $alterconf['USER_LINKING_CFID']; $result = array(); $query_cfs = "SELECT DISTINCT `content` FROM `cfitems` WHERE `typeid`='" . $linkcfid . "'"; $allcfs = simple_queryall($query_cfs); if (!empty($allcfs)) { foreach ($allcfs as $io => $eachcf) { $query_user = "******" . $linkfield . "`='" . $eachcf['content'] . "' "; $userlogin = simple_query($query_user); $result[$userlogin['login']] = $eachcf['content']; } } return $result; }
/** * Appends new option to config with override if old option if exists * * @param string $path - config file path * @param string $option - option key * @param string $value - option raw value * * @return void */ function zb_DeployConfigOptionOverride($path, $option, $value) { if (file_exists($path)) { $currentData = rcms_parse_ini_file($path); if (!isset($currentData[$option])) { file_put_contents($path, "\n" . $option . '=' . $value . "\n", FILE_APPEND | LOCK_EX); show_window(__('Added'), __('New option key') . ': ' . $option . ' ' . __('with value') . ': ' . $value . ' to: ' . $path); log_register("DEPLOY CFG OPTOVR (" . $option . ") GOOD"); } else { file_put_contents($path, "\n" . $option . '=' . $value . "\n", FILE_APPEND | LOCK_EX); show_window(__('Notice'), __('Option already exist - overriding') . ': ' . $option . ' value:' . $value . ' in:' . $path); log_register("DEPLOY CFG OPTOVR (" . $option . ") OVR"); } } else { show_error(__('Config not exists')); log_register("DEPLOY CFG OPTOVR (" . $option . ") FAIL"); } }
<?php $altcfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); if ($altcfg['ASKOZIA_ENABLED']) { function zb_AskoziaGetNumAliases() { $result = array(); $rawAliases = zb_StorageGet('ASKOZIAPBX_NUMALIAS'); if (empty($rawAliases)) { $newAliasses = serialize($result); $newAliasses = base64_encode($newAliasses); zb_StorageSet('ASKOZIAPBX_NUMALIAS', $newAliasses); } else { $readAlias = base64_decode($rawAliases); $readAlias = unserialize($readAlias); $result = $readAlias; } return $result; } function zb_AskoziaGetConf() { $result = array(); $emptyArray = array(); //getting url $url = zb_StorageGet('ASKOZIAPBX_URL'); if (empty($url)) { $url = 'http://sip.isp/'; zb_StorageSet('ASKOZIAPBX_URL', $url); } //getting login $login = zb_StorageGet('ASKOZIAPBX_LOGIN');
<?php if (cfr('CATVBS')) { catv_GlobalControlsShow(); $alterconf = rcms_parse_ini_file(CONFIG_PATH . "catv.ini"); set_time_limit(0); $inputencoding = $alterconf['BS_INCHARSET']; $outputencoding = $alterconf['BS_OUTCHARSET']; //upload subroutine if (isset($_POST['upload'])) { $upload_done = catvbs_UploadFile(); if ($upload_done) { //if image sucefully uploaded convert and load in into raw table $filename = $upload_done; $filecontent = file_get_contents(DATA_PATH . "banksta/" . $filename); if ($inputencoding != $outputencoding) { $filecontent = iconv($inputencoding, $outputencoding, $filecontent); } $hash = md5($filecontent); if (catvbs_CheckHash($hash)) { $rawid = catvbs_FilePush($filename, $filecontent); if ($rawid) { //reparse file into normal processing format catvbs_ParseRaw($rawid); log_register("CATV_BANKSTA UPLOAD DONE"); } } else { show_window(__('Error'), __('Duplicate file detected')); log_register("CATV_BANKSTA UPLOAD DUPLICATE"); } }
function docsis_ModemAdd($maclan) { $maclan = mysql_real_escape_string($maclan); //random mac for usb $macusb = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99); $altercfg = rcms_parse_ini_file(CONFIG_PATH . '/alter.ini'); $netid = $altercfg['DOCSIS_MODEM_NETID']; $nextfreeip = multinet_get_next_freeip('nethosts', 'ip', $netid); $note = ''; $userbind = ''; $basetemplate = 'short'; $date = curdate(); //check for free ip in subnet if (!empty($nextfreeip)) { $nic = str_replace('.', 'x', $nextfreeip); //check is mac unique? if (multinet_mac_free($maclan) and check_mac_format($maclan)) { $query = "INSERT INTO `modems` (\n `id` ,\n `maclan` ,\n `macusb` ,\n `date` ,\n `ip` ,\n `conftemplate` ,\n `userbind` ,\n `nic` ,\n `note`\n )\n VALUES (\n NULL , '" . $maclan . "', '" . $maclan . "', '" . $date . "', '" . $nextfreeip . "', '" . $basetemplate . "', '' , '" . $nic . "', ''\n );"; nr_query($query); $lastid = simple_get_lastid('modems'); log_register("DOCSIS MODEM ADD MAC" . $maclan . " IP " . $nextfreeip . "[" . $lastid . "]"); multinet_add_host($netid, $nextfreeip, $maclan, ''); multinet_rebuild_all_handlers(); rcms_redirect("?module=docsis&showmodem=" . $lastid); } else { show_window(__('Error'), __('This MAC is currently used') . ' ' . __('This MAC have wrong format')); } } else { show_window(__('Error'), __('No free IP available in selected pool')); } }
function catv_PaymentsShow($query) { $alter_conf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini'); $alladrs = catv_GetFullAddressList(); $allrealnames = catv_GetAllRealnames(); $alltypes = zb_CashGetAllCashTypes(); $allapayments = simple_queryall($query); $total = 0; $result = '<table width="100%" border="0" class="sortable">'; $result .= ' <tr class="row1"> <td>' . __('ID') . '</td> <td>' . __('IDENC') . '</td> <td>' . __('Date') . '</td> <td>' . __('Cash') . '</td> <td>' . __('User') . '</td> <td>' . __('Full address') . '</td> <td>' . __('Notes') . '</td> <td>' . __('Admin') . '</td> </tr> '; if (!empty($allapayments)) { foreach ($allapayments as $io => $eachpayment) { if ($alter_conf['TRANSLATE_PAYMENTS_NOTES']) { if ($eachpayment['notes'] == '') { $eachpayment['notes'] = __('CaTV'); } $eachpayment['notes'] = zb_TranslatePaymentNote($eachpayment['notes'], array()); } $result .= ' <tr class="row3"> <td>' . $eachpayment['id'] . '</td> <td>' . zb_NumEncode($eachpayment['id']) . '</td> <td>' . $eachpayment['date'] . '</td> <td>' . $eachpayment['summ'] . '</td> <td> <a href="?module=catv_profile&userid=' . $eachpayment['userid'] . '">' . web_profile_icon() . '</a> ' . @$allrealnames[$eachpayment['userid']] . '</td> <td>' . @$alladrs[$eachpayment['userid']] . '</td> <td>' . $eachpayment['notes'] . '</td> <td>' . $eachpayment['admin'] . '</td> </tr> '; if ($eachpayment['summ'] > 0) { $total = $total + $eachpayment['summ']; } } } $result .= '</table>'; $result .= '<strong>' . __('Total') . ': ' . $total . '</strong>'; return $result; }
/** * Returns all addres array in view like login=>city address * * @return array */ function zb_AddressGetFullCityaddresslist() { $alterconf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini'); $result = array(); $apts = array(); $builds = array(); $city_q = "SELECT * from `city`"; $adrz_q = "SELECT * from `address`"; $apt_q = "SELECT * from `apt`"; $build_q = "SELECT * from build"; $streets_q = "SELECT * from `street`"; $alladdrz = simple_queryall($adrz_q); $allapt = simple_queryall($apt_q); $allbuilds = simple_queryall($build_q); $allstreets = simple_queryall($streets_q); if (!empty($alladdrz)) { $cities = zb_AddressGetFullCityNames(); foreach ($alladdrz as $io1 => $eachaddress) { $address[$eachaddress['id']] = array('login' => $eachaddress['login'], 'aptid' => $eachaddress['aptid']); } foreach ($allapt as $io2 => $eachapt) { $apts[$eachapt['id']] = array('apt' => $eachapt['apt'], 'buildid' => $eachapt['buildid']); } foreach ($allbuilds as $io3 => $eachbuild) { $builds[$eachbuild['id']] = array('buildnum' => $eachbuild['buildnum'], 'streetid' => $eachbuild['streetid']); } foreach ($allstreets as $io4 => $eachstreet) { $streets[$eachstreet['id']] = array('streetname' => $eachstreet['streetname'], 'cityid' => $eachstreet['cityid']); } foreach ($address as $io5 => $eachaddress) { $apartment = $apts[$eachaddress['aptid']]['apt']; $building = $builds[$apts[$eachaddress['aptid']]['buildid']]['buildnum']; $streetname = $streets[$builds[$apts[$eachaddress['aptid']]['buildid']]['streetid']]['streetname']; $cityid = $streets[$builds[$apts[$eachaddress['aptid']]['buildid']]['streetid']]['cityid']; // zero apt handle if ($alterconf['ZERO_TOLERANCE']) { if ($apartment == 0) { $apartment_filtered = ''; } else { $apartment_filtered = '/' . $apartment; } } else { $apartment_filtered = '/' . $apartment; } //only city display option $result[$eachaddress['login']] = $cities[$cityid] . ' ' . $streetname . ' ' . $building . $apartment_filtered; } } return $result; }
/** * Creates new task in database * * @param string $startdate * @param string $starttime * @param string $address * @param string $login * @param string $phone * @param int $jobtypeid * @param int $employeeid * @param string $jobnote * * @return void */ function ts_CreateTask($startdate, $starttime, $address, $login, $phone, $jobtypeid, $employeeid, $jobnote) { $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $curdate = curdatetime(); $admin = whoami(); $address = str_replace('\'', '`', $address); $address = mysql_real_escape_string($address); $login = mysql_real_escape_string($login); $phone = mysql_real_escape_string($phone); $startdate = mysql_real_escape_string($startdate); $jobSendTime = !empty($starttime) ? ' ' . date("H:i", strtotime($starttime)) : ''; if (!empty($starttime)) { $starttime = "'" . mysql_real_escape_string($starttime) . "'"; } else { $starttime = 'NULL'; } $jobtypeid = vf($jobtypeid, 3); $employeeid = vf($employeeid, 3); $jobnote = mysql_real_escape_string($jobnote); $smsData = 'NULL'; //store sms for backround processing via watchdog if ($altercfg['WATCHDOG_ENABLED']) { if (isset($_POST['newtasksendsms'])) { $newSmsText = $address . ' ' . $phone . ' ' . $jobnote . $jobSendTime; $smsDataRaw = ts_SendSMS($employeeid, $newSmsText); if (!empty($smsDataRaw)) { $smsData = serialize($smsDataRaw); $smsData = "'" . base64_encode($smsData) . "'"; } } } $query = "INSERT INTO `taskman` (`id` , `date` , `address` , `login` , `jobtype` , `jobnote` , `phone` , `employee` , `employeedone` ,`donenote` , `startdate` ,`starttime`, `enddate` , `admin` , `status`,`smsdata`)\n VALUES (NULL , '" . $curdate . "', '" . $address . "', '" . $login . "', '" . $jobtypeid . "', '" . $jobnote . "', '" . $phone . "', '" . $employeeid . "',NULL, NULL , '" . $startdate . "'," . $starttime . ",NULL , '" . $admin . "', '0'," . $smsData . ");"; nr_query($query); //flushing darkvoid $darkVoid = new DarkVoid(); $darkVoid->flushCache(); log_register("TASKMAN CREATE `" . $address . "`"); }
public function __construct() { $this->loadTemplates(); $this->altcfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); }
/** * 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); }
<?php if (cfr('SYSCONF')) { $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $alteropts = rcms_parse_ini_file(CONFIG_PATH . "optsaltcfg"); $dbconf = rcms_parse_ini_file(CONFIG_PATH . "mysql.ini"); $dbopts = rcms_parse_ini_file(CONFIG_PATH . "optsdbcfg"); $billingconf = rcms_parse_ini_file(CONFIG_PATH . "billing.ini"); $billopts = rcms_parse_ini_file(CONFIG_PATH . "optsbillcfg"); $catvconf = rcms_parse_ini_file(CONFIG_PATH . "catv.ini"); $catvopts = rcms_parse_ini_file(CONFIG_PATH . "optscatvcfg"); $ymconf = rcms_parse_ini_file(CONFIG_PATH . "ymaps.ini"); $ymopts = rcms_parse_ini_file(CONFIG_PATH . "optsymcfg"); $photoconf = rcms_parse_ini_file(CONFIG_PATH . "photostorage.ini"); $photoopts = rcms_parse_ini_file(CONFIG_PATH . "optsphotocfg"); if ($alterconf['PASSWORDSHIDE']) { $hide_passwords = true; } else { $hide_passwords = false; } $dbcell = web_ConfigEditorShow('mysqlini', $dbconf, $dbopts); $billcell = web_ConfigEditorShow('billingini', $billingconf, $billopts); $altercell = web_ConfigEditorShow('alterini', $alterconf, $alteropts); $catvcell = web_ConfigEditorShow('catvini', $catvconf, $catvopts); $ymcells = web_ConfigEditorShow('ymaps', $ymconf, $ymopts); $photocells = web_ConfigEditorShow('photostorage', $photoconf, $photoopts); $grid = wf_tag('script'); $grid .= '$(function() { $( "#tabs" ).tabs().addClass( "ui-tabs-vertical ui-helper-clearfix" ); $( "#tabs li" ).removeClass( "ui-corner-top" ).addClass( "ui-corner-left" ); });';
function deleteComment($cat_id, $art_id, $comment) { $cat_id = (int) $cat_id; $art_id = (int) $art_id; if (empty($this->container)) { $this->last_error = __('No section selected!'); return false; } if ($this->container !== '#root' && $this->container !== '#hidden') { if (!($category = $this->getCategory($cat_id))) { return false; } $art_prefix = ARTICLES_PATH . $this->container . '/' . $cat_id . '/' . $art_id . '/'; } else { $art_prefix = ARTICLES_PATH . $this->container . '/' . $art_id . '/'; } if ($data = @unserialize(@file_get_contents($art_prefix . 'comments'))) { if (isset($data[$comment])) { rcms_remove_index($comment, $data, true); @file_write_contents($art_prefix . 'comments', serialize($data)); $article_data = rcms_parse_ini_file($art_prefix . 'define'); $article_data['comcount']--; @write_ini_file($article_data, $art_prefix . 'define'); } if ($this->container !== '#root' && $this->container !== '#hidden') { $this->index[$cat_id][$art_id]['ccnt']--; } else { $this->index[$art_id]['ccnt']--; } $res = $this->saveIndex(); return $res; } else { return false; } }
/** * Performs an user registration * * @global object $billing * @param array $user_data * @param bool $goprofile */ function zb_UserRegister($user_data, $goprofile = true) { global $billing; // Init all of needed user data $login = vf($user_data['login']); $login = zb_RegLoginFilter($login); $password = vf($user_data['password']); $ip = $user_data['IP']; $cityid = $user_data['city']; $streetid = $user_data['street']; $buildid = $user_data['build']; @($entrance = $user_data['entrance']); @($floor = $user_data['floor']); $apt = $user_data['apt']; $serviceid = $user_data['service']; $netid = multinet_get_service_networkid($serviceid); $busylogins = zb_AllBusyLogins(); //check login lenght $maxStLen = 42; $loginLen = strlen($login); if ($loginLen > $maxStLen) { log_register("HUGELOGIN REGISTER TRY (" . $login . ")"); $alert = __('Attention generated login longer than') . ' ' . $maxStLen . ' ' . __('bytes') . '. (' . $login . ' > ' . $loginLen . ') ' . __('And is not compatible with Stargazer') . '.'; die($alert); } // empty login validation if (empty($login)) { $alert = wf_tag('script', false, '', 'type="text/javascript"'); $alert .= 'alert("' . __('Error') . ': ' . __('Empty login') . '");'; $alert .= wf_tag('script', true); print $alert; rcms_redirect("?module=userreg"); die; } //duplicate login validation if (isset($busylogins[$login])) { $alert = wf_tag('script', false, '', 'type="text/javascript"'); $alert .= 'alert("' . __('Error') . ': ' . __('Duplicate login') . '");'; $alert .= wf_tag('script', true); print $alert; rcms_redirect("?module=userreg"); die; } //last check if (!zb_ip_unique($ip)) { $alert = wf_tag('script', false, '', 'type="text/javascript"'); $alert .= 'alert("' . __('Error') . ': ' . __('This IP is already used by another user') . '");'; $alert .= wf_tag('script', true); print $alert; rcms_redirect("?module=userreg"); die; } // registration subroutine $billing->createuser($login); log_register("StgUser REGISTER (" . $login . ")"); $billing->setpassword($login, $password); log_register("StgUser (" . $login . ") PASSWORD `" . $password . "`"); $billing->setip($login, $ip); log_register("StgUser (" . $login . ") IP `" . $ip . "`"); zb_AddressCreateApartment($buildid, $entrance, $floor, $apt); zb_AddressCreateAddress($login, zb_AddressGetLastid()); multinet_add_host($netid, $ip); zb_UserCreateRealName($login, ''); zb_UserCreatePhone($login, '', ''); zb_UserCreateContract($login, ''); zb_UserCreateEmail($login, ''); zb_UserCreateSpeedOverride($login, 0); zb_UserRegisterLog($login); // if random mac needed $billingconf = rcms_parse_ini_file(CONFIG_PATH . '/billing.ini'); $alterconf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); if ($billingconf['REGRANDOM_MAC']) { // funny random mac, yeah? :) $mac = '14:' . '88' . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99) . ':' . rand(10, 99); multinet_change_mac($ip, $mac); multinet_rebuild_all_handlers(); } // if AlwaysOnline to new user needed if ($billingconf['REGALWONLINE']) { $alwaysonline = 1; $billing->setao($login, $alwaysonline); log_register('CHANGE AlwaysOnline (' . $login . ') ON ' . $alwaysonline); } // if we want to disable detailed stats to new user by default if ($billingconf['REGDISABLEDSTAT']) { $dstat = 1; $billing->setdstat($login, $dstat); log_register('CHANGE dstat (' . $login . ') ON ' . $dstat); } //set contract same as login for this user if (isset($alterconf['CONTRACT_SAME_AS_LOGIN'])) { if ($alterconf['CONTRACT_SAME_AS_LOGIN']) { $newUserContract = $login; zb_UserChangeContract($login, $newUserContract); } } //cemetery processing if (isset($alterconf['CEMETERY_ENABLED'])) { if ($alterconf['CEMETERY_ENABLED']) { if ($alterconf['CEMETERY_ENABLED'] == 2) { $cemetery = new Cemetery(false); $cemetery->setDead($login); } } } //contract autogeneration if (isset($alterconf['CONTRACT_AUTOGEN'])) { if ($alterconf['CONTRACT_AUTOGEN']) { $contract_proposal = ''; $allcontracts = zb_UserGetAllContracts(); $top_offset = 100000; //contract generation mode default if ($alterconf['CONTRACT_GENERATION_DEFAULT']) { for ($i = 1; $i < $top_offset; $i++) { if (!isset($allcontracts[$i])) { $contract_proposal = $i; break; } } } else { //alternate generation method $max_contract = max(array_keys($allcontracts)); $contract_proposal = $max_contract + 1; } //setting generated contract to new user if (!isset($allcontracts[$contract_proposal])) { $contractDate = date("Y-m-d"); zb_UserChangeContract($login, $contract_proposal); zb_UserContractDateCreate($contract_proposal, $contractDate); } } } /////////////////////////////////// if ($goprofile) { rcms_redirect("?module=userprofile&username=" . $login); } }
/** * Loads menudata into private raw data property * * @return void */ protected function loadData() { $this->rawData = rcms_parse_ini_file(CONFIG_PATH . 'globalmenu.ini', true); }
/** * Loads and returns category taskbar elements * * @param string $category * * @return string */ protected function loadCategoryElements($category) { $result = ''; $elementsPath = self::BASE_PATH . $category . '/'; $allElements = rcms_scandir($elementsPath, '*.ini'); if (!empty($allElements)) { $categoryName = isset($this->categories[$category]) ? $this->categories[$category] : ''; $result .= wf_tag('p') . wf_tag('h3') . wf_tag('u') . $categoryName . wf_tag('u', true) . wf_tag('h3', true) . wf_tag('p', true); $result .= wf_tag('div', false, 'dashboard'); foreach ($allElements as $io => $eachfilename) { $elementData = rcms_parse_ini_file($elementsPath . $eachfilename); if (isset($elementData['TYPE']) and isset($elementData['ID'])) { if (!isset($this->loadedElements[$elementData['ID']])) { $this->loadedElements[$elementData['ID']] = $elementData; $result .= $this->buildElement($elementData); } else { $this->currentAlerts .= $this->messages->getStyledMessage(__('Duplicate element ID') . ': ' . $elementData['ID'] . ' -> ' . $eachfilename, 'warning'); } } else { $this->currentAlerts .= $this->messages->getStyledMessage(__('Wrong element format') . ': ' . $eachfilename, 'warning'); } } $result .= wf_tag('div', true); $result .= wf_tag('div', false, '', 'style="clear:both"') . wf_tag('div', true); } return $result; }
<?php $altcfg = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini'); if ($altcfg['SWITCH_AUTOCONFIG']) { $swLogin = new SwitchLogin(); if (cfr(SwitchLogin::MODULE)) { if (wf_CheckGet(array('ajax'))) { if ($_GET['ajax'] == 'snmp') { $swLogin->SwLoginAddSnmpForm(); } if ($_GET['ajax'] == 'connect') { $swLogin->SwLoginAddConnForm(); } if ($_GET['ajax'] == 'snmp_edit') { $swLogin->SwLoginEditSnmpForm($_GET['edit']); } if ($_GET['ajax'] == 'connect_edit') { $swLogin->SwLoginEditConnForm($_GET['edit']); } } if (!isset($_GET['edit'])) { $megaForm = wf_AjaxLoader(); $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=snmp', 'SNMP', 'megaContainer1', false, 'ubButton'); $megaForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&ajax=connect', 'Connect', 'megaContainer1', false, 'ubButton'); $megaForm .= wf_tag('div', false, '', 'id="megaContainer1"') . wf_tag('div', true); show_window(__("Switches login data"), $megaForm); $swLogin->ShowSwAllLogin(); } else { $megaEditForm = wf_AjaxLoader(); $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=snmp_edit', 'SNMP', 'megaContainer1', false, 'ubButton'); $megaEditForm .= wf_AjaxLink(SwitchLogin::MODULE_URL . '&edit=' . $_GET['edit'] . '&ajax=connect_edit', 'Connect', 'megaContainer1', false, 'ubButton');
/** * Performs snmp templates preprocessing for OLT devices * * @return void */ protected function loadSnmpTemplates() { if (!empty($this->allOltDevices)) { foreach ($this->allOltDevices as $oltId => $eachOltData) { if (isset($this->allOltSnmp[$oltId])) { $oltModelid = $this->allOltSnmp[$oltId]['modelid']; if ($oltModelid) { if (isset($this->allOltModels[$oltModelid])) { $templateFile = 'config/snmptemplates/' . $this->allOltModels[$oltModelid]['snmptemplate']; if (file_exists($templateFile)) { $this->snmpTemplates[$oltModelid] = rcms_parse_ini_file($templateFile, true); } } } } } } }
function zb_StargazerSIGHUP() { $ub_conf = rcms_parse_ini_file(CONFIG_PATH . "billing.ini"); if ($ub_conf['STGNASHUP']) { $sig_command = $ub_conf['SUDO'] . ' ' . $ub_conf['KILL'] . ' -1' . ' `' . $ub_conf['CAT'] . ' ' . $ub_conf['STGPID'] . '`'; shell_exec($sig_command); log_register("SIGHUP STG"); } }
<?php if (cfr('OPTION82')) { $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $billing_config = rcms_parse_ini_file(CONFIG_PATH . "billing.ini"); /** * Parse option 82 leases from dhcpd.log * * @param $billing_config - preprocessed billing.ini * @param $altercfg - preprocessed alter.ini * * @return array */ function opt82_LoadLeases($billing_config, $altercfg, $busyLeases) { $sudo = $billing_config['SUDO']; $cat = $billing_config['CAT']; $grep = $billing_config['GREP']; $tail = $billing_config['TAIL']; $leasePath = $altercfg['NMLEASES']; $leasemark = '(with opt82)'; $command = $sudo . ' ' . $cat . ' ' . $leasePath . ' | ' . $grep . ' "' . $leasemark . '" | ' . $tail . ' -n 100'; $rawData = shell_exec($command); $rawArr = array(); $rawArr = explodeRows($rawData); $result = array(); if (!empty($rawArr)) { foreach ($rawArr as $eachline) { $explodeLine = preg_split('/\\s+/', $eachline); //log have normal format if (isset($explodeLine[9]) and isset($explodeLine[11]) and isset($explodeLine[7])) {
/** * Shows report editing form * * @param string $reportfile */ function web_ReportMasterShowEditForm($reportfile) { $reports_path = DATA_PATH . "reports/"; $report_template = rcms_parse_ini_file($reports_path . $reportfile); $inputs = wf_TextInput('editreportname', __('Report name'), $report_template['REPORT_NAME'], true, 40); $inputs .= wf_TextInput('editsqlquery', __('SQL Query'), $report_template['REPORT_QUERY'], true, 40); $inputs .= wf_TextInput('editdatakeys', __('Data keys, separated by comma'), $report_template['REPORT_KEYS'], true, 40); $inputs .= wf_TextInput('editfieldnames', __('Field names, separated by comma'), $report_template['REPORT_FIELD_NAMES'], true, 40); $inputs .= web_RMTriggerSelector('editaddr', $report_template['REPORT_ADDR']) . ' ' . __('Show full address by login key') . wf_tag('br'); $inputs .= web_RMTriggerSelector('editrnames', $report_template['REPORT_RNAMES']) . ' ' . __('Show Real Names by login key') . wf_tag('br'); $inputs .= web_RMTriggerSelector('editrowcount', $report_template['REPORT_ROW_COUNT']) . ' ' . __('Show data query row count') . wf_tag('br'); $inputs .= wf_Submit(__('Save')); $form = wf_Form('', 'POST', $inputs, 'glamour'); show_window(__('Edit report'), $form); }
<?php if (cfr('PAYEXPORT')) { $alter_conf = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); if ($alter_conf['EXPORT_ENABLED']) { show_window(__('Export payments data'), zb_ExportForm()); if (isset($_POST['fromdate']) and isset($_POST['todate'])) { $from_date = $_POST['fromdate']; $to_date = $_POST['todate']; //export types //xml if ($alter_conf['EXPORT_FORMAT'] == 'xml') { $export_result = zb_ExportPayments($from_date, $to_date); } //dbf if ($alter_conf['EXPORT_FORMAT'] == 'dbf') { //need to be written } $export_file = 'exports/' . time() . '.export'; $exported_link = '<a href="' . $export_file . '">' . __('Download') . '</a>'; file_write_contents($export_file, $export_result); show_window(__('Exported data download'), $exported_link); } } else { show_error(__('Payments export not enabled')); } } else { show_error(__('You cant control this module')); }
/** * Returns raw plugins data. Plugins initialization files must be stored in CONFIG_PATH * * @return array */ protected function loadPluginsRaw($filename) { $result = array(); if (file_exists(CONFIG_PATH . $filename)) { $result = rcms_parse_ini_file(CONFIG_PATH . $filename, true); } return $result; }
function web_PaymentSearch($markers) { if (wf_CheckPost(array('searchtable'))) { if ($_POST['searchtable'] == 'payments') { $table = 'payments'; } if ($_POST['searchtable'] == 'corrections') { $table = 'paymentscorr'; } } else { $table = 'payments'; } $query = "SELECT * from `" . $table . "`"; $query .= $markers; $altercfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini"); $csvdata = ''; $allpayments = simple_queryall($query); if ($altercfg['FINREP_CONTRACT']) { $allcontracts = zb_UserGetAllContracts(); $allcontracts = array_flip($allcontracts); } if ($altercfg['FINREP_TARIFF']) { $alltariffs = zb_TariffsGetAllUsers(); } $allrealnames = zb_UserGetAllRealnames(); $alladdress = zb_AddressGetFulladdresslist(); $alltypes = zb_CashGetAllCashTypes(); $allservicenames = zb_VservicesGetAllNamesLabeled(); $allpaysyspercents = zb_PaySysPercentGetAll(); $totalsumm = 0; $paysyssumm = 0; $profitsumm = 0; $totalcount = 0; $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Cash')); $cells .= wf_TableCell(__('PS%')); $cells .= wf_TableCell(__('Profit')); $cells .= wf_TableCell(__('Login')); if ($altercfg['FINREP_CONTRACT']) { $cells .= wf_TableCell(__('Contract')); } $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Real Name')); if ($altercfg['FINREP_TARIFF']) { $cells .= wf_TableCell(__('Tariff')); } $cells .= wf_TableCell(__('Payment type')); $cells .= wf_TableCell(__('Notes')); $cells .= wf_TableCell(__('Admin')); $rows = wf_TableRow($cells, 'row1'); if (!empty($allpayments)) { if ($altercfg['FINREP_TARIFF']) { $csvTariffColumn = ';' . __('Tariff'); } else { $csvTariffColumn = ''; } $csvdata .= __('ID') . ';' . __('Date') . ';' . __('Cash') . ';' . __('PS%') . ';' . __('Profit') . ';' . __('Login') . ';' . __('Full address') . ';' . __('Real Name') . $csvTariffColumn . ';' . __('Payment type') . ';' . __('Notes') . ';' . __('Admin') . "\n"; foreach ($allpayments as $io => $each) { $cells = wf_TableCell($each['id']); $cells .= wf_TableCell($each['date']); $cells .= wf_TableCell($each['summ']); //detecting paymentsystem and calc percent if (isset($allpaysyspercents[$each['note']])) { $currPc = $allpaysyspercents[$each['note']]['percent']; $rawSumm = $each['summ']; $paySysPc = $rawSumm / 100 * $currPc; $ourProfit = $rawSumm - $paySysPc; } else { $paySysPc = 0; $ourProfit = $each['summ']; } $cells .= wf_TableCell($paySysPc); $cells .= wf_TableCell($ourProfit); $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login'], false, '')); if ($altercfg['FINREP_CONTRACT']) { $cells .= wf_TableCell(@$allcontracts[$each['login']]); } @($paymentRealname = $allrealnames[$each['login']]); @($paymentCashType = __($alltypes[$each['cashtypeid']])); @($paymentAddress = $alladdress[$each['login']]); $cells .= wf_TableCell($paymentAddress); $cells .= wf_TableCell($paymentRealname); if ($altercfg['FINREP_TARIFF']) { @($userTariff = $alltariffs[$each['login']]); $cells .= wf_TableCell($userTariff); $csvTariff = ';' . $userTariff; } else { $csvTariff = ''; } $cells .= wf_TableCell($paymentCashType); //payment notes translation if ($altercfg['TRANSLATE_PAYMENTS_NOTES']) { $paynote = zb_TranslatePaymentNote($each['note'], $allservicenames); } else { $paynote = $each['note']; } $cells .= wf_TableCell($paynote); $cells .= wf_TableCell($each['admin']); $rows .= wf_TableRow($cells, 'row3'); //calculating totals if ($each['summ'] > 0) { $totalsumm = $totalsumm + $each['summ']; $totalcount++; } if ($paySysPc > 0) { $paysyssumm = $paysyssumm + $paySysPc; } if ($ourProfit > 0) { $profitsumm = $profitsumm + $ourProfit; } $csvSumm = str_replace('.', ',', $each['summ']); $csvdata .= $each['id'] . ';' . $each['date'] . ';' . $csvSumm . ';' . $paySysPc . ';' . $ourProfit . ';' . $each['login'] . ';' . $paymentAddress . ';' . $paymentRealname . $csvTariff . ';' . $paymentCashType . ';' . $paynote . ';' . $each['admin'] . "\n"; } } //saving report for future download if (!empty($csvdata)) { $csvSaveName = 'exports/payfind_' . zb_rand_string(8) . '.csv'; $csvSaveNameEnc = base64_encode($csvSaveName); $csvdata = iconv('utf-8', 'windows-1251', $csvdata); file_put_contents($csvSaveName, $csvdata); $csvDownloadLink = wf_Link('?module=payfind&downloadcsv=' . $csvSaveNameEnc, wf_img('skins/excel.gif', __('Export')), false); } else { $csvDownloadLink = ''; } $result = wf_TableBody($rows, '100%', '0', 'sortable'); //additional total counters $result .= wf_tag('div', false, 'glamour') . __('Count') . ': ' . $totalcount . wf_tag('div', true); $result .= wf_tag('div', false, 'glamour') . __('Total payments') . ': ' . $totalsumm . wf_tag('div', true); $result .= wf_tag('div', false, 'glamour') . __('Payment systems %') . ': ' . $paysyssumm . wf_tag('div', true); $result .= wf_tag('div', false, 'glamour') . __('Our final profit') . ': ' . $profitsumm . wf_tag('div', true); $result .= wf_CleanDiv(); show_window(__('Payments found') . ' ' . $csvDownloadLink, $result); }
/** * Returns list of all available SNMP device templates * * @return array */ function sp_SnmpGetAllModelTemplates() { $path = CONFIG_PATH . "snmptemplates/"; $alltemplates = rcms_scandir($path); $result = array(); if (!empty($alltemplates)) { foreach ($alltemplates as $each) { $result[$each] = rcms_parse_ini_file($path . $each, true); } } return $result; }
public function loadSettings() { $alert = zb_StorageGet('WATCHDOG_ALERT'); if (empty($alert)) { $alert = __('Watchdog notifies that'); zb_StorageSet('WATCHDOG_ALERT', $alert); } $phones = zb_StorageGet('WATCHDOG_PHONES'); if (empty($phones)) { zb_StorageSet('WATCHDOG_PHONES', ''); } $emails = zb_StorageGet('WATCHDOG_EMAILS'); if (empty($emails)) { zb_StorageSet('WATCHDOG_EMAILS', ''); } $smsgateway = zb_StorageGet('WATCHDOG_TSMS_GATEWAY'); if (empty($smsgateway)) { $altcfg = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini'); $smsgateway = $altcfg['TSMS_GATEWAY']; zb_StorageSet('WATCHDOG_TSMS_GATEWAY', $smsgateway); } $smslogin = zb_StorageGet('WATCHDOG_TSMS_LOGIN'); if (empty($smslogin)) { $smslogin = $altcfg['TSMS_LOGIN']; zb_StorageSet('WATCHDOG_TSMS_LOGIN', $smslogin); } $smspassword = zb_StorageGet('WATCHDOG_TSMS_PASSWORD'); if (empty($smspassword)) { $smspassword = $altcfg['TSMS_PASSWORD']; zb_StorageSet('WATCHDOG_TSMS_PASSWORD', $smspassword); } $smssign = zb_StorageGet('WATCHDOG_TSMS_SIGN'); if (empty($smssign)) { $smssign = 'Ubilling'; zb_StorageSet('WATCHDOG_TSMS_SIGN', $smssign); } $this->settings['WATCHDOG_ALERT'] = $alert; $this->settings['WATCHDOG_PHONES'] = $phones; $this->settings['WATCHDOG_EMAILS'] = $emails; $this->settings['WATCHDOG_TSMS_GATEWAY'] = $smsgateway; $this->settings['WATCHDOG_TSMS_LOGIN'] = $smslogin; $this->settings['WATCHDOG_TSMS_PASSWORD'] = $smspassword; $this->settings['WATCHDOG_TSMS_SIGN'] = $smssign; }