示例#1
0
    case 'user':
        $from = !empty($_POST['from']) ? $_POST['from'] : time() - 60 * 60 * 24;
        $to = !empty($_POST['to']) ? $_POST['to'] : time();
        $net = !empty($_POST['net']) ? $_POST['net'] : 0;
        $customer = !empty($_POST['customerid']) ? $_POST['customerid'] : 0;
        if (is_array($from)) {
            $from = mktime($from['Hour'], $from['Minute'], 0, $from['Month'], $from['Day'], $from['Year']);
        }
        if (is_array($to)) {
            $to = mktime($to['Hour'], $to['Minute'], 0, $to['Month'], $to['Day'], $to['Year']);
        }
        $SMARTY->assign('datefrom', $from);
        $SMARTY->assign('dateto', $to);
        $SMARTY->assign('net', $net);
        $SMARTY->assign('customer', $customer);
        $traffic = Traffic($from, $to, $net, $customer, isset($_POST['order']) ? $_POST['order'] : '', isset($_POST['limit']) ? $_POST['limit'] : 0);
        break;
    default:
        // set filter window
        $SMARTY->assign('netlist', $LMS->GetNetworks());
        $SMARTY->assign('nodelist', $LMS->GetNodeList());
        if (!isset($CONFIG['phpui']['big_networks']) || !chkconfig($CONFIG['phpui']['big_networks'])) {
            $SMARTY->assign('customers', $LMS->GetCustomerNames());
        }
        $bars = 0;
        break;
}
if (isset($traffic)) {
    $SMARTY->assign('download', $traffic['download']);
    $SMARTY->assign('upload', $traffic['upload']);
}
示例#2
0
<?php

/* LMS version 1.11-git
 *
 *  (C) Copyright 2001-2012 LMS Developers
 *
 *  Please, see the doc/AUTHORS for more information about authors!
 *
 *  This program is free software; you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License Version 2 as
 *  published by the Free Software Foundation.
 *
 *  This program is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 *  USA.
 *
 *  $Id$
 */
$layout['pagetitle'] = trans('Network Statistics');
$traffic = Traffic(time() - 60 * 60 * 24 * 365, time(), 0, $SESSION->is_set('trafficorder') ? $SESSION->get('trafficorder') : 'download');
$SMARTY->assign('download', $traffic['download']);
$SMARTY->assign('upload', $traffic['upload']);
$SMARTY->assign('bars', TRUE);
示例#3
0
文件: traffic.php 项目: kornelek/lms
 *  You should have received a copy of the GNU General Public License
 *  along with this program; if not, write to the Free Software
 *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
 *  USA.
 *
 *  $Id$
 */
$layout['pagetitle'] = trans('Network Statistics');
$bars = 1;
if (isset($_GET['bar']) && isset($_POST['order'])) {
    $SESSION->save('trafficorder', $_POST['order']);
}
$bar = isset($_GET['bar']) ? $_GET['bar'] : '';
switch ($bar) {
    case 'user':
        $traffic = Traffic($_POST['from'], $_POST['to'], $_POST['net'], $_POST['order'], $_POST['limit']);
        break;
    default:
        // set filter window
        $SMARTY->assign('netlist', $LMS->GetNetworks());
        $SMARTY->assign('nodelist', $LMS->GetNodeList());
        $bars = 0;
        break;
}
if (isset($traffic)) {
    $SMARTY->assign('download', $traffic['download']);
    $SMARTY->assign('upload', $traffic['upload']);
}
// f**k this anyway... Maybe i write function in LMS:: for this, but not now
$starttime = $DB->GetOne('SELECT MIN(dt) FROM stats');
$endtime = $DB->GetOne('SELECT MAX(dt) FROM stats');
示例#4
0
function module_main()
{
    global $SMARTY, $SESSION;
    $bars = 1;
    if (isset($_GET['bar']) && isset($_POST['order'])) {
        $SESSION->save('trafficorder', $_POST['order']);
    }
    $bar = isset($_GET['bar']) ? $_GET['bar'] : '';
    $owner = ConfigHelper::checkConfig('userpanel.owner_stats') ? $SESSION->id : NULL;
    switch ($bar) {
        case 'hour':
            $traffic = Traffic(time() - 60 * 60, time(), $owner, 'download');
            break;
        case 'day':
            $traffic = Traffic(time() - 60 * 60 * 24, time(), $owner, 'download');
            break;
        case 'year':
            $traffic = Traffic(time() - 60 * 60 * 24 * 365, time(), $owner, 'download');
            break;
        case 'all':
            $traffic = Traffic(0, time(), $owner, 'download');
            break;
        case 'month':
        default:
            $traffic = Traffic(time() - 60 * 60 * 24 * 30, time(), $owner, 'download');
            break;
    }
    if (isset($traffic)) {
        $SMARTY->assign('download', $traffic['download']);
        $SMARTY->assign('upload', $traffic['upload']);
    }
    $layout['pagetitle'] = trans('Network Statistics');
    $SMARTY->assign('bar', $bar ? $bar : 'month');
    $SMARTY->display('module:stats.html');
}