Example #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['traffic'] . '"');
             $actionLinks = wf_Link('?module=pl_traffdetails&username='******'login'], wf_img('skins/icon_stats.gif', __('Detailed stats')), false, '');
             $actionLinks .= wf_link('?module=dstatedit&username='******'login'], web_edit_icon(), false, '');
             $cells .= wf_TableCell($actionLinks);
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
Example #2
0
 /**
  * Loads cached address data to private data property 
  * 
  * @return void
  */
 protected function loadAddress()
 {
     if ($this->cachedAddress) {
         $this->alladdress = zb_AddressGetFulladdresslistCached();
     } else {
         $this->alladdress = zb_AddressGetFulladdresslist();
     }
 }
Example #3
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="******"\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);
 }
Example #4
0
 function web_AnnihilateFormShow($login)
 {
     $alladdress = zb_AddressGetFulladdresslist();
     $inputs = __('Be careful, this module permanently deletes user and all data associated with it. Opportunities to raise from the dead no longer.');
     $inputs .= wf_tag('br');
     $inputs .= __('To ensure that we have seen the seriousness of your intentions to enter the word сonfirm the field below.');
     $inputs .= wf_tag('br');
     $inputs .= wf_tag('input', false, '', 'type="text" name="confirmation" autocomplete="off"');
     $inputs .= wf_HiddenInput('anihilation', 'true');
     $inputs .= wf_delimiter();
     $inputs .= wf_Submit(__('I really want to stop suffering User'));
     $form = wf_Form('', 'POST', $inputs, 'glamour');
     show_window(__('Deleting user') . ' ' . @$alladdress[$login] . ' (' . $login . ')', $form);
 }
Example #5
0
 function web_VserviceCashForm($login)
 {
     $currentvcash = zb_VserviceCashGet($login);
     $alladdr = zb_AddressGetFulladdresslist();
     $allrealnames = zb_UserGetAllRealnames();
     $form = '
         <form action="" method="POST">
         <table width="50%" border="0">
         <tr>
         <td  class="row2">' . __('Login') . '</td>
         <td  class="row3">' . $login . '</td>
         </tr>
         <tr>
         <td class="row2">' . __('Address') . '</td>
         <td class="row3">' . @$alladdr[$login] . '</td>
         </tr>
         <tr>
         <td class="row2">' . __('Real Name') . '</td>
         <td class="row3">' . @$allrealnames[$login] . '</td>
         </tr>
         <tr>
         <td class="row2">' . __('Current Cash state') . '</td>
         <td class="row3">' . $currentvcash . '</td>
         </tr>
         <tr>
         <td class="row2">' . __('New cash') . '</td>
         <td class="row3"><input name="newcash" size="5" type="text"></td>
         </tr>
         
         <tr>
         <td class="row2">' . __('Actions') . '</td>
         <td class="row3">
         <input name="operation" value="add" checked="checked" type="radio"> ' . __('Add cash') . '
         <input name="operation" value="set" type="radio"> ' . __('Set cash') . '
         </td>
         </tr>
         <tr>
         <td class="row2">' . __('Payment type') . '</td>
         <td class="row3">' . web_CashTypeSelector() . '</td>
         </tr>
          <tr>
         <td class="row2">' . __('Virtual services') . '</td>
         <td class="row3">' . web_VservicesSelector() . '</td>
         </tr>
         </table> 
         <input type="submit" value="' . __('Change') . '">
        </form>';
     return $form;
 }
Example #6
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='******'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;
 }
Example #7
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='******'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;
 }
Example #8
0
 function docsis_AjaxModemDataSource()
 {
     $query = "SELECT * from `modems`";
     $alladdress = zb_AddressGetFulladdresslist();
     $alluserips = zb_UserGetAllIPs();
     $alluserips = array_flip($alluserips);
     $allmodems = simple_queryall($query);
     $i = 1;
     $totalcount = sizeof($allmodems);
     $result = '{ 
           "aaData": [';
     if (!empty($allmodems)) {
         foreach ($allmodems as $io => $each) {
             $ending = $i != $totalcount ? ',' : '';
             if (isset($alluserips[$each['userbind']])) {
                 @($useraddress = $alladdress[$alluserips[$each['userbind']]]);
             } else {
                 $useraddress = '';
             }
             $actions = '<a href=?module=docsis&showmodem=' . $each['id'] . '><img src=skins/icon_edit.gif></a>';
             $result .= '
             [
             "' . $each['id'] . '",
             "' . $each['maclan'] . '",
             "' . $each['date'] . '",
             "' . $each['ip'] . '",
             "' . $each['userbind'] . '",
             "' . $useraddress . '",
             "' . $actions . '"
             ]' . $ending . '
             ';
             $i++;
         }
     }
     $result .= '] 
 }';
     die($result);
 }
