/** * Returns all of used by users MAC bindings from database as array login=>mac * * @return array */ function zb_UserGetAllMACs() { $alluserips = zb_UserGetAllIPs(); $alluserips = array_flip($alluserips); $allmac = zb_UserGetAllIpMACs(); $result = array(); //filling mac array if (!empty($allmac)) { foreach ($allmac as $eachip => $eachmac) { if (isset($alluserips[$eachip])) { $result[$alluserips[$eachip]] = $eachmac; } } } return $result; }
} } } return $result; } } // Main code part $alter_config = $ubillingConfig->getAlter(); if ($alter_config['MTSIGMON_ENABLED']) { $sigmon = new MTSIGMON(); $allMonitoredDevices = $sigmon->getDevices(); $allusermacs = zb_UserGetAllMACs(); $alladdress = zb_AddressGetFullCityaddresslist(); $alltariffs = zb_TariffsGetAllUsers(); $allrealnames = zb_UserGetAllRealnames(); $alluserips = zb_UserGetAllIPs(); $result = ''; $hlightmac = ''; //hlight user mac sub if (isset($_GET['username'])) { $login = mysql_real_escape_string($_GET['username']); $userip = zb_UserGetIP($login); $usermac = zb_MultinetGetMAC($userip); $hlightmac = $usermac; } if (!empty($allMonitoredDevices)) { foreach ($allMonitoredDevices as $io => $eachdevice) { $userCounter = 0; $hostdata = $sigmon->deviceQuery($eachdevice['ip'], $eachdevice['community']); $result .= wf_tag('h2', false) . wf_img('skins/wifi.png') . ' ' . $eachdevice['location'] . ' - ' . $eachdevice['ip'] . wf_tag('h2', true); $tablecells = wf_TableCell(__('Full address'));
/** * Generates ghaph images links: * * @param str $ip User's IP address, for whitch links are generated * @return array Graph links */ function zb_BandwidthdGenLinks($ip) { $bandwidthd_url = zb_BandwidthdGetUrl($ip); $netid = zb_NetworkGetByIp($ip); $nasid = zb_NasGetByNet($netid); $nasdata = zb_NasGetData($nasid); $nastype = $nasdata['nastype']; // RouterOS graph model: if ($nastype == 'mikrotik') { // Get user's IP array: $alluserips = zb_UserGetAllIPs(); $alluserips = array_flip($alluserips); // Generate graphs paths: $urls['dayr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/daily.gif'; $urls['days'] = null; $urls['weekr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/weekly.gif'; $urls['weeks'] = null; $urls['monthr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/monthly.gif'; $urls['months'] = null; $urls['yearr'] = $bandwidthd_url . '/' . $alluserips[$ip] . '/yearly.gif'; $urls['years'] = null; } else { // Banwidthd graphs model: $urls['dayr'] = $bandwidthd_url . '/' . $ip . '-1-R.png'; $urls['days'] = $bandwidthd_url . '/' . $ip . '-1-S.png'; $urls['weekr'] = $bandwidthd_url . '/' . $ip . '-2-R.png'; $urls['weeks'] = $bandwidthd_url . '/' . $ip . '-2-S.png'; $urls['monthr'] = $bandwidthd_url . '/' . $ip . '-3-R.png'; $urls['months'] = $bandwidthd_url . '/' . $ip . '-3-S.png'; $urls['yearr'] = $bandwidthd_url . '/' . $ip . '-4-R.png'; $urls['years'] = $bandwidthd_url . '/' . $ip . '-4-S.png'; } return $urls; }
function ra_NasRebuildAll() { $nas_q = "SELECT * from `nas` WHERE `nastype`='radius'"; $radiusnas = simple_queryall($nas_q); if (!empty($radiusnas)) { $allips = zb_UserGetAllIPs(); $transips = array_flip($allips); $allnetids = zb_UserGetNetidsAll(); $alluserdata = zb_TemplateGetAllUserData(); foreach ($radiusnas as $io => $eachnas) { $netid = $eachnas['netid']; $nasid = $eachnas['id']; $nastemplate = ra_NasGetTemplate($nasid); if (!empty($nastemplate)) { foreach ($allnetids as $ip => $eachnetid) { if ($eachnetid == $netid) { $userlogin = $transips[$ip]; if (!empty($userlogin)) { $parsed_template = zb_TemplateReplace($userlogin, $nastemplate, $alluserdata); ra_UserRebuildAttributes($userlogin, $parsed_template, false); } } } } } } }
function docsis_ModemProfileShow($modemid) { $modemid = vf($modemid, 3); $data = docsis_ModemGetData($modemid); $netdata = array(); $netdata_q = "SELECT * from `nethosts` where `ip`='" . $data['ip'] . "'"; $netdata = simple_queryall($netdata_q); $netdata = print_r($netdata, true); $netdata = nl2br($netdata); $alluserips = zb_UserGetAllIPs(); $alluserips = array_flip($alluserips); $result = wf_Link("?module=docsis", __('Back'), false, 'ubButton'); $ajaxcontainer = wf_AjaxLoader() . wf_AjaxLink("?module=docsis&ajaxsnmp=" . $modemid, __('Renew modem data'), 'ajaxdata', true, 'ubButton') . wf_tag('div', false, '', 'id="ajaxdata"') . wf_tag('div', true); $result .= wf_modal(__('Modem diagnostics'), __('Modem diagnostics'), $ajaxcontainer, 'ubButton', '500', '400'); $result .= wf_modal(__('Networking data'), __('Networking data'), $netdata, 'ubButton', '500', '400'); $result .= wf_delimiter(); if (!empty($data)) { $cells = wf_TableCell(__('ID')); $cells .= wf_TableCell($data['id'] . ' ' . wf_JSAlert("?module=docsis&deletemodem=" . $modemid, web_delete_icon(), __('Removing this may lead to irreparable results'))); $rows = wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('IP')); $cells .= wf_TableCell($data['ip']); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('MAC Lan')); $cells .= wf_TableCell($data['maclan']); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Date')); $cells .= wf_TableCell($data['date']); $rows .= wf_TableRow($cells, 'row3'); if (isset($alluserips[$data['userbind']])) { $bindedLogin = $alluserips[$data['userbind']]; $profileLink = ' ' . wf_Link('?module=userprofile&username='******' ' . $bindedLogin, false, ''); } else { $profileLink = ''; } $cells = wf_TableCell(__('Linked user')); $cells .= wf_TableCell($data['userbind'] . $profileLink); $rows .= wf_TableRow($cells, 'row3'); $cells = wf_TableCell(__('Notes')); $cells .= wf_TableCell($data['note']); $rows .= wf_TableRow($cells, 'row3'); $result .= wf_TableBody($rows, '100%', '0', ''); $inputs = wf_TextInput('edituserbind', __('Linked user'), $data['userbind'], true, '40'); $inputs .= wf_TextInput('editnote', __('Notes'), $data['note'], true, '40'); $inputs .= wf_Submit(__('Save')); $form = wf_Form("", 'POST', $inputs, 'glamour'); $result .= $form; show_window(__('Modem profile'), $result); } else { show_window(__('Error'), __('Strange exeption')); } }
/** * Preloads raw data for searchable user fields and controls caching * * @return void */ protected function loadRawdata($forceCache = false) { $cacheTime = $this->alterConf['GLOBALSEARCH_CACHE']; $cacheTime = time() - $cacheTime * 60; //in minutes //extracting user fields types to load if (!empty($this->alterConf['GLOBALSEARCH_FIELDS'])) { $this->fields = explode(',', $this->alterConf['GLOBALSEARCH_FIELDS']); $this->fields = array_flip($this->fields); } $updateCache = false; if (file_exists(self::CACHE_NAME)) { $updateCache = false; if (filemtime(self::CACHE_NAME) > $cacheTime) { $updateCache = false; } else { $updateCache = true; } } else { $updateCache = true; } //force cache parameter if ($forceCache) { $updateCache = true; } //updating rawdata cache if ($updateCache) { //loading needed fields if (isset($this->fields['realname'])) { $this->rawData = $this->rawData + $this->transformArray(zb_UserGetAllRealnames(), __('Real Name'), 'realname'); } if (isset($this->fields['address'])) { $this->rawData = $this->rawData + $this->transformArray(zb_AddressGetFulladdresslist(), __('Full address'), 'address'); } if (isset($this->fields['contract'])) { $allContracts = zb_UserGetAllContracts(); $allContracts = array_flip($allContracts); $this->rawData = $this->rawData + $this->transformArray($allContracts, __('Contract'), 'contract'); } if (isset($this->fields['phone']) or isset($this->fields['mobile'])) { $allPhonedata = zb_UserGetAllPhoneData(); if (isset($this->fields['phone'])) { if (!empty($allPhonedata)) { $allPhones = array(); foreach ($allPhonedata as $io => $each) { $allPhones[$io] = $each['phone']; } $this->rawData = $this->rawData + $this->transformArray($allPhones, __('Phone'), 'phone'); } } if (isset($this->fields['mobile'])) { if (!empty($allPhonedata)) { $allMobiles = array(); foreach ($allPhonedata as $io => $each) { $allMobiles[$io] = $each['mobile']; } $this->rawData = $this->rawData + $this->transformArray($allMobiles, __('Mobile'), 'mobile'); } } } if (isset($this->fields['ip'])) { $this->rawData = $this->rawData + $this->transformArray(zb_UserGetAllIPs(), __('IP'), 'ip'); } if (isset($this->fields['mac'])) { $this->rawData = $this->rawData + $this->transformArray(zb_UserGetAllIpMACs(), __('MAC address'), 'mac'); } if (isset($this->fields['login'])) { $allLogins = zb_UserGetAllStargazerLogins(); $this->rawData = $this->rawData + $this->transformArray($allLogins, __('Login'), 'login'); } if (isset($this->fields['seal'])) { $conDet = new ConnectionDetails(); $allSeals = $conDet->getAllSeals(); $this->rawData = $this->rawData + $this->transformArray($allSeals, __('Cable seal'), 'seal'); } if (isset($this->fields['paymentid'])) { if ($this->alterConf['OPENPAYZ_REALID']) { $allPayIds_q = "SELECT * from `op_customers`"; $allPayIds = simple_queryall($allPayIds_q); $tmpArrPayids = array(); if (!empty($allPayIds)) { foreach ($allPayIds as $io => $each) { $tmpArrPayids[$each['realid']] = $each['virtualid']; } } $this->rawData = $this->rawData + $this->transformArray($tmpArrPayids, __('Payment ID'), 'payid'); } else { $allPayIds_q = "SELECT `login`,`IP` from `users`"; $allPayIds = simple_queryall($allPayIds_q); $tmpArrPayids = array(); if (!empty($allPayIds)) { foreach ($allPayIds as $io => $each) { $tmpArrPayids[$each['login']] = ip2int($each['IP']); } } $this->rawData = $this->rawData + $this->transformArray($tmpArrPayids, __('Payment ID'), 'payid'); } } file_put_contents(self::CACHE_NAME, serialize($this->rawData)); } else { $this->rawData = file_get_contents(self::CACHE_NAME); $this->rawData = unserialize($this->rawData); } }
/** * Renders ticket, all of replies and all needed controls/forms for they * * @param int $ticketid * * @return string */ function web_TicketDialogue($ticketid) { $ticketid = vf($ticketid, 3); $ticketdata = zb_TicketGetData($ticketid); $ticketreplies = zb_TicketGetReplies($ticketid); $result = wf_tag('p', false, '', 'align="right"') . wf_Link('?module=ticketing', 'Back to tickets list', true, 'ubButton') . wf_tag('p', true); if (!empty($ticketdata)) { $alladdress = zb_AddressGetFulladdresslist(); $allrealnames = zb_UserGetAllRealnames(); $alltariffs = zb_TariffsGetAllUsers(); $allcash = zb_CashGetAllUsers(); $allcredits = zb_CreditGetAllUsers(); $alluserips = zb_UserGetAllIPs(); if ($ticketdata['status']) { $actionlink = wf_Link('?module=ticketing&openticket=' . $ticketdata['id'], 'Open', false, 'ubButton'); } else { $actionlink = wf_Link('?module=ticketing&closeticket=' . $ticketdata['id'], 'Close', false, 'ubButton'); } $tablecells = wf_TableCell(__('ID')); $tablecells .= wf_TableCell(__('Date')); $tablecells .= wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Real Name')); $tablecells .= wf_TableCell(__('Full address')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Tariff')); $tablecells .= wf_TableCell(__('Balance')); $tablecells .= wf_TableCell(__('Credit')); $tablecells .= wf_TableCell(__('Processed')); $tablerows = wf_TableRow($tablecells, 'row1'); $tablecells = wf_TableCell($ticketdata['id']); $tablecells .= wf_TableCell($ticketdata['date']); $profilelink = wf_Link('?module=userprofile&username='******'from'], web_profile_icon() . ' ' . $ticketdata['from']); $tablecells .= wf_TableCell($profilelink); $tablecells .= wf_TableCell(@$allrealnames[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alladdress[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alluserips[$ticketdata['from']]); $tablecells .= wf_TableCell(@$alltariffs[$ticketdata['from']]); $tablecells .= wf_TableCell(@$allcash[$ticketdata['from']]); $tablecells .= wf_TableCell(@$allcredits[$ticketdata['from']]); $tablecells .= wf_TableCell(web_bool_led($ticketdata['status'])); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0'); //ticket body $tickettext = strip_tags($ticketdata['text']); $tickettext = nl2br($tickettext); $tablecells = wf_TableCell('', '20%'); $tablecells .= wf_TableCell($ticketdata['date']); $tablerows = wf_TableRow($tablecells, 'row2'); $ticketauthor = wf_tag('center') . wf_tag('b') . @$allrealnames[$ticketdata['from']] . wf_tag('b', true) . wf_tag('center', true); $ticketavatar = wf_tag('center') . wf_img('skins/userava.png') . wf_tag('center', true); $ticketpanel = $ticketauthor . wf_tag('br') . $ticketavatar; $tablecells = wf_TableCell($ticketpanel); $tablecells .= wf_TableCell($tickettext); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= $actionlink; } if (!empty($ticketreplies)) { $result .= wf_tag('h2') . __('Replies') . wf_tag('h2', true); $result .= wf_CleanDiv(); foreach ($ticketreplies as $io => $eachreply) { //reply if ($eachreply['admin']) { $replyauthor = wf_tag('center') . wf_tag('b') . $eachreply['admin'] . wf_tag('b', true) . wf_tag('center', true); $replyavatar = wf_tag('center') . gravatar_ShowAdminAvatar($eachreply['admin'], '64') . wf_tag('center', true); } else { $replyauthor = wf_tag('center') . wf_tag('b') . @$allrealnames[$eachreply['from']] . wf_tag('b', true) . wf_tag('center', true); $replyavatar = wf_tag('center') . wf_img('skins/userava.png') . wf_tag('center', true); } $replyactions = wf_tag('center'); $replyactions .= wf_JSAlert('?module=ticketing&showticket=' . $ticketdata['id'] . '&deletereply=' . $eachreply['id'], web_delete_icon(), 'Removing this may lead to irreparable results') . ' '; $replyactions .= wf_JSAlert('?module=ticketing&showticket=' . $ticketdata['id'] . '&editreply=' . $eachreply['id'], web_edit_icon(), 'Are you serious'); $replyactions .= wf_tag('center', true); // reply body if (isset($_GET['editreply'])) { if ($_GET['editreply'] == $eachreply['id']) { //is this reply editing? $replytext = web_TicketReplyEditForm($eachreply['id']); } else { //not this ticket edit $replytext = strip_tags($eachreply['text']); } } else { //normal text by default $replytext = strip_tags($eachreply['text']); $replytext = nl2br($replytext); } $replypanel = $replyauthor . wf_tag('br') . $replyavatar . wf_tag('br') . $replyactions; $tablecells = wf_TableCell('', '20%'); $tablecells .= wf_TableCell($eachreply['date']); $tablerows = wf_TableRow($tablecells, 'row2'); $tablecells = wf_TableCell($replypanel); $tablecells .= wf_TableCell($replytext); $tablerows .= wf_TableRow($tablecells, 'row3'); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= wf_CleanDiv(); } } //reply form and previous tickets $allprevious = zb_TicketsGetAllByUser($ticketdata['from']); $previoustickets = ''; if (!empty($allprevious)) { $previoustickets = wf_tag('h2') . __('All tickets by this user') . wf_tag('h2', true); foreach ($allprevious as $io => $eachprevious) { $tablecells = wf_TableCell($eachprevious['date']); $tablecells .= wf_TableCell(web_bool_led($eachprevious['status'])); $prevaction = wf_Link('?module=ticketing&showticket=' . $eachprevious['id'], 'Show', false, 'ubButton'); $tablecells .= wf_TableCell($prevaction); $tablerows = wf_TableRow($tablecells, 'row3'); $previoustickets .= wf_TableBody($tablerows, '100%', '0'); } } $tablecells = wf_TableCell(web_TicketReplyForm($ticketid), '50%', '', 'valign="top"'); $tablecells .= wf_TableCell($previoustickets, '50%', '', 'valign="top"'); $tablerows = wf_TableRow($tablecells); $result .= wf_TableBody($tablerows, '100%', '0', 'glamour'); $result .= wf_CleanDiv(); return $result; }
/** * Returns JSON for actual ARP table * * @return string */ public function ajaxReplyArp() { $result = ''; $command = 'arp -a'; $raw = shell_exec($command); $jsonAAData = array(); if (!empty($raw)) { $allUserAddress = zb_AddressGetFulladdresslistCached(); $allUserIps = zb_UserGetAllIPs(); $allUserIps = array_flip($allUserIps); $allSwitchesIps = $this->getAllSwitchesIps(); $raw = explodeRows($raw); if (!empty($raw)) { foreach ($raw as $io => $each) { if (!empty($each)) { $ip = zb_ExtractIpAddress($each); $mac = zb_ExtractMacAddress($each); $hostType = $this->getHostLink($allUserIps, $allUserAddress, $allSwitchesIps, $ip); $jsonItem = array(); $jsonItem[] = $ip; $jsonItem[] = $mac; $jsonItem[] = $hostType; $jsonAAData[] = $jsonItem; } } } } $result = array("aaData" => $jsonAAData); return json_encode($result); }
/** * Returns ajax selector reply for outcoming operation creation form * * @param string $destMark * @return string */ public function outcomindAjaxDestSelector($destMark) { $result = ''; $destMark = vf($destMark); $result .= wf_HiddenInput('newoutdesttype', $destMark); switch ($destMark) { case 'task': $tasksTmp = array(); $allJobTypes = ts_GetAllJobtypes(); $allUndoneTasks = ts_GetUndoneTasksArray(); if (!empty($allUndoneTasks)) { foreach ($allUndoneTasks as $io => $each) { $tasksTmp[$io] = $each['address'] . ' - ' . $allJobTypes[$each['jobtype']]; } } $result .= wf_Selector('newoutdestparam', $tasksTmp, __('Undone tasks'), '', false); break; case 'contractor': $result .= wf_Selector('newoutdestparam', $this->allContractors, __('Contractor'), '', false); break; case 'employee': $result .= wf_Selector('newoutdestparam', $this->activeEmployee, __('Worker'), '', false); break; case 'storage': $result .= wf_Selector('newoutdestparam', $this->allStorages, __('Warehouse storage'), '', false); break; case 'user': $allUsers = zb_UserGetAllIPs(); if (!empty($allUsers)) { $allUsers = array_flip($allUsers); } $result .= wf_AutocompleteTextInput('newoutdestparam', $allUsers, __('Login'), '', false); break; case 'sale': $result .= wf_HiddenInput('newoutdestparam', 'true'); break; case 'cancellation': $result .= wf_HiddenInput('newoutdestparam', 'true'); break; case 'mistake': $result .= wf_HiddenInput('newoutdestparam', 'true'); break; default: $result = __('Strange exeption'); break; } return $result; }
/** * Returns full map marks for builds with filled GEO field * * @return string */ function um_MapDrawBuilds() { $ym_conf = rcms_parse_ini_file(CONFIG_PATH . "ymaps.ini"); $query = "SELECT * from `build` WHERE `geo` != '' "; $allbuilds = simple_queryall($query); $allstreets = zb_AddressGetStreetAllData(); $streetData = array(); $cacheDir = 'exports/'; $cacheTime = 10; $cacheTime = time() - $cacheTime * 60; //street id => streetname if (!empty($allstreets)) { foreach ($allstreets as $ia => $eachstreet) { $streetData[$eachstreet['id']] = $eachstreet['streetname']; } } //get apts in all builds aggregated with users logins $aptData = array(); $allapts_q = "SELECT `buildid`,`apt`,`login` from `apt` JOIN `address` ON `apt`.`id`=`address`.`aptid`"; $allapts = simple_queryall($allapts_q); if (!empty($allapts)) { $aptData = $allapts; } //get all user ips $alluserips = zb_UserGetAllIPs(); //form alive ips array $aliveIps = array(); if (file_exists("exports/nmaphostscan")) { $nmapData = file_get_contents("exports/nmaphostscan"); $nmapData = explodeRows($nmapData); if (!empty($nmapData)) { foreach ($nmapData as $ic => $eachnmaphost) { $zhost = zb_ExtractIpAddress($eachnmaphost); if ($zhost) { $aliveIps[$zhost] = $zhost; } } } } $result = ''; if (!empty($allbuilds)) { foreach ($allbuilds as $io => $each) { $geo = mysql_real_escape_string($each['geo']); @($streetname = $streetData[$each['streetid']]); $title = wf_Link("?module=builds&action=editbuild&streetid=" . $each['streetid'] . "&buildid=" . $each['id'], $streetname . ' ' . $each['buildnum'], false); $content = ''; $cells = wf_TableCell(__('apt.')); $cells .= wf_TableCell(__('User')); $cells .= wf_TableCell(__('Status')); $rows = wf_tag('tr', false, '', 'bgcolor=#DCDCDC') . $cells . wf_tag('tr', true); $iconlabel = ''; $footer = ''; $aliveUsers = 0; $usersCount = 0; if (!empty($aptData)) { //build users data caching $cacheName = $cacheDir . $each['id'] . '.inbuildusers'; if (file_exists($cacheName)) { $updateCache = false; if (filemtime($cacheName) > $cacheTime) { $updateCache = false; } else { $updateCache = true; } } else { $updateCache = true; } if (!$updateCache) { $cachePrev = file_get_contents($cacheName); $cachePrev = unserialize($cachePrev); $rows = $cachePrev['rows']; $usersCount = $cachePrev['userscount']; $aliveUsers = $cachePrev['aliveusers']; } else { foreach ($aptData as $ib => $eachapt) { if ($eachapt['buildid'] == $each['id']) { if (isset($alluserips[$eachapt['login']])) { $userIp = $alluserips[$eachapt['login']]; $usersCount++; if (isset($aliveIps[$userIp])) { $aliveFlag = web_bool_led(true); $aliveUsers++; } else { $aliveFlag = web_bool_led(false); } $cells = wf_TableCell($eachapt['apt']); $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], $userIp, false)); $cells .= wf_TableCell($aliveFlag); $rows .= wf_TableRow($cells); } } } $cacheStore = array(); $cacheStore['rows'] = $rows; $cacheStore['userscount'] = $usersCount; $cacheStore['aliveusers'] = $aliveUsers; $cacheStore = serialize($cacheStore); file_put_contents($cacheName, $cacheStore); } } $footer = __('Active') . ' ' . $aliveUsers . '/' . $usersCount; $icon = um_MapBuildIcon($usersCount); $content = json_encode(wf_TableBody($rows, '', 0)); $title = json_encode($title); $content = str_replace('"', '', $content); $content = str_replace("'", '', $content); $content = str_replace("\n", '', $content); $title = str_replace('"', '', $title); $title = str_replace("'", '', $title); $title = str_replace("\n", '', $title); $result .= sm_MapAddMark($geo, $title, $content, $footer, $icon, $iconlabel, true); } } return $result; }
/** * Returns user array in table view * * @global object $ubillingConfig * @param array $usersarr * @return string */ function web_UserArrayShower($usersarr) { global $ubillingConfig; $alterconf = $ubillingConfig->getAlter(); if (!empty($usersarr)) { $alladdress = zb_AddressGetFulladdresslistCached(); $allrealnames = zb_UserGetAllRealnames(); $alltariffs = zb_TariffsGetAllUsers(); $allusercash = zb_CashGetAllUsers(); $allusercredits = zb_CreditGetAllUsers(); $alluserips = zb_UserGetAllIPs(); if ($alterconf['ONLINE_LAT']) { $alluserlat = zb_LatGetAllUsers(); } //additional finance links if ($alterconf['FAST_CASH_LINK']) { $fastcash = true; } else { $fastcash = false; } $tablecells = wf_TableCell(__('Login')); $tablecells .= wf_TableCell(__('Address')); $tablecells .= wf_TableCell(__('Real Name')); $tablecells .= wf_TableCell(__('IP')); $tablecells .= wf_TableCell(__('Tariff')); // last activity time if ($alterconf['ONLINE_LAT']) { $tablecells .= wf_TableCell(__('LAT')); } $tablecells .= wf_TableCell(__('Active')); //online detect if ($alterconf['DN_ONLINE_DETECT']) { $tablecells .= wf_TableCell(__('Users online')); } $tablecells .= wf_TableCell(__('Balance')); $tablecells .= wf_TableCell(__('Credit')); $tablerows = wf_TableRow($tablecells, 'row1'); foreach ($usersarr as $eachlogin) { @($usercash = $allusercash[$eachlogin]); @($usercredit = $allusercredits[$eachlogin]); //finance check $activity = web_green_led(); $activity_flag = 1; if ($usercash < '-' . $usercredit) { $activity = web_red_led(); $activity_flag = 0; } //fast cash link if ($fastcash) { $financelink = wf_Link('?module=addcash&username='******'skins/icon_dollar.gif', __('Finance operations')), false, ''); } else { $financelink = ''; } $profilelink = $financelink . wf_Link('?module=userprofile&username='******' ' . $eachlogin); $tablecells = wf_TableCell($profilelink); $tablecells .= wf_TableCell(@$alladdress[$eachlogin]); $tablecells .= wf_TableCell(@$allrealnames[$eachlogin]); $tablecells .= wf_TableCell(@$alluserips[$eachlogin], '', '', 'sorttable_customkey="' . ip2int(@$alluserips[$eachlogin]) . '"'); $tablecells .= wf_TableCell(@$alltariffs[$eachlogin]); if ($alterconf['ONLINE_LAT']) { if (isset($alluserlat[$eachlogin])) { $cUserLat = date("Y-m-d H:i:s", $alluserlat[$eachlogin]); } else { $cUserLat = __('No'); } $tablecells .= wf_TableCell($cUserLat); } $tablecells .= wf_TableCell($activity, '', '', 'sorttable_customkey="' . $activity_flag . '"'); if ($alterconf['DN_ONLINE_DETECT']) { if (file_exists(DATA_PATH . 'dn/' . $eachlogin)) { $online_flag = 1; } else { $online_flag = 0; } $tablecells .= wf_TableCell(web_bool_star($online_flag), '', '', 'sorttable_customkey="' . $online_flag . '"'); } $tablecells .= wf_TableCell($usercash); $tablecells .= wf_TableCell($usercredit); $tablerows .= wf_TableRow($tablecells, 'row3'); } $result = wf_TableBody($tablerows, '100%', '0', 'sortable'); $result .= wf_tag('b') . __('Total') . ': ' . wf_tag('b', true) . sizeof($usersarr); } else { $result = __('Any users found'); } return $result; }
} } //updating build users state cache if ($alterconf['SWYMAP_ENABLED']) { $updateBuilCache = um_MapDrawBuilds(); print 'OK:USERBUILDCACHE'; } die('OK:FULLHOSTSCAN'); } /* * users data cache rebuild for external scripts */ if ($_GET['action'] == 'rebuilduserdatacache') { $cacheAddressArr = zb_AddressGetFulladdresslist(); $cacheAddressArr = serialize($cacheAddressArr); $cacheIpsArr = zb_UserGetAllIPs(); $cacheIpsArr = serialize($cacheIpsArr); $cacheMacArr = zb_UserGetAllIpMACs(); $cacheMacArr = serialize($cacheMacArr); file_put_contents('exports/cache_address', $cacheAddressArr); file_put_contents('exports/cache_ips', $cacheIpsArr); file_put_contents('exports/cache_mac', $cacheMacArr); die('OK:REBUILDUSERDATACACHE'); } /* * auto freezing call */ if ($_GET['action'] == 'autofreeze') { if (isset($alterconf['AUTOFREEZE_CASH_LIMIT'])) { $afCashLimit = $alterconf['AUTOFREEZE_CASH_LIMIT']; $autoFreezeQuery = "SELECT * from `users` WHERE `Passive`='0' AND `Cash`<='" . $afCashLimit . "' AND `Credit`='0';";