コード例 #1
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 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;
 }
コード例 #2
0
ファイル: index.php プロジェクト: nightflyza/Ubilling
 /**
  * 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);
 }
コード例 #3
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 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;
 }
コード例 #4
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 protected function render($creditUserList)
 {
     $counter = 0;
     $allrealnames = zb_UserGetAllRealnames();
     $alladdress = zb_AddressGetFulladdresslistCached();
     $cells = wf_TableCell(__('Login'));
     $cells .= wf_TableCell(__('Tariff'));
     $cells .= wf_TableCell(__('Cash'));
     $cells .= wf_TableCell(__('Credit'));
     $cells .= wf_TableCell(__('Credit expire'));
     $cells .= wf_TableCell(__('Address'));
     $cells .= wf_TableCell(__('Real name'));
     $cells .= wf_TableCell(__('Actions'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($creditUserList)) {
         foreach ($creditUserList as $io => $eachuser) {
             $cells = wf_TableCell($eachuser['login']);
             $cells .= wf_TableCell($eachuser['Tariff']);
             $cells .= wf_TableCell($eachuser['Cash']);
             $cells .= wf_TableCell($eachuser['Credit']);
             if ($eachuser['CreditExpire'] != '0') {
                 $expireDate = date("Y-m-d", $eachuser['CreditExpire']);
             } else {
                 $expireDate = __('Forever and ever');
             }
             $cells .= wf_TableCell($expireDate);
             $cells .= wf_TableCell(@$alladdress[$eachuser['login']]);
             $cells .= wf_TableCell(@$allrealnames[$eachuser['login']]);
             $actlinks = '';
             if (cfr('CREDIT')) {
                 $actlinks .= wf_Link('?module=report_creditexpire&fastfix=' . $eachuser['login'], wf_img('skins/icon_repair.gif', __('Fix')), false, '');
             }
             $actlinks .= wf_Link('?module=userprofile&username='******'login'], web_profile_icon(), false, '');
             $actlinks .= wf_Link('?module=creditexpireedit&username='******'login'], wf_img('skins/icon_calendar.gif', __('Change') . ' ' . __('Credit expire')), false, '');
             $cells .= wf_TableCell($actlinks);
             $rows .= wf_TableRow($cells, 'row3');
             $counter++;
         }
     }
     $result = wf_TableBody($rows, '100%', '0', 'sortable');
     $result .= wf_tag('b') . __('Total') . ': ' . $counter . wf_tag('b', true);
     return $result;
 }
コード例 #5
0
ファイル: api.uhw.php プロジェクト: nightflyza/Ubilling
 /**
  * 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;
 }
コード例 #6
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 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;
 }
コード例 #7
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 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;
 }
コード例 #8
0
ファイル: api.ticketing.php プロジェクト: l1ght13aby/Ubilling
/**
 * 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;
}
コード例 #9
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);
     }
 }
コード例 #10
0
/**
 *  Returns all data about current userbase
 *  which used for templatizing functions
 * 
 *  @return  array
 */
function zb_TemplateGetAllUserData()
{
    $altcfg = rcms_parse_ini_file(CONFIG_PATH . "alter.ini");
    $userdata = array();
    $alluserdata = zb_UserGetAllStargazerData();
    $tariffspeeds = zb_TariffGetAllSpeeds();
    $tariffprices = zb_TariffGetPricesAll();
    $multinetdata = zb_MultinetGetAllData();
    $allcontracts = zb_UserGetAllContracts();
    $allcontracts = array_flip($allcontracts);
    $allrealnames = zb_UserGetAllRealnames();
    $alladdress = zb_AddressGetFulladdresslist();
    $allemails = zb_UserGetAllEmails();
    $allnasdata = zb_NasGetAllData();
    $allcfdata = cf_FieldsGetAll();
    $allpdata = zb_UserPassportDataGetAll();
    if ($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']]['realname'] = $allrealnames[$eachuser['login']]);
            @($userdata[$eachuser['login']]['address'] = $alladdress[$eachuser['login']]);
            @($userdata[$eachuser['login']]['email'] = $allemails[$eachuser['login']]);
            //openpayz payment ID
            if ($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;
            }
            //CF data
            $usercfdata = zb_cfGetContent($eachuser['login'], $allcfdata);
            if (!empty($usercfdata)) {
                foreach ($usercfdata as $cd => $eachcf) {
                    $userdata[$eachuser['login']]['cf'][$cd] = $eachcf;
                }
            }
            //passport data
            @($userdata[$eachuser['login']]['birthdate'] = $allpdata[$eachuser['login']]['birthdate']);
            @($userdata[$eachuser['login']]['passportnum'] = $allpdata[$eachuser['login']]['passportnum']);
            @($userdata[$eachuser['login']]['passportdate'] = $allpdata[$eachuser['login']]['passportdate']);
            @($userdata[$eachuser['login']]['passportwho'] = $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']);
        }
    }
    return $userdata;
}
コード例 #11
0
ファイル: api.cardpay.php プロジェクト: l1ght13aby/Ubilling
/**
 * Returns payment card brutes attempts list
 * 
 * @return string
 */