Example #9
0
 function web_TsmsExcludeOpts()
 {
     $excludedUsers = tsms_GetExcludeUsers();
     $alladdress = zb_AddressGetFulladdresslist();
     $allrealnames = zb_UserGetAllRealnames();
     $allphones = tsms_GetAllMobileNumbers();
     $cells = wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Full address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('Phone'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($excludedUsers)) {
         foreach ($excludedUsers as $eachlogin => $io) {
             $cells = wf_TableCell(wf_Link("?module=userprofile&username="******"?module=turbosms&excludedelete=" . $eachlogin, web_delete_icon(), __('Are you serious')));
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     //adding form
     $inputs = wf_TextInput('newexcludelogin', __('User login to exclude from sending'), '', true, '15');
     $inputs .= wf_Submit('Save');
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     $result .= wf_delimiter();
     $result .= wf_Form("", 'POST', $inputs, 'glamour');
     return $result;
 }
Example #10
0
function bs_ShowHash($hash)
{
    $hash = vf($hash);
    $allrealnames = zb_UserGetAllRealnames();
    $alladdress = zb_AddressGetFulladdresslist();
    $checkarr = bs_SearchCheckArr($alladdress, $allrealnames);
    $alter_conf = rcms_parse_ini_file(CONFIG_PATH . 'alter.ini');
    $query = "SELECT * from `bankstaparsed` WHERE `hash`='" . $hash . "' ORDER BY `id` DESC";
    $alldata = simple_queryall($query);
    // проверяем врублены ли корпоративные пользователи
    if ($alter_conf['USER_LINKING_ENABLED']) {
        $alllinkedusers = cu_GetAllLinkedUsers();
        $allparentusers = cu_GetAllParentUsers();
    }
    if (!empty($alldata)) {
        $tablecells = wf_TableCell(__('ID'));
        $tablecells .= wf_TableCell(__('Real Name'));
        $tablecells .= wf_TableCell(__('Address'));
        $tablecells .= wf_TableCell(__('Cash'));
        $tablecells .= wf_TableCell(__('Login poroposal'));
        $tablecells .= wf_TableCell(__('Processed'));
        $tablecells .= wf_TableCell(__('Actions'));
        $tablerows = wf_TableRow($tablecells, 'row1');
        foreach ($alldata as $io => $eachrow) {
            $tablecells = wf_TableCell($eachrow['id']);
            $tablecells .= wf_TableCell(bs_NameEditForm($eachrow['id'], $eachrow['realname']));
            $tablecells .= wf_TableCell(bs_AddressEditForm($eachrow['id'], $eachrow['address']));
            $tablecells .= wf_TableCell($eachrow['summ']);
            //proposal subroutine
            if (empty($eachrow['login'])) {
                $proposed_login = bs_SearchLoginByAddresspart($eachrow['address'], $eachrow['realname'], $checkarr);
                //if no one found
                if (sizeof($proposed_login) == 0) {
                    $proposal_form = bs_LoginProposalForm($eachrow['id'], '');
                }
                //if only one user found
                if (sizeof($proposed_login) == 1) {
                    $proposal_form = bs_LoginProposalForm($eachrow['id'], $proposed_login[0]);
                    //заполним со старта что-ли
                    simple_update_field('bankstaparsed', 'login', $proposed_login[0], "WHERE `id`='" . $eachrow['id'] . "'");
                }
                //if many users found
                if (sizeof($proposed_login) > 1) {
                    //считаем что это корпоративный пользователь и достаем для него родительского
                    if ($alter_conf['USER_LINKING_ENABLED']) {
                        foreach ($proposed_login as $eachcorp) {
                            if (bs_cu_IsParent($eachcorp, $allparentusers)) {
                                $proposal_form = web_corporate_icon() . ' ' . $eachcorp;
                                //заполним родительского пользователя
                                simple_update_field('bankstaparsed', 'login', $eachcorp, "WHERE `id`='" . $eachrow['id'] . "'");
                            }
                        }
                    } else {
                        // если корпоративщина не включена - вываливаем екзепшн
                        $proposal_form = __('Multiple users found');
                    }
                }
            } else {
                $proposal_form = bs_LoginProposalForm($eachrow['id'], $eachrow['login']);
            }
            $tablecells .= wf_TableCell($proposal_form);
            $procflag = web_bool_led($eachrow['state']);
            if (!$eachrow['state']) {
                $actlink = wf_JSAlert("?module=bankstatements&lockrow=" . $eachrow['id'] . "&showhash=" . $eachrow['hash'], web_key_icon('Lock'), __('Are you serious'));
            } else {
                $actlink = '';
            }
            $tablecells .= wf_TableCell($procflag);
            $tablecells .= wf_TableCell($actlink);
            $tablerows .= wf_TableRow($tablecells, 'row3');
        }
        $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
    } else {
        $result = __('Strange exeption catched');
    }
    show_window('', wf_Link("?module=bankstatements", 'Back', true, 'ubButton'));
    show_window(__('Bank statement processing'), $result);
}
Example #11
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='******'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);
 }
Example #12
0
 /**
  * Exports existing userbase as CSV format 
  * 
  * @return void
  */
 function zb_RMExportUserbaseCsv()
 {
     $allusers = zb_UserGetAllStargazerData();
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $allcontracts = zb_UserGetAllContracts();
     $allmac = array();
     $mac_q = "SELECT * from `nethosts`";
     $allnh = simple_queryall($mac_q);
     if (!empty($allnh)) {
         foreach ($allnh as $nh => $eachnh) {
             $allmac[$eachnh['ip']] = $eachnh['mac'];
         }
     }
     $result = '';
     //options
     $delimiter = ";";
     $in_charset = 'utf-8';
     $out_charset = 'windows-1251';
     /////////////////////
     if (!empty($allusers)) {
         $result .= __('Login') . $delimiter . __('Password') . $delimiter . __('IP') . $delimiter . __('MAC') . $delimiter . __('Tariff') . $delimiter . __('Cash') . $delimiter . __('Credit') . $delimiter . __('Credit expire') . $delimiter . __('Address') . $delimiter . __('Real Name') . $delimiter . __('Contract') . $delimiter . __('AlwaysOnline') . $delimiter . __('Disabled') . $delimiter . __('User passive') . "\n";
         foreach ($allusers as $io => $eachuser) {
             //credit expirity
             if ($eachuser['CreditExpire'] != 0) {
                 $creditexpire = date("Y-m-d", $eachuser['CreditExpire']);
             } else {
                 $creditexpire = '';
             }
             //user mac
             if (isset($allmac[$eachuser['IP']])) {
                 $usermac = $allmac[$eachuser['IP']];
             } else {
                 $usermac = '';
             }
             $result .= $eachuser['login'] . $delimiter . $eachuser['Password'] . $delimiter . $eachuser['IP'] . $delimiter . $usermac . $delimiter . $eachuser['Tariff'] . $delimiter . $eachuser['Cash'] . $delimiter . $eachuser['Credit'] . $delimiter . $creditexpire . $delimiter . @$alladdress[$eachuser['login']] . $delimiter . @$allrealnames[$eachuser['login']] . $delimiter . @$allcontracts[$eachuser['login']] . $delimiter . $eachuser['AlwaysOnline'] . $delimiter . $eachuser['Down'] . $delimiter . $eachuser['Passive'] . "\n";
         }
         if ($in_charset != $out_charset) {
             $result = iconv($in_charset, $out_charset, $result);
         }
         log_register('DOWNLOAD FILE `userbase.csv`');
         // push data for csv handler
         header('Content-type: application/ms-excel');
         header('Content-Disposition: attachment; filename=userbase.csv');
         echo $result;
         die;
     }
 }
Example #13
0
/**
 * function that display JSON data for display FDB cache
 * 
 * @param $fdbData_raw - array of existing cache _fdb files
 * 
 * @return string
 */
