コード例 #1
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 function web_TstatsShow()
 {
     $allclasses = zb_DirectionsGetAll();
     $classtraff = array();
     $traffCells = wf_TableCell(__('Traffic classes'), '20%');
     $traffCells .= wf_TableCell(__('Traffic'), '20%');
     $traffCells .= wf_TableCell(__('Traffic classes'));
     $traffRows = wf_TableRow($traffCells, 'row1');
     if (!empty($allclasses)) {
         foreach ($allclasses as $eachclass) {
             $d_name = 'D' . $eachclass['rulenumber'];
             $u_name = 'U' . $eachclass['rulenumber'];
             $query_d = "SELECT SUM(`" . $d_name . "`) FROM `users`";
             $query_u = "SELECT SUM(`" . $u_name . "`) FROM `users`";
             $classdown = simple_query($query_d);
             $classdown = $classdown['SUM(`' . $d_name . '`)'];
             $classup = simple_query($query_u);
             $classup = $classup['SUM(`' . $u_name . '`)'];
             $classtraff[$eachclass['rulename']] = $classdown + $classup;
         }
         if (!empty($classtraff)) {
             $total = max($classtraff);
             foreach ($classtraff as $name => $count) {
                 $traffCells = wf_TableCell($name);
                 $traffCells .= wf_TableCell(stg_convert_size($count), '', '', 'sorttable_customkey="' . $count . '"');
                 $traffCells .= wf_TableCell(web_bar($count, $total), '', '', 'sorttable_customkey="' . $count . '"');
                 $traffRows .= wf_TableRow($traffCells, 'row3');
             }
         }
     }
     $result = wf_TableBody($traffRows, '100%', 0, 'sortable');
     show_window(__('Traffic report'), $result);
 }
コード例 #2
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;
 }
コード例 #3
0
ファイル: api.swpoll.php プロジェクト: l1ght13aby/Ubilling
/**
 * Cisco memory usage data parser
 * 
 * @return string
 */
function sp_parse_ciscomemory($data)
{
    if (!empty($data)) {
        $data = explode('=', $data);
        $result = vf($data[1], 3);
        $result = trim($result);
        $result = stg_convert_size($result);
        return $result;
    } else {
        return __('Empty reply received');
    }
}
コード例 #4
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 public function render()
 {
     $this->form->InputForm(null, 'POST', __('Save'), null, null, null, self::FORM_NAME, null);
     // Block 1: Authorization Data
     $this->form->addmessage(__('Authorization Data'));
     $inputs = array('username', 'password');
     foreach ($inputs as $input) {
         $_hide = $input == 'password' ? $this->config['PASSWORDSHIDE'] : false;
         $contents = $this->form->text_box(self::FORM_NAME . '[' . $input . ']', $this->options[$input], 0, 0, $_hide, null);
         $this->form->addrow(__($input), $contents);
     }
     unset($inputs);
     // Connection-sensetive options:
     if ($this->api->connect($this->_ip, $this->options['username'], $this->options['password'])) {
         // Block 2: Interface settings
         $this->form->addmessage(__('Interface settings'));
         $this->get_ifaces();
         $selects = array('users', 'graph');
         foreach ($selects as $select) {
             $opt = $select . '_interface';
             $name = self::FORM_NAME . '[' . $opt . ']';
             $current = isset($this->options[$opt]) ? $this->options[$opt] : null;
             $contents = $this->form->select_tag($name, $this->_if, $current);
             $this->form->addrow(__(ucwords($select) . ' Interface'), $contents);
         }
         unset($selects);
         // Block 3: Setting On* scripts behavior for this NAS
         $this->form->addmessage(__('Setting On* scripts behavior for this NAS'));
         $checkboxes = array('firewall', 'arp', 'queue', 'dhcp', 'ppp');
         foreach ($checkboxes as $checkbox) {
             $opt = 'manage_' . $checkbox;
             $name = self::FORM_NAME . '[' . $opt . ']';
             $current = isset($this->options[$opt]) ? true : false;
             $contents = $this->form->checkbox($name, true, null, $current, null);
             $this->form->addrow(__('Manage ' . $checkbox), $contents);
         }
         unset($checkboxes);
         // Block 4: MikroTik General Information
         $this->form->addmessage(__('MikroTik General Information'));
         $status = $this->api->command('/system/resource/print');
         foreach ($status[0] as $key => $value) {
             switch ($key) {
                 case 'uptime':
                     $parse = array('w' => ' ' . __('w') . ' ', 'd' => ' ' . __('d') . ' ');
                     $search = array_keys($parse);
                     $replace = array_values($parse);
                     $value = str_replace($search, $replace, $value);
                     $this->form->addrow(__($key), $value);
                     break;
                 case 'version':
                     $this->form->addrow(__($key), $value);
                     list($value) = explode('.', $value);
                     $this->form->hidden(self::FORM_NAME . '[' . $key . ']', $value);
                     break;
                 case 'free-memory':
                 case 'total-memory':
                 case 'free-hdd-space':
                 case 'total-hdd-space':
                     $value = stg_convert_size($value);
                     $this->form->addrow(__($key), $value);
                     break;
                 case 'cpu-frequency':
                     $this->form->addrow(__($key), $value . ' MHz');
                     break;
                 case 'cpu-load':
                     $this->form->addrow(__($key), $value . ' %');
                     break;
                 case 'bad-blocks':
                     $style = $value > 0 ? 'color:red;' : null;
                     $this->form->addrow(__($key), '<span style="' . $style . '">' . $value . ' %</span>');
                     break;
                 default:
                     if (!empty($value)) {
                         $this->form->addrow(__($key), $value);
                     }
                     break;
             }
         }
     }
     /* Uncomment for debug window show:
      * if ( !is_null($this->api->debug_str) ) deb($this->api->debug_str);
      */
     return $this->form->show(true);
 }