function web_CardShowBrutes()
{
    $query = "SELECT * from `cardbrute`";
    $allbrutes = simple_queryall($query);
    $cells = wf_TableCell(__('ID'));
    $cells .= wf_TableCell(__('Serial number'));
    $cells .= wf_TableCell(__('Date'));
    $cells .= wf_TableCell(__('Login'));
    $cells .= wf_TableCell(__('IP'));
    $cells .= wf_TableCell(__('Full address'));
    $cells .= wf_TableCell(__('Real Name'));
    $rows = wf_TableRow($cells, 'row1');
    if (!empty($allbrutes)) {
        $allrealnames = zb_UserGetAllRealnames();
        $alladdress = zb_AddressGetFulladdresslist();
        foreach ($allbrutes as $io => $eachbrute) {
            $cleaniplink = wf_JSAlert('?module=cards&cleanip=' . $eachbrute['ip'], web_delete_icon(__('Clean this IP')), __('Removing this may lead to irreparable results'));
            $cells = wf_TableCell($eachbrute['id']);
            $cells .= wf_TableCell($eachbrute['serial']);
            $cells .= wf_TableCell($eachbrute['date']);
            $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $eachbrute['login']));
            $cells .= wf_TableCell($eachbrute['ip'] . ' ' . $cleaniplink);
            $cells .= wf_TableCell(@$alladdress[$eachbrute['login']]);
            $cells .= wf_TableCell(@$allrealnames[$eachbrute['login']]);
            $rows .= wf_TableRow($cells, 'row3');
        }
    }
    $result = wf_TableBody($rows, '100%', 0, 'sortable');
    $cleanAllLink = wf_JSAlert('?module=cards&cleanallbrutes=true', wf_img('skins/icon_cleanup.png', __('Cleanup')), 'Are you serious');
    show_window(__('Bruteforce attempts') . ' ' . $cleanAllLink, $result);
    return $result;
}
コード例 #12
0
ファイル: index.php プロジェクト: nightflyza/Ubilling
 /**
  * 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;
     }
 }
コード例 #13
0
ファイル: api.condet.php プロジェクト: nightflyza/Ubilling
 /**
  * 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);
 }
コード例 #14
0
 /**
  * loads all users realnames
  * 
  * @return void
  */
 protected function loadUserRealnames()
 {
     $this->userRealnames = zb_UserGetAllRealnames();
 }
コード例 #15
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 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);
 }
コード例 #16
0
/**
 * Returns user array in table view
 * 
 * @global object $ubillingConfig
 * @param array $usersarr
 * @return string
 */