function sn_SnmpParseFdbCacheJson($fdbData_raw)
{
    $allusermacs = zb_UserGetAllMACs();
    $allusermacs = array_flip($allusermacs);
    $alladdress = zb_AddressGetFulladdresslist();
    $allswitches = zb_SwitchesGetAll();
    $rawFilters = zb_StorageGet('FDBCACHEMACFILTERS');
    $filteredCounter = 0;
    $switchdata = array();
    $allfilters = array();
    //switch data preprocessing
    if (!empty($allswitches)) {
        foreach ($allswitches as $io => $eachswitch) {
            $switchdata[$eachswitch['ip']] = $eachswitch['location'];
        }
    }
    //mac filters preprocessing
    if (!empty($rawFilters)) {
        $rawFilters = base64_decode($rawFilters);
        $rawFilters = explodeRows($rawFilters);
        if (!empty($rawFilters)) {
            foreach ($rawFilters as $rawfindex => $rawfmac) {
                $eachMacFilter = strtolower($rawfmac);
                $allfilters[trim($eachMacFilter)] = $rawfindex;
            }
        }
    }
    $result = '{ 
                  "aaData": [';
    foreach ($fdbData_raw as $each_raw) {
        $nameExplode = explode('_', $each_raw);
        if (sizeof($nameExplode) == 2) {
            $switchIp = $nameExplode[0];
            if (file_exists('exports/' . $each_raw)) {
                $eachfdb_raw = file_get_contents('exports/' . $each_raw);
                $eachfdb = unserialize($eachfdb_raw);
                if (!empty($eachfdb_raw)) {
                    foreach ($eachfdb as $mac => $port) {
                        //detecting user login by his mac
                        if (isset($allusermacs[$mac])) {
                            $userlogin = $allusermacs[$mac];
                        } else {
                            $userlogin = false;
                        }
                        if ($userlogin) {
                            $userlink = '<a href=?module=userprofile&username='******'><img src=skins/icon_user.gif> ' . @$alladdress[$userlogin] . '</a>';
                        } else {
                            $userlink = '';
                        }
                        if (sn_FDBFilterCheckMac($mac, $allfilters)) {
                            $result .= '
                    [
                    "' . $switchIp . '",
                    "' . $port . '",
                    "' . @$switchdata[$switchIp] . '",
                    "' . $mac . '",
                    "' . $userlink . '"
                    ],';
                            $filteredCounter++;
                        }
                    }
                }
            }
        }
    }
    //show some data if filters failed
    if ($filteredCounter == 0) {
        $result .= '
                    [
                    "",
                    "",
                    "",
                    "' . __('Nothing found') . '",
                    ""
                    ],';
    }
    $result = substr($result, 0, -1);
    $result .= '] 
        }';
    return $result;
}
Example #14
0
 public function renderAll($cutdata = false)
 {
     $alladdress = zb_AddressGetFulladdresslist();
     $allrealnames = zb_UserGetAllRealnames();
     $userCounter = 0;
     $cells = '';
     if (!$cutdata) {
         $cells .= wf_TableCell(__('Login'));
     }
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('IP'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Next month'));
     $cells .= wf_TableCell(__('Cash'));
     $cells .= wf_TableCell(__('Credit'));
     $cells .= wf_TableCell(__('Contract'));
     $cells .= wf_TableCell(__('Service active'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->data)) {
         foreach ($this->data as $io => $each) {
             $cells = '';
             if (!$cutdata) {
                 $profileLink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $each['login'], false, '');
                 $cells = wf_TableCell($profileLink);
             }
             $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($each['TariffChange']);
             $cells .= wf_TableCell($each['Cash']);
             $cells .= wf_TableCell($each['Credit']);
             $cells .= wf_TableCell(@$this->contracts[$each['login']]);
             $actFlag = web_bool_led(@$this->actives[$each['login']], true);
             if ($cutdata) {
                 $actFlag = strip_tags($actFlag);
             }
             $cells .= wf_TableCell($actFlag, '', '', 'sorttable_customkey="' . @$this->actives[$each['login']] . '"');
             $rows .= wf_TableRow($cells, 'row3');
             $userCounter++;
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     $result .= __('Total') . ': ' . $userCounter;
     return $result;
 }
Example #15
0
 /**
  * Returns JSON reply for jquery datatables with full list of available connection details
  * 
  * @return void
  */
 public function ajaxGetData()
 {
     $query = "SELECT * from `condet`;";
     $all = simple_queryall($query);
     $alladdress = zb_AddressGetFulladdresslist();
     $allrealnames = zb_UserGetAllRealnames();
     $allStgData_raw = zb_UserGetAllStargazerData();
     $userData = array();
     if (!empty($allStgData_raw)) {
         foreach ($allStgData_raw as $io => $each) {
             $userData[$each['login']] = $each;
         }
     }
     $result = '{ 
               "aaData": [ ';
     if (!empty($all)) {
         foreach ($all as $io => $each) {
             $profileLink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ', 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);
             @($cash = $userData[$each['login']]['Cash']);
             @($credit = $userData[$each['login']]['Credit']);
             $act = wf_img('skins/icon_active.gif') . __('Yes');
             //finance check
             if ($cash < '-' . $credit) {
                 $act = wf_img('skins/icon_inactive.gif') . __('No');
             }
             $act = str_replace('"', '', $act);
             $act = trim($act);
             $result .= '
                 [
                 "' . $profileLink . $userAddress . '",
                 "' . $userRealname . '",
                 "' . @$userData[$each['login']]['IP'] . '",
                 "' . @$userData[$each['login']]['Tariff'] . '",
                 "' . $act . '",
                 "' . $cash . '",
                 "' . $credit . '",
                 "' . $each['seal'] . '",
                 "' . $each['price'] . '",
                 "' . $each['length'] . '",
                 "' . 'CREDIT' . '"
                 ],';
         }
     }
     $result = substr($result, 0, -1);
     $result .= '] 
     }';
     die($result);
 }
Example #16
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='******'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);
}
Example #17
0
/**
 * Puts userreg log entry into database
 * 
 * @param string $login
 * 
 * @return void
 */
