Esempio n. 1
0
 public function render()
 {
     $cells = wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('IP'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Traffic'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->data)) {
         $allrealnames = zb_UserGetAllRealnames();
         $alladdress = zb_AddressGetFulladdresslist();
         foreach ($this->data as $io => $each) {
             $loginLink = wf_Link("?module=userprofile&username=" . $each['login'], web_profile_icon() . ' ' . $each['login'], false, '');
             $cells = wf_TableCell($loginLink);
             $cells .= wf_TableCell(@$alladdress[$each['login']]);
             $cells .= wf_TableCell(@$allrealnames[$each['login']]);
             $cells .= wf_TableCell($each['IP']);
             $cells .= wf_TableCell($each['Tariff']);
             $cells .= wf_TableCell(stg_convert_size($each['traffic']), '', '', 'sorttable_customkey="' . $each['traffic'] . '"');
             $actionLinks = wf_Link('?module=pl_traffdetails&username=' . $each['login'], wf_img('skins/icon_stats.gif', __('Detailed stats')), false, '');
             $actionLinks .= wf_link('?module=dstatedit&username=' . $each['login'], web_edit_icon(), false, '');
             $cells .= wf_TableCell($actionLinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
Esempio n. 2
0
 /**
  * Renders search results for used cards
  * 
  * @param int $year
  * @param string $month
  * 
  * @return void
  */
 function web_CardShowUsageByMonth($year, $month)
 {
     $month = mysql_real_escape_string($month);
     $year = mysql_real_escape_string($year);
     $query = "SELECT * from `cardbank` WHERE `usedate` LIKE '%" . $year . "-" . $month . "-%'";
     $allusedcards = simple_queryall($query);
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $totalsumm = 0;
     $totalcount = 0;
     $csvdata = '';
     $tablecells = wf_TableCell(__('ID'));
     $tablecells .= wf_TableCell(__('Serial number'));
     $tablecells .= wf_TableCell(__('Cash'));
     $tablecells .= wf_TableCell(__('Usage date'));
     $tablecells .= wf_TableCell(__('Used login'));
     $tablecells .= wf_TableCell(__('Full address'));
     $tablecells .= wf_TableCell(__('Real name'));
     $tablerows = wf_TableRow($tablecells, 'row1');
     if (!empty($allusedcards)) {
         $csvdata = __('ID') . ';' . __('Serial number') . ';' . __('Cash') . ';' . __('Usage date') . ';' . __('Used login') . ';' . __('Full address') . ';' . __('Real name') . "\n";
         foreach ($allusedcards as $io => $eachcard) {
             $tablecells = wf_TableCell($eachcard['id']);
             $tablecells .= wf_TableCell($eachcard['serial']);
             $tablecells .= wf_TableCell($eachcard['cash']);
             $tablecells .= wf_TableCell($eachcard['usedate']);
             $profilelink = wf_Link("?module=userprofile&username=" . $eachcard['usedlogin'], web_profile_icon() . ' ' . $eachcard['usedlogin'], false);
             $tablecells .= wf_TableCell($profilelink);
             @($useraddress = $alladdress[$eachcard['usedlogin']]);
             $tablecells .= wf_TableCell($useraddress);
             @($userrealname = $allrealnames[$eachcard['usedlogin']]);
             $tablecells .= wf_TableCell($userrealname);
             $tablerows .= wf_TableRow($tablecells, 'row3');
             $totalcount++;
             $totalsumm = $totalsumm + $eachcard['cash'];
             $csvdata .= $eachcard['id'] . ';' . $eachcard['serial'] . ';' . $eachcard['cash'] . ';' . $eachcard['usedate'] . ';' . $eachcard['usedlogin'] . ';' . $useraddress . ';' . $userrealname . "\n";
         }
     }
     if (!empty($csvdata)) {
         $exportFilename = 'exports/cardreport_' . $year . '-' . $month . '.csv';
         $csvdata = iconv('utf-8', 'windows-1251', $csvdata);
         file_put_contents($exportFilename, $csvdata);
         $exportLink = wf_Link('?module=cardreport&dloadcsv=' . base64_encode($exportFilename), wf_img('skins/excel.gif', __('Export')), false, '');
     } else {
         $exportLink = '';
     }
     $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
     $result .= __('Total') . ': ' . $totalcount . ' ' . __('payments') . ', ' . __('with total amount') . ': ' . $totalsumm;
     show_window(__('Payment cards usage report') . ' ' . $exportLink, $result);
 }
Esempio n. 3
0
 /**
  * Renders custom report
  * 
  * @param string $reportfile
  * @param string $report_name
  * @param array $titles
  * @param array $keys
  * @param array $alldata
  * @param bool $address
  * @param bool $realnames
  * @param bool $rowcount
  * 
  * @return void
  */
 function web_ReportMasterShow($reportfile, $report_name, $titles, $keys, $alldata, $address = 0, $realnames = 0, $rowcount = 0)
 {
     $report_name = __($report_name) . ' ' . wf_tag('a', false, '', 'href="?module=reportmaster&view=' . $reportfile . '&printable=true" target="_BLANK"');
     $report_name .= wf_img('skins/printer_small.gif', __('Print'));
     $report_name .= wf_tag('a', true);
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $i = 0;
     $result = wf_tag('table', false, '', 'width="100%" class="sortable" border="0"');
     $result .= wf_tag('tr', false, 'row1');
     foreach ($titles as $eachtitle) {
         $result .= wf_tag('td') . __($eachtitle) . wf_tag('td', true);
     }
     if ($address) {
         $result .= wf_tag('td') . __('Full address') . wf_tag('td', true);
     }
     if ($realnames) {
         $result .= wf_tag('td') . __('Real Name') . wf_tag('td', true);
     }
     $result .= wf_tag('tr', true);
     if (!empty($alldata)) {
         foreach ($alldata as $io => $eachdata) {
             $i++;
             $result .= wf_tag('tr', false, 'row3');
             foreach ($keys as $eachkey) {
                 if (array_key_exists($eachkey, $eachdata)) {
                     $result .= wf_tag('td') . $eachdata[$eachkey] . wf_tag('td', true);
                 }
             }
             if ($address) {
                 $result .= wf_tag('td') . @$alladdress[$eachdata['login']] . wf_tag('td', true);
             }
             if ($realnames) {
                 $result .= wf_tag('td') . wf_Link('?module=userprofile&username=' . $eachdata['login'], web_profile_icon() . ' ' . @$allrealnames[$eachdata['login']]) . wf_tag('td', true);
             }
             $result .= wf_tag('tr', true);
         }
     }
     $result .= wf_tag('table', true);
     if ($rowcount) {
         $result .= wf_tag('strong') . __('Total') . ': ' . $i . wf_tag('strong', true);
     }
     show_window($report_name, $result);
 }
Esempio n. 4
0
 /**
  * Returns JSON reply for jquery datatables with full list of available UHW usages
  * 
  * @return string
  */
 public function ajaxGetData()
 {
     $query = "SELECT * from `uhw_log` ORDER by `id` DESC;";
     $alluhw = simple_queryall($query);
     $alladdress = zb_AddressGetFulladdresslist();
     $allrealnames = zb_UserGetAllRealnames();
     $result = '{ 
               "aaData": [ ';
     if (!empty($alluhw)) {
         foreach ($alluhw as $io => $each) {
             $profileLink = wf_Link('?module=userprofile&username=' . $each['login'], web_profile_icon() . ' ' . $each['login'], false);
             $profileLink = str_replace('"', '', $profileLink);
             $profileLink = str_replace("'", '', $profileLink);
             $profileLink = trim($profileLink);
             $userAddress = @$alladdress[$each['login']];
             $userAddress = str_replace("'", '`', $userAddress);
             $userAddress = str_replace('"', '``', $userAddress);
             $userAddress = trim($userAddress);
             $userRealname = @$allrealnames[$each['login']];
             $userRealname = str_replace("'", '`', $userRealname);
             $userRealname = str_replace('"', '``', $userRealname);
             $userRealname = trim($userRealname);
             $result .= '
                 [
                 "' . $each['id'] . '",
                 "' . $each['date'] . '",
                 "' . $each['password'] . '",
                 "' . $profileLink . '",
                 "' . $userAddress . '",
                 "' . $userRealname . '",
                 "' . $each['ip'] . '",
                 "' . $each['nhid'] . '",
                 "' . $each['oldmac'] . '",
                 "' . $each['newmac'] . '"
                 ],';
         }
     }
     $result = substr($result, 0, -1);
     $result .= '] 
     }';
     return $result;
 }
Esempio n. 5
0
 function web_UsersLister($users)
 {
     $tablecells = wf_TableCell(__('Login'));
     $tablecells .= wf_TableCell(__('Real Name'));
     $tablecells .= wf_TableCell(__('Full address'));
     $tablecells .= wf_TableCell(__('Tariff'));
     $tablecells .= wf_TableCell(__('Tariff speeds'));
     $tablecells .= wf_TableCell(__('Speed override'));
     $tablecells .= wf_TableCell(__('Actions'));
     $tablerows = wf_TableRow($tablecells, 'row1');
     if (!empty($users)) {
         $udata = array();
         $alluserdata = zb_UserGetAllStargazerData();
         $alladdress = zb_AddressGetFulladdresslist();
         $allrealnames = zb_UserGetAllRealnames();
         $allspeeds = zb_TariffGetAllSpeeds();
         if (!empty($alluserdata)) {
             foreach ($alluserdata as $ia => $eachdata) {
                 $udata[$eachdata['login']]['Tariff'] = $eachdata['Tariff'];
                 @($udata[$eachdata['login']]['Address'] = $alladdress[$eachdata['login']]);
                 @($udata[$eachdata['login']]['RealName'] = $allrealnames[$eachdata['login']]);
                 @($udata[$eachdata['login']]['NormalSpeedDown'] = $allspeeds[$eachdata['Tariff']]['speeddown']);
                 @($udata[$eachdata['login']]['NormalSpeedUp'] = $allspeeds[$eachdata['Tariff']]['speedup']);
             }
         }
         foreach ($users as $io => $eachuser) {
             $tablecells = wf_TableCell(wf_Link('?module=userprofile&username=' . $eachuser['login'], web_profile_icon() . ' ' . $eachuser['login']));
             $tablecells .= wf_TableCell($udata[$eachuser['login']]['RealName']);
             $tablecells .= wf_TableCell($udata[$eachuser['login']]['Address']);
             $tablecells .= wf_TableCell($udata[$eachuser['login']]['Tariff']);
             $tablecells .= wf_TableCell($udata[$eachuser['login']]['NormalSpeedDown'] . '/' . $udata[$eachuser['login']]['NormalSpeedUp']);
             $tablecells .= wf_TableCell(zb_UserGetSpeedOverride($eachuser['login']));
             $fixlink = wf_JSAlert('?module=speedcontrol&fix=' . $eachuser['login'], '<img src="skins/icon_repair.gif" title=' . __('Fix') . '>', 'Are you serious');
             $tablecells .= wf_TableCell($fixlink);
             $tablerows .= wf_TableRow($tablecells, 'row3');
         }
     }
     $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
     return $result;
 }
Esempio n. 6
0
 $userCounter++;
 //hightlighting user
 if (!empty($hlightmac)) {
     if ($hlightmac == $eachmac) {
         $rowclass = 'siglight';
     } else {
         $rowclass = 'row3';
     }
 } else {
     $rowclass = 'row3';
 }
 //extracting user profile link
 if (array_search($eachmac, $allusermacs)) {
     $backmaclogin = array_search($eachmac, $allusermacs);
     @($backaddress = $alladdress[$backmaclogin]);
     $profilelink = wf_Link("?module=userprofile&username=" . $backmaclogin, web_profile_icon() . ' ' . $backaddress, false, '');
     $realname = @$allrealnames[$backmaclogin];
     $usertariff = @$alltariffs[$backmaclogin];
     $userip = @$alluserips[$backmaclogin];
 } else {
     $profilelink = '';
     $realname = '';
     $usertariff = '';
     $userip = '';
 }
 $tablecells = wf_TableCell($profilelink);
 $tablecells .= wf_TableCell($realname);
 $tablecells .= wf_TableCell($usertariff);
 $tablecells .= wf_TableCell($userip);
 $tablecells .= wf_TableCell($eachmac);
 $tablecells .= wf_TableCell($displaysig);
Esempio n. 7
0
 /**
  * Returns form for usersearch and debtors by city
  * 
  * @return string
  */
 public function PerCityDataShow()
 {
     $this->LoadAllOnu();
     $this->LoadAllNotes();
     $this->LoadAllPhoneData();
     $this->LoadAllCredited();
     $this->loadSignalsCache();
     $addr_sort = 'address_down';
     $realname_sort = 'realname_down';
     $credited_sort = 'credited_down';
     $cash_sort = 'cash_down';
     $tariff_sort = 'tariff_down';
     $comment_sort = 'comment_down';
     $signal_sort = 'signal_down';
     $mac_onu_sort = 'mac_onu_down';
     if (isset($_GET['sort'])) {
         switch ($_GET['sort']) {
             case 'address_up':
                 $this->sort_additional($this->allAddresses, SORT_ASC);
                 break;
             case 'address_down':
                 $this->sort_additional($this->allAddresses, SORT_DESC);
                 break;
             case 'realname_up':
                 $this->sort_additional($this->allRealNames, SORT_ASC);
                 break;
             case 'realname_down':
                 $this->sort_additional($this->allRealNames, SORT_DESC);
                 break;
             case 'credited_up':
                 $this->sort_additional($this->allCredited, SORT_ASC);
                 break;
             case 'credited_down':
                 $this->sort_additional($this->allCredited, SORT_DESC);
                 break;
             case 'cash_up':
                 $this->sort_standart('Cash', SORT_ASC);
                 break;
             case 'cash_down':
                 $this->sort_standart('Cash', SORT_DESC);
                 break;
             case 'tariff_up':
                 $this->sort_standart('Tariff', SORT_ASC);
                 break;
             case 'tariff_down':
                 $this->sort_standart('Tariff', SORT_DESC);
                 break;
             case 'comment_up':
                 $this->sort_additional($this->allNotes, SORT_ASC);
                 break;
             case 'comment_down':
                 $this->sort_additional($this->allNotes, SORT_DESC);
                 break;
             case 'signal_up':
                 $this->sort_signal($this->allOnu, $this->signalCache, SORT_ASC);
                 break;
             case 'signal_down':
                 $this->sort_signal($this->allOnu, $this->signalCache, SORT_DESC);
                 break;
             case 'mac_onu_up':
                 $this->sort_additional($this->allOnu, SORT_ASC);
                 break;
             case 'mac_onu_down':
                 $this->sort_additional($this->allOnu, SORT_DESC);
                 break;
         }
         if ($_GET['sort'] == 'address_down') {
             $addr_sort = 'address_up';
         }
         if ($_GET['sort'] == 'realname_down') {
             $realname_sort = 'realname_up';
         }
         if ($_GET['sort'] == 'credited_down') {
             $credited_sort = 'credited_up';
         }
         if ($_GET['sort'] == 'cash_down') {
             $cash_sort = 'cash_up';
         }
         if ($_GET['sort'] == 'tariff_down') {
             $tariff_sort = 'tariff_up';
         }
         if ($_GET['sort'] == 'comment_down') {
             $comment_sort = 'comment_up';
         }
         if ($_GET['sort'] == 'signal_down') {
             $signal_sort = 'signal_up';
         }
         if ($_GET['sort'] == 'mac_onu_down') {
             $mac_onu_sort = 'mac_onu_up';
         }
     }
     $total = 0;
     $totalPayCount = 0;
     $colors = new ColorTagging();
     $cells = wf_TableCell(wf_tag('h2', false) . __('ID') . wf_tag('h2', true));
     $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $addr_sort, __('Full address')) . wf_tag('h2', true));
     $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $realname_sort, __('Real Name')) . wf_tag('h2', true));
     $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $credited_sort, __('Was credited')) . wf_tag('h2', true));
     $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $cash_sort, __('Cash')) . wf_tag('h2', true));
     if ($this->altCfg['FINREP_TARIFF']) {
         $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $tariff_sort, __('Tariff')) . wf_tag('h2', true));
         $this->LoadAllTariffs();
     }
     $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $comment_sort, __('Comment')) . wf_tag('h2', true));
     $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $signal_sort, __('Signal')) . wf_tag('h2', true));
     $cells .= wf_TableCell(wf_tag('h2', false) . wf_Link($this->SaveGetParams('sort') . 'sort=' . $mac_onu_sort, __('MAC ONU/ONT')) . wf_tag('h2', true));
     $cells .= wf_TableCell(wf_tag('h2', false) . __('Login') . wf_tag('h2', true));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->allData)) {
         foreach ($this->allData as $eachdebtor) {
             $total = $total + $eachdebtor['Cash'];
             $totalPayCount++;
             $signal = @$this->signalCache[$this->allOnu[$eachdebtor['login']]['mac']];
             $sigColor = '#000000';
             if (!empty($signal)) {
                 if ($signal > 0 or $signal < -25) {
                     $sigColor = '#ab0000';
                 } else {
                     $sigColor = '#005502';
                 }
             } else {
                 $signal = __("No");
             }
             $userColor = $colors->GetUsersColor($eachdebtor['login']);
             $cell = wf_TableCell($totalPayCount);
             $cell .= wf_TableCell(@$this->allAddresses[$eachdebtor['login']]);
             $cell .= wf_TableCell(@$this->allRealNames[$eachdebtor['login']] . "&nbsp&nbsp" . @$this->allPhoneData[$eachdebtor['login']]['mobile']);
             $cell .= wf_TableCell(@$this->allCredited[$eachdebtor['login']]);
             $cell .= wf_TableCell($eachdebtor['Cash']);
             if ($this->altCfg['FINREP_TARIFF']) {
                 $cell .= wf_TableCell($this->allTariffs[$eachdebtor['login']]);
             }
             $cell .= wf_TableCell(@$this->allNotes[$eachdebtor['login']]);
             $cell .= wf_TableCell(wf_tag('strong') . wf_tag('font color=' . $sigColor, false) . $signal . wf_tag('font', true) . wf_tag('strong', true));
             $cell .= wf_TableCell(@$this->allOnu[$eachdebtor['login']]['mac']);
             $cell .= wf_TableCell(wf_Link('?module=userprofile&username=' . $eachdebtor['login'], web_profile_icon() . ' ' . $eachdebtor['login'], false, ''));
             if (!empty($userColor)) {
                 $style = "background-color:{$userColor}";
                 $rows .= wf_TableRowStyled($cell, 'row4', $style);
             } else {
                 $rows .= wf_TableRow($cell, 'row4');
             }
         }
     }
     $result = wf_tag('strong') . __('Count') . ': ' . $totalPayCount . wf_tag('strong', true) . wf_tag('br');
     $result .= wf_tag('strong') . __('Cash') . ': ' . $total . wf_tag('strong', true) . wf_tag('br');
     $result .= wf_TableBody($rows, '100%', '0', '');
     return $result;
 }