コード例 #5
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);
}
コード例 #6
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
    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;
    }
コード例 #7
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 function web_ConfigsUbillingList()
 {
     $downloadable = array('config/billing.ini', 'config/mysql.ini', 'config/alter.ini', 'config/ymaps.ini', 'config/catv.ini', 'config/photostorage.ini', 'config/dhcp/global.template', 'config/dhcp/subnets.template', 'config/dhcp/option82.template', 'config/dhcp/option82_vpu.template', 'userstats/config/mysql.ini', 'userstats/config/userstats.ini', 'userstats/config/tariffmatrix.ini');
     if (!empty($downloadable)) {
         $cells = wf_TableCell(__('Date'));
         $cells .= wf_TableCell(__('Size'));
         $cells .= wf_TableCell(__('Filename'));
         $rows = wf_TableRow($cells, 'row1');
         foreach ($downloadable as $eachConfig) {
             if (file_exists($eachConfig)) {
                 $fileDate = filectime($eachConfig);
                 $fileDate = date("Y-m-d H:i:s", $fileDate);
                 $fileSize = filesize($eachConfig);
                 $fileSize = stg_convert_size($fileSize);
                 $downloadLink = wf_Link('?module=backups&download=' . base64_encode($eachConfig), $eachConfig, false, '');
                 $cells = wf_TableCell($fileDate);
                 $cells .= wf_TableCell($fileSize);
                 $cells .= wf_TableCell($downloadLink);
                 $rows .= wf_TableRow($cells, 'row3');
             } else {
                 $cells = wf_TableCell('');
                 $cells .= wf_TableCell('');
                 $cells .= wf_TableCell($eachConfig);
                 $rows .= wf_TableRow($cells, 'row3');
             }
         }
         $result = wf_TableBody($rows, '100%', '0', 'sortable');
     }
     return $result;
 }
