Пример #1
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;
}
Пример #2
0
    function stg_show_fulluserlistOld()
    {
        global $alter_conf;
        $allusers = zb_UserGetAllStargazerData();
        $allrealnames = zb_UserGetAllRealnames();
        $alladdress = zb_AddressGetFulladdresslist();
        if ($alter_conf['USER_LINKING_ENABLED']) {
            $alllinkedusers = cu_GetAllLinkedUsers();
            $allparentusers = cu_GetAllParentUsers();
        }
        $totaltraff_i = 0;
        $totaltraff_m = 0;
        $totaltraff = 0;
        $ucount = 0;
        $trueonline = 0;
        $inacacount = 0;
        $tcredit = 0;
        $tcash = 0;
        // LAT column
        if ($alter_conf['ONLINE_LAT']) {
            $lat_col_head = wf_TableCell(__('LAT'));
            $act_offset = 1;
        } else {
            $lat_col_head = '';
            $act_offset = 0;
        }
        //online stars
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_header = wf_TableCell(__('Users online'));
            $true_online_selector = ' col_' . (5 + $act_offset) . ': "select",';
        } else {
            $true_online_header = '';
            $true_online_selector = '';
        }
        //extended filters
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $extfilters = wf_Link('javascript:showfilter();', __('Extended filters'), false);
        } else {
            $extfilters = '';
        }
        //additional finance links
        if ($alter_conf['FAST_CASH_LINK']) {
            $fastcash = true;
        } else {
            $fastcash = false;
        }
        $result = $extfilters;
        $result .= wf_tag('table', false, 'sortable', 'width="100%" id="onlineusers"');
        $headerCells = wf_TableCell(__('Full address'));
        $headerCells .= wf_TableCell(__('Real Name'));
        $headerCells .= wf_TableCell(__('IP'));
        $headerCells .= wf_TableCell(__('Tariff'));
        $headerCells .= $lat_col_head;
        $headerCells .= wf_TableCell(__('Active'));
        $headerCells .= $true_online_header;
        $headerCells .= wf_TableCell(__('Traffic'));
        $headerCells .= wf_TableCell(__('Balance'));
        $headerCells .= wf_TableCell(__('Credit'));
        $headerRow = wf_TableRow($headerCells, 'row1');
        $result .= $headerRow;
        if (!empty($allusers)) {
            foreach ($allusers as $io => $eachuser) {
                $tinet = 0;
                $ucount++;
                $cash = $eachuser['Cash'];
                $credit = $eachuser['Credit'];
                for ($classcounter = 0; $classcounter <= 9; $classcounter++) {
                    $dc = 'D' . $classcounter . '';
                    $uc = 'U' . $classcounter . '';
                    $tinet = $tinet + ($eachuser[$dc] + $eachuser[$uc]);
                }
                $totaltraff = $totaltraff + $tinet;
                $tcredit = $tcredit + $credit;
                $tcash = $tcash + $cash;
                $act = web_green_led() . ' ' . __('Yes');
                //finance check
                if ($cash < '-' . $credit) {
                    $act = web_red_led() . ' ' . __('No');
                    $inacacount++;
                }
                if ($alter_conf['ONLINE_LAT']) {
                    $user_lat = wf_TableCell(date("Y-m-d H:i:s", $eachuser['LastActivityTime']));
                } else {
                    $user_lat = '';
                }
                //online check
                if ($alter_conf['DN_ONLINE_DETECT']) {
                    if (file_exists(DATA_PATH . 'dn/' . $eachuser['login'])) {
                        $online_flag = 1;
                        $trueonline++;
                    } else {
                        $online_flag = 0;
                    }
                    $online_cell = wf_TableCell(web_bool_star($online_flag, true), '', '', 'sorttable_customkey="' . $online_flag . '"');
                } else {
                    $online_cell = '';
                    $online_flag = 0;
                }
                if ($alter_conf['ONLINE_LIGHTER']) {
                    $lighter = 'onmouseover="this.className = \'row2\';" onmouseout="this.className = \'row3\';" ';
                } else {
                    $lighter = '';
                }
                //user linking indicator
                if ($alter_conf['USER_LINKING_ENABLED']) {
                    //is user child?
                    if (isset($alllinkedusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $alllinkedusers[$eachuser['login']], web_corporate_icon(), false);
                    } else {
                        $corporate = '';
                    }
                    //is  user parent?
                    if (isset($allparentusers[$eachuser['login']])) {
                        $corporate = wf_Link('?module=corporate&userlink=' . $allparentusers[$eachuser['login']], web_corporate_icon('Corporate parent'), false);
                    }
                } else {
                    $corporate = '';
                }
                //fast cash link
                if ($fastcash) {
                    $financelink = wf_Link('?module=addcash&username='******'login'] . '#profileending', wf_img('skins/icon_dollar.gif', __('Finance operations')), false);
                } else {
                    $financelink = '';
                }
                $result .= wf_tag('tr', false, 'row3', $lighter);
                $result .= wf_tag('td', false);
                $result .= wf_Link('?module=traffstats&username='******'login'], web_stats_icon(), false);
                $result .= $financelink;
                $result .= wf_Link('?module=userprofile&username='******'login'], web_profile_icon(), false);
                $result .= $corporate;
                $result .= @$alladdress[$eachuser['login']];
                $result .= wf_tag('td', true);
                $result .= wf_TableCell(@$allrealnames[$eachuser['login']]);
                $result .= wf_TableCell($eachuser['IP'], '', '', 'sorttable_customkey="' . ip2int($eachuser['IP']) . '"');
                $result .= wf_TableCell($eachuser['Tariff']);
                $result .= $user_lat;
                $result .= wf_TableCell($act);
                $result .= $online_cell;
                $result .= wf_TableCell(stg_convert_size($tinet), '', '', 'sorttable_customkey="' . $tinet . '"');
                $result .= wf_TableCell(round($eachuser['Cash'], 2));
                $result .= wf_TableCell(round($eachuser['Credit'], 2));
                $result .= wf_tag('tr', true);
            }
        }
        if ($alter_conf['DN_ONLINE_DETECT']) {
            $true_online_counter = wf_TableCell(__('Users online') . ' ' . $trueonline);
        } else {
            $true_online_counter = null;
        }
        $result .= wf_tag('table', true);
        $footerCells = wf_TableCell(__('Total') . ': ' . $ucount);
        $footerCells .= wf_TableCell(__('Active users') . ' ' . ($ucount - $inacacount) . ' / ' . __('Inactive users') . ' ' . $inacacount);
        $footerCells .= $true_online_counter;
        $footerCells .= wf_TableCell(__('Traffic') . ': ' . stg_convert_size($totaltraff));
        $footerCells .= wf_TableCell(__('Total') . ': ' . round($tcash, 2));
        $footerCells .= wf_TableCell(__('Credit total') . ': ' . $tcredit);
        $footerRows = wf_TableRow($footerCells, 'row1');
        $result .= wf_TableBody($footerRows, '100%', '0');
        //extended filters again
        if ($alter_conf['ONLINE_FILTERS_EXT']) {
            $filtercode = wf_tag('script', false, '', 'language="javascript" type="text/javascript"');
            $filtercode .= '
            //<![CDATA[
            function showfilter() {
            var onlinefilters = {
		btn: false,
          	col_' . (4 + $act_offset) . ': "select",
               ' . $true_online_selector . '
		btn_text: ">"
               }
                setFilterGrid("onlineusers",0,onlinefilters);
             }
            //]]>';
            $filtercode .= wf_tag('script', true);
        } else {
            $filtercode = '';
        }
        $result .= $filtercode;
        return $result;
    }
