/** * parses previously extracted payments and preprocess it to data private prop * * @return void */ public function parsePayments() { if (!empty($this->lines)) { foreach ($this->lines as $io => $eachline) { //setting empty tariff line counters $this->data[$eachline]['summ'] = 0; $this->data[$eachline]['count'] = 0; if (!empty($this->payments)) { foreach ($this->payments as $ia => $eachpayment) { $userTariff = @$this->userTariffs[$eachpayment['login']]; if (ispos($eachline, '*')) { $searchLine = str_replace('*', '', $eachline); if (ispos($userTariff, $searchLine)) { $this->data[$eachline]['summ'] = $this->data[$eachline]['summ'] + $eachpayment['summ']; $this->data[$eachline]['count']++; $this->totalsum = $this->totalsum + $eachpayment['summ']; } } else { if ($userTariff == $eachline) { $this->data[$eachline]['summ'] = $this->data[$eachline]['summ'] + $eachpayment['summ']; $this->data[$eachline]['count']++; $this->totalsum = $this->totalsum + $eachpayment['summ']; } } } } else { show_error(__('No payments found')); } } } else { show_error(__('Undefined tariff lines')); } }
/** * Stores SMS in sending queue * * @param string $number Mobile number in international format. Eg: +380506666666 * @param string $message Text message for sending * @param bool $translit force message transliteration * @param string $module module that inits SMS sending * * @return bool */ public function sendSMS($number, $message, $translit = true, $module = '') { $result = false; $number = trim($number); $module = !empty($module) ? ' MODULE ' . $module : ''; if (!empty($number)) { if (ispos($number, '+')) { $message = str_replace(array("\n\r", "\n", "\r"), ' ', $message); if ($translit) { $message = zb_TranslitString($message); } $message = trim($message); $filename = self::QUEUE_PATH . 'us_' . zb_rand_string(8); $storedata = 'NUMBER="' . $number . '"' . "\n"; $storedata .= 'MESSAGE="' . $message . '"' . "\n"; file_put_contents($filename, $storedata); log_register('USMS SEND SMS `' . $number . '`' . $module); $result = true; } } return $result; }
/** * Stores SMS in sending queue * * @param string $number Mobile number in international format. Eg: +380506666666 * @param string $message Text message for sending * @param bool $translit force message transliteration * @return bool */ public function sendSMS($number, $message, $translit = true) { $result = false; $number = trim($number); if (!empty($number)) { if (ispos($number, '+')) { $message = str_replace('\\r\\n', ' ', $message); if ($translit) { $message = zb_TranslitString($message); } $message = trim($message); $filename = self::QUEUE_PATH . 'us_' . zb_rand_string(8); $storedata = 'NUMBER="' . $number . '"' . "\n"; $storedata .= 'MESSAGE="' . $message . '"' . "\n"; $result['number'] = $number; $result['message'] = $message; file_put_contents($filename, $storedata); log_register("USMS SEND SMS `" . $number . "`"); $result = true; } } return $result; }
/** * Extracts funds only with some date pattern * * @param array $fundsflow standard fundsflow array * @param string $date * * @return array */ public function filterByDate($fundsflow, $date) { $result = array(); if (!empty($fundsflow)) { foreach ($fundsflow as $timestamp => $flowdata) { if (ispos($flowdata['date'], $date)) { $result[$timestamp] = $flowdata; } } } return $result; }
} } } } if (wf_CheckGet(array('layers'))) { $layers = $_GET['layers']; //switches layer if (ispos($layers, 'sw')) { $placemarks .= sm_MapDrawSwitches(); } //switches uplinks layer if (ispos($layers, 'ul')) { $placemarks .= sm_MapDrawSwitchUplinks(); } //builds layer if (ispos($layers, 'bs')) { $placemarks .= um_MapDrawBuilds(); } } if (wf_CheckGet(array('mapedit', 'showmap'))) { $editor = $custmaps->mapLocationEditor(); } else { $editor = ''; } show_window($custmaps->mapGetName($mapId), $custmaps->mapInit($placemarks, $editor)); } } else { show_error(__('This module is disabled')); } } else { show_error(__('Access denied'));
/** * renders users signup report * * @return void */ public function reportSignup() { $regdates = array(); $months = months_array(); $monthCount = array(); $showYear = wf_CheckPost(array('showyear')) ? vf($_POST['showyear'], 3) : curyear(); $showMonth = wf_CheckGet(array('month')) ? mysql_real_escape_string($_GET['month']) : curmonth(); $yearCount = 0; if (!empty($this->users)) { foreach ($this->users as $io => $each) { if (!empty($each['regdate'])) { $dateTime = explode(' ', $each['regdate']); $regdates[$dateTime[0]][] = $each['id']; } } } // show year selector $yearInputs = wf_YearSelector('showyear', ' ', false); $yearInputs .= wf_Submit(__('Show')); $yearForm = wf_Form('', 'POST', $yearInputs, 'glamour'); show_window(__('Year'), $yearForm); //extract year signup count data foreach ($months as $eachMonth => $monthName) { $sigcount = 0; if (!empty($regdates)) { foreach ($regdates as $eachRegDate => $userIds) { $dateMark = $showYear . '-' . $eachMonth; if (ispos($eachRegDate, $dateMark)) { $sigcount = $sigcount + count($regdates[$eachRegDate]); } $monthCount[$eachMonth] = $sigcount; } $yearCount = $yearCount + $sigcount; } } //render per year grid $cells = wf_TableCell(''); $cells .= wf_TableCell(__('Month')); $cells .= wf_TableCell(__('Signups')); $cells .= wf_TableCell(__('Visual')); $rows = wf_TableRow($cells, 'row1'); foreach ($months as $eachMonth => $monthName) { $cells = wf_TableCell($eachMonth); $monthLink = wf_Link(self::URL_REPORTS_MGMT . 'reportSignup&month=' . $showYear . '-' . $eachMonth, rcms_date_localise($monthName), false); $cells .= wf_TableCell($monthLink); $cells .= wf_TableCell($monthCount[$eachMonth]); $cells .= wf_TableCell(web_bar($monthCount[$eachMonth], $yearCount)); $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $yearCount; show_window(__('User signups by year') . ' ' . $showYear, $result); //render per month registrations $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Full address')); $cells .= wf_TableCell(__('Real Name')); $cells .= wf_TableCell(__('Tariff')); $rows = wf_TableRow($cells, 'row1'); if (!empty($regdates)) { foreach ($regdates as $eachRegDate => $eachRegUsers) { if (ispos($eachRegDate, $showMonth)) { foreach ($eachRegUsers as $ix => $eachUserId) { $cells = wf_TableCell($eachUserId); $cells .= wf_TableCell($this->users[$eachUserId]['regdate']); $userLink = wf_Link(self::URL_USERS_PROFILE . $eachUserId, web_profile_icon() . ' ', false); $cells .= wf_TableCell($userLink . $this->userGetFullAddress($eachUserId)); $cells .= wf_TableCell($this->users[$eachUserId]['realname']); $cells .= wf_TableCell(@$this->tariffs[$this->users[$eachUserId]['tariffid']]['tariffname']); $rows .= wf_TableRow($cells, 'row3'); } } } } $result = wf_TableBody($rows, '100%', '0', 'sortable'); if ($showMonth == curmonth()) { $monthTitle = __('Current month user signups'); } else { $monthTitle = __('User signups by month') . ' ' . $showMonth; } show_window($monthTitle, $result); }
/** * Creates new SMS for queue * * @param string $number * @param string $message * * @return string/void */ public function createSMS($number, $message) { $result = ''; $translit = wf_CheckPost(array('newsmstranslit')) ? true : false; if (ispos($number, '+')) { $this->sms->sendSMS($number, $message, $translit, 'TQUEUE'); } else { $result = __('Number must be in international format'); } return $result; }
/** * Renders NDS users payments list * * @param string $query * @return string */ function web_NdsPaymentsShow($query) { $alter_conf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini'); $alladrs = zb_AddressGetFulladdresslist(); $alltypes = zb_CashGetAllCashTypes(); $allapayments = simple_queryall($query); $ndstax = $alter_conf['NDS_TAX_PERCENT']; $allndsusers = zb_NdsGetAllUsers(); $ndspercent = zb_NdsGetPercent(); $allservicenames = zb_VservicesGetAllNamesLabeled(); $total = 0; $ndstotal = 0; $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('IDENC')); $tablecells .= wf_TableCell(__('Date')); $tablecells .= wf_TableCell(__('Cash')); $tablecells .= wf_TableCell(__('NDS')); $tablecells .= wf_TableCell(__('Without NDS')); $tablecells .= wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Full address')); $tablecells .= wf_TableCell(__('Cash type')); $tablecells .= wf_TableCell(__('Notes')); $tablecells .= wf_TableCell(__('Admin')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($allapayments)) { foreach ($allapayments as $io => $eachpayment) { if (zb_NdsCheckUser($eachpayment['login'], $allndsusers)) { if ($alter_conf['TRANSLATE_PAYMENTS_NOTES']) { if ($eachpayment['note'] == '') { $eachpayment['note'] = __('Internet'); } if (isset($allservicenames[$eachpayment['note']])) { $eachpayment['note'] = $allservicenames[$eachpayment['note']]; } if (ispos($eachpayment['note'], 'CARD:')) { $cardnum = explode(':', $eachpayment['note']); $eachpayment['note'] = __('Card') . " " . $cardnum[1]; } if (ispos($eachpayment['note'], 'SCFEE')) { $eachpayment['note'] = __('Credit fee'); } if (ispos($eachpayment['note'], 'TCHANGE:')) { $tariff = explode(':', $eachpayment['note']); $eachpayment['note'] = __('Tariff change') . " " . $tariff[1]; } if (ispos($eachpayment['note'], 'BANKSTA:')) { $banksta = explode(':', $eachpayment['note']); $eachpayment['note'] = __('Bank statement') . " " . $banksta[1]; } } $tablecells = wf_TableCell($eachpayment['id']); $tablecells .= wf_TableCell(zb_NumEncode($eachpayment['id'])); $tablecells .= wf_TableCell($eachpayment['date']); $tablecells .= wf_TableCell($eachpayment['summ']); $paynds = zb_NdsCalc($eachpayment['summ'], $ndspercent); $tablecells .= wf_TableCell($paynds); $tablecells .= wf_TableCell($eachpayment['summ'] - $paynds); $profilelink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachpayment['login'], false); $tablecells .= wf_TableCell($profilelink); $tablecells .= wf_TableCell(@$alladrs[$eachpayment['login']]); $tablecells .= wf_TableCell(@__($alltypes[$eachpayment['cashtypeid']])); $tablecells .= wf_TableCell($eachpayment['note']); $tablecells .= wf_TableCell($eachpayment['admin']); $tablerows .= wf_TableRow($tablecells, 'row3'); if ($eachpayment['summ'] > 0) { $total = $total + $eachpayment['summ']; $ndstotal = $ndstotal + $paynds; } } } } $tablecells = wf_TableCell(''); $tablecells .= wf_TableCell(''); $tablecells .= wf_TableCell(''); $tablecells .= wf_TableCell($total); $tablecells .= wf_TableCell($ndstotal); $tablecells .= wf_TableCell($total - $ndstotal); $tablecells .= wf_TableCell(''); $tablecells .= wf_TableCell(''); $tablecells .= wf_TableCell(''); $tablecells .= wf_TableCell(''); $tablecells .= wf_TableCell(''); $tablerows .= wf_TableRow($tablecells, 'row2'); $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); $result .= '' . __('Total') . ': <strong>' . $total . '</strong> ' . __('ELVs for all payments of') . ': <strong>' . $ndstotal . '</strong>'; return $result; }
/** * Renders per-payment system openpayz transaction charts * * @return string */ public function renderGraphs() { $psysdata = array(); $gcAllData = array(); $gcMonthData = array(); $result = wf_Link('?module=openpayz', __('Back'), true, 'ubButton'); if (!empty($this->allTransactions)) { foreach ($this->allTransactions as $io => $each) { $timestamp = strtotime($each['date']); $curMonth = curmonth(); $date = date("Y-m-01", $timestamp); if (isset($psysdata[$each['paysys']][$date]['count'])) { $psysdata[$each['paysys']][$date]['count']++; $psysdata[$each['paysys']][$date]['summ'] = $psysdata[$each['paysys']][$date]['summ'] + $each['summ']; } else { $psysdata[$each['paysys']][$date]['count'] = 1; $psysdata[$each['paysys']][$date]['summ'] = $each['summ']; } //all time stats if (isset($gcAllData[$each['paysys']])) { $gcAllData[$each['paysys']]++; } else { $gcAllData[$each['paysys']] = 1; } //current month stats if (ispos($date, $curMonth . '-')) { if (isset($gcMonthData[$each['paysys']])) { $gcMonthData[$each['paysys']]++; } else { $gcMonthData[$each['paysys']] = 1; } } } } $chartOpts = "chartArea: { width: '90%', height: '90%' }, legend : {position: 'right'}, "; if (!empty($gcAllData)) { $gcAllPie = wf_gcharts3DPie($gcAllData, __('All time'), '400px', '400px', $chartOpts); } else { $gcAllPie = ''; } if (!empty($gcMonthData)) { $gcMonthPie = wf_gcharts3DPie($gcMonthData, __('Current month'), '400px', '400px', $chartOpts); } else { $gcMonthPie = ''; } $gcells = wf_TableCell($gcAllPie); $gcells .= wf_TableCell($gcMonthPie); $grows = wf_TableRow($gcells); $result .= wf_TableBody($grows, '100%', 0, ''); if (!empty($psysdata)) { foreach ($psysdata as $psys => $opdate) { $gdata = __('Date') . ',' . __('Count') . ',' . __('Cash') . "\n"; foreach ($opdate as $datestamp => $optrans) { $gdata .= $datestamp . ',' . $optrans['count'] . ',' . $optrans['summ'] . "\n"; } $result .= wf_tag('div', false, '', ''); $result .= wf_tag('h2') . $psys . wf_tag('h2', true) . wf_delimiter(); $result .= wf_Graph($gdata, '800', '200', false); $result .= wf_tag('div', true); } } return $result; }
$sudo_path = $config['SUDO']; $userdata = zb_UserGetStargazerData($login); $user_ip = $userdata['IP']; $command = $sudo_path . ' ' . $arping_path . ' ' . $arping_iface . ' ' . $arping_options . ' ' . $user_ip; $raw_result = shell_exec($command); if (wf_CheckGet(array('ajax'))) { die($raw_result); } $ping_result = wf_AjaxLoader(); $ping_result .= wf_AjaxLink('?module=pl_arping&username='******'&ajax=true', __('Renew'), 'ajaxarping', true, 'ubButton'); $ping_result .= wf_tag('pre', false, '', 'id="ajaxarping"') . $raw_result . wf_tag('pre', true); //detecting duplicate MAC $rawArray = explodeRows($raw_result); if (!empty($rawArray)) { foreach ($rawArray as $io => $eachline) { if (ispos($eachline, 'packets transmitted')) { $parseMe = $eachline; } } } if (!empty($parseMe)) { $parseMe = explode(',', $parseMe); if (sizeof($parseMe) == 3) { $txCount = vf($parseMe[0], 3); $rxCount = vf($parseMe[1], 3); if ($rxCount > $txCount) { $cloneFlag = true; } } } if ($cloneFlag) {
/** * Stores SMS for some employee for further sending with senddog run * * @param int $employeeid * @param string $message * @return array * @throws Exception */ function ts_SendSMS($employeeid, $message) { $query = "SELECT `mobile`,`name` from `employee` WHERE `id`='" . $employeeid . "'"; $empData = simple_query($query); $mobile = $empData['mobile']; $result = array(); $sms = new UbillingSMS(); if (!empty($mobile)) { if (ispos($mobile, '+')) { $sms->sendSMS($mobile, $message, true, 'TASKMAN'); $result['number'] = $mobile; $result['message'] = $message; } else { throw new Exception('BAD_MOBILE_FORMAT ' . $mobile); } } return $result; }
/** * Renders ONU signal history chart * * @param int $onuId * @return string */ protected function onuSignalHistory($onuId) { $onuId = vf($onuId, 3); $result = ''; if (isset($this->allOnu[$onuId])) { //not empty MAC if ($this->allOnu[$onuId]['mac']) { if (file_exists(self::ONUSIG_PATH . md5($this->allOnu[$onuId]['mac']))) { $historyKey = self::ONUSIG_PATH . md5($this->allOnu[$onuId]['mac']); } elseif (file_exists(self::ONUSIG_PATH . md5($this->allOnu[$onuId]['serial']))) { $historyKey = self::ONUSIG_PATH . md5($this->allOnu[$onuId]['serial']); } else { $historyKey = ''; } if (!empty($historyKey)) { $rawData = file_get_contents($historyKey); $result .= wf_delimiter(); $result .= wf_tag('h2') . __('ONU signal history') . wf_tag('h2', true); //current day signal levels $todaySignal = ''; $curdate = curdate(); if (!empty($rawData)) { $todayTmp = explodeRows($rawData); if (!empty($todayTmp)) { foreach ($todayTmp as $io => $each) { if (ispos($each, $curdate)) { $todaySignal .= $each . "\n"; } } } } $result .= __('Today'); $result .= wf_tag('div', false, '', ''); $result .= wf_Graph($todaySignal, '800', '300', false); $result .= wf_tag('div', true); $result .= wf_tag('br'); //current month signal levels $monthSignal = ''; $curmonth = curmonth(); if (!empty($rawData)) { $monthTmp = explodeRows($rawData); if (!empty($monthTmp)) { foreach ($monthTmp as $io => $each) { if (ispos($each, $curmonth)) { $monthSignal .= $each . "\n"; } } } } $result .= __('Month'); $result .= wf_tag('div', false, '', ''); $result .= wf_Graph($monthSignal, '800', '300', false); $result .= wf_tag('div', true); $result .= wf_tag('br'); //all time signal history $result .= __('All time'); $result .= wf_tag('div', false, '', ''); $result .= wf_GraphCSV($historyKey, '800', '300', false); $result .= wf_tag('div', true); } } } return $result; }
// Конец поиска // Ловим сообщения о совершенных платежах в виде: // ?action=bill_input&bill_identifier=2887647236&summ=10&pkey=aaa444455656&date=2012-04-02T18:20:15 if (isset($_GET['action'])) { if ($_GET['action'] == 'bill_input') { $customerid = vf($_GET['bill_identifier'], 3); //если все нормально регистрируем новую транзакцию if (!empty($customerid)) { $summ = $_GET['sum']; $hash = $_GET['pkey']; $ophash = 'PB' . $_GET['pkey']; $date = date("Y-M-d H:i:s"); //точно ли уникальный хеш? if (pb_IsHashUnique($ophash)) { //не нулевая ли сумма if ($summ > 1 and !ispos($summ, ',')) { op_TransactionAdd($ophash, $summ, $customerid, 'PBANK', $date); op_ProcessHandlers(); $transaction_ok = ' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ResponseExtInputPay> <extInputPay> <inner_ref>' . $hash . '</inner_ref> </extInputPay> </ResponseExtInputPay> '; print $transaction_ok; } else { $sum_fail = ' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ResponseExtInputPay>
function zb_AsteriskParseCDR($data) { global $altcfg; $normalData = $data; if (!empty($normalData)) { $totalTime = 0; $callsCounter = 0; $cells = wf_TableCell('#'); $cells .= wf_TableCell(__('Time')); $cells .= wf_TableCell(__('From')); $cells .= wf_TableCell(__('To')); $cells .= wf_TableCell(__('Type')); $cells .= wf_TableCell(__('Status')); $cells .= wf_TableCell(__('Talk time')); $rows = wf_TableRow($cells, 'row1'); foreach ($normalData as $io => $each) { $callsCounter++; $debugData = wf_tag('pre') . print_r($each, true) . wf_tag('pre', true); $startTime = explode(' ', $each['calldate']); @($startTime = $startTime[1]); $tmpTime = strtotime($each['calldate']); $endTime = $tmpTime + $each['duration']; $endTime = date("H:i:s", $endTime); $answerTime = $tmpTime + ($each['duration'] - $each['billsec']); $answerTime = date("H:i:s", $answerTime); $tmpStats = __('Taken up the phone') . ': ' . $answerTime . "\n"; $tmpStats .= __('End of call') . ': ' . $endTime; $sessionTimeStats = wf_tag('abbr', false, '', 'title="' . $tmpStats . '"'); $sessionTimeStats .= $startTime; $sessionTimeStats .= wf_tag('abbr', true); $callDirection = ''; $cells = wf_TableCell(wf_modal($callsCounter, $callsCounter, $debugData, '', '500', '600'), '', '', 'sorttable_customkey="' . $callsCounter . '"'); $cells .= wf_TableCell($sessionTimeStats, '', '', 'sorttable_customkey="' . $tmpTime . '"'); $cells .= wf_TableCell(zb_AsteriskGetNumAlias($each['src'])); $cells .= wf_TableCell(zb_AsteriskGetNumAlias($each['dst'])); $CallType = __('Dial'); if (ispos($each['lastapp'], 'internal-caller-transfer')) { $CallType = __('Call transfer'); } $cells .= wf_TableCell($CallType); $callStatus = $each['disposition']; $statusIcon = ''; if (ispos($each['disposition'], 'ANSWERED')) { $callStatus = __('Answered'); $statusIcon = wf_img('skins/calls/phone_green.png'); } if (ispos($each['disposition'], 'NO ANSWER')) { $callStatus = __('No answer'); $statusIcon = wf_img('skins/calls/phone_red.png'); } if (ispos($each['disposition'], 'BUSY')) { $callStatus = __('Busy'); $statusIcon = wf_img('skins/calls/phone_yellow.png'); } if (ispos($each['disposition'], 'FAILED')) { $callStatus = __('Failed'); $statusIcon = wf_img('skins/calls/phone_fail.png'); } $cells .= wf_TableCell($statusIcon . ' ' . $callStatus); $speekTime = $each['billsec']; $totalTime = $totalTime + $each['billsec']; $speekTime = zb_AsteriskFormatTime($speekTime); $cells .= wf_TableCell($speekTime, '', '', 'sorttable_customkey="' . $each['billsec'] . '"'); $rows .= wf_TableRow($cells, 'row3'); } $result = wf_TableBody($rows, '100%', '0', 'sortable'); $result .= __('Time spent on calls') . ': ' . zb_AsteriskFormatTime($totalTime) . wf_tag('br'); $result .= __('Total calls') . ': ' . $callsCounter; show_window('', $result); } }
$table = "bd_rx_log"; $interval = 3024000; $ip = str_replace('-3-R.png', '', $ip); } if (ispos($ip, '-3-S')) { $table = "bd_tx_log"; $interval = 3024000; $ip = str_replace('-3-S.png', '', $ip); } //yearly if (ispos($ip, '-4-R')) { $table = "bd_rx_log"; $interval = 34560000; $ip = str_replace('-4-R.png', '', $ip); } if (ispos($ip, '-4-S')) { $table = "bd_tx_log"; $interval = 34560000; $ip = str_replace('-4-S.png', '', $ip); } if (isset($_GET['timestamp'])) { $timestamp = $_GET['timestamp']; } else { $timestamp = time() - $interval + 0.05 * $interval; } $total = array(); $icmp = array(); $udp = array(); $tcp = array(); $ftp = array(); $http = array();
/** * Returns array of timesheet records filtered by Year/month in MySQL date format Y-m * * @param string $yearMonth * * @return array */ protected function timesheetFilterMonth($yearMonth) { $result = array(); if (!empty($this->allTimesheets)) { foreach ($this->allTimesheets as $io => $each) { if (ispos($each['date'], $yearMonth)) { $result[$each['id']] = $each; } } } return $result; }
/** * Performs login search by partial address * * @global object $ubillingConfig * @param string $query * @return array */ function zb_UserSearchAddressPartial($query) { global $ubillingConfig; $altercfg = $ubillingConfig->getAlter(); $query = mysql_real_escape_string($query); if (!$altercfg['SEARCHADDR_AUTOCOMPLETE']) { $query = strtolower_utf8($query); } $alluseraddress = zb_AddressGetFulladdresslist(); $result = array(); if (!empty($alluseraddress)) { if (!$altercfg['SEARCHADDR_AUTOCOMPLETE']) { foreach ($alluseraddress as $login => $address) { if (ispos(strtolower_utf8($address), $query)) { $result[] = $login; } } } else { foreach ($alluseraddress as $login => $address) { if (ispos($address, $query)) { $result[] = $login; } } } } return $result; }
/** * Do the search in dead switches time machine * * @param string $query * @return string */ function ub_SwitchesTimeMachineSearch($request) { $request = strtolower_utf8($request); $result = ''; $query = "SELECT * from `switchdeadlog` ORDER BY `id` DESC"; $raw = simple_queryall($query); $deadcount = 0; $tmpArr = array(); if (!empty($raw)) { foreach ($raw as $io => $each) { if (!empty($each)) { $switchData = unserialize($each['swdead']); foreach ($switchData as $switchIp => $switchLocation) { if (ispos(strtolower_utf8($switchIp), $request) or ispos(strtolower_utf8($switchLocation), $request)) { $searchId = zb_rand_string(8); $tmpArr[$searchId]['date'] = $each['date']; $tmpArr[$searchId]['ip'] = $switchIp; $tmpArr[$searchId]['location'] = $switchLocation; } } } } } if (!empty($tmpArr)) { $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('IP')); $cells .= wf_TableCell(__('Location')); $rows = wf_TableRow($cells, 'row1'); foreach ($tmpArr as $ia => $eachResult) { $cells = wf_TableCell($eachResult['date']); $cells .= wf_TableCell($eachResult['ip']); $cells .= wf_TableCell($eachResult['location']); $rows .= wf_TableRow($cells, 'row3'); $deadcount++; } $result = wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $deadcount; } else { $result = __('Nothing found'); } return $result; }
function ra_UserRebuildAttributes($login, $attrtemplate, $verbose = false) { $login = mysql_real_escape_string($login); $clean_q = "DELETE from `radattr` WHERE `login`='" . $login . "'"; nr_query($clean_q); if (!empty($attrtemplate)) { if ($verbose) { show_window(__('User attributes'), '<pre>' . $attrtemplate . '</pre>'); } $splitted = explodeRows($attrtemplate); if (!empty($splitted)) { foreach ($splitted as $io => $eachattr) { if (ispos($eachattr, '=')) { $attr_raw = explode('=', $eachattr); $attr = $attr_raw[0]; $value = $attr_raw[1]; $query = "INSERT INTO `radattr` (`id` ,`login` ,`attr` ,`value`) VALUES (NULL , '" . $login . "', '" . $attr . "', '" . $value . "');"; nr_query($query); } } } } }
/** * Stores SMS for some employee for further sending with watchdog run * * @param int $employeeid * @param string $message * @return array * @throws Exception */ function ts_SendSMS($employeeid, $message) { $query = "SELECT `mobile`,`name` from `employee` WHERE `id`='" . $employeeid . "'"; $empData = simple_query($query); $mobile = $empData['mobile']; $employeeName = $empData['name']; $result = array(); if (!empty($mobile)) { if (ispos($mobile, '+')) { $message = str_replace('\\r\\n', ' ', $message); $message = zb_TranslitString($message); $message = trim($message); $number = trim($mobile); $filename = 'content/tsms/ts_' . zb_rand_string(8); $storedata = 'NUMBER="' . $number . '"' . "\n"; $storedata .= 'MESSAGE="' . $message . '"' . "\n"; $result['number'] = $number; $result['message'] = $message; file_put_contents($filename, $storedata); log_register("TASKMAN SEND SMS `" . $number . "` FOR `" . $employeeName . "`"); } else { throw new Exception('BAD_MOBILE_FORMAT'); } } return $result; }
/** * Returns previousa alerts search results * * @param string $request * @return string */ public function alertSearchResults($request) { $result = $this->alertsSearchForm(); $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell(__('Event')); $rows = wf_TableRow($cells, 'row1'); $counter = 0; if (!empty($this->previousAlerts)) { foreach ($this->previousAlerts as $io => $each) { if (ispos($each['event'], $request)) { $cells = wf_TableCell($each['date']); $cells .= wf_TableCell($each['event']); $rows .= wf_TableRow($cells, 'row3'); $counter++; } } } $result .= wf_TableBody($rows, '100%', 0, 'sortable'); $result .= __('Total') . ': ' . $counter; return $result; }
function bs_SearchLoginByAddresspart($queryaddress, $queryname, $checkarr) { $queryaddress = mysql_real_escape_string($queryaddress); $queryaddress = strtolower_utf8($queryaddress); $queryname = mysql_real_escape_string($queryname); $queryname = strtolower_utf8($queryname); $result = array(); if (!empty($checkarr)) { foreach ($checkarr as $io => $check) { // искаем логин по паре фамилия+пароль if (ispos($queryaddress, strtolower_utf8($check['address']))) { if (!empty($check['realname'])) { if (ispos($queryname, strtolower_utf8($check['realname']))) { $result[] = $io; } } } } } return $result; }
function zb_AskoziaParseStatus($rawData) { $exploded = explodeRows($rawData); $data = array('phones' => 0, 'curcalls' => 0, 'totalcalls' => 0, 'ram' => 0, 'disk' => 0, 'uptime' => 0); if (!empty($exploded)) { foreach ($exploded as $each) { //detecting stats if (ispos($each, ';')) { $parse = explode(';', $each); //current calls $data['curcalls'] = $parse[1]; //total calls $data['totalcalls'] = $parse[2]; //registered phones $data['phones'] = $parse[4]; //uptime in days or minutes $data['uptime'] = $parse[5]; $data['uptime'] = str_replace('min', __('minutes'), $data['uptime']); $data['uptime'] = str_replace('hours', __('hours'), $data['uptime']); $data['uptime'] = str_replace('hour', __('hour'), $data['uptime']); $data['uptime'] = str_replace('days', __('days'), $data['uptime']); $data['uptime'] = str_replace('day', __('day'), $data['uptime']); //system memory $data['ram'] = $parse[6]; //external storage $data['disk'] = $parse[7]; } } } $cells = wf_TableCell(__('Phones')); $cells .= wf_TableCell(__('Current calls')); $cells .= wf_TableCell(__('Calls processed')); $cells .= wf_TableCell(__('Uptime')); $cells .= wf_TableCell(__('Memory usage')); $cells .= wf_TableCell(__('External storage')); $rows = wf_TableRow($cells, 'row2'); $cells = wf_TableCell($data['phones']); $cells .= wf_TableCell($data['curcalls']); $cells .= wf_TableCell($data['totalcalls']); $cells .= wf_TableCell($data['uptime']); $cells .= wf_TableCell(web_bar($data['ram'], '100') . ' ' . $data['ram'] . '%'); $cells .= wf_TableCell(web_bar($data['disk'], '100') . ' ' . $data['disk'] . '%'); $rows .= wf_TableRow($cells, 'row3'); $result = wf_TableBody($rows, '100%', 0, ''); return $result; }
function catvbs_MonthDetect($string) { $string = strtolower_utf8($string); $montharr = array('01' => 'январь', '02' => 'февраль', '03' => 'март', '04' => 'апрель', '05' => 'май', '06' => 'июнь', '07' => 'июль', '08' => 'август', '09' => 'сентябрь', '10' => 'октябрь', '11' => 'ноябрь', '12' => 'декабрь'); $result = false; foreach ($montharr as $io => $eachmonth) { if (ispos($string, $eachmonth)) { $result = $io; } else { if (!$result) { $result = false; } } } return $result; }
/** * Shows signups by another year-month * * @global object $altercfg * @param string $cmonth * * @return void */ function web_SignupsShowAnotherYearMonth($cmonth) { global $altercfg; $alltariffs = zb_TariffsGetAllUsers(); $cmonth = mysql_real_escape_string($cmonth); $where = "WHERE `date` LIKE '" . $cmonth . "%' ORDER by `date` DESC;"; $signups = zb_SignupsGet($where); $curdate = curdate(); //cemetery hide processing $ignoreUsers = array(); if ($altercfg['CEMETERY_ENABLED']) { $cemetery = new Cemetery(); $ignoreUsers = $cemetery->getAllTagged(); } $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('Date')); $tablecells .= wf_TableCell(__('Administrator')); if ($altercfg['SIGREP_CONTRACT']) { $tablecells .= wf_TableCell(__('Contract')); $allcontracts = array_flip(zb_UserGetAllContracts()); } $tablecells .= wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Full address')); $tablerows = wf_TableRow($tablecells, 'row1'); if (!empty($signups)) { foreach ($signups as $io => $eachsignup) { $tablecells = wf_TableCell($eachsignup['id']); $tablecells .= wf_TableCell($eachsignup['date']); $tablecells .= wf_TableCell($eachsignup['admin']); if ($altercfg['SIGREP_CONTRACT']) { $tablecells .= wf_TableCell(@$allcontracts[$eachsignup['login']]); } $tablecells .= wf_TableCell($eachsignup['login']); @($sigTariff = $alltariffs[$eachsignup['login']]); $tablecells .= wf_TableCell($sigTariff); $profilelink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachsignup['address']); $tablecells .= wf_TableCell($profilelink); if (ispos($eachsignup['date'], $curdate)) { $rowClass = 'todaysig'; } else { $rowClass = 'row3'; } //cemetary user if (isset($ignoreUsers[$eachsignup['login']])) { $rowClass = 'sigcemeteryuser'; } //ugly check - is user removed? if (empty($sigTariff)) { $rowClass = 'sigdeleteduser'; } $tablerows .= wf_TableRow($tablecells, $rowClass); } } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); show_window(__('User signups by month') . ' ' . $cmonth, $result); }
/** * Returns streets data array * * @return array */ protected function getBuildsData() { $result = array(); if (!empty($this->allBuilds)) { foreach ($this->allBuilds as $buildId => $buildData) { $result[$buildId]['id'] = $buildId; $streetId = $buildData['streetid']; $streetName = @$this->allStreets[$streetId]['streetname']; $result[$buildId]['city_district_id'] = ''; $result[$buildId]['street_id'] = $buildData['streetid']; $result[$buildId]['full_name'] = $streetName . ' ' . $buildData['buildnum']; $result[$buildId]['postcode'] = ''; if (isset($this->buildPassports[$buildId])) { $result[$buildId]['floor'] = $this->buildPassports[$buildId]['floors']; $result[$buildId]['entrance'] = $this->buildPassports[$buildId]['entrances']; } else { $result[$buildId]['floor'] = ''; $result[$buildId]['entrance'] = ''; } if (ispos($buildData['buildnum'], '/')) { $buildExpl = explode('/', $buildData['buildnum']); @($buildNumber = vf($buildExpl[0], 3)); @($blockLetter = $buildExpl[1]); } else { $buildNumber = vf($buildData['buildnum'], 3); $blockLetter = preg_replace('/\\P{L}+/u', '', $buildData['buildnum']); $blockLetter = trim($blockLetter); } $result[$buildId]['number'] = $buildNumber; $result[$buildId]['block'] = $blockLetter; $result[$buildId]['coordinates'] = $buildData['geo']; } } return $result; }
/** * Zyxel Port description data parser * * @return string */ function sp_parse_zyportdesc($data) { if (!empty($data)) { $data = explode('=', $data); $data[0] = trim($data[0]); $portnum = substr($data[0], -2); $portnum = str_replace('.', '', $portnum); if (ispos($data[1], 'NULL')) { $desc = __('No'); } else { $desc = str_replace('STRING:', '', $data[1]); $desc = trim($desc); } if (ispos($data[1], 'up')) { $cells = wf_TableCell($portnum, '24', '', 'style="height:20px;"'); $cells .= wf_TableCell($desc); $rows = wf_TableRow($cells, 'row3'); $result = wf_TableBody($rows, '100%', 0, ''); } else { $cells = wf_TableCell($portnum, '24', '', 'style="height:20px;"'); $cells .= wf_TableCell($desc); $rows = wf_TableRow($cells, 'row3'); $result = wf_TableBody($rows, '100%', 0, ''); } return $result; } else { return __('Empty reply received'); } }
/** * Returns row class for some event * * @param string $event * * @return string */ protected function getEventClass($event) { $result = 'row3'; if (ispos($event, 'attemp')) { $result = 'ukvbankstadup'; } if (ispos($event, 'moved from')) { $result = 'undone'; } if (ispos($event, 'new station')) { $result = 'todaysig'; } if (ispos($event, 'ETHERTYPE')) { $result = 'sigcemeteryuser'; } if (ispos($event, 'hardware')) { $result = 'donetask'; } if (ispos($event, 'flip flop')) { $result = 'undone'; } if (ispos($event, 'using my IP')) { $result = 'rowerror'; } return $result; }
/** * Returns count of dead users by some date with non strict search * * @param string $date * * @return int */ public function getDeadDateCount($date) { $result = 0; if (!empty($this->allDead)) { foreach ($this->allDead as $io => $each) { if (ispos($each['date'], $date)) { if ($each['state']) { $result++; } else { $result--; } } } } return $result; }
/** * Detects searchtype by search query fragment * * @param string $term * @return string */ public function detectSearchType($term) { $result = ''; $term = trim($term); if (!empty($term)) { $term = strtolower_utf8($term); $this->loadRawdata(); if (!empty($this->rawData)) { foreach ($this->rawData as $io => $each) { if (ispos($each['lower'], $term)) { $result = $each['type']; break; } } } } return $result; }