function zb_UserRegisterLog($login)
{
    $date = curdatetime();
    $admin = whoami();
    $login = vf($login);
    $address = zb_AddressGetFulladdresslist();
    $address = $address[$login];
    $address = mysql_real_escape_string($address);
    $query = "INSERT INTO `userreg` (`id` ,`date` ,`admin` ,`login` ,`address`) " . "VALUES (NULL , '" . $date . "', '" . $admin . "', '" . $login . "', '" . $address . "');";
    nr_query($query);
}
Example #18
0
    function zb_AjaxOnlineDataSource()
    {
        // Speed debug
        //          $mtime = microtime();
        //          $mtime = explode(" ",$mtime);
        //          $mtime = $mtime[1] + $mtime[0];
        //          $starttime = $mtime;
        global $alter_conf;
        $query = "SELECT * from `users`";
        $query_fio = "SELECT * from `realname`";
        $allusers = simple_queryall($query);
        $allfioz = simple_queryall($query_fio);
        $fioz = zb_UserGetAllRealnames();
        $detect_address = zb_AddressGetFulladdresslist();
        $ucount = 0;
        $deadUsers = array();
        //alternate view of online module
        $addrDelimiter = '';
        if (isset($alter_conf['ONLINE_ALTERNATE_VIEW'])) {
            if ($alter_conf['ONLINE_ALTERNATE_VIEW']) {
                $addrDelimiter = wf_tag('br');
            }
        }
        //hide dead users array
        if ($alter_conf['DEAD_HIDE']) {
            if (!empty($alter_conf['DEAD_TAGID'])) {
                $tagDead = vf($alter_conf['DEAD_TAGID'], 3);
                $query_dead = "SELECT `login`,`tagid` from `tags` WHERE `tagid`='" . $tagDead . "'";
                $alldead = simple_queryall($query_dead);
                if (!empty($alldead)) {
                    foreach ($alldead as $idead => $eachDead) {
                        $deadUsers[$eachDead['login']] = $eachDead['tagid'];
                    }
                }
            }
        }
        $result = '{';
        $result .= '
       "aaData": [
  ';
        if (!empty($allusers)) {
            $totalusers = sizeof($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]);
                }
                $act = '<img src=skins/icon_active.gif>' . __('Yes');
                //finance check
                if ($cash < '-' . $credit) {
                    $act = '<img src=skins/icon_inactive.gif>' . __('No');
                }
                //online activity check
                if ($alter_conf['DN_ONLINE_DETECT']) {
                    $onlineFlag = '"<img src=skins/icon_nostar.gif> ' . __('No') . '",';
                    if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) {
                        $onlineFlag = '"<img src=skins/icon_star.gif> ' . __('Yes') . '",';
                    }
                } else {
                    $onlineFlag = '';
                }
                @($clearuseraddress = $detect_address[$eachuser['login']]);
                $clearuseraddress = trim($clearuseraddress);
                $clearuseraddress = str_replace("'", '`', $clearuseraddress);
                $clearuseraddress = mysql_real_escape_string($clearuseraddress);
                //additional finance links
                if ($alter_conf['FAST_CASH_LINK']) {
                    $fastcashlink = ' <a href=?module=addcash&username='******'login'] . '#profileending><img src=skins/icon_dollar.gif border=0></a> ';
                } else {
                    $fastcashlink = '';
                }
                if (!$alter_conf['DEAD_HIDE']) {
                    $result .= '
     [
     "<a href=?module=traffstats&username='******'login'] . '><img src=skins/icon_stats.gif border=0 title=' . __('Stats') . '></a> <a href=?module=userprofile&username='******'login'] . '><img src=skins/icon_user.gif border=0 title=' . __('Profile') . '></a> ' . $fastcashlink . $addrDelimiter . $clearuseraddress . '",
     
         "' . @mysql_real_escape_string(trim($fioz[$eachuser['login']])) . '",
         "' . $eachuser['IP'] . '",
         "' . $eachuser['Tariff'] . '",
         "' . $act . '",
         ' . $onlineFlag . '    
         "' . zb_TraffToGb($tinet) . '",
         "' . round($eachuser['Cash'], 2) . '",
         "' . round($eachuser['Credit'], 2) . '"
         ],';
                } else {
                    if (!isset($deadUsers[$eachuser['login']])) {
                        $result .= '
                 [
                 "<a href=?module=traffstats&username='******'login'] . '><img src=skins/icon_stats.gif border=0 title=' . __('Stats') . '></a> <a href=?module=userprofile&username='******'login'] . '><img src=skins/icon_user.gif border=0 title=' . __('Profile') . '></a> ' . $fastcashlink . $clearuseraddress . '",

                     "' . @mysql_real_escape_string(trim($fioz[$eachuser['login']])) . '",
                     "' . $eachuser['IP'] . '",
                     "' . $eachuser['Tariff'] . '",
                     "' . $act . '",
                     ' . $onlineFlag . '   
                     "' . zb_TraffToGb($tinet) . '",
                     "' . round($eachuser['Cash'], 2) . '",
                     "' . round($eachuser['Credit'], 2) . '"
                     ],';
                    }
                }
            }
        }
        $result = substr($result, 0, -1);
        $result .= '
    
    ]
    }
        ';
        print $result;
        //          $mtime = microtime();
        //          $mtime = explode(" ",$mtime);
        //          $mtime = $mtime[1] + $mtime[0];
        //          $endtime = $mtime;
        //          $totaltime = ($endtime - $starttime);
        //          echo "This result generated in ".$totaltime." seconds";
        die;
    }
Example #19
0
/**
 * Returns user apartment editing form
 * 
 * @param string $login
 * @return string
 */
function web_AddressAptForm($login)
{
    $login = vf($login);
    $aptdata = zb_AddressGetAptData($login);
    $useraddress = zb_AddressGetFulladdresslist();
    @($useraddress = $useraddress[$login]);
    $cells = wf_TableCell(__('Value'));
    $cells .= wf_TableCell(__('Current state'));
    $cells .= wf_TableCell(__('Actions'));
    $rows = wf_TableRow($cells, 'row1');
    $cells = wf_TableCell(__('Login'));
    $cells .= wf_TableCell($login);
    $cells .= wf_TableCell('');
    $rows .= wf_TableRow($cells, 'row3');
    $cells = wf_TableCell(__('Full address'));
    $cells .= wf_TableCell(@$useraddress);
    $cells .= wf_TableCell(wf_JSAlert('?module=binder&username='******'&orphan=true', web_delete_icon(), __('Are you sure you want to make the homeless this user') . "?"));
    $rows .= wf_TableRow($cells, 'row3');
    $cells = wf_TableCell(__('Entrance'));
    $cells .= wf_TableCell(@$aptdata['entrance']);
    $cells .= wf_TableCell(wf_TextInput('changeentrance', '', @$aptdata['entrance'], false));
    $rows .= wf_TableRow($cells, 'row3');
    $cells = wf_TableCell(__('Floor'));
    $cells .= wf_TableCell(@$aptdata['floor']);
    $cells .= wf_TableCell(wf_TextInput('changefloor', '', @$aptdata['floor'], false));
    $rows .= wf_TableRow($cells, 'row3');
    $cells = wf_TableCell(__('Apartment') . wf_tag('sup') . '*' . wf_tag('sup', true));
    $cells .= wf_TableCell(@$aptdata['apt']);
    $cells .= wf_TableCell(wf_TextInput('changeapt', '', @$aptdata['apt'], false));
    $rows .= wf_TableRow($cells, 'row3');
    $table = wf_TableBody($rows, '100%', 0, '');
    $table .= wf_Submit(__('Save'));
    $form = wf_Form("", 'POST', $table, '');
    return $form;
}
Example #20
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='******'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;
}
Example #21
0
/**
 * Returns report by planned next month tariffs change
 * 
 * @global object $ubillingConfig
 * @return string
 */