Пример #3
0
 /**
  * Renders subscribtion management form
  * 
  * @param int $subId
  * 
  * @return string
  */
 public function renderSubManagerForm($subId)
 {
     $subId = vf($subId, 3);
     $result = '';
     if (isset($this->allSubscribers[$subId])) {
         $baseUrl = self::URL_ME . '&' . self::URL_SUBVIEW . '&subid=' . $subId;
         $subData = $this->allSubscribers[$subId];
         $cells = wf_TableCell(__('ID'));
         $cells .= wf_TableCell(__('User'));
         $cells .= wf_TableCell(__('Tariff'));
         $cells .= wf_TableCell(__('Date'));
         $cells .= wf_TableCell(__('Active'));
         $cells .= wf_TableCell(__('Primary'));
         $cells .= wf_TableCell(__('Free period'));
         $rows = wf_TableRow($cells, 'row1');
         $cells = wf_TableCell($subData['id']);
         $cells .= wf_TableCell(wf_Link('?module=userprofile&username='******'login'], web_profile_icon() . ' ' . $subData['login']));
         $cells .= wf_TableCell($this->allTariffs[$subData['tariffid']]['name']);
         $cells .= wf_TableCell($subData['actdate']);
         $cells .= wf_TableCell(web_bool_led($subData['active']));
         $cells .= wf_TableCell(web_bool_led($subData['primary']));
         $cells .= wf_TableCell(web_bool_led($subData['freeperiod']));
         $rows .= wf_TableRow($cells, 'row3');
         $result = wf_TableBody($rows, '100%', 0, '');
         $result .= wf_delimiter();
         if (cfr('ROOT')) {
             $controls = wf_Link($baseUrl . '&maction=subscribe', web_bool_star(1) . ' ' . __('Subscribe with Megogo API'), true, 'ubButton') . wf_tag('br');
             $controls .= wf_Link($baseUrl . '&maction=unsubscribe', web_bool_star(0) . ' ' . __('Unubscribe with Megogo API'), true, 'ubButton') . wf_tag('br');
             $controls .= wf_Link($baseUrl . '&maction=activate', web_bool_led(1) . ' ' . __('Activate subscription'), true, 'ubButton') . wf_tag('br');
             $controls .= wf_Link($baseUrl . '&maction=deactivate', web_bool_led(0) . ' ' . __('Deactivate subscription'), true, 'ubButton') . wf_tag('br');
             $controls .= wf_JSAlertStyled($baseUrl . '&maction=delete', web_delete_icon() . ' ' . __('Delete subscription'), $this->messages->getDeleteAlert(), 'ubButton');
             $result .= $controls;
         }
     } else {
         $result = $this->messages->getStyledMessage(__('Something went wrong') . ' EX_ID_NOEXISTS', 'error');
     }
     return $result;
 }