Esempio n. 8
0
 function web_TsmsMassendConfirm($userarray)
 {
     global $td_users, $td_mobiles, $td_realnames, $td_realnamestrans, $td_tariffprices, $td_alladdress;
     global $ubillingConfig;
     $altCfg = $ubillingConfig->getAlter();
     $template = tsms_GetTemplate();
     $excludeUsers = tsms_GetExcludeUsers();
     $excludeArr = array();
     //ignoring DEAD_TAGID users
     if ($altCfg['CEMETERY_ENABLED']) {
         $cemetery = new Cemetery();
         $excludeCemetery = $cemetery->getAllTagged();
         if (!empty($excludeCemetery)) {
             foreach ($excludeCemetery as $eecl => $eecld) {
                 $excludeUsers[$eecl] = 'NOP';
             }
         }
     }
     $cells = wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('SMS'));
     $cells .= wf_TableCell(__('Mobile'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Balance'));
     $cells .= wf_TableCell(__('Credit'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($userarray)) {
         //excluded users handling
         if (!empty($excludeUsers)) {
             $excludeResult = wf_tag('h3') . __('Next users will be ignored while SMS sending') . wf_tag('h3', true);
             foreach ($excludeUsers as $excludeLogin => $nop) {
                 unset($userarray[$excludeLogin]);
                 $excludeArr[$excludeLogin] = $excludeLogin;
             }
         } else {
             $excludeResult = '';
         }
         foreach ($userarray as $login => $phone) {
             $message = tsms_ParseTemplate($login, $template);
             $smsContainer = wf_modal(__('Show'), __('SMS'), $message, '', '300', '200');
             $cells = wf_TableCell(wf_Link("?module=userprofile&username=" . $login, web_profile_icon() . ' ' . $login, false));
             $cells .= wf_TableCell(@$td_alladdress[$login]);
             $cells .= wf_TableCell(@$td_realnames[$login]);
             $cells .= wf_TableCell($smsContainer);
             $cells .= wf_TableCell($td_mobiles[$login]);
             $cells .= wf_TableCell($td_users[$login]['Tariff']);
             $cells .= wf_TableCell($td_users[$login]['Cash']);
             $cells .= wf_TableCell($td_users[$login]['Credit']);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     //confirmation form
     $packdata = serialize($userarray);
     $packdata = base64_encode($packdata);
     $inputs = wf_HiddenInput('massendConfirm', $packdata);
     $inputs .= wf_Submit(__('Send SMS for all of this users'));
     $confirmForm = wf_Form("", 'POST', $inputs, 'glamour');
     $result = $confirmForm;
     $result .= wf_TableBody($rows, '100%', '0', 'sortable');
     //showing which users will be excluded
     if (!empty($excludeUsers)) {
         $result .= $excludeResult;
         $result .= web_UserArrayShower($excludeArr);
     }
     return $result;
 }
Esempio n. 9
0
 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, web_profile_icon() . ' ' . $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'));
     }
 }
Esempio n. 10
0
 /**
  * Returns form for usersearch and debtors by city
  * 
  * @return string
  */
 public function PerCityDataShow()
 {
     $total = 0;
     $totalPayCount = 0;
     $colors = new ColorTagging();
     $this->LoadAllOnu();
     $this->LoadAllComments();
     $this->LoadAllNotes();
     $this->LoadAllPhoneData();
     $this->LoadAllCredited();
     $cells = wf_TableCell(__('Full address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('Credited'));
     $cells .= wf_TableCell(__('Cash'));
     if ($this->altCfg['FINREP_TARIFF']) {
         $cells .= wf_TableCell(__('Tariff'));
         $this->LoadAllTariffs();
     }
     $cells .= wf_TableCell(__('Comment'));
     $cells .= wf_TableCell(__('MAC ONU/ONT'));
     $cells .= wf_TableCell(__('Login'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->allData)) {
         foreach ($this->allData as $eachdebtor) {
             $userColor = $colors->GetUsersColor($eachdebtor['login']);
             $cell = wf_TableCell(@$this->allAddresses[$eachdebtor['login']]);
             $cell .= wf_TableCell(@$this->allRealNames[$eachdebtor['login']] . "&nbsp&nbsp" . @$this->allPhoneData[$eachdebtor['login']]['mobile']);
             $cell .= wf_TableCell(@$this->allCredited[$eachdebtor['login']]);
             $cell .= wf_TableCell($eachdebtor['Cash']);
             if ($this->altCfg['FINREP_TARIFF']) {
                 $cell .= wf_TableCell($this->allTariffs[$eachdebtor['login']]);
             }
             $cell .= wf_TableCell(@$this->allNotes[$eachdebtor['login']] . "&nbsp&nbsp" . @$this->allComments[$eachdebtor['login']]);
             $cell .= wf_TableCell(@$this->allOnu[$eachdebtor['login']]);
             $cell .= wf_TableCell(wf_Link('?module=userprofile&username=' . $eachdebtor['login'], web_profile_icon() . ' ' . $eachdebtor['login'], false, ''));
             if (!empty($userColor)) {
                 $style = "background-color:{$userColor}";
                 $rows .= wf_TableRowStyled($cell, 'row4', $style);
             } else {
                 $rows .= wf_TableRow($cell, 'row4');
             }
             $total = $total + $eachdebtor['Cash'];
             $totalPayCount++;
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable id');
     $result .= wf_tag('strong') . __('Cash') . ': ' . $total . wf_tag('strong', true) . wf_tag('br');
     $result .= wf_tag('strong') . __('Count') . ': ' . $totalPayCount . wf_tag('strong', true);
     return $result;
 }
Esempio n. 11
0
    function stg_show_fulluserlistOld()
    {
        global $alter_conf;
        $allusers = zb_UserGetAllStargazerData();
        $allrealnames = zb_UserGetAllRealnames();
        $alladdress = zb_AddressGetFulladdresslist();
        if ($alter_conf['USER_LINKING_ENABLED']) {
            $alllinkedusers = cu_GetAllLinkedUsers();
            $allparentusers = cu_GetAllParentUsers();
        }
        $totaltraff_i = 0;
        $totaltraff_m = 0;
        $totaltraff = 0;
        $ucount = 0;
        $trueonline = 0;
        $inacacount = 0;
        $tcredit = 0;
        $tcash = 0;
        // LAT column
        if ($alter_conf['ONLINE_LAT']) {
            $lat_col_head = wf_TableCell(__('LAT'));
            $act_offset = 1;
        } else {
            $lat_col_head = '';
            $act_offset = 0;
        }
        //online stars
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_header = wf_TableCell(__('Users online'));
            $true_online_selector = ' col_' . (5 + $act_offset) . ': "select",';
        } else {
            $true_online_header = '';
            $true_online_selector = '';
        }
        //extended filters
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $extfilters = wf_Link('javascript:showfilter();', __('Extended filters'), false);
        } else {
            $extfilters = '';
        }
        //additional finance links
        if ($alter_conf['FAST_CASH_LINK']) {
            $fastcash = true;
        } else {
            $fastcash = false;
        }
        $result = $extfilters;
        $result .= wf_tag('table', false, 'sortable', 'width="100%" id="onlineusers"');
        $headerCells = wf_TableCell(__('Full address'));
        $headerCells .= wf_TableCell(__('Real Name'));
        $headerCells .= wf_TableCell(__('IP'));
        $headerCells .= wf_TableCell(__('Tariff'));
        $headerCells .= $lat_col_head;
        $headerCells .= wf_TableCell(__('Active'));
        $headerCells .= $true_online_header;
        $headerCells .= wf_TableCell(__('Traffic'));
        $headerCells .= wf_TableCell(__('Balance'));
        $headerCells .= wf_TableCell(__('Credit'));
        $headerRow = wf_TableRow($headerCells, 'row1');
        $result .= $headerRow;
        if (!empty($allusers)) {
            foreach ($allusers as $io => $eachuser) {
                $tinet = 0;
                $ucount++;
                $cash = $eachuser['Cash'];
                $credit = $eachuser['Credit'];
                for ($classcounter = 0; $classcounter <= 9; $classcounter++) {
                    $dc = 'D' . $classcounter . '';
                    $uc = 'U' . $classcounter . '';
                    $tinet = $tinet + ($eachuser[$dc] + $eachuser[$uc]);
                }
                $totaltraff = $totaltraff + $tinet;
                $tcredit = $tcredit + $credit;
                $tcash = $tcash + $cash;
                $act = web_green_led() . ' ' . __('Yes');
                //finance check
                if ($cash < '-' . $credit) {
                    $act = web_red_led() . ' ' . __('No');
                    $inacacount++;
                }
                if ($alter_conf['ONLINE_LAT']) {
                    $user_lat = wf_TableCell(date("Y-m-d H:i:s", $eachuser['LastActivityTime']));
                } else {
                    $user_lat = '';
                }
                //online check
                if ($alter_conf['DN_ONLINE_DETECT']) {
                    if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) {
                        $online_flag = 1;
                        $trueonline++;
                    } else {
                        $online_flag = 0;
                    }
                    $online_cell = wf_TableCell(web_bool_star($online_flag, true), '', '', 'sorttable_customkey="' . $online_flag . '"');
                } else {
                    $online_cell = '';
                    $online_flag = 0;
                }
                if ($alter_conf['ONLINE_LIGHTER']) {
                    $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
                } else {
                    $lighter = '';
                }
                //user linking indicator
                if ($alter_conf['USER_LINKING_ENABLED']) {
                    //is user child?
                    if (isset($alllinkedusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $alllinkedusers[$eachuser['login']], web_corporate_icon(), false);
                    } else {
                        $corporate = '';
                    }
                    //is  user parent?
                    if (isset($allparentusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $allparentusers[$eachuser['login']], web_corporate_icon('Corporate parent'), false);
                    }
                } else {
                    $corporate = '';
                }
                //fast cash link
                if ($fastcash) {
                    $financelink = wf_Link('?module=addcash&username=' . $eachuser['login'] . '#profileending', wf_img('skins/icon_dollar.gif', __('Finance operations')), false);
                } else {
                    $financelink = '';
                }
                $result .= wf_tag('tr', false, 'row3', $lighter);
                $result .= wf_tag('td', false);
                $result .= wf_Link('?module=traffstats&username=' . $eachuser['login'], web_stats_icon(), false);
                $result .= $financelink;
                $result .= wf_Link('?module=userprofile&username=' . $eachuser['login'], web_profile_icon(), false);
                $result .= $corporate;
                $result .= @$alladdress[$eachuser['login']];
                $result .= wf_tag('td', true);
                $result .= wf_TableCell(@$allrealnames[$eachuser['login']]);
                $result .= wf_TableCell($eachuser['IP'], '', '', 'sorttable_customkey="' . ip2int($eachuser['IP']) . '"');
                $result .= wf_TableCell($eachuser['Tariff']);
                $result .= $user_lat;
                $result .= wf_TableCell($act);
                $result .= $online_cell;
                $result .= wf_TableCell(stg_convert_size($tinet), '', '', 'sorttable_customkey="' . $tinet . '"');
                $result .= wf_TableCell(round($eachuser['Cash'], 2));
                $result .= wf_TableCell(round($eachuser['Credit'], 2));
                $result .= wf_tag('tr', true);
            }
        }
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_counter = wf_TableCell(__('Users online') . ' ' . $trueonline);
        } else {
            $true_online_counter = null;
        }
        $result .= wf_tag('table', true);
        $footerCells = wf_TableCell(__('Total') . ': ' . $ucount);
        $footerCells .= wf_TableCell(__('Active users') . ' ' . ($ucount - $inacacount) . ' / ' . __('Inactive users') . ' ' . $inacacount);
        $footerCells .= $true_online_counter;
        $footerCells .= wf_TableCell(__('Traffic') . ': ' . stg_convert_size($totaltraff));
        $footerCells .= wf_TableCell(__('Total') . ': ' . round($tcash, 2));
        $footerCells .= wf_TableCell(__('Credit total') . ': ' . $tcredit);
        $footerRows = wf_TableRow($footerCells, 'row1');
        $result .= wf_TableBody($footerRows, '100%', '0');
        //extended filters again
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $filtercode = wf_tag('script', false, '', 'language="javascript" type="text/javascript"');
            $filtercode .= '
            //<![CDATA[
            function showfilter() {
            var onlinefilters = {
		btn: false,
          	col_' . (4 + $act_offset) . ': "select",
               ' . $true_online_selector . '
		btn_text: ">"
               }
                setFilterGrid("onlineusers",0,onlinefilters);
             }
            //]]>';
            $filtercode .= wf_tag('script', true);
        } else {
            $filtercode = '';
        }
        $result .= $filtercode;
        return $result;
    }
Esempio n. 12
0
function bs_LoginProposalForm($id, $login = '')
{
    $id = vf($id, 3);
    if (!empty($login)) {
        $loginform = web_bool_led(true) . '<a href="?module=userprofile&username=' . $login . '">' . web_profile_icon() . ' ' . $login . '</a>';
    } else {
        $loginform = web_bool_led(false);
    }
    return $loginform;
}
Esempio n. 13
0
 /**
  * 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=' . $eachsignup['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);
 }
Esempio n. 14
0
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;
}
Esempio n. 15
0
 /**
  * Renders available tasks list with controls
  * 
  * @param sring $login
  * 
  * @return string
  */
 public function renderTasksList($login = '')
 {
     $result = '';
     $messages = new UbillingMessageHelper();
     $tmpArr = array();
     if (!empty($this->allTasks)) {
         foreach ($this->allTasks as $io => $each) {
             if (empty($login)) {
                 $tmpArr[$io] = $each;
             } else {
                 if ($login == $each['login']) {
                     $tmpArr[$io] = $each;
                 }
             }
         }
     }
     if (!empty($tmpArr)) {
         $cells = wf_TableCell(__('ID'));
         $cells .= wf_TableCell(__('Date'));
         $cells .= wf_TableCell(__('User'));
         $cells .= wf_TableCell(__('Task'));
         $cells .= wf_TableCell(__('Parameter'));
         $cells .= wf_TableCell(__('Notes'));
         $cells .= wf_TableCell(__('Actions'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($tmpArr as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['date']);
             $cells .= wf_TableCell(wf_Link('?module=userprofile&username=' . $each['login'], web_profile_icon() . ' ' . $each['login'], false, ''));
             $cells .= wf_TableCell($this->actionNames[$each['action']]);
             $cells .= wf_TableCell($each['param']);
             $cells .= wf_TableCell($each['note']);
             $taskControls = wf_JSAlert(self::URL_ME . '&username=' . $each['login'] . '&deletetaskid=' . $each['id'], web_delete_icon(), $messages->getDeleteAlert());
             $cells .= wf_TableCell($taskControls);
             $rows .= wf_TableRow($cells, 'row3');
         }
         $result = wf_TableBody($rows, '100%', 0, 'sortable');
     } else {
         $result = $messages->getStyledMessage(__('Nothing found'), 'info');
     }
     return $result;
 }
Esempio n. 16
0
 /**
  * renders available pools assigned by some network
  * 
  * @param $netid int existing network ID
  * 
  * @return string
  */
 public function renderPools($netid)
 {
     $netid = vf($netid, 3);
     $result = __('Nothing found');
     $netpools = array();
     if (isset($this->networks[$netid])) {
         if (!empty($this->pools)) {
             foreach ($this->pools as $io => $each) {
                 if ($each['netid'] == $netid) {
                     $netpools[$each['id']] = $each;
                 }
             }
         }
     }
     if (!empty($netpools)) {
         $cells = wf_TableCell(__('ID'));
         $cells .= wf_TableCell(__('Pool'));
         $cells .= wf_TableCell(__('Netmask'));
         $cells .= wf_TableCell(__('Gateway'));
         $cells .= wf_TableCell(__('IP'));
         $cells .= wf_TableCell(__('Broadcast'));
         $cells .= wf_TableCell(__('VLAN'));
         $cells .= wf_TableCell(__('Login'));
         $cells .= wf_TableCell(__('Actions'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($netpools as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['pool']);
             $cells .= wf_TableCell($this->cidrToMask[$each['netmask']] . ' (/' . $each['netmask'] . ')');
             $cells .= wf_TableCell($each['gw']);
             $cells .= wf_TableCell(wf_Link('?module=extnets&showipsbypoolid=' . $each['id'], $this->ipsGetAssociated($each['id']), false), '40%');
             $cells .= wf_TableCell($each['broadcast']);
             $cells .= wf_TableCell($each['vlan']);
             if (!empty($each['login'])) {
                 $loginlink = wf_Link('?module=userprofile&username=' . $each['login'], web_profile_icon() . ' ' . $each['login'], 'fasle');
             } else {
                 $loginlink = '';
             }
             $cells .= wf_TableCell($loginlink);
             $actlinks = wf_JSAlert('?module=extnets&showpoolbynetid=' . $netid . '&deletepoolid=' . $each['id'], web_delete_icon(), __('Removing this may lead to irreparable results'));
             $actlinks .= wf_modal(web_edit_icon(), __('Edit') . ' ' . $each['pool'] . '/' . $each['netmask'], $this->poolEditForm($each['id']), '', '300', '200');
             $cells .= wf_TableCell($actlinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
         $result = wf_TableBody($rows, '100%', '0', 'sortable');
     }
     return $result;
 }
Esempio n. 17
0
function gen_check_users()
{
    global $etalon_day_band, $control_tariffs, $etalon_speed, $cur_day, $home_band_p;
    $tariff_names = array_keys($control_tariffs);
    $genocide_qarr = array();
    $band_arr = array();
    $geninputs = wf_TextInput('home_band_p', 'Normal bandwidth load', $home_band_p, false, '2') . ' %';
    $geninputs .= wf_HiddenInput('change_settings', 'true') . ' ';
    $geninputs .= wf_Submit('Change');
    $genform = wf_Form('', 'POST', $geninputs, 'glamour');
    $result = $genform;
    $tablecells = wf_TableCell(__('Tariff'));
    $tablecells .= wf_TableCell(__('Normal day band'));
    $tablecells .= wf_TableCell(__('Current date normal band'));
    $tablecells .= wf_TableCell(__('Speed'));
    $tablecells .= wf_TableCell(__('Actions'));
    $tablerows = wf_TableRow($tablecells, 'row1');
    $i = 0;
    foreach ($control_tariffs as $eachtariff) {
        @($cspeed_k = $etalon_speed / $eachtariff);
        @($cband_k = $etalon_day_band / $cspeed_k);
        $dband_l = $cband_k * $cur_day;
        $band_arr[$i][$tariff_names[$i]] = $dband_l * 1024 * 1024;
        $tablecells = wf_TableCell($tariff_names[$i]);
        $tablecells .= wf_TableCell(stg_convert_size($cband_k * 1024 * 1024));
        $tablecells .= wf_TableCell(stg_convert_size($band_arr[$i][$tariff_names[$i]]));
        $tablecells .= wf_TableCell($eachtariff);
        $gactions = wf_JSAlert('?module=genocide&delete=' . $tariff_names[$i], web_delete_icon(), 'Are you serious');
        $tablecells .= wf_TableCell($gactions);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $i++;
    }
    //controlled tariffs
    $result .= wf_TableBody($tablerows, '100%', '0', '');
    $i = 0;
    foreach ($band_arr as $eachtariff => $eachband) {
        $query = "SELECT * from `users` WHERE `D0`+`U0`>'" . $eachband[$tariff_names[$i]] . "' and `Tariff`='" . $tariff_names[$i] . "';";
        $genocide_qarr[] = $query;
        $i++;
    }
    $tablecells = wf_TableCell(__('Login'));
    $tablecells .= wf_TableCell(__('Full address'));
    $tablecells .= wf_TableCell(__('Real Name'));
    $tablecells .= wf_TableCell(__('Tariff'));
    $tablecells .= wf_TableCell(__('IP'));
    $tablecells .= wf_TableCell(__('Downloaded'));
    $tablecells .= wf_TableCell(__('Uploaded'));
    $tablecells .= wf_TableCell(__('Total'));
    $tablerows = wf_TableRow($tablecells, 'row1');
    foreach ($genocide_qarr as $each_q) {
        $genocide_users = simple_queryall($each_q);
        if (!empty($genocide_users)) {
            $alluseraddress = zb_AddressGetFulladdresslist();
            $allusernames = zb_UserGetAllRealnames();
            foreach ($genocide_users as $io => $eachuser) {
                $profilelink = wf_Link('?module=userprofile&username=' . $eachuser['login'], web_profile_icon() . ' ' . $eachuser['login']);
                $tablecells = wf_TableCell($profilelink);
                $tablecells .= wf_TableCell(@$alluseraddress[$eachuser['login']]);
                $tablecells .= wf_TableCell(@$allusernames[$eachuser['login']]);
                $tablecells .= wf_TableCell($eachuser['Tariff']);
                $tablecells .= wf_TableCell($eachuser['IP'], '', '', 'sorttable_customkey="' . ip2int($eachuser['IP']) . '"');
                $tablecells .= wf_TableCell(stg_convert_size($eachuser['D0']), '', '', 'sorttable_customkey="' . $eachuser['D0'] . '"');
                $tablecells .= wf_TableCell(stg_convert_size($eachuser['U0']), '', '', 'sorttable_customkey="' . $eachuser['U0'] . '"');
                $tablecells .= wf_TableCell(stg_convert_size($eachuser['D0'] + $eachuser['U0']), '', '', 'sorttable_customkey="' . ($eachuser['D0'] + $eachuser['U0']) . '"');
                $tablerows .= wf_TableRow($tablecells, 'row3');
            }
        }
    }
    $result .= wf_TableBody($tablerows, '100%', '0', 'sortable');
    show_window(__('Genocide'), $result);
}
Esempio n. 18
0
 /**
  * Renders json formatted data for jquery data tables list
  * 
  * @return string
  */
 public function ajaxOnuData()
 {
     $allRealnames = zb_UserGetAllRealnames();
     $allAddress = zb_AddressGetFulladdresslistCached();
     if ($this->altCfg['ADCOMMENTS_ENABLED']) {
         $adcomments = new ADcomments('PONONU');
         $adc = true;
     } else {
         $adc = false;
     }
     $this->loadSignalsCache();
     $result = '{ 
               "aaData": [ ';
     if (!empty($this->allOnu)) {
         foreach ($this->allOnu as $io => $each) {
             if (!empty($each['login'])) {
                 $userLogin = trim($each['login']);
                 $userLink = wf_Link('?module=userprofile&username=' . $userLogin, web_profile_icon() . ' ' . @$allAddress[$userLogin], false);
                 $userLink = str_replace('"', '', $userLink);
                 $userLink = trim($userLink);
                 @($userRealName = $allRealnames[$userLogin]);
                 $userRealName = str_replace('"', '', $userRealName);
                 $userRealName = trim($userRealName);
             } else {
                 $userLink = '';
                 $userRealName = '';
             }
             //checking adcomments availability
             if ($adc) {
                 $indicatorIcon = $adcomments->getCommentsIndicator($each['id']);
                 $indicatorIcon = str_replace('"', '\'', $indicatorIcon);
                 $indicatorIcon = trim($indicatorIcon);
             } else {
                 $indicatorIcon = '';
             }
             $actLinks = wf_Link('?module=ponizer&editonu=' . $each['id'], web_edit_icon(), false);
             $actLinks = str_replace('"', '', $actLinks);
             $actLinks = trim($actLinks);
             $actLinks .= ' ' . $indicatorIcon;
             //coloring signal
             if (isset($this->signalCache[$each['mac']])) {
                 $signal = $this->signalCache[$each['mac']];
                 if ($signal > 0 or $signal < -25) {
                     $sigColor = '#ab0000';
                 } else {
                     $sigColor = '#005502';
                 }
             } elseif (isset($this->signalCache[$each['serial']])) {
                 $signal = $this->signalCache[$each['serial']];
                 if ($signal > 0 or $signal < -25) {
                     $sigColor = '#ab0000';
                 } else {
                     $sigColor = '#005502';
                 }
             } else {
                 $signal = __('No');
                 $sigColor = '#000000';
             }
             $result .= '
                 [
                 "' . $each['id'] . '",
                 "' . $this->getModelName($each['onumodelid']) . '",
                 "' . @$this->allOltDevices[$each['oltid']] . '",
                 "' . $each['ip'] . '",
                 "' . $each['mac'] . '",
                 "<font color=' . $sigColor . '>' . $signal . '</font>",
                 "' . $userLink . '",
                 "' . $userRealName . '",
                 "' . $actLinks . '"
                 ],';
         }
     }
     $result = substr($result, 0, -1);
     $result .= '] 
     }';
     return $result;
 }
Esempio n. 19
0
 /**
  * Returns JSON reply for jquery datatables with full list of available connection details
  * 
  * @return void
  */
 public function ajaxGetDataUkv()
 {
     $ukv = new UkvSystem();
     $query = "SELECT * from `ukv_users` WHERE `cableseal` != '' ;";
     $all = simple_queryall($query);
     $result = '{ 
               "aaData": [ ';
     if (!empty($all)) {
         foreach ($all as $io => $each) {
             $profileLink = wf_Link('?module=ukv&users=true&showuser=' . $each['id'], web_profile_icon() . ' ', false);
             $profileLink = str_replace('"', '', $profileLink);
             $profileLink = str_replace("'", '', $profileLink);
             $profileLink = trim($profileLink);
             $userAddress = @$ukv->userGetFullAddress($each['id']);
             $userAddress = str_replace("'", '`', $userAddress);
             $userAddress = str_replace('"', '``', $userAddress);
             $userAddress = trim($userAddress);
             $userRealname = $each['realname'];
             $userRealname = str_replace("'", '`', $userRealname);
             $userRealname = str_replace('"', '``', $userRealname);
             $userRealname = trim($userRealname);
             $act = wf_img('skins/icon_active.gif') . __('Yes');
             //finance check
             if (!$each['active']) {
                 $act = wf_img('skins/icon_inactive.gif') . __('No');
             }
             $act = str_replace('"', '', $act);
             $act = trim($act);
             $result .= '
                 [
                 "' . $profileLink . $userAddress . '",
                 "' . $userRealname . '",
                 "' . $ukv->tariffGetName($each['tariffid']) . '",
                 "' . $act . '",
                 "' . $each['cash'] . '",
                 "' . $each['cableseal'] . '"
                 ],';
         }
     }
     $result = substr($result, 0, -1);
     $result .= '] 
     }';
     die($result);
 }
Esempio n. 20
0
 /**
  * returns catv backlinks if enabled 
  * 
  * @return string
  */
 protected function getCatvBacklinks()
 {
     $result = '';
     if ($this->alterCfg['UKV_ENABLED']) {
         $catv_backlogin_q = "SELECT * from `ukv_users` WHERE `inetlogin`='" . $this->login . "'";
         $catv_backlogin = simple_query($catv_backlogin_q);
         if (!empty($catv_backlogin)) {
             $catv_backlink = wf_Link("?module=ukv&users=true&showuser=" . $catv_backlogin['id'], web_profile_icon() . ' ' . $catv_backlogin['street'] . ' ' . $catv_backlogin['build'] . '/' . $catv_backlogin['apt'], false);
             $result = $this->addRow(__('UKV'), $catv_backlink);
         } else {
             $result = $this->addRow(__('UKV'), __('No'));
         }
     } else {
         if ($this->alterCfg['CATV_ENABLED']) {
             $catv_backlogin_q = "SELECT * from `catv_users` WHERE `inetlink`='" . $this->login . "'";
             $catv_backlogin = simple_query($catv_backlogin_q);
             if (!empty($catv_backlogin)) {
                 $catv_backlink = wf_Link("?module=catv_profile&userid=" . $catv_backlogin['id'], web_profile_icon() . ' ' . $catv_backlogin['street'] . ' ' . $catv_backlogin['build'] . '/' . $catv_backlogin['apt'], false);
                 $result = $this->addRow(__('CaTV'), $catv_backlink);
             } else {
                 $result = $this->addRow(__('CaTV'), __('No'));
             }
         }
     }
     return $result;
 }
Esempio n. 21
0
 /**
  * Renders previously generated all users documents 
  * 
  * @return string
  */
 public function renderAllUserDocuments()
 {
     $allAddress = zb_AddressGetFulladdresslistCached();
     $allRealnames = zb_UserGetAllRealnames();
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Public'));
     $cells .= wf_TableCell(__('Template'));
     $cells .= wf_TableCell(__('Path'));
     $cells .= wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->allUserDocuments)) {
         foreach ($this->allUserDocuments as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['date']);
             $cells .= wf_TableCell(web_bool_led($each['public']));
             @($templateName = $this->templates[$each['templateid']]['name']);
             $cells .= wf_TableCell(wf_tag('abbr', false, '', 'title="' . $each['templateid'] . '"') . $templateName . wf_tag('abbr', true));
             $downloadLink = wf_Link('?module=report_documents&documentdownload=' . $each['path'], $each['path'], false, '');
             $cells .= wf_TableCell($downloadLink);
             $profileLink = wf_Link('?module=userprofile&username=' . $each['login'], web_profile_icon() . ' ' . $each['login']);
             $cells .= wf_TableCell($profileLink);
             $cells .= wf_TableCell(@$allAddress[$each['login']]);
             $cells .= wf_TableCell(@$allRealnames[$each['login']]);
             $actionLinks = wf_JSAlert('?module=report_documents&deletedocument=' . $each['id'], web_delete_icon(), __('Are you serious'));
             $cells .= wf_TableCell($actionLinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result = wf_TableBody($rows, '100%', '0', '');
     return $result;
 }
Esempio n. 22
0
/**
 * 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=' . $eachpayment['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;
}
Esempio n. 23
0
/**
 * Shows task editing/management form
 * 
 * @global object $ubillingConfig
 * @param int $taskid
 * 
 * @return void
 */
function ts_TaskChangeForm($taskid)
{
    global $ubillingConfig;
    $altercfg = $ubillingConfig->getAlter();
    $taskid = vf($taskid, 3);
    $taskdata = ts_GetTaskData($taskid);
    $result = '';
    $allemployee = ts_GetAllEmployee();
    $activeemployee = ts_GetActiveEmployee();
    $alljobtypes = ts_GetAllJobtypes();
    $messages = new UbillingMessageHelper();
    $smsData = '';
    if (!empty($taskdata)) {
        //not done task
        if (empty($taskdata['login'])) {
            $login_detected = ts_DetectUserByAddress($taskdata['address']);
            if ($login_detected) {
                $addresslink = wf_Link("?module=userprofile&username=" . $login_detected, web_profile_icon() . ' ' . $taskdata['address'], false);
                $loginType = ' (' . __('telepathically guessed') . ')';
                $taskLogin = $login_detected;
            } else {
                $addresslink = $taskdata['address'];
                $loginType = ' (' . __('No') . ' - ' . __('telepathically guessed') . ')';
                $taskLogin = '';
            }
        } else {
            $addresslink = wf_Link("?module=userprofile&username=" . $taskdata['login'], web_profile_icon() . ' ' . $taskdata['address'], false);
            $taskLogin = $taskdata['login'];
            $loginType = '';
        }
        //job generation form
        if ($taskLogin) {
            $jobgencheckbox = wf_CheckInput('generatejob', __('Generate job performed for this task'), true, true);
            $jobgencheckbox .= wf_HiddenInput('generatelogin', $taskLogin);
            $jobgencheckbox .= wf_HiddenInput('generatejobid', $taskdata['jobtype']);
            $jobgencheckbox .= wf_delimiter();
        } else {
            $jobgencheckbox = '';
        }
        //modify form handlers
        $modform = '';
        if (cfr('TASKMANTRACK')) {
            $modform .= wf_Link('?module=taskmantrack&trackid=' . $taskid, wf_img('skins/track_icon.png', __('Track this task')));
        }
        $modform .= wf_modal(web_edit_icon(), __('Edit'), ts_TaskModifyForm($taskid), '', '450', '550');
        //modform end
        //extracting sms data
        if (!empty($taskdata['smsdata'])) {
            $rawSmsData = $taskdata['smsdata'];
            $rawSmsData = base64_decode($rawSmsData);
            $rawSmsData = unserialize($rawSmsData);
            $smsDataCells = wf_TableCell(__('Mobile'), '', 'row2');
            $smsDataCells .= wf_TableCell($rawSmsData['number']);
            $smsDataRows = wf_TableRow($smsDataCells, 'row3');
            $smsDataCells = wf_TableCell(__('Message'), '', 'row2');
            $smsDataCells .= wf_TableCell($rawSmsData['message']);
            $smsDataRows .= wf_TableRow($smsDataCells, 'row3');
            $smsDataTable = wf_TableBody($smsDataRows, '100%', '0', 'glamour');
            $smsDataFlushControl = wf_delimiter() . wf_JSAlert('?module=taskman&edittask=' . $taskid . '&flushsmsdata=' . $taskid, web_delete_icon(), __('Are you serious'));
            $smsData = wf_modal(wf_img('skins/icon_sms_micro.gif', __('SMS sent to employees')), __('SMS sent to employees'), $smsDataTable . $smsDataFlushControl, '', '400', '200');
        } else {
            //post sending form
            if ($altercfg['WATCHDOG_ENABLED']) {
                $smsAddress = str_replace('\'', '`', $taskdata['address']);
                $smsAddress = mysql_real_escape_string($smsAddress);
                $smsPhone = mysql_real_escape_string($taskdata['phone']);
                $smsJobTime = !empty($taskdata['starttime']) ? ' ' . date("H:i", strtotime($taskdata['starttime'])) : '';
                $smsJobNote = mysql_real_escape_string($taskdata['jobnote']);
                $smsEmployee = vf($taskdata['employee']);
                $newSmsText = $smsAddress . ' ' . $smsPhone . ' ' . $smsJobNote . $smsJobTime;
                $smsDataCells = wf_TableCell(__('Employee'), '', 'row2');
                $smsDataCells .= wf_TableCell(@$allemployee[$taskdata['employee']]);
                $smsDataRows = wf_TableRow($smsDataCells, 'row3');
                $smsDataCells = wf_TableCell(__('Message'), '', 'row2');
                $smsDataCells .= wf_TableCell(zb_TranslitString($newSmsText));
                $smsDataRows .= wf_TableRow($smsDataCells, 'row3');
                $smsDataTable = wf_TableBody($smsDataRows, '100%', '0', 'glamour');
                $smsInputs = $smsDataTable;
                $smsInputs .= wf_HiddenInput('postsendemployee', $smsEmployee);
                $smsInputs .= wf_HiddenInput('postsendsmstext', $newSmsText);
                $smsInputs .= wf_Submit(__('Send SMS'));
                $smsForm = wf_Form('', 'POST', $smsInputs, '');
                $smsData = wf_modal(wf_img_sized('skins/icon_mobile.gif', __('Send SMS'), '10'), __('Send SMS'), $smsForm, '', '400', '200');
            }
        }
        $tablecells = wf_TableCell(__('ID'), '30%');
        $tablecells .= wf_TableCell($taskdata['id']);
        $tablerows = wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Task creation date') . ' / ' . __('Administrator'));
        $tablecells .= wf_TableCell($taskdata['date'] . ' / ' . $taskdata['admin']);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Target date'));
        $tablecells .= wf_TableCell(wf_tag('strong') . $taskdata['startdate'] . ' ' . $taskdata['starttime'] . wf_tag('strong', true));
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Task address'));
        $tablecells .= wf_TableCell($addresslink);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Login'));
        $tablecells .= wf_TableCell($taskLogin . $loginType);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Phone'));
        $tablecells .= wf_TableCell($taskdata['phone']);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Job type'));
        $tablecells .= wf_TableCell(@$alljobtypes[$taskdata['jobtype']]);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Who should do'));
        $tablecells .= wf_TableCell(@$allemployee[$taskdata['employee']] . ' ' . $smsData);
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $tablecells = wf_TableCell(__('Job note'));
        $tablecells .= wf_TableCell(nl2br($taskdata['jobnote']));
        $tablerows .= wf_TableRow($tablecells, 'row3');
        $result .= wf_TableBody($tablerows, '100%', '0', 'glamour');
        $result .= wf_tag('div', false, '', 'style="clear:both;"') . wf_tag('div', true);
        // show task preview
        show_window(__('View task') . ' ' . $modform, $result);
        //Salary accounting
        if ($altercfg['SALARY_ENABLED']) {
            if (cfr('SALARYTASKSVIEW')) {
                $salary = new Salary();
                show_window(__('Additional jobs done'), $salary->taskJobCreateForm($_GET['edittask']));
            }
        }
        //warehouse integration
        if ($altercfg['WAREHOUSE_ENABLED']) {
            if (cfr('WAREHOUSE')) {
                $warehouse = new Warehouse();
                show_window(__('Additionally spent materials'), $warehouse->taskMaterialsReport($_GET['edittask']));
            }
        }
        //if task undone
        if ($taskdata['status'] == 0) {
            $sup = wf_tag('sup') . '*' . wf_tag('sup', false);
            $inputs = wf_HiddenInput('changetask', $taskid);
            $inputs .= wf_DatePicker('editenddate') . wf_tag('label', false) . __('Finish date') . $sup . wf_tag('label', true) . wf_tag('br');
            $inputs .= wf_tag('br');
            $inputs .= wf_Selector('editemployeedone', $activeemployee, __('Worker done'), $taskdata['employee'], true);
            $inputs .= wf_tag('br');
            $inputs .= wf_tag('label', false) . __('Finish note') . wf_tag('label', true) . wf_tag('br');
            $inputs .= wf_TextArea('editdonenote', '', '', true, '35x3');
            $inputs .= wf_tag('br');
            $inputs .= $jobgencheckbox;
            $inputs .= wf_Submit(__('This task is done'));
            $form = wf_Form("", 'POST', $inputs, 'glamour');
            if (cfr('TASKMANDELETE')) {
                show_window('', wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton'));
            }
            //show editing form
            if (cfr('TASKMANDONE')) {
                show_window(__('If task is done'), $form);
            }
        } else {
            $donecells = wf_TableCell(__('Finish date'), '30%');
            $donecells .= wf_TableCell($taskdata['enddate']);
            $donerows = wf_TableRow($donecells, 'row3');
            $donecells = wf_TableCell(__('Worker done'));
            $donecells .= wf_TableCell($allemployee[$taskdata['employeedone']]);
            $donerows .= wf_TableRow($donecells, 'row3');
            $donecells = wf_TableCell(__('Finish note'));
            $donecells .= wf_TableCell($taskdata['donenote']);
            $donerows .= wf_TableRow($donecells, 'row3');
            $doneresult = wf_TableBody($donerows, '100%', '0', 'glamour');
            if (cfr('TASKMANDELETE')) {
                $doneresult .= wf_JSAlertStyled('?module=taskman&deletetask=' . $taskid, web_delete_icon() . ' ' . __('Remove this task - it is an mistake'), $messages->getDeleteAlert(), 'ubButton');
            }
            if (cfr('TASKMANDONE')) {
                $doneresult .= '&nbsp;';
                $doneresult .= wf_JSAlertStyled('?module=taskman&setundone=' . $taskid, wf_img('skins/icon_key.gif') . ' ' . __('No work was done'), $messages->getEditAlert(), 'ubButton');
            }
            show_window(__('Task is done'), $doneresult);
        }
    }
}
Esempio n. 24
0
 /**
  * Returns clickable if possible host link by its IP
  * 
  * @param array $allUserIps
  * @param array $allUserAddress
  * @param array $allSwitchesIps
  * @param string $ip
  * 
  * @return string
  */
 protected function getHostLink($allUserIps, $allUserAddress, $allSwitchesIps, $ip)
 {
     $result = '';
     $userUrl = '?module=userprofile&username=';
     $switchUrl = '?module=switches&edit=';
     if (isset($allUserIps[$ip])) {
         $result = wf_Link($userUrl . $allUserIps[$ip], web_profile_icon(__('User')) . ' ' . @$allUserAddress[$allUserIps[$ip]], false);
     } else {
         if (isset($allSwitchesIps[$ip])) {
             $result = wf_Link($switchUrl . $allSwitchesIps[$ip]['id'], wf_img_sized('skins/menuicons/switches.png', __('Switch'), '11', '13') . ' ' . $allSwitchesIps[$ip]['location'], false);
         }
     }
     return $result;
 }
Esempio n. 25
0
 /**
  * Retruns json data for jquery data tables with transactions list
  * 
  * @global object $ubillingConfig
  * @return string
  */
 public function transactionAjaxSource()
 {
     $manual_mode = $this->altCfg['OPENPAYZ_MANUAL'];
     $query = "SELECT * from `op_transactions` ORDER by `id` DESC;";
     $alltransactions = simple_queryall($query);
     $result = '{ 
               "aaData": [ ';
     if (!empty($alltransactions)) {
         foreach ($alltransactions as $io => $eachtransaction) {
             if ($manual_mode) {
                 if ($eachtransaction['processed'] == 0) {
                     $control = wf_Link('?module=openpayz&process=' . $eachtransaction['id'], web_add_icon('Payment'));
                     $control = str_replace('"', '', $control);
                     $control = trim($control);
                 } else {
                     $control = '';
                 }
             } else {
                 $control = '';
             }
             @($user_login = $this->allCustomers[$eachtransaction['customerid']]);
             @($user_realname = $this->allRealnames[$user_login]);
             $user_realname = str_replace('"', '', $user_realname);
             $user_realname = trim($user_realname);
             @($user_address = $this->allAddress[$user_login]);
             $user_address = trim($user_address);
             $user_address = str_replace("'", '`', $user_address);
             $user_address = mysql_real_escape_string($user_address);
             if (!empty($user_login)) {
                 $profileLink = wf_Link('?module=userprofile&username=' . $user_login, web_profile_icon());
                 $profileLink = str_replace('"', '', $profileLink);
                 $profileLink = trim($profileLink);
             } else {
                 $profileLink = '';
             }
             $stateIcon = web_bool_led($eachtransaction['processed']);
             $stateIcon = str_replace('"', '', $stateIcon);
             $stateIcon = trim($stateIcon) . ' ' . $control;
             $result .= '
                 [
                 "' . $eachtransaction['id'] . '",
                 "' . $eachtransaction['date'] . '",
                 "' . $eachtransaction['summ'] . '",
                 "' . $eachtransaction['customerid'] . '",
                 "' . $user_realname . '",
                 "' . $profileLink . ' ' . $user_address . '",
                 "' . $eachtransaction['paysys'] . '",
                 "' . $stateIcon . '"
                 ],';
         }
     }
     $result = substr($result, 0, -1);
     $result .= '] 
     }';
     return $result;
 }
Esempio n. 26
0
/**
 * 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=' . $ticketdata['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;
}
Esempio n. 27
0
/**
 * Show data for some device
 * 
 * @param   $ip device ip
 * @param   $community snmp community
 * @param   $alltemplates all of snmp templates
 * @param   $quiet  no output
 * 
 * @return  void
 */
function sp_SnmpPollDevice($ip, $community, $alltemplates, $deviceTemplate, $allusermacs, $alladdress, $quiet = false)
{
    global $ubillingConfig;
    if (isset($alltemplates[$deviceTemplate])) {
        $currentTemplate = $alltemplates[$deviceTemplate];
        if (!empty($currentTemplate)) {
            $deviceDescription = $currentTemplate['define']['DEVICE'];
            $deviceFdb = $currentTemplate['define']['FDB'];
            $sectionResult = '';
            $sectionName = '';
            $finalResult = '';
            $tempArray = array();
            $alterCfg = $ubillingConfig->getAlter();
            $snmp = new SNMPHelper();
            //selecting FDB processing mode
            if (isset($currentTemplate['define']['FDB_MODE'])) {
                $deviceFdbMode = $currentTemplate['define']['FDB_MODE'];
            } else {
                $deviceFdbMode = 'default';
            }
            //selecting FDB ignored port for skipping MAC-s on it
            if (isset($currentTemplate['define']['FDB_IGNORE_PORTS'])) {
                $deviceFdbIgnore = $currentTemplate['define']['FDB_IGNORE_PORTS'];
                $deviceFdbIgnore = explode(',', $deviceFdbIgnore);
                $deviceFdbIgnore = array_flip($deviceFdbIgnore);
            } else {
                $deviceFdbIgnore = array();
            }
            //parse each section of template
            foreach ($alltemplates[$deviceTemplate] as $section => $eachpoll) {
                if ($section != 'define') {
                    if (!$quiet) {
                        $finalResult .= wf_tag('div', false, 'dashboard', '');
                    }
                    $sectionName = $eachpoll['NAME'];
                    $sectionOids = explode(',', $eachpoll['OIDS']);
                    $sectionParser = $eachpoll['PARSER'];
                    $sectionResult = '';
                    //now parse each oid
                    foreach ($sectionOids as $eachOid) {
                        $eachOid = trim($eachOid);
                        $rawData = $snmp->walk($ip, $community, $eachOid, true);
                        $rawData = str_replace('"', '`', $rawData);
                        $parseCode = '$sectionResult.=' . $sectionParser . '("' . $rawData . '");';
                        eval($parseCode);
                    }
                    if (!$quiet) {
                        $finalResult .= wf_tag('div', false, 'dashtask', '') . wf_tag('strong') . __($sectionName) . wf_tag('strong', true) . '<br>';
                        $finalResult .= $sectionResult . wf_tag('div', true);
                    }
                }
            }
            $finalResult .= wf_tag('div', true);
            $finalResult .= wf_tag('div', false, '', 'style="clear:both;"');
            $finalResult .= wf_tag('div', true);
            if (!$quiet) {
                show_window('', $finalResult);
            }
            //
            //parsing data from FDB table
            //
            if ($deviceFdb == 'true') {
                $portData = array();
                $snmp->setBackground(false);
                // need to process data with system + background
                if ($deviceFdbMode == 'default') {
                    //default zyxel & cisco port table
                    $portTable = $snmp->walk($ip, $community, '.1.3.6.1.2.1.17.4.3.1.2', true);
                } else {
                    if ($deviceFdbMode == 'dlp') {
                        //custom dlink port table with VLANS
                        $portTable = $snmp->walk($ip, $community, '.1.3.6.1.2.1.17.7.1.2.2.1.2', true);
                    }
                }
                if (!empty($portTable)) {
                    if ($deviceFdbMode == 'default') {
                        //default FDB parser
                        $portData = sp_SnmpParseFDB($portTable);
                    } else {
                        if ($deviceFdbMode == 'dlp') {
                            //exotic dlink parser
                            $portData = sp_SnmpParseFdbDl($portTable);
                        }
                    }
                    //skipping some port data if FDB_IGNORE_PORTS option is set
                    if (!empty($deviceFdbIgnore)) {
                        if (!empty($portData)) {
                            foreach ($portData as $some_mac => $some_port) {
                                if (!isset($deviceFdbIgnore[$some_port])) {
                                    $tempArray[$some_mac] = $some_port;
                                }
                            }
                            $portData = $tempArray;
                        }
                    }
                    $fdbCache = serialize($portData);
                    file_put_contents('exports/' . $ip . '_fdb', $fdbCache);
                }
                //show port data User friendly :)
                if (!empty($portData)) {
                    //extracting all needed data for switchport control
                    if ($alterCfg['SWITCHPORT_IN_PROFILE']) {
                        $allswitchesArray = zb_SwitchesGetAll();
                        $allportassigndata = array();
                        $allportassigndata_q = "SELECT * from `switchportassign`;";
                        $allportassigndata_raw = simple_queryall($allportassigndata_q);
                        if (!empty($allportassigndata_raw)) {
                            foreach ($allportassigndata_raw as $iopd => $eachpad) {
                                $allportassigndata[$eachpad['login']] = $eachpad;
                            }
                        }
                    }
                    $allusermacs = array_flip($allusermacs);
                    $cells = wf_TableCell(__('User'), '30%');
                    $cells .= wf_TableCell(__('MAC'));
                    $cells .= wf_TableCell(__('Ports'));
                    $rows = wf_TableRow($cells, 'row1');
                    foreach ($portData as $eachMac => $eachPort) {
                        //user detection
                        if (isset($allusermacs[$eachMac])) {
                            $userLogin = $allusermacs[$eachMac];
                            @($useraddress = $alladdress[$userLogin]);
                            $userlink = wf_Link('?module=userprofile&username=' . $userLogin, web_profile_icon() . ' ' . $useraddress, false);
                            //switch port assing form
                            if ($alterCfg['SWITCHPORT_IN_PROFILE']) {
                                $assignForm = wf_modal(web_edit_icon(__('Switch port assign')), __('Switch port assign'), web_SnmpSwitchControlForm($userLogin, $allswitchesArray, $allportassigndata, @$_GET['switchid'], $eachPort), '', '500', '250');
                                if (isset($allportassigndata[$userLogin])) {
                                    $assignForm .= wf_img('skins/arrow_right_green.png') . @$allportassigndata[$userLogin]['port'];
                                }
                            } else {
                                $assignForm = '';
                            }
                        } else {
                            $userlink = '';
                            $assignForm = '';
                        }
                        $cells = wf_TableCell($userlink . $assignForm, '', '', 'sorttable_customkey="' . $eachPort . '"');
                        $cells .= wf_TableCell($eachMac);
                        $cells .= wf_TableCell($eachPort);
                        $rows .= wf_TableRow($cells, 'row3');
                    }
                    if (!$quiet) {
                        show_window(__('FDB'), wf_TableBody($rows, '100%', '0', 'sortable'));
                    }
                }
            }
        }
    }
}
Esempio n. 28
0
 public function render()
 {
     $allAddress = zb_AddressGetFulladdresslistCached();
     $allRealNames = zb_UserGetAllRealnames();
     $stargazerUsers = zb_UserGetAllStargazerData();
     $allUsers = array();
     if (!empty($stargazerUsers)) {
         foreach ($stargazerUsers as $io => $each) {
             $allUsers[$each['login']] = $each['Credit'];
         }
     }
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('Cash'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->data)) {
         foreach ($this->data as $io => $each) {
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['date']);
             $loginLink = wf_Link("?module=userprofile&username=" . @$each['login'], web_profile_icon() . ' ' . @$each['login'], false, '');
             $cells .= wf_TableCell($loginLink);
             $cells .= wf_TableCell(@$allAddress[$each['login']]);
             $cells .= wf_TableCell(@$allRealNames[$each['login']]);
             $cells .= wf_TableCell(@$each['balance']);
             //deleded users indication
             if (@isset($allUsers[$each['login']])) {
                 $rowClass = 'row3';
             } else {
                 $rowClass = 'sigdeleteduser';
             }
             $rows .= wf_TableRow($cells, $rowClass);
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
Esempio n. 29
0
 /**
  * renders streets report
  * 
  * @return void
  */
 public function reportStreets()
 {
     $ukvCities = array();
     $ukvStreets = array();
     //loads cities and streets occupied by UKV users
     $ukvCities_q = "SELECT DISTINCT `city` from `ukv_users` ORDER BY `city` ASC";
     $ukvCitiesRaw = simple_queryall($ukvCities_q);
     if (!empty($ukvCitiesRaw)) {
         foreach ($ukvCitiesRaw as $ieuc => $euc) {
             $ukvCities[$euc['city']] = $euc['city'];
         }
     }
     $ukvStreets_q = "SELECT DISTINCT `street` from `ukv_users` ORDER BY `street` ASC";
     $ukvStreetsRaw = simple_queryall($ukvStreets_q);
     if (!empty($ukvStreetsRaw)) {
         foreach ($ukvStreetsRaw as $ieus => $eus) {
             $ukvStreets[$eus['street']] = $eus['street'];
         }
     }
     //main codepart
     $citySelected = wf_CheckPost(array('streetreportcity')) ? $_POST['streetreportcity'] : '';
     $streetSelected = wf_CheckPost(array('streetreportstreet')) ? $_POST['streetreportstreet'] : '';
     $inputs = wf_Selector('streetreportcity', $ukvCities, __('City'), $citySelected, false);
     $inputs .= wf_Selector('streetreportstreet', $ukvStreets, __('Street'), $streetSelected, false);
     $inputs .= wf_Submit(__('Show'));
     $form = wf_Form('', 'POST', $inputs, 'glamour');
     show_window(__('Streets report'), $form);
     if (wf_CheckPost(array('streetreportcity', 'streetreportstreet')) or wf_CheckGet(array('rc', 'rs'))) {
         //set form data
         if (wf_CheckPost(array('streetreportcity', 'streetreportstreet'))) {
             $citySearch = $_POST['streetreportcity'];
             $streetSearch = $_POST['streetreportstreet'];
         }
         //or printable report
         if (wf_CheckGet(array('rc', 'rs'))) {
             $citySearch = $_GET['rc'];
             $streetSearch = $_GET['rs'];
         }
         if (!empty($this->users)) {
             $counter = 0;
             $cells = wf_TableCell(__('Contract'), '10%');
             $cells .= wf_TableCell(__('Full address'), '31%');
             $cells .= wf_TableCell(__('Real Name'), '30%');
             $cells .= wf_TableCell(__('Tariff'), '15%');
             $cells .= wf_TableCell(__('Cash'), '7%');
             $cells .= wf_TableCell(__('Status'), '7%');
             $rows = wf_TableRow($cells, 'row1');
             foreach ($this->users as $io => $eachUser) {
                 if ($eachUser['city'] == $citySearch and $eachUser['street'] == $streetSearch) {
                     $cells = wf_TableCell($eachUser['contract']);
                     $fullAddress = $this->userGetFullAddress($eachUser['id']);
                     $profileLink = wf_Link(self::URL_USERS_PROFILE . $eachUser['id'], web_profile_icon() . ' ', false, '');
                     $cells .= wf_TableCell($profileLink . $fullAddress);
                     $cells .= wf_TableCell($eachUser['realname']);
                     $cells .= wf_TableCell($this->tariffs[$eachUser['tariffid']]['tariffname']);
                     $cells .= wf_TableCell($eachUser['cash']);
                     $cells .= wf_TableCell(web_bool_led($eachUser['active'], true));
                     $rows .= wf_TableRow($cells, 'row3');
                     $counter++;
                 }
             }
             $result = wf_TableBody($rows, '100%', '0', 'sortable');
             $result .= __('Total') . ': ' . $counter;
             if (wf_CheckGet(array('printable'))) {
                 $this->reportPrintable($citySearch . ' / ' . $streetSearch, $result);
             } else {
                 $printlink = wf_Link(self::URL_REPORTS_MGMT . 'reportStreets&rc=' . $citySearch . '&rs=' . $streetSearch . '&printable=true', wf_img('skins/icon_print.png', __('Print')), false, '');
                 show_window($citySearch . ' / ' . $streetSearch . ' ' . $printlink, $result);
             }
         } else {
             show_window(__('Result'), __('Any users found'));
         }
     }
 }
Esempio n. 30
0
 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=' . $each['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);
 }