function web_UserArrayShower($usersarr)
{
    global $ubillingConfig;
    $alterconf = $ubillingConfig->getAlter();
    if (!empty($usersarr)) {
        $alladdress = zb_AddressGetFulladdresslistCached();
        $allrealnames = zb_UserGetAllRealnames();
        $alltariffs = zb_TariffsGetAllUsers();
        $allusercash = zb_CashGetAllUsers();
        $allusercredits = zb_CreditGetAllUsers();
        $alluserips = zb_UserGetAllIPs();
        if ($alterconf['ONLINE_LAT']) {
            $alluserlat = zb_LatGetAllUsers();
        }
        //additional finance links
        if ($alterconf['FAST_CASH_LINK']) {
            $fastcash = true;
        } else {
            $fastcash = false;
        }
        $tablecells = wf_TableCell(__('Login'));
        $tablecells .= wf_TableCell(__('Address'));
        $tablecells .= wf_TableCell(__('Real Name'));
        $tablecells .= wf_TableCell(__('IP'));
        $tablecells .= wf_TableCell(__('Tariff'));
        // last activity time
        if ($alterconf['ONLINE_LAT']) {
            $tablecells .= wf_TableCell(__('LAT'));
        }
        $tablecells .= wf_TableCell(__('Active'));
        //online detect
        if ($alterconf['DN_ONLINE_DETECT']) {
            $tablecells .= wf_TableCell(__('Users online'));
        }
        $tablecells .= wf_TableCell(__('Balance'));
        $tablecells .= wf_TableCell(__('Credit'));
        $tablerows = wf_TableRow($tablecells, 'row1');
        foreach ($usersarr as $eachlogin) {
            @($usercash = $allusercash[$eachlogin]);
            @($usercredit = $allusercredits[$eachlogin]);
            //finance check
            $activity = web_green_led();
            $activity_flag = 1;
            if ($usercash < '-' . $usercredit) {
                $activity = web_red_led();
                $activity_flag = 0;
            }
            //fast cash link
            if ($fastcash) {
                $financelink = wf_Link('?module=addcash&username='******'skins/icon_dollar.gif', __('Finance operations')), false, '');
            } else {
                $financelink = '';
            }
            $profilelink = $financelink . wf_Link('?module=userprofile&username='******' ' . $eachlogin);
            $tablecells = wf_TableCell($profilelink);
            $tablecells .= wf_TableCell(@$alladdress[$eachlogin]);
            $tablecells .= wf_TableCell(@$allrealnames[$eachlogin]);
            $tablecells .= wf_TableCell(@$alluserips[$eachlogin], '', '', 'sorttable_customkey="' . ip2int(@$alluserips[$eachlogin]) . '"');
            $tablecells .= wf_TableCell(@$alltariffs[$eachlogin]);
            if ($alterconf['ONLINE_LAT']) {
                if (isset($alluserlat[$eachlogin])) {
                    $cUserLat = date("Y-m-d H:i:s", $alluserlat[$eachlogin]);
                } else {
                    $cUserLat = __('No');
                }
                $tablecells .= wf_TableCell($cUserLat);
            }
            $tablecells .= wf_TableCell($activity, '', '', 'sorttable_customkey="' . $activity_flag . '"');
            if ($alterconf['DN_ONLINE_DETECT']) {
                if (file_exists(DATA_PATH . 'dn/' . $eachlogin)) {
                    $online_flag = 1;
                } else {
                    $online_flag = 0;
                }
                $tablecells .= wf_TableCell(web_bool_star($online_flag), '', '', 'sorttable_customkey="' . $online_flag . '"');
            }
            $tablecells .= wf_TableCell($usercash);
            $tablecells .= wf_TableCell($usercredit);
            $tablerows .= wf_TableRow($tablecells, 'row3');
        }
        $result = wf_TableBody($tablerows, '100%', '0', 'sortable');
        $result .= wf_tag('b') . __('Total') . ': ' . wf_tag('b', true) . sizeof($usersarr);
    } else {
        $result = __('Any users found');
    }
    return $result;
}
コード例 #17
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 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;
 }
コード例 #18
0
ファイル: api.megogo.php プロジェクト: carriercomm/Ubilling
 /**
  * Renders ajax data subscriptions
  * 
  * @return void
  */
 public function subscribtionsListAjax()
 {
     $allAddress = zb_AddressGetFulladdresslistCached();
     $allRealNames = zb_UserGetAllRealnames();
     $allBalance = zb_UserGetAllBalance();
     $result = '{ 
               "aaData": [ ';
     if (!empty($this->allSubscribers)) {
         foreach ($this->allSubscribers as $io => $each) {
             $userLink = wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . @$allAddress[$each['login']], false);
             $userLink = $this->jqDtFilter($userLink);
             @($userRealName = $this->jqDtFilter($allRealNames[$each['login']]));
             $actFlag = $this->jqDtFilter(web_bool_led($each['active'], false));
             $primFlag = $this->jqDtFilter(web_bool_led($each['primary'], false));
             $freeperiodFlag = $this->jqDtFilter(web_bool_led($each['freeperiod'], false));
             $actLinks = wf_Link(self::URL_ME . '&' . self::URL_SUBVIEW . '&subid=' . $each['id'], wf_img('skins/icon_edit.gif'));
             $actLinks = $this->jqDtFilter($actLinks);
             @($userCash = $this->jqDtFilter($allBalance[$each['login']]));
             $result .= '
                 [
                 "' . $each['id'] . '",
                 "' . $userLink . '",
                 "' . $userRealName . '",
                 "' . $userCash . '",
                 "' . @$this->allTariffs[$each['tariffid']]['name'] . '",
                 "' . $each['actdate'] . '",
                 "' . $actFlag . '",
                 "' . $primFlag . '",
                 "' . $freeperiodFlag . '",
                 "' . $actLinks . '"
                 ],';
         }
     }
     $result = zb_CutEnd($result);
     $result .= '] 
     }';
     die($result);
 }