function web_TariffShowMoveReport()
{
    global $ubillingConfig;
    $alter_conf = $ubillingConfig->getAlter();
    $billing_conf = $ubillingConfig->getBilling();
    $chartData = array();
    $nmchange = '#!/bin/sh' . "\n";
    //is nmchange enabled?
    if ($alter_conf['NMCHANGE']) {
        $sgconf = $billing_conf['SGCONF'];
        $stg_host = $billing_conf['STG_HOST'];
        $stg_port = $billing_conf['STG_PORT'];
        $stg_login = $billing_conf['STG_LOGIN'];
        $stg_passwd = $billing_conf['STG_PASSWD'];
    }
    $query = "SELECT `login`,`Tariff`,`TariffChange` from `users` WHERE `TariffChange` !=''";
    $allmoves = simple_queryall($query);
    $alladdrz = zb_AddressGetFulladdresslist();
    $allrealnames = zb_UserGetAllRealnames();
    $alltariffprices = zb_TariffGetPricesAll();
    $totaldiff = 0;
    $movecount = 0;
    $tablecells = wf_TableCell(__('Login'));
    $tablecells .= wf_TableCell(__('Full address'));
    $tablecells .= wf_TableCell(__('Real name'));
    $tablecells .= wf_TableCell(__('Tariff'));
    $tablecells .= wf_TableCell(__('Next month'));
    $tablecells .= wf_TableCell(__('Difference'));
    $tablerows = wf_TableRow($tablecells, 'row1');
    if (!empty($allmoves)) {
        foreach ($allmoves as $io => $eachmove) {
            //generate NMCHANGE option
            if ($alter_conf['NMCHANGE']) {
                $nmchange .= $sgconf . ' set -s ' . $stg_host . ' -p ' . $stg_port . ' -a' . $stg_login . ' -w' . $stg_passwd . ' -u' . $eachmove['login'] . ' --always-online 0' . "\n";
                $nmchange .= $sgconf . ' set -s ' . $stg_host . ' -p ' . $stg_port . ' -a' . $stg_login . ' -w' . $stg_passwd . ' -u' . $eachmove['login'] . ' --always-online 1' . "\n";
            }
            @($current_price = $alltariffprices[$eachmove['Tariff']]);
            @($next_price = $alltariffprices[$eachmove['TariffChange']]);
            @($difference = $next_price - $current_price);
            //coloring movements
            if ($difference < 0) {
                $cashcolor = '#a90000';
            } else {
                $cashcolor = '#005304';
            }
            $totaldiff = $totaldiff + $difference;
            $movecount++;
            $tablecells = wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachmove['login'], false));
            $tablecells .= wf_TableCell(@$alladdrz[$eachmove['login']]);
            $tablecells .= wf_TableCell(@$allrealnames[$eachmove['login']]);
            $tablecells .= wf_TableCell($eachmove['Tariff']);
            $tablecells .= wf_TableCell($eachmove['TariffChange']);
            $tablecells .= wf_TableCell('<font color="' . $cashcolor . '">' . $difference . '</font>');
            $tablerows .= wf_TableRow($tablecells, 'row3');
        }
    }
    $result = wf_TableBody($tablerows, '100%', 0, 'sortable');
    //coloring profit
    if ($totaldiff < 0) {
        $profitcolor = '#a90000';
    } else {
        $profitcolor = '#005304';
    }
    $result .= wf_tag('b') . __('Total') . ': ' . $movecount . wf_tag('b', true) . wf_tag('br');
    $result .= wf_tag('font', false, '', 'color="' . $profitcolor . '"');
    $result .= __('PROFIT') . ': ' . $totaldiff;
    $result .= wf_tag('font', true);
    //yep, lets write nmchange
    if ($alter_conf['NMCHANGE']) {
        if (date("d") != 1) {
            // protect of override on 1st day
            file_put_contents(CONFIG_PATH . 'nmchange.sh', $nmchange);
        }
    }
    return $result;
}
Example #22
0
 /**
  * Renders json data for user list
  * 
  * @global array $alter_conf
  * 
  * @return string
  */
 function zb_AjaxOnlineDataSourceSafe()
 {
     global $alter_conf;
     $query = "SELECT * from `users`";
     $query_fio = "SELECT * from `realname`";
     $allusers = simple_queryall($query);
     $allfioz = simple_queryall($query_fio);
     $fioz = zb_UserGetAllRealnames();
     $detect_address = zb_AddressGetFulladdresslist();
     $ucount = 0;
     $deadUsers = array();
     //alternate view of online module
     $addrDelimiter = '';
     if (isset($alter_conf['ONLINE_ALTERNATE_VIEW'])) {
         if ($alter_conf['ONLINE_ALTERNATE_VIEW']) {
             $addrDelimiter = wf_tag('br');
         }
     }
     //hide dead users array
     if ($alter_conf['DEAD_HIDE']) {
         if (!empty($alter_conf['DEAD_TAGID'])) {
             $tagDead = vf($alter_conf['DEAD_TAGID'], 3);
             $query_dead = "SELECT `login`,`tagid` from `tags` WHERE `tagid`='" . $tagDead . "'";
             $alldead = simple_queryall($query_dead);
             if (!empty($alldead)) {
                 foreach ($alldead as $idead => $eachDead) {
                     $deadUsers[$eachDead['login']] = $eachDead['tagid'];
                 }
             }
         }
     }
     $jsonAAData = array();
     if (!empty($allusers)) {
         $totalusers = sizeof($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]);
             }
             $act = '<img src=skins/icon_active.gif>' . __('Yes');
             //finance check
             if ($cash < '-' . $credit) {
                 $act = '<img src=skins/icon_inactive.gif>' . __('No');
             }
             //online activity check
             if ($alter_conf['DN_ONLINE_DETECT']) {
                 $onlineFlag = '<img src=skins/icon_nostar.gif> ' . __('No');
                 if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) {
                     $onlineFlag = '<img src=skins/icon_star.gif> ' . __('Yes');
                 }
             } else {
                 $onlineFlag = '';
             }
             @($clearuseraddress = $detect_address[$eachuser['login']]);
             //additional finance links
             if ($alter_conf['FAST_CASH_LINK']) {
                 $fastcashlink = ' <a href=?module=addcash&username='******'login'] . '#profileending><img src=skins/icon_dollar.gif border=0></a> ';
             } else {
                 $fastcashlink = '';
             }
             if (!$alter_conf['DEAD_HIDE']) {
                 $jsonItem = array();
                 $jsonItem[] = '<a href=?module=traffstats&username='******'login'] . '><img src=skins/icon_stats.gif border=0 title=' . __('Stats') . '></a> <a href=?module=userprofile&username='******'login'] . '><img src=skins/icon_user.gif border=0 title=' . __('Profile') . '></a> ' . $fastcashlink . $addrDelimiter . $clearuseraddress;
                 $jsonItem[] = @$fioz[$eachuser['login']];
                 $jsonItem[] = $eachuser['IP'];
                 $jsonItem[] = $eachuser['Tariff'];
                 $jsonItem[] = $act;
                 if (!empty($onlineFlag)) {
                     $jsonItem[] = $onlineFlag;
                 }
                 $jsonItem[] = zb_TraffToGb($tinet);
                 $jsonItem[] = "" . round($eachuser['Cash'], 2);
                 $jsonItem[] = "" . round($eachuser['Credit'], 2);
                 $jsonAAData[] = $jsonItem;
             } else {
                 if (!isset($deadUsers[$eachuser['login']])) {
                     $jsonItem = array();
                     $jsonItem[] = '<a href=?module=traffstats&username='******'login'] . '><img src=skins/icon_stats.gif border=0 title=' . __('Stats') . '></a> <a href=?module=userprofile&username='******'login'] . '><img src=skins/icon_user.gif border=0 title=' . __('Profile') . '></a> ' . $fastcashlink . $clearuseraddress;
                     $jsonItem[] = @$fioz[$eachuser['login']];
                     $jsonItem[] = $eachuser['IP'];
                     $jsonItem[] = $eachuser['Tariff'];
                     $jsonItem[] = $act;
                     if (!empty($onlineFlag)) {
                         $jsonItem[] = $onlineFlag;
                     }
                     $jsonItem[] = zb_TraffToGb($tinet);
                     $jsonItem[] = "" . round($eachuser['Cash'], 2);
                     $jsonItem[] = "" . round($eachuser['Credit'], 2);
                     $jsonAAData[] = $jsonItem;
                 }
             }
         }
     }
     $result = array("aaData" => $jsonAAData);
     return json_encode($result);
 }