コード例 #8
0
function web_DBCleanupForm()
{
    $oldLogs = zb_DBCleanupGetLogs();
    $oldDetailstat = zb_DBCleanupGetDetailstat();
    $cleanupData = $oldLogs + $oldDetailstat;
    $result = '';
    $totalRows = 0;
    $totalSize = 0;
    $totalCount = 0;
    $cells = wf_TableCell(__('Table name'));
    $cells .= wf_TableCell(__('Rows'));
    $cells .= wf_TableCell(__('Size'));
    $cells .= wf_TableCell(__('Actions'));
    $rows = wf_TableRow($cells, 'row1');
    if (!empty($cleanupData)) {
        foreach ($cleanupData as $io => $each) {
            $cells = wf_TableCell($each['name']);
            $cells .= wf_TableCell($each['rows']);
            $cells .= wf_TableCell(stg_convert_size($each['size']), '', '', 'sorttable_customkey="' . $each['size'] . '"');
            $actlink = wf_JSAlert("?module=backups&tableclean=" . $each['name'], web_delete_icon(), 'Are you serious');
            $cells .= wf_TableCell($actlink);
            $rows .= wf_TableRow($cells, 'row3');
            $totalRows = $totalRows + $each['rows'];
            $totalSize = $totalSize + $each['size'];
            $totalCount = $totalCount + 1;
        }
    }
    $result = wf_TableBody($rows, '100%', '0', 'sortable');
    $result .= wf_tag('b') . __('Total') . ': ' . $totalCount . ' / ' . $totalRows . ' / ' . stg_convert_size($totalSize) . wf_tag('b', true);
    return $result;
}
コード例 #9
0
ファイル: index.php プロジェクト: l1ght13aby/Ubilling
 function web_DSShowDayStats($login, $day, $page = 0)
 {
     $traffclasse_raw = zb_DirectionsGetAll();
     $tc = array();
     if (!empty($traffclasse_raw)) {
         foreach ($traffclasse_raw as $io => $eachtc) {
             $tc[$eachtc['rulenumber']] = $eachtc['rulename'];
         }
     }
     $login = mysql_real_escape_string($login);
     $page = vf($page);
     $day = vf($day);
     $daystats = ds_GetDayStats($login, $day, $page);
     $result = '<table width="100%" border="0" class="sortable">';
     $result .= '
                 <tr class="row1">
                 <td>' . __('Session start') . '</td>
                 <td>' . __('Session end') . '</td>
                 <td>' . __('IP') . '</td>
                 <td>' . __('Traffic classes') . '</td>
                 <td>' . __('Downloaded') . '/' . __('Uploaded') . '</td>
                 <td>' . __('Cash') . '</td>
                 </tr>
                 ';
     if (!empty($daystats)) {
         foreach ($daystats as $io => $eachtraff) {
             $result .= '
                 <tr class="row3">
                 <td>' . $eachtraff['startTime'] . '</td>
                 <td>' . $eachtraff['endTime'] . '</td>
                 <td><a href="http://whois.domaintools.com/' . $eachtraff['IP'] . '" target="_BLANK">
                <img src="skins/icon_whois_small.jpg"></a>
                <a href="http://' . $eachtraff['IP'] . '">' . $eachtraff['IP'] . '</td>
                 <td>' . @$tc[$eachtraff['dir']] . '</td>
                 <td sorttable_customkey="' . ($eachtraff['down'] + $eachtraff['up']) . '">' . stg_convert_size($eachtraff['down']) . ' / ' . stg_convert_size($eachtraff['up']) . '</td>
                 <td>' . round($eachtraff['cash'], 3) . '</td>
                 </tr>
                 ';
         }
     }
     $result .= '</table>';
     return $result;
 }
コード例 #10
0
ファイル: index.php プロジェクト: nightflyza/Ubilling
 /**
  * 
  * @param type $login
  * @param type $day
  * @param int $page
  * @return string
  */
 function web_DSShowDayStats($login, $day, $page = 0)
 {
     $traffclasse_raw = zb_DirectionsGetAll();
     $tc = array();
     if (!empty($traffclasse_raw)) {
         foreach ($traffclasse_raw as $io => $eachtc) {
             $tc[$eachtc['rulenumber']] = $eachtc['rulename'];
         }
     }
     $login = mysql_real_escape_string($login);
     $page = vf($page);
     $day = vf($day);
     $daystats = ds_GetDayStats($login, $day, $page);
     $result = '';
     $cells = wf_TableCell(__('Session start'));
     $cells .= wf_TableCell(__('Session end'));
     $cells .= wf_TableCell(__('IP'));
     $cells .= wf_TableCell(__('Traffic classes'));
     $cells .= wf_TableCell(__('Downloaded') . '/' . __('Uploaded'));
     $cells .= wf_TableCell(__('Cash'));
     $rows = wf_TableRow($cells, 'row1');
     if (!empty($daystats)) {
         foreach ($daystats as $io => $eachtraff) {
             $cells = wf_TableCell($eachtraff['startTime']);
             $cells .= wf_TableCell($eachtraff['endTime']);
             $whoisLink = wf_Link('?module=whois&ip=' . $eachtraff['IP'], wf_img('skins/icon_whois_small.png', __('Whois')));
             $webLink = wf_Link('http://' . $eachtraff['IP'], $eachtraff['IP']);
             $cells .= wf_TableCell($whoisLink . ' ' . $webLink);
             $cells .= wf_TableCell(@$tc[$eachtraff['dir']]);
             $cells .= wf_TableCell(stg_convert_size($eachtraff['down']) . ' / ' . stg_convert_size($eachtraff['up']), '', '', 'sorttable_customkey="' . ($eachtraff['down'] + $eachtraff['up']) . '"');
             $cells .= wf_TableCell(round($eachtraff['cash'], 3));
             $rows .= wf_TableRow($cells, 'row3');
         }
     }
     $result .= wf_TableBody($rows, '100%', 0, 'sortable');
     return $result;
 }