コード例 #19
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 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;
 }
コード例 #20
0
ファイル: index.php プロジェクト: nightflyza/Ubilling
 /**
  * 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);
 }
コード例 #21
0
ファイル: index.php プロジェクト: syscenter/ubilling-sms
 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;
 }
コード例 #22
0
ファイル: api.banksta.php プロジェクト: l1ght13aby/Ubilling
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);
}
コード例 #23
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
                     $result[$mac] = $rssi;
                 }
             }
         }
         return $result;
     }
 }
 // Main code part
 $alter_config = $ubillingConfig->getAlter();
 if ($alter_config['MTSIGMON_ENABLED']) {
     $sigmon = new MTSIGMON();
     $allMonitoredDevices = $sigmon->getDevices();
     $allusermacs = zb_UserGetAllMACs();
     $alladdress = zb_AddressGetFullCityaddresslist();
     $alltariffs = zb_TariffsGetAllUsers();
     $allrealnames = zb_UserGetAllRealnames();
     $alluserips = zb_UserGetAllIPs();
     $result = '';
     $hlightmac = '';
     //hlight user mac sub
     if (isset($_GET['username'])) {
         $login = mysql_real_escape_string($_GET['username']);
         $userip = zb_UserGetIP($login);
         $usermac = zb_MultinetGetMAC($userip);
         $hlightmac = $usermac;
     }
     if (!empty($allMonitoredDevices)) {
         foreach ($allMonitoredDevices as $io => $eachdevice) {
             $userCounter = 0;
             $hostdata = $sigmon->deviceQuery($eachdevice['ip'], $eachdevice['community']);
             $result .= wf_tag('h2', false) . wf_img('skins/wifi.png') . ' ' . $eachdevice['location'] . ' - ' . $eachdevice['ip'] . wf_tag('h2', true);
コード例 #24
0
ファイル: api.cess.php プロジェクト: l1ght13aby/Ubilling
/**
 * Renders printable HTML sales slip
 * 
 * @param int $paymentid
 * @return string
 */
function zb_PrintCheck($paymentid)
{
    $paymentdata = zb_PaymentGetData($paymentid);
    $login = $paymentdata['login'];
    $templatebody = zb_PrintCheckLoadTemplate();
    $allfioz = zb_UserGetAllRealnames();
    $alladdress = zb_AddressGetFullCityaddresslist();
    $useraddress = $alladdress[$login];
    $agent_data = zb_AgentAssignedGetDataFast($login, $useraddress);
    $cassnames = zb_PrintCheckLoadCassNames();
    $cday = date("d");
    $cmonth = date("m");
    $month_array = months_array();
    $cmonth_name = $month_array[$cmonth];
    $cyear = curyear();
    $morph = new UBMorph();
    //forming template data
    @($templatedata['{PAYID}'] = $paymentdata['id']);
    @($templatedata['{PAYIDENC}'] = zb_NumEncode($paymentdata['id']));
    @($templatedata['{PAYDATE}'] = $paymentdata['date']);
    @($templatedata['{PAYSUMM}'] = $paymentdata['summ']);
    @($templatedata['{PAYSUMM_LIT}'] = $morph->sum2str($paymentdata['summ']));
    // omg omg omg
    @($templatedata['{REALNAME}'] = $allfioz[$login]);
    @($templatedata['{BUHNAME}'] = 'а відки я знаю?');
    @($templatedata['{CASNAME}'] = $cassnames[whoami()]);
    @($templatedata['{PAYTARGET}'] = 'Оплата за послуги / ' . $paymentdata['date']);
    @($templatedata['{FULLADDRESS}'] = $useraddress);
    @($templatedata['{CDAY}'] = $cday);
    @($templatedata['{CMONTH}'] = rcms_date_localise($cmonth_name));
    @($templatedata['{CYEAR}'] = $cyear);
    @($templatedata['{DAYPAYID}'] = zb_PrintCheckGetDayNum($paymentdata['id'], $paymentdata['date']));
    //contragent full data
    @($templatedata['{AGENTEDRPO}'] = $agent_data['edrpo']);
    @($templatedata['{AGENTNAME}'] = $agent_data['contrname']);
    @($templatedata['{AGENTID}'] = $agent_data['id']);
    @($templatedata['{AGENTBANKACC}'] = $agent_data['bankacc']);
    @($templatedata['{AGENTBANKNAME}'] = $agent_data['bankname']);
    @($templatedata['{AGENTBANKCODE}'] = $agent_data['bankcode']);
    @($templatedata['{AGENTIPN}'] = $agent_data['ipn']);
    @($templatedata['{AGENTLICENSE}'] = $agent_data['licensenum']);
    @($templatedata['{AGENTJURADDR}'] = $agent_data['juraddr']);
    @($templatedata['{AGENTPHISADDR}'] = $agent_data['phisaddr']);
    @($templatedata['{AGENTPHONE}'] = $agent_data['phone']);
    //parsing result
    $result = zb_ExportParseTemplate($templatebody, $templatedata);
    return $result;
}
コード例 #25
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='******'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;
 }