Example #23
0
 public function render()
 {
     $allAddress = zb_AddressGetFulladdresslist();
     $allRealNames = zb_UserGetAllRealnames();
     $allUserCash = zb_CashGetAllUsers();
     $totalCount = 0;
     $totalSumm = 0;
     $result = '';
     $cells = wf_TableCell(__('ID'));
     $cells .= wf_TableCell(__('Date'));
     $cells .= wf_TableCell(__('Cash'));
     $cells .= wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Real Name'));
     $cells .= wf_TableCell(__('Full address'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Balance'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($this->data)) {
         foreach ($this->data as $io => $each) {
             $totalCount++;
             @($usertariff = $this->usertariffs[$each['login']]);
             // fill tariff stats
             if (!empty($usertariff)) {
                 if (isset($this->tariffstats[$usertariff])) {
                     $this->tariffstats[$usertariff]++;
                 } else {
                     $this->tariffstats[$usertariff] = 1;
                 }
             }
             @($usercash = $allUserCash[$each['login']]);
             $totalSumm = $totalSumm + $each['summ'];
             $cells = wf_TableCell($each['id']);
             $cells .= wf_TableCell($each['date']);
             $cells .= wf_TableCell($each['summ']);
             $loginLink = wf_Link("?module=userprofile&username="******"clear:both;"') . wf_tag('div', 'true');
     $result .= wf_TableBody($rows, '100%', '0', 'sortable');
     return $result;
 }
Example #24
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='******'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;
}
Example #25
0
 /**
  * loads user data for template processing 
  * 
  * @return void
  */
 public function loadAllUserData()
 {
     $userdata = array();
     $alluserdata = zb_UserGetAllStargazerData();
     $tariffspeeds = zb_TariffGetAllSpeeds();
     $tariffprices = zb_TariffGetPricesAll();
     $multinetdata = zb_MultinetGetAllData();
     $allcontracts = zb_UserGetAllContracts();
     $allcontracts = array_flip($allcontracts);
     $contractDates = $this->getContractDatesAll();
     $allphonedata = zb_UserGetAllPhoneData();
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslist();
     $allemails = zb_UserGetAllEmails();
     $allnasdata = zb_NasGetAllData();
     $allcfdata = cf_FieldsGetAll();
     $allpdata = zb_UserPassportDataGetAll();
     $curdate = curdate();
     $lastDocId = $this->getDocumentLastId();
     $newDocId = $lastDocId + 1;
     if ($this->altcfg['OPENPAYZ_REALID']) {
         $allopcustomers = zb_TemplateGetAllOPCustomers();
     }
     if (!empty($alluserdata)) {
         foreach ($alluserdata as $io => $eachuser) {
             $userdata[$eachuser['login']]['LOGIN'] = $eachuser['login'];
             $userdata[$eachuser['login']]['PASSWORD'] = $eachuser['Password'];
             $userdata[$eachuser['login']]['USERHASH'] = crc16($eachuser['login']);
             $userdata[$eachuser['login']]['TARIFF'] = $eachuser['Tariff'];
             @($userdata[$eachuser['login']]['TARIFFPRICE'] = $tariffprices[$eachuser['Tariff']]);
             $userdata[$eachuser['login']]['CASH'] = $eachuser['Cash'];
             $userdata[$eachuser['login']]['CREDIT'] = $eachuser['Credit'];
             $userdata[$eachuser['login']]['DOWN'] = $eachuser['Down'];
             $userdata[$eachuser['login']]['PASSIVE'] = $eachuser['Passive'];
             $userdata[$eachuser['login']]['AO'] = $eachuser['AlwaysOnline'];
             @($userdata[$eachuser['login']]['CONTRACT'] = $allcontracts[$eachuser['login']]);
             @($userdata[$eachuser['login']]['CONTRACTDATE'] = $contractDates[$eachuser['login']]['contractdate']);
             @($userdata[$eachuser['login']]['REALNAME'] = $allrealnames[$eachuser['login']]);
             @($userdata[$eachuser['login']]['ADDRESS'] = $alladdress[$eachuser['login']]);
             @($userdata[$eachuser['login']]['EMAIL'] = $allemails[$eachuser['login']]);
             @($userdata[$eachuser['login']]['PHONE'] = $allphonedata[$eachuser['login']]['phone']);
             @($userdata[$eachuser['login']]['MOBILE'] = $allphonedata[$eachuser['login']]['mobile']);
             //openpayz payment ID
             if ($this->altcfg['OPENPAYZ_REALID']) {
                 @($userdata[$eachuser['login']]['PAYID'] = $allopcustomers[$eachuser['login']]);
             } else {
                 @($userdata[$eachuser['login']]['PAYID'] = ip2int($eachuser['IP']));
             }
             //traffic params
             $userdata[$eachuser['login']]['TRAFFIC'] = $eachuser['D0'] + $eachuser['U0'];
             $userdata[$eachuser['login']]['TRAFFICDOWN'] = $eachuser['D0'];
             $userdata[$eachuser['login']]['TRAFFICUP'] = $eachuser['U0'];
             //net params
             @($userdata[$eachuser['login']]['IP'] = $eachuser['IP']);
             @($userdata[$eachuser['login']]['MAC'] = $multinetdata[$eachuser['IP']]['mac']);
             @($userdata[$eachuser['login']]['NETID'] = $multinetdata[$eachuser['IP']]['netid']);
             @($userdata[$eachuser['login']]['HOSTID'] = $multinetdata[$eachuser['IP']]['id']);
             //nas data
             @($usernas = zb_NasGetParams($multinetdata[$eachuser['IP']]['netid'], $allnasdata));
             @($userdata[$eachuser['login']]['NASID'] = $usernas['id']);
             @($userdata[$eachuser['login']]['NASIP'] = $usernas['nasip']);
             @($userdata[$eachuser['login']]['NASNAME'] = $usernas['nasname']);
             @($userdata[$eachuser['login']]['NASTYPE'] = $usernas['nastype']);
             if (isset($tariffspeeds[$eachuser['Tariff']])) {
                 $userdata[$eachuser['login']]['SPEEDDOWN'] = $tariffspeeds[$eachuser['Tariff']]['speeddown'];
                 $userdata[$eachuser['login']]['SPEEDUP'] = $tariffspeeds[$eachuser['Tariff']]['speedup'];
             } else {
                 //if no tariff speed defined zero speed by default
                 $userdata[$eachuser['login']]['SPEEDDOWN'] = 0;
                 $userdata[$eachuser['login']]['SPEEDUP'] = 0;
             }
             //passport data
             @($userdata[$eachuser['login']]['PBIRTH'] = $allpdata[$eachuser['login']]['birthdate']);
             @($userdata[$eachuser['login']]['PNUM'] = $allpdata[$eachuser['login']]['passportnum']);
             @($userdata[$eachuser['login']]['PDATE'] = $allpdata[$eachuser['login']]['passportdate']);
             @($userdata[$eachuser['login']]['PWHO'] = $allpdata[$eachuser['login']]['passportwho']);
             @($userdata[$eachuser['login']]['PCITY'] = $allpdata[$eachuser['login']]['pcity']);
             @($userdata[$eachuser['login']]['PSTREET'] = $allpdata[$eachuser['login']]['pstreet']);
             @($userdata[$eachuser['login']]['PBUILD'] = $allpdata[$eachuser['login']]['pbuild']);
             @($userdata[$eachuser['login']]['PAPT'] = $allpdata[$eachuser['login']]['papt']);
             //other document data
             @($userdata[$eachuser['login']]['CURDATE'] = $curdate);
             @($userdata[$eachuser['login']]['DOCID'] = $newDocId);
         }
     }
     $this->userData = $userdata;
 }
Example #26
0
/**
 * Passport data editing form
 * 
 * @param $login - user login
 * @param $passportdata - user passport data array
 * 
 * @return void
 * 
 */
function web_PassportDataEditFormshow($login, $passportdata)
{
    $alladdress = zb_AddressGetFulladdresslist();
    @($useraddress = $alladdress[$login]);
    //extracting passport data
    if (!empty($passportdata)) {
        $birthdate = $passportdata['birthdate'];
        $passportnum = $passportdata['passportnum'];
        $passportdate = $passportdata['passportdate'];
        $passportwho = $passportdata['passportwho'];
        $pcity = $passportdata['pcity'];
        $pstreet = $passportdata['pstreet'];
        $pbuild = $passportdata['pbuild'];
        $papt = $passportdata['papt'];
    } else {
        $birthdate = '';
        $passportnum = '';
        $passportdate = '';
        $passportwho = '';
        $pcity = '';
        $pstreet = '';
        $pbuild = '';
        $papt = '';
    }
    //form construction
    $inputs = wf_tag('h3') . __('Passport data') . wf_tag('h3', true);
    $inputs .= wf_DatePickerPreset('editbirthdate', $birthdate, true);
    $inputs .= __('Birth date');
    $inputs .= wf_delimiter();
    $inputs .= wf_TextInput('editpassportnum', __('Passport number'), $passportnum, false, '35');
    $inputs .= wf_delimiter();
    $inputs .= wf_TextInput('editpassportwho', __('Issuing authority'), $passportwho, false, '35');
    $inputs .= wf_delimiter();
    $inputs .= wf_DatePickerPreset('editpassportdate', $passportdate, true);
    $inputs .= __('Date of issue');
    $inputs .= wf_delimiter();
    $inputs .= wf_tag('h3') . __('Registration address') . wf_tag('h3', true);
    $inputs .= wf_TextInput('editpcity', __('City'), $pcity, false, '20');
    $inputs .= wf_delimiter();
    $inputs .= wf_TextInput('editpstreet', __('Street'), $pstreet, false, '20');
    $inputs .= wf_delimiter();
    $inputs .= wf_TextInput('editpbuild', __('Build'), $pbuild, false, '5');
    $inputs .= wf_delimiter();
    $inputs .= wf_TextInput('editpapt', __('Apartment'), $papt, false, '5');
    $inputs .= wf_delimiter();
    $inputs .= wf_Submit(__('Save'));
    $form = wf_Form('', 'POST', $inputs, 'glamour');
    show_window(__('Edit') . ' ' . __('passport data') . ' ' . $useraddress, $form);
}
Example #27
0
/**
 * Returns user address by some user login
 * 
 * @param string $login
 * 
 * @return string
 */
function zb_UserGetFullAddress($login)
{
    $alladdress = zb_AddressGetFulladdresslist();
    @($address = $alladdress[$login]);
    return $address;
}
Example #28
0
/**
 * Performs login search by partial address
 * 
 * @global object $ubillingConfig
 * @param string $query
 * @return array
 */
function zb_UserSearchAddressPartial($query)
{
    global $ubillingConfig;
    $altercfg = $ubillingConfig->getAlter();
    $query = mysql_real_escape_string($query);
    if (!$altercfg['SEARCHADDR_AUTOCOMPLETE']) {
        $query = strtolower_utf8($query);
    }
    $alluseraddress = zb_AddressGetFulladdresslist();
    $result = array();
    if (!empty($alluseraddress)) {
        if (!$altercfg['SEARCHADDR_AUTOCOMPLETE']) {
            foreach ($alluseraddress as $login => $address) {
                if (ispos(strtolower_utf8($address), $query)) {
                    $result[] = $login;
                }
            }
        } else {
            foreach ($alluseraddress as $login => $address) {
                if (ispos($address, $query)) {
                    $result[] = $login;
                }
            }
        }
    }
    return $result;
}
Example #29
0
 /**
  * Preloads raw data for searchable user fields and controls caching
  * 
  * @return void
  */
 protected function loadRawdata($forceCache = false)
 {
     $cacheTime = $this->alterConf['GLOBALSEARCH_CACHE'];
     $cacheTime = time() - $cacheTime * 60;
     //in minutes
     //extracting user fields types to load
     if (!empty($this->alterConf['GLOBALSEARCH_FIELDS'])) {
         $this->fields = explode(',', $this->alterConf['GLOBALSEARCH_FIELDS']);
         $this->fields = array_flip($this->fields);
     }
     $updateCache = false;
     if (file_exists(self::CACHE_NAME)) {
         $updateCache = false;
         if (filemtime(self::CACHE_NAME) > $cacheTime) {
             $updateCache = false;
         } else {
             $updateCache = true;
         }
     } else {
         $updateCache = true;
     }
     //force cache parameter
     if ($forceCache) {
         $updateCache = true;
     }
     //updating rawdata cache
     if ($updateCache) {
         //loading needed fields
         if (isset($this->fields['realname'])) {
             $this->rawData = $this->rawData + $this->transformArray(zb_UserGetAllRealnames(), __('Real Name'), 'realname');
         }
         if (isset($this->fields['address'])) {
             $this->rawData = $this->rawData + $this->transformArray(zb_AddressGetFulladdresslist(), __('Full address'), 'address');
         }
         if (isset($this->fields['contract'])) {
             $allContracts = zb_UserGetAllContracts();
             $allContracts = array_flip($allContracts);
             $this->rawData = $this->rawData + $this->transformArray($allContracts, __('Contract'), 'contract');
         }
         if (isset($this->fields['phone']) or isset($this->fields['mobile'])) {
             $allPhonedata = zb_UserGetAllPhoneData();
             if (isset($this->fields['phone'])) {
                 if (!empty($allPhonedata)) {
                     $allPhones = array();
                     foreach ($allPhonedata as $io => $each) {
                         $allPhones[$io] = $each['phone'];
                     }
                     $this->rawData = $this->rawData + $this->transformArray($allPhones, __('Phone'), 'phone');
                 }
             }
             if (isset($this->fields['mobile'])) {
                 if (!empty($allPhonedata)) {
                     $allMobiles = array();
                     foreach ($allPhonedata as $io => $each) {
                         $allMobiles[$io] = $each['mobile'];
                     }
                     $this->rawData = $this->rawData + $this->transformArray($allMobiles, __('Mobile'), 'mobile');
                 }
             }
         }
         if (isset($this->fields['ip'])) {
             $this->rawData = $this->rawData + $this->transformArray(zb_UserGetAllIPs(), __('IP'), 'ip');
         }
         if (isset($this->fields['mac'])) {
             $this->rawData = $this->rawData + $this->transformArray(zb_UserGetAllIpMACs(), __('MAC address'), 'mac');
         }
         if (isset($this->fields['login'])) {
             $allLogins = zb_UserGetAllStargazerLogins();
             $this->rawData = $this->rawData + $this->transformArray($allLogins, __('Login'), 'login');
         }
         if (isset($this->fields['seal'])) {
             $conDet = new ConnectionDetails();
             $allSeals = $conDet->getAllSeals();
             $this->rawData = $this->rawData + $this->transformArray($allSeals, __('Cable seal'), 'seal');
         }
         if (isset($this->fields['paymentid'])) {
             if ($this->alterConf['OPENPAYZ_REALID']) {
                 $allPayIds_q = "SELECT * from `op_customers`";
                 $allPayIds = simple_queryall($allPayIds_q);
                 $tmpArrPayids = array();
                 if (!empty($allPayIds)) {
                     foreach ($allPayIds as $io => $each) {
                         $tmpArrPayids[$each['realid']] = $each['virtualid'];
                     }
                 }
                 $this->rawData = $this->rawData + $this->transformArray($tmpArrPayids, __('Payment ID'), 'payid');
             } else {
                 $allPayIds_q = "SELECT `login`,`IP` from `users`";
                 $allPayIds = simple_queryall($allPayIds_q);
                 $tmpArrPayids = array();
                 if (!empty($allPayIds)) {
                     foreach ($allPayIds as $io => $each) {
                         $tmpArrPayids[$each['login']] = ip2int($each['IP']);
                     }
                 }
                 $this->rawData = $this->rawData + $this->transformArray($tmpArrPayids, __('Payment ID'), 'payid');
             }
         }
         file_put_contents(self::CACHE_NAME, serialize($this->rawData));
     } else {
         $this->rawData = file_get_contents(self::CACHE_NAME);
         $this->rawData = unserialize($this->rawData);
     }
 }
Example #30
0
 /**
  * Get full address list of all users and load it into $this->allAddress
  * 
  * @return void
  */
 protected function LoadAddresses()
 {
     $this->allAddresses = zb_AddressGetFulladdresslist();
 }