コード例 #26
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
    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;
    }
コード例 #27
0
ファイル: api.opayz.php プロジェクト: l1ght13aby/Ubilling
 /**
  * Loads users realnames list into protected property
  * 
  * @return void
  */
 protected function loadRealname()
 {
     $this->allRealnames = zb_UserGetAllRealnames();
 }
コード例 #28
0
ファイル: api.pon.php プロジェクト: nightflyza/Ubilling
 /**
  * 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='******' ' . @$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;
 }
コード例 #29
0
ファイル: api.userside.php プロジェクト: l1ght13aby/Ubilling
 /**
  * Returns existing users full info
  * 
  * @return array
  */
 protected function getUsersList()
 {
     $result = array();
     $allRealNames = zb_UserGetAllRealnames();
     $allContracts = zb_UserGetAllContracts();
     $allUserTags = $this->getAllUsersTags();
     $allUserNotes = zb_UserGetAllNotes();
     $allPaymentIds = $this->getAllUserPaymentIds();
     $allAddresBindings = $this->getAllAddressList();
     $allAptData = $this->getAllAptList();
     $allPhones = zb_UserGetAllPhoneData();
     $allEmails = zb_UserGetAllEmails();
     $allNethosts = $this->getNethostsData();
     $allNetworks = $this->getNetworksData();
     $allRegData = $this->getUserRegData();
     if (!empty($allContracts)) {
         $allContracts = array_flip($allContracts);
     }
     $allContractDates = zb_UserContractDatesGetAll();
     if (!empty($this->allUserData)) {
         foreach ($this->allUserData as $userLogin => $userData) {
             $result[$userLogin]['id'] = $userLogin;
             $result[$userLogin]['login'] = $userLogin;
             $result[$userLogin]['full_name'] = @$allRealNames[$userLogin];
             $result[$userLogin]['flag_corporate'] = 0;
             if ($userData['TariffChange']) {
                 $curMonth = date('n');
                 $curYear = date('Y');
                 $firstDayNextMonth = $curMonth == 12 ? mktime(0, 0, 0, 0, 0, $curYear + 1) : mktime(0, 0, 0, $curMonth + 1, 1);
                 $firstDayNextMonth = date("Y-m-d", $firstDayNextMonth);
             } else {
                 $firstDayNextMonth = '';
             }
             $result[$userLogin]['tariff']['current'][0]['id'] = $userData['Tariff'];
             if ($firstDayNextMonth) {
                 $result[$userLogin]['tariff']['current'][0]['date_finish'] = $firstDayNextMonth;
             }
             if ($userData['TariffChange']) {
                 $result[$userLogin]['tariff']['new'][0]['id'] = $userData['TariffChange'];
                 $result[$userLogin]['tariff']['new'][0]['date_start'] = $firstDayNextMonth;
             }
             $userContract = @$allContracts[$userLogin];
             if ($userContract) {
                 $result[$userLogin]['agreement'][0]['number'] = $userContract;
                 $contractDate = @$allContractDates[$userContract];
                 if ($contractDate) {
                     $result[$userLogin]['agreement'][0]['date'] = $contractDate;
                 }
             }
             $result[$userLogin]['account_number'] = @$allPaymentIds[$userLogin];
             // yep, this is something like Payment ID
             if (isset($allUserTags[$userLogin])) {
                 foreach ($allUserTags[$userLogin] as $tagIo => $eachTagid) {
                     $result[$userLogin]['group'][$tagIo] = $eachTagid;
                 }
             }
             $userNotes = @$allUserNotes[$userLogin];
             if ($userNotes) {
                 $result[$userLogin]['comment'] = $userNotes;
             }
             $result[$userLogin]['balance'] = $userData['Cash'];
             $result[$userLogin]['credit'] = $userData['Credit'];
             $userState = 5;
             // work
             if ($userData['Cash'] < '-' . $userData['Credit']) {
                 $userState = 1;
                 //nomoney
             }
             if ($userData['Passive'] == 1) {
                 $userState = 2;
                 // pause
             }
             if ($userData['Down'] == 1) {
                 $userState = 3;
                 // disable
             }
             if ($userData['Tariff'] == '*_NO_TARIFF_*') {
                 $userState = 4;
                 // new
             }
             $result[$userLogin]['state_id'] = $userState;
             if (isset($allRegData[$userLogin])) {
                 $result[$userLogin]['date_create'] = $allRegData[$userLogin];
                 $result[$userLogin]['date_connect'] = $allRegData[$userLogin];
             } else {
                 $result[$userLogin]['date_create'] = '';
                 $result[$userLogin]['date_connect'] = '';
             }
             $result[$userLogin]['date_activity'] = date("Y-m-d H:i:s", $userData['LastActivityTime']);
             $result[$userLogin]['traffic']['month']['up'] = $userData['U0'];
             $result[$userLogin]['traffic']['month']['down'] = $userData['D0'];
             $result[$userLogin]['discount'] = 0;
             // TODO: to many discount models at this time
             $userApartmentId = @$allAddresBindings[$userLogin];
             if ($userApartmentId) {
                 $aptData = $allAptData[$userApartmentId];
                 $result[$userLogin]['address'][0]['type'] = 'connect';
                 $result[$userLogin]['address'][0]['house_id'] = $aptData['buildid'];
                 $result[$userLogin]['address'][0]['apartment']['id'] = $userApartmentId;
                 $result[$userLogin]['address'][0]['apartment']['full_name'] = $aptData['apt'];
                 $result[$userLogin]['address'][0]['apartment']['number'] = vf($aptData['apt'], 3);
                 if ($aptData['entrance']) {
                     $result[$userLogin]['address'][0]['entrance'] = $aptData['entrance'];
                 }
                 if ($aptData['floor']) {
                     $result[$userLogin]['address'][0]['floor'] = $aptData['floor'];
                 }
             }
             $userPhoneData = @$allPhones[$userLogin];
             if (!empty($userPhoneData)) {
                 if (isset($userPhoneData['phone'])) {
                     $result[$userLogin]['phone'][0]['number'] = $userPhoneData['phone'];
                     $result[$userLogin]['phone'][0]['flag_main'] = 0;
                 }
                 if (isset($userPhoneData['mobile'])) {
                     $result[$userLogin]['phone'][1]['number'] = $userPhoneData['mobile'];
                     $result[$userLogin]['phone'][1]['flag_main'] = 1;
                 }
             }
             $userEmail = @$allEmails[$userLogin];
             if ($userEmail) {
                 $result[$userLogin]['email'][0]['address'] = $userEmail;
                 $result[$userLogin]['email'][0]['flag_main'] = 1;
             }
             $userIp = $userData['IP'];
             $userIp = ip2int($userIp);
             $result[$userLogin]['ip_mac'][0]['ip'] = $userIp;
             $nethostsData = @$allNethosts[$userData['IP']];
             if (!empty($nethostsData)) {
                 $subnetId = $nethostsData['netid'];
                 $userMac = $nethostsData['mac'];
                 $userMac = str_replace(':', '', $userMac);
                 $userMac = strtolower($userMac);
                 // mac lowercased withot delimiters
                 $result[$userLogin]['ip_mac'][0]['mac'] = $userMac;
                 $result[$userLogin]['ip_mac'][0]['ip_net'] = @$allNetworks[$subnetId]['desc'];
             }
             if (isset($this->allCfData[$userLogin])) {
                 $result[$userLogin]['additional_data'] = $this->allCfData[$userLogin];
             }
             //   die(print_r($result, true));
         }
     }
     return $result;
 }
コード例 #30
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
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);
}