Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 1674 → Rev 1675

/web/acc/manager/stats/README
26,8 → 26,8
 
3. LICENSE
 
vnstat PHP frontend 1.5.1
Copyright (c)2006-2008 Bjorge Dijkstra (bjd@jooz.net)
vnstat PHP frontend 1.5.2
Copyright (c)2006-2011 Bjorge Dijkstra (bjd@jooz.net)
 
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
/web/acc/manager/stats/config.php
17,7 → 17,7
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// for more information.
//
error_reporting(E_ALL | E_NOTICE);
27,23 → 27,40
//
// edit these to reflect your particular situation
//
$locale = 'en_US.UTF-8';
$language = 'en';
if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE']))
{
$Langue = explode(",",$_SERVER['HTTP_ACCEPT_LANGUAGE']);
$Language = strtolower(substr(chop($Langue[0]),0,2));
}
if($Language == 'fr')
{
$locale = 'fr_FR.UTF-8';
$language = 'fr';
$title = 'Traffic Internet sortant';
date_default_timezone_set("Europe/Paris");
}
else
{
$locale = 'en_US.UTF-8';
$language = 'en';
$title = 'Internet outbound';
date_default_timezone_set("Europe/London");
}
 
// list of network interfaces monitored by vnStat
$iface_list = array('eth0');
$iface_list = array('enp0s3');
 
//
// optional names for interfaces
// if there's no name set for an interface then the interface identifier
// will be displayed instead
//
$iface_title['eth0'] = 'Wire';
//
$iface_title['enp0s3'] = $title;
 
//
// There are two possible sources for vnstat data. If the $vnstat_bin
// variable is set then vnstat is called directly from the PHP script
// to get the interface data.
// to get the interface data.
//
// The other option is to periodically dump the vnstat interface data to
// a file (e.g. by a cronjob). In that case the $vnstat_bin variable
52,14 → 69,17
//
// You can generate vnstat dumps with the command:
// vnstat --dumpdb -i $iface > /path/to/data_dir/vnstat_dump_$iface
//
//
$vnstat_bin = '/usr/bin/vnstat';
$data_dir = './dumps';
$data_dir = '/var/spool/vnstat';
 
// graphics format to use: svg or png
$graph_format='svg';
 
// preferred byte notation. null auto chooses. otherwise use one of
// 'TB','GB','MB','KB'
$byte_notation = null;
 
// Font to use for PNG graphs
define('GRAPH_FONT',dirname(__FILE__).'/VeraBd.ttf');
 
68,5 → 88,8
 
// Default theme
define('DEFAULT_COLORSCHEME', 'light');
// SVG Depth scaling factor
define('SVG_DEPTH_SCALING', 1);
 
?>
/web/acc/manager/stats/graph.php
17,7 → 17,7
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// for more information.
//
require 'config.php';
32,7 → 32,7
{
return imagecolorallocatealpha($im, $colors[0], $colors[1], $colors[2], $colors[3]);
}
 
function init_image()
{
global $im, $xlm, $xrm, $ytm, $ybm, $iw, $ih,$graph, $cl, $iface, $colorscheme, $style;
42,7 → 42,7
 
//
// image object
//
//
$xlm = 70;
$xrm = 20;
$ytm = 35;
50,7 → 50,7
if ($graph == 'small')
{
$iw = 300 + $xrm + $xlm;
$ih = 100 + $ytm + $ybm;
$ih = 100 + $ytm + $ybm;
}
else
{
75,10 → 75,10
$cl['rx_border'] = allocate_color($im, $cs['rx_border']);
$cl['tx'] = allocate_color($im, $cs['tx']);
$cl['tx_border'] = allocate_color($im, $cs['tx_border']);
 
imagefilledrectangle($im,0,0,$iw,$ih,$cl['image_background']);
imagefilledrectangle($im,$xlm,$ytm,$iw-$xrm,$ih-$ybm, $cl['background']);
 
$x_step = ($iw - $xlm - $xrm) / 12;
$depth = ($x_step / 8) + 4;
imagefilledpolygon($im, array($xlm, $ytm, $xlm, $ih - $ybm, $xlm - $depth, $ih - $ybm + $depth, $xlm - $depth, $ytm + $depth), 4, $cl['background_2']);
89,7 → 89,7
$bbox = imagettfbbox(10, 0, GRAPH_FONT, $text);
$textwidth = $bbox[2] - $bbox[0];
imagettftext($im, 10, 0, ($iw-$textwidth)/2, ($ytm/2), $cl['text'], GRAPH_FONT, $text);
 
}
 
function draw_border()
98,16 → 98,16
 
imageline($im, 0, 0,$iw-1, 0, $cl['border']);
imageline($im, 0,$ih-1,$iw-1,$ih-1, $cl['border']);
imageline($im, 0, 0, 0,$ih-1, $cl['border']);
imageline($im, 0, 0, 0,$ih-1, $cl['border']);
imageline($im, $iw-1, 0,$iw-1,$ih-1, $cl['border']);
}
 
function draw_grid($x_ticks, $y_ticks)
{
global $im, $cl, $iw, $ih, $xlm, $xrm, $ytm, $ybm;
$x_step = ($iw - $xlm - $xrm) / $x_ticks;
$x_step = ($iw - $xlm - $xrm) / ($x_ticks ?: 1);
$y_step = ($ih - $ytm - $ybm) / $y_ticks;
 
$depth = 10;//($x_step / 8) + 4;
 
$ls = array($cl['grid_stipple_1'],$cl['grid_stipple_2']);
119,14 → 119,13
}
for ($i=$ytm;$i<=($ih-$ybm); $i += $y_step)
{
imageline($im, $xlm, $i, $iw - $xrm, $i, IMG_COLOR_STYLED);
imageline($im, $xlm, $i, $iw - $xrm, $i, IMG_COLOR_STYLED);
imageline($im, $xlm, $i, $xlm - $depth, $i + $depth, IMG_COLOR_STYLED);
}
imageline($im, $xlm, $ytm, $xlm, $ih - $ybm, $cl['border']);
imageline($im, $xlm, $ih - $ybm, $iw - $xrm, $ih - $ybm, $cl['border']);
}
 
function draw_data($data)
{
global $im,$cl,$iw,$ih,$xlm,$xrm,$ytm,$ybm;
140,7 → 139,7
$unit = 'K';
$offset = 0;
$gr_h = $ih - $ytm - $ybm;
$x_step = ($iw - $xlm - $xrm) / $x_ticks;
$x_step = ($iw - $xlm - $xrm) / ($x_ticks ?: 1);
$y_step = ($ih - $ytm - $ybm) / $y_ticks;
$bar_w = ($x_step / 2) ;
 
168,7 → 167,7
{
$prescale = $prescale * 1024;
$y_scale = $y_scale / 1024;
if ($unit == 'K')
if ($unit == 'K')
$unit = 'M';
else if ($unit == 'M')
$unit = 'G';
178,7 → 177,7
}
 
draw_grid($x_ticks, $y_ticks);
 
//
// graph scale factor (per pixel)
//
185,9 → 184,9
imagesetthickness($im, 1);
$sf = ($prescale * $y_scale * $y_ticks) / $gr_h;
 
if ($data[0] == 'nodata')
if (count($data) == 0)
{
$text = 'no data available';
$text = T('no data available');
$bbox = imagettfbbox(10, 0, GRAPH_FONT, $text);
$textwidth = $bbox[2] - $bbox[0];
imagettftext($im, 10, 0, ($iw-$textwidth)/2, $ytm + 80, $cl['text'], GRAPH_FONT, $text);
196,26 → 195,26
{
//
// draw bars
//
//
for ($i=0; $i<$x_ticks; $i++)
{
$x = $xlm + ($i * $x_step);
$y = $ytm + ($ih - $ytm - $ybm) - (($data[$i]['rx'] - $offset) / $sf);
 
$depth = $x_step / 8;
$space = 0;
 
$x1 = $x;
$y1 = $y;
$x2 = $x + $bar_w - $space;
$y2 = $ih - $ybm;
 
imagefilledrectangle($im, $x1, $y1, $x2, $y2, $cl['rx']);
imagerectangle($im, $x1, $y1, $x2, $y2, $cl['rx_border']);
 
imagefilledrectangle($im, $x1 - $depth, $y1 + $depth, $x2 -$depth, $y2 + $depth, $cl['rx']);
imagerectangle($im, $x1 - $depth, $y1 + $depth, $x2 - $depth, $y2 + $depth, $cl['rx_border']);
 
imagefilledpolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['rx']);
imagepolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['rx_border']);
imagefilledpolygon($im, array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth), 4, $cl['rx']);
227,16 → 226,16
 
imagefilledrectangle($im, $x1, $y1, $x2, $y2, $cl['tx']);
imagerectangle($im, $x1, $y1, $x2, $y2, $cl['tx_border']);
 
imagefilledrectangle($im, $x1 - $depth, $y1 + $depth, $x2 - $depth, $y2 + $depth, $cl['tx']);
imagerectangle($im, $x1 - $depth, $y1 + $depth, $x2 - $depth, $y2 + $depth, $cl['tx_border']);
imagerectangle($im, $x1 - $depth, $y1 + $depth, $x2 - $depth, $y2 + $depth, $cl['tx_border']);
 
imagefilledpolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['tx']);
imagepolygon($im, array($x1, $y1, $x2, $y1, $x2 - $depth, $y1 + $depth, $x1 - $depth, $y1 + $depth), 4, $cl['tx_border']);
imagefilledpolygon($im, array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth), 4, $cl['tx']);
imagepolygon($im, array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth), 4, $cl['tx_border']);
}
 
//
// axis labels
//
265,11 → 264,11
//
imagefilledrectangle($im, $xlm, $ih-$ybm+39, $xlm+8,$ih-$ybm+47,$cl['rx']);
imagerectangle($im, $xlm, $ih-$ybm+39, $xlm+8,$ih-$ybm+47,$cl['text']);
imagettftext($im, 8,0, $xlm+14, $ih-$ybm+48,$cl['text'], GRAPH_FONT,'bytes in');
imagettftext($im, 8,0, $xlm+14, $ih-$ybm+48,$cl['text'], GRAPH_FONT,T('bytes in'));
 
imagefilledrectangle($im, $xlm+120 , $ih-$ybm+39, $xlm+128,$ih-$ybm+47,$cl['tx']);
imagerectangle($im, $xlm+120, $ih-$ybm+39, $xlm+128,$ih-$ybm+47,$cl['text']);
imagettftext($im, 8,0, $xlm+134, $ih-$ybm+48,$cl['text'], GRAPH_FONT,'bytes out');
imagettftext($im, 8,0, $xlm+134, $ih-$ybm+48,$cl['text'], GRAPH_FONT,T('bytes out'));
}
 
function output_image()
293,11 → 292,11
{
draw_data($month);
}
header('Content-type: image/png');
 
header('Content-type: image/png');
imagepng($im);
}
 
get_vnstat_data();
output_image();
?>
?>
/web/acc/manager/stats/graph_svg.php
17,7 → 17,7
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// for more information.
//
require 'config.php';
61,8 → 61,8
print "</g>\n";
}
 
function svg_text($x, $y, $text, $options = array())
{
function svg_text($x, $y, $text, $options = array())
{
printf("<text x=\"%F\" y=\"%F\" ", $x, $y);
svg_options($options);
print ">$text</text>\n";
75,7 → 75,7
print "/>\n";
}
 
function svg_rect($x, $y, $w, $h, $options = array())
function svg_rect($x, $y, $w, $h, $options = array())
{
printf("<rect x=\"%F\" y=\"%F\" width=\"%F\" height=\"%F\" ", $x, $y, $w, $h);
svg_options($options);
98,7 → 98,7
$col['opacity'] = sprintf("%F", (127 - $colors[3]) / 127);
return $col;
}
 
function init_image()
{
global $xlm, $xrm, $ytm, $ybm, $iw, $ih,$graph, $cl, $iface, $colorscheme, $style;
108,7 → 108,7
 
//
// image object
//
//
$xlm = 70;
$xrm = 20;
$ytm = 35;
116,7 → 116,7
if ($graph == 'small')
{
$iw = 300 + $xrm + $xlm;
$ih = 100 + $ytm + $ybm;
$ih = 100 + $ytm + $ybm;
}
else
{
123,7 → 123,7
$iw = 600 + $xrm + $xlm;
$ih = 200 + $ytm + $ybm;
}
 
svg_create($iw, $ih);
 
//
141,11 → 141,11
$cl['rx_border'] = allocate_color($cs['rx_border']);
$cl['tx'] = allocate_color($cs['tx']);
$cl['tx_border'] = allocate_color($cs['tx_border']);
 
svg_rect(0, 0, $iw, $ih, array( 'stroke' => 'none', 'stroke-width' => 0, 'fill' => $cl['image_background']['rgb']) );
svg_rect($xlm, $ytm, $iw-$xrm-$xlm, $ih-$ybm-$ytm, array( 'stroke' => 'none', 'stroke-width' => 0, 'fill' => $cl['background']['rgb']) );
$depth = 12;
 
$depth = 12*SVG_DEPTH_SCALING;
svg_group( array( 'stroke' => 'none', 'stroke-width' => 0, 'fill' => $cl['background_2']['rgb'], 'fill-opacity' => $cl['background_2']['opacity']) );
svg_poly(array($xlm, $ytm, $xlm, $ih - $ybm, $xlm - $depth, $ih - $ybm + $depth, $xlm - $depth, $ytm + $depth));
svg_poly(array($xlm, $ih - $ybm, $xlm - $depth, $ih - $ybm + $depth, $iw - $xrm - $depth, $ih - $ybm + $depth, $iw - $xrm, $ih - $ybm));
153,7 → 153,7
 
// draw title
$text = T('Traffic data for')." $iface";
svg_text($iw / 2, ($ytm / 2), $text, array( 'stroke' => $cl['text'], 'fill' => $cl['text']['rgb'],'stroke-width' => 0, 'font-family' => SVG_FONT, 'font-weight' => 'bold', 'text-anchor' => 'middle' ));
svg_text($iw / 2, ($ytm / 2), $text, array( 'stroke' => 'none', 'fill' => $cl['text']['rgb'],'stroke-width' => 0, 'font-family' => SVG_FONT, 'font-weight' => 'bold', 'text-anchor' => 'middle' ));
}
 
function draw_border()
161,15 → 161,15
global $cl, $iw, $ih;
svg_rect(1, 1, $iw-2, $ih-2, array( 'stroke' => $cl['border']['rgb'], 'stroke-opacity' => $cl['border']['opacity'], 'stroke-width' => 1, 'fill' => 'none') );
}
 
function draw_grid($x_ticks, $y_ticks)
{
global $cl, $iw, $ih, $xlm, $xrm, $ytm, $ybm;
$x_step = ($iw - $xlm - $xrm) / $x_ticks;
$x_step = ($iw - $xlm - $xrm) / ($x_ticks ?: 1);
$y_step = ($ih - $ytm - $ybm) / $y_ticks;
$depth = 12;
 
$depth = 12*SVG_DEPTH_SCALING;
 
svg_group( array( 'stroke' => $cl['grid_stipple_1']['rgb'], 'stroke-opacity' => $cl['grid_stipple_1']['opacity'], 'stroke-width' => '1px', 'stroke-dasharray' => '1,1' ) );
for ($i = $xlm; $i <= ($iw - $xrm); $i += $x_step)
{
178,7 → 178,7
}
for ($i = $ytm; $i <= ($ih - $ybm); $i += $y_step)
{
svg_line($xlm, $i, $iw - $xrm, $i);
svg_line($xlm, $i, $iw - $xrm, $i);
svg_line($xlm, $i, $xlm - $depth, $i + $depth);
}
svg_group_end();
188,8 → 188,8
svg_line($xlm, $ih - $ybm, $iw - $xrm, $ih - $ybm);
svg_group_end();
}
 
 
function draw_data($data)
{
global $cl,$iw,$ih,$xlm,$xrm,$ytm,$ybm;
203,7 → 203,7
$unit = 'K';
$offset = 0;
$gr_h = $ih - $ytm - $ybm;
$x_step = ($iw - $xlm - $xrm) / $x_ticks;
$x_step = ($iw - $xlm - $xrm) / ($x_ticks ?: 1);
$y_step = ($ih - $ytm - $ybm) / $y_ticks;
$bar_w = ($x_step / 2) ;
 
231,7 → 231,7
{
$prescale = $prescale * 1024;
$y_scale = $y_scale / 1024;
if ($unit == 'K')
if ($unit == 'K')
$unit = 'M';
else if ($unit == 'M')
$unit = 'G';
241,13 → 241,13
}
 
draw_grid($x_ticks, $y_ticks);
 
//
// graph scale factor (per pixel)
//
$sf = ($prescale * $y_scale * $y_ticks) / $gr_h;
 
if ($data[0] == 'nodata')
if (count($data) == 0)
{
$text = 'no data available';
svg_text($iw/2, $ytm + 80, $text, array( 'stroke' => $cl['text']['rgb'], 'fill' => $cl['text']['rgb'], 'stroke-width' => 0, 'font-family' => SVG_FONT, 'font-size' => '16pt', 'text-anchor' => 'middle') );
256,15 → 256,15
{
//
// draw bars
//
//
for ($i=0; $i<$x_ticks; $i++)
{
$x = $xlm + ($i * $x_step);
$y = $ytm + ($ih - $ytm - $ybm) - (($data[$i]['rx'] - $offset) / $sf);
$depth = ($x_ticks < 20) ? 8 : 6;
 
$depth = ($x_ticks < 20) ? 8*SVG_DEPTH_SCALING : 6*SVG_DEPTH_SCALING;
$space = 0;
 
$x1 = (int)$x;
$y1 = (int)$y;
$w = (int)($bar_w - $space);
271,7 → 271,7
$h = (int)($ih - $ybm - $y);
$x2 = (int)($x + $bar_w - $space);
$y2 = (int)($ih - $ybm);
 
svg_group( array( 'stroke' => $cl['rx_border']['rgb'], 'stroke-opacity' => $cl['rx_border']['opacity'],
'stroke-width' => 1, 'stroke-linejoin' => 'round',
'fill' => $cl['rx']['rgb'], 'fill-opacity' => $cl['rx']['opacity'] ) );
287,7 → 287,7
$w = (int)($bar_w - $space);
$h = (int)($ih - $ybm - $y1 - 1);
 
svg_group( array( 'stroke' => $cl['tx_border']['rgb'], 'stroke-opacity' => $cl['tx_border']['opacity'],
svg_group( array( 'stroke' => $cl['tx_border']['rgb'], 'stroke-opacity' => $cl['tx_border']['opacity'],
'stroke-width' => 1, 'stroke-linejoin' => 'round',
'fill' => $cl['tx']['rgb'], 'fill-opacity' => $cl['tx']['opacity'] ) );
svg_rect($x1, $y1, $w, $h);
296,7 → 296,7
svg_poly(array($x2, $y1, $x2, $y2, $x2 - $depth, $y2 + $depth, $x2 - $depth, $y1 + $depth));
svg_group_end();
}
 
//
// axis labels
//
359,4 → 359,4
 
get_vnstat_data();
output_image();
?>
?>
/web/acc/manager/stats/index.php
17,7 → 17,7
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// for more information.
//
require 'config.php';
31,15 → 31,20
function write_side_bar()
{
global $iface, $page, $graph, $script, $style;
global $iface_list, $iface_title;
global $iface_list, $iface_title;
global $page_list, $page_title;
 
$p = "&amp;graph=$graph&amp;style=$style";
 
print "<ul class=\"iface\">\n";
foreach ($iface_list as $if)
{
print "<li class=\"iface\">";
if ($iface == $if) {
print "<li class=\"iface active\">";
} else {
print "<li class=\"iface\">";
}
print "<a href=\"$script?if=$if$p\">";
if (isset($iface_title[$if]))
{
print $iface_title[$if];
48,6 → 53,7
{
print $if;
}
print "</a>";
print "<ul class=\"page\">\n";
foreach ($page_list as $pg)
{
54,26 → 60,35
print "<li class=\"page\"><a href=\"$script?if=$if$p&amp;page=$pg\">".$page_title[$pg]."</a></li>\n";
}
print "</ul></li>\n";
}
print "</ul>\n";
print "</ul>\n";
}
 
 
function kbytes_to_string($kb)
{
 
global $byte_notation;
 
$units = array('TB','GB','MB','KB');
$scale = 1024*1024*1024;
$ui = 0;
 
while (($kb < $scale) && ($scale > 1))
$custom_size = isset($byte_notation) && in_array($byte_notation, $units);
 
while ((($kb < $scale) && ($scale > 1)) || $custom_size)
{
$ui++;
$scale = $scale / 1024;
}
 
if ($custom_size && $units[$ui] == $byte_notation) {
break;
}
}
 
return sprintf("%0.2f %s", ($kb/$scale),$units[$ui]);
}
 
function write_summary()
{
global $summary,$top,$day,$hour,$month;
84,32 → 99,37
//
// build array for write_data_table
//
$sum[0]['act'] = 1;
$sum[0]['label'] = T('This hour');
$sum[0]['rx'] = $hour[0]['rx'];
$sum[0]['tx'] = $hour[0]['tx'];
 
$sum[1]['act'] = 1;
$sum[1]['label'] = T('This day');
$sum[1]['rx'] = $day[0]['rx'];
$sum[1]['tx'] = $day[0]['tx'];
$sum = array();
 
$sum[2]['act'] = 1;
$sum[2]['label'] = T('This month');
$sum[2]['rx'] = $month[0]['rx'];
$sum[2]['tx'] = $month[0]['tx'];
if (count($day) > 0 && count($hour) > 0 && count($month) > 0) {
$sum[0]['act'] = 1;
$sum[0]['label'] = T('This hour');
$sum[0]['rx'] = $hour[0]['rx'];
$sum[0]['tx'] = $hour[0]['tx'];
 
$sum[3]['act'] = 1;
$sum[3]['label'] = T('All time');
$sum[3]['rx'] = $trx;
$sum[3]['tx'] = $ttx;
$sum[1]['act'] = 1;
$sum[1]['label'] = T('This day');
$sum[1]['rx'] = $day[0]['rx'];
$sum[1]['tx'] = $day[0]['tx'];
 
$sum[2]['act'] = 1;
$sum[2]['label'] = T('This month');
$sum[2]['rx'] = $month[0]['rx'];
$sum[2]['tx'] = $month[0]['tx'];
 
$sum[3]['act'] = 1;
$sum[3]['label'] = T('All time');
$sum[3]['rx'] = $trx;
$sum[3]['tx'] = $ttx;
}
 
write_data_table(T('Summary'), $sum);
print "<br/>\n";
write_data_table(T('Top 10 days'), $top);
}
 
 
function write_data_table($caption, $tab)
{
print "<table width=\"100%\" cellspacing=\"0\">\n";
118,7 → 138,7
print "<th class=\"label\" style=\"width:120px;\">&nbsp;</th>";
print "<th class=\"label\">".T('In')."</th>";
print "<th class=\"label\">".T('Out')."</th>";
print "<th class=\"label\">".T('Total')."</th>";
print "<th class=\"label\">".T('Total')."</th>";
print "</tr>\n";
 
for ($i=0; $i<count($tab); $i++)
148,7 → 168,7
//
header('Content-type: text/html; charset=utf-8');
print '<?xml version="1.0"?>';
?>
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
160,7 → 180,7
<div id="wrap">
<div id="sidebar"><?php write_side_bar(); ?></div>
<div id="content">
<div id="header"><?php print T('Traffic data for')." $iface_title[$iface] ($iface)";?></div>
<div id="header"><?php print T('Traffic data for').(isset($iface_title[$iface]) ? $iface_title[$iface] : '')." ($iface)";?></div>
<div id="main">
<?php
$graph_params = "if=$iface&amp;page=$page&amp;style=$style";
168,7 → 188,7
if ($graph_format == 'svg') {
print "<object type=\"image/svg+xml\" width=\"692\" height=\"297\" data=\"graph_svg.php?$graph_params\"></object>\n";
} else {
print "<img src=\"graph.php?$graph_params\" alt=\"graph\"/>\n";
print "<img src=\"graph.php?$graph_params\" alt=\"graph\"/>\n";
}
 
if ($page == 's')
176,20 → 196,20
write_summary();
}
else if ($page == 'h')
{
write_data_table(T('Last 24 hours'), $hour);
{
write_data_table(T('Last 24 hours'), $hour);
}
else if ($page == 'd')
{
write_data_table(T('Last 30 days'), $day);
write_data_table(T('Last 30 days'), $day);
}
else if ($page == 'm')
{
write_data_table(T('Last 12 months'), $month);
write_data_table(T('Last 12 months'), $month);
}
?>
</div>
<div id="footer"><a href="http://www.sqweek.com/">vnStat PHP frontend</a> 1.5.1 - &copy;2006-2010 Bjorge Dijkstra (bjd _at_ jooz.net)</div>
<div id="footer"><a href="http://www.sqweek.com/">vnStat PHP frontend</a> 1.5.2 - &copy;2006-2011 Bjorge Dijkstra (bjd _at_ jooz.net)</div>
</div>
</div>
 
/web/acc/manager/stats/json.php
0,0 → 1,81
<?php
//
// vnStat PHP frontend (c)2006-2010 Bjorge Dijkstra (bjd@jooz.net)
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// 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
//
//
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// for more information.
//
require 'config.php';
require 'localize.php';
require 'vnstat.php';
 
validate_input();
 
require "./themes/$style/theme.php";
 
function write_summary()
{
global $summary,$top,$day,$hour,$month;
 
$trx = $summary['totalrx']*1024+$summary['totalrxk'];
$ttx = $summary['totaltx']*1024+$summary['totaltxk'];
 
//
// build array for write_data_table
//
$sum['hour']['act'] = 1;
$sum['hour']['rx'] = $hour[0]['rx'];
$sum['hour']['tx'] = $hour[0]['tx'];
 
$sum['day']['act'] = 1;
$sum['day']['rx'] = $day[0]['rx'];
$sum['day']['tx'] = $day[0]['tx'];
 
$sum['month']['act'] = 1;
$sum['month']['rx'] = $month[0]['rx'];
$sum['month']['tx'] = $month[0]['tx'];
 
$sum['total']['act'] = 1;
$sum['total']['rx'] = $trx;
$sum['total']['tx'] = $ttx;
 
print json_encode($sum);
}
 
 
get_vnstat_data(false);
 
header('Content-type: application/json; charset=utf-8');
$graph_params = "if=$iface&amp;page=$page&amp;style=$style";
if ($page == 's')
{
write_summary();
}
else if ($page == 'h')
{
print json_encode(array('hours' => $hour));
}
else if ($page == 'd')
{
print json_encode(array('days' => $day));
}
else if ($page == 'm')
{
print json_encode(array('months' => $month));
}
?>
/web/acc/manager/stats/lang/br.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'sumario';
$L['hours'] = 'horas';
$L['days'] = 'dias';
$L['months'] = 'meses';
 
// main table headers
$L['Summary'] = 'Sumario';
$L['Top 10 days'] = 'Top 10 - dias';
$L['Last 24 hours'] = 'Ultimas 24 horas';
$L['Last 30 days'] = 'Ultimos 30 dias';
$L['Last 12 months'] = 'Ultimos 12 meses';
 
// traffic table columns
$L['In'] = 'Entrada';
$L['Out'] = 'Saida';
$L['Total'] = 'Total';
 
// summary rows
$L['This hour'] = 'Esta hora';
$L['This day'] = 'Este dia';
$L['This month'] = 'Este mes';
$L['All time'] = 'Todos os tempos';
 
// graph text
$L['Traffic data for'] = 'Trafego da';
$L['bytes in'] = 'bytes entrada';
$L['bytes out'] = 'bytes saida';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%l%p';
$L['datefmt_hours_img'] = '%l';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/cn.php
0,0 → 1,40
<?php
 
// sidebar labels
$L['summary'] = '总计';
$L['hours'] = '每时';
$L['days'] = '每天';
$L['months'] = '每月';
 
// main table headers
$L['Summary'] = '概览';
$L['Top 10 days'] = '最高流量的10天';
$L['Last 24 hours'] = '过去24小时';
$L['Last 30 days'] = '过去30天';
$L['Last 12 months'] = '过去12个月';
 
// traffic table columns
$L['In'] = '流入';
$L['Out'] = '流出';
$L['Total'] = '总流量';
 
// summary rows
$L['This hour'] = '本小时';
$L['This day'] = '本日';
$L['This month'] = '本月';
$L['All time'] = '总计';
 
// graph text
$L['Traffic data for'] = '统计的网络:';
$L['bytes in'] = '流入bytes';
$L['bytes out'] = '流出bytes';
 
// date formats
$L['datefmt_days'] = '%B%d日';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%Y年%B';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%H:00';
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%Y年%m月%d日';
 
/web/acc/manager/stats/lang/cs.php
34,6 → 34,6
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%k%P';
$L['datefmt_hours'] = '%k%p';
$L['datefmt_hours_img'] = '%k';
$L['datefmt_top'] = '%d. %B %Y';
/web/acc/manager/stats/lang/de.php
0,0 → 1,40
<?php
 
// sidebar labels
$L['summary'] = 'Übersicht';
$L['hours'] = 'Stunden';
$L['days'] = 'Tage';
$L['months'] = 'Monate';
 
// main table headers
$L['Summary'] = 'Übersicht';
$L['Top 10 days'] = 'Top 10 nach Tagen';
$L['Last 24 hours'] = 'Letzte 24 Stunden';
$L['Last 30 days'] = 'Letzte 30 Tage';
$L['Last 12 months'] = 'Letzte 12 Monate';
 
// traffic table columns
$L['In'] = 'Rein';
$L['Out'] = 'Raus';
$L['Total'] = 'Total';
 
// summary rows
$L['This hour'] = 'Diese Stunde';
$L['This day'] = 'Dieser Tag';
$L['This month'] = 'Dieser Monat';
$L['All time'] = 'Alles';
 
// graph text
$L['Traffic data for'] = 'Trafficdaten für';
$L['bytes in'] = 'Bytes rein';
$L['bytes out'] = 'Bytes raus';
 
// date formats
$L['datefmt_days'] = '%d.%B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B.%Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%H:%M';
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%d.%B.%Y';
 
/web/acc/manager/stats/lang/en.php
34,6 → 34,6
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%l%P';
$L['datefmt_hours'] = '%l%p';
$L['datefmt_hours_img'] = '%l';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/es.php
0,0 → 1,41
<?php
 
// sidebar labels
$L['summary'] = 'sumario';
$L['hours'] = 'horas';
$L['days'] = 'días';
$L['months'] = 'meses';
 
// main table headers
$L['Summary'] = 'Sumario';
$L['Top 10 days'] = 'Últimos 10 días';
$L['Last 24 hours'] = 'Últimas 24 horas';
$L['Last 30 days'] = 'Últimos 30 días';
$L['Last 12 months'] = 'Últimos 12 meses';
 
// traffic table columns
$L['In'] = 'Entrada';
$L['Out'] = 'Salida';
$L['Total'] = 'Total';
 
// summary rows
$L['This hour'] = 'Esta hora';
$L['This day'] = 'Este día';
$L['This month'] = 'Este mes';
$L['All time'] = 'Todo el tiempo';
 
// graph text
$L['Traffic data for'] = 'Trafico de datos para';
$L['bytes in'] = 'entrada de bytes';
$L['bytes out'] = 'salida de bytes';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%H:%M';
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%d %B %Y';
 
// spanish version by Carlos Troetsch
/web/acc/manager/stats/lang/fi.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'yhteenveto';
$L['hours'] = 'tunnit';
$L['days'] = 'päivät';
$L['months'] = 'kuukaudet';
 
// main table headers
$L['Summary'] = 'Yhteenveto';
$L['Top 10 days'] = 'Top 10 päivää';
$L['Last 24 hours'] = 'Viimeiset 24 tuntia';
$L['Last 30 days'] = 'Viimeiset 30 päivää';
$L['Last 12 months'] = 'Viimeiset 12 kuukautta';
 
// traffic table columns
$L['In'] = 'Sisään';
$L['Out'] = 'Ulos';
$L['Total'] = 'Yhteensä';
 
// summary rows
$L['This hour'] = 'Viimeisin tunti';
$L['This day'] = 'Viimeisin päivä';
$L['This month'] = 'Viimeisin kuukausi';
$L['All time'] = 'Kaikkiaan';
 
// graph text
$L['Traffic data for'] = 'Liikennemäärä';
$L['bytes in'] = 'tavua sisään';
$L['bytes out'] = 'tavua ulos';
 
// date formats
$L['datefmt_days'] = '%d. %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%H';
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%a %d. %b %Y';
/web/acc/manager/stats/lang/fr.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'Sommaire';
$L['hours'] = 'Heures';
$L['days'] = 'Jours';
$L['months'] = 'Mois';
 
// main table headers
$L['Summary'] = 'Sommaire';
$L['Top 10 days'] = 'Les 10 meilleurs jours';
$L['Last 24 hours'] = 'Dernières 24 heures';
$L['Last 30 days'] = 'Derniers 30 jours';
$L['Last 12 months'] = 'Les 12 derniers mois';
 
// traffic table columns
$L['In'] = 'Entrant';
$L['Out'] = 'Sortant';
$L['Total'] = 'Total';
 
// summary rows
$L['This hour'] = 'Cette heure';
$L['This day'] = 'Aujourd\' hui';
$L['This month'] = 'Ce mois';
$L['All time'] = 'Tout temps';
 
// graph text
$L['Traffic data for'] = 'Traffic de donnée pour :';
$L['bytes in'] = 'bytes entrants';
$L['bytes out'] = 'bytes sortants';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%Hh%M';
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/hr.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'sažetak'; // summary
$L['hours'] = 'sati';
$L['days'] = 'dani';
$L['months'] = 'mjeseci';
 
// main table headers
$L['Summary'] = 'Sažetak';
$L['Top 10 days'] = '10 naprometnijih dana';
$L['Last 24 hours'] = 'Zadnja 24 sata';
$L['Last 30 days'] = 'Zadnjih 30 dana';
$L['Last 12 months'] = 'Zadnjih 12 mjeseci';
 
// traffic table columns
$L['In'] = 'Primljeno';
$L['Out'] = 'Poslano';
$L['Total'] = 'Ukupno'; // Total
 
// summary rows
$L['This hour'] = 'Tekući sat';
$L['This day'] = 'Danas';
$L['This month'] = 'Tekući mjesec';
$L['All time'] = 'Sveukupno';
 
// graph text
$L['Traffic data for'] = 'Promet za';
$L['bytes in'] = 'bajta primljeno';
$L['bytes out'] = 'bajta poslano';
 
// date formats
$L['datefmt_days'] = '%d. %m';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%m.%Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%H'; // %k
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%d.%m.%Y';
/web/acc/manager/stats/lang/hu.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'Összegzés';
$L['hours'] = 'órák';
$L['days'] = 'napok';
$L['months'] = 'hónapok';
 
// main table headers
$L['Summary'] = 'Öszegzés';
$L['Top 10 days'] = 'Legjobb 10 nap';
$L['Last 24 hours'] = 'Utolsó 24 óra';
$L['Last 30 days'] = 'Utolsó 30 nap';
$L['Last 12 months'] = 'Utolsó 12 hónap';
 
// traffic table columns
$L['In'] = 'Bejövő';
$L['Out'] = 'Kimenő';
$L['Total'] = 'Összesen';
 
// summary rows
$L['This hour'] = 'Ebben az órában';
$L['This day'] = 'Ezen a napon';
$L['This month'] = 'Ebben a hónapban';
$L['All time'] = 'Összesen';
 
// graph text
$L['Traffic data for'] = 'Forgalmi adatok: ';
$L['bytes in'] = 'bejövő bájtok';
$L['bytes out'] = 'kimenő bájtok';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%l%p';
$L['datefmt_hours_img'] = '%l';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/it.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'Riepilogo';
$L['hours'] = 'Ore';
$L['days'] = 'Giorni';
$L['months'] = 'Mesi';
 
// main table headers
$L['Summary'] = 'Riepilogo';
$L['Top 10 days'] = '10 giorni piu intensivi';
$L['Last 24 hours'] = 'Ultime 24 ore';
$L['Last 30 days'] = 'Ultimi 30 giorni';
$L['Last 12 months'] = 'Ultimi 12 mesi';
 
// traffic table columns
$L['In'] = 'Entrata';
$L['Out'] = 'Uscita';
$L['Total'] = 'Totale';
 
// summary rows
$L['This hour'] = 'Quest ora';
$L['This day'] = 'Oggi';
$L['This month'] = 'Questo mese';
$L['All time'] = 'Sempre';
 
// graph text
$L['Traffic data for'] = 'Dati per';
$L['bytes in'] = 'bytes entrati';
$L['bytes out'] = 'bytes usciti';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%l%p';
$L['datefmt_hours_img'] = '%l';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/no.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'Sammendrag';
$L['hours'] = 'Timer';
$L['days'] = 'Dager';
$L['months'] = 'Måneder';
 
// main table headers
$L['Summary'] = 'Sammendrag';
$L['Top 10 days'] = 'Topp 10 dager';
$L['Last 24 hours'] = 'Siste 24 timer';
$L['Last 30 days'] = 'Siste 30 dager';
$L['Last 12 months'] = 'Siste 12 måneder';
 
// traffic table columns
$L['In'] = 'Inn';
$L['Out'] = 'Ut';
$L['Total'] = 'Totalt';
 
// summary rows
$L['This hour'] = 'Denne time';
$L['This day'] = 'Idag';
$L['This month'] = 'Denne måneden';
$L['All time'] = 'Totalt';
 
// graph text
$L['Traffic data for'] = 'Trafikkdata for';
$L['bytes in'] = 'bytes inn';
$L['bytes out'] = 'bytes ut';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%H:%M';
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/pl.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'podsumowanie';
$L['hours'] = 'godziny';
$L['days'] = 'dni';
$L['months'] = 'miesiące';
 
// main table headers
$L['Summary'] = 'Podsumowanie';
$L['Top 10 days'] = 'Top 10 dni';
$L['Last 24 hours'] = 'Ostatnie 24 godziny';
$L['Last 30 days'] = 'Ostatnie 30 dni';
$L['Last 12 months'] = 'Ostatnie 12 miesięcy';
 
// traffic table columns
$L['In'] = 'Wyjście';
$L['Out'] = 'Wejście';
$L['Total'] = 'Suma';
 
// summary rows
$L['This hour'] = 'Ta godzina';
$L['This day'] = 'Ten dzień';
$L['This month'] = 'Ten miesiąc';
$L['All time'] = 'Całość';
 
// graph text
$L['Traffic data for'] = 'Transfer dla';
$L['bytes in'] = 'Wysłane';
$L['bytes out'] = 'Odebrane';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%l%p';
$L['datefmt_hours_img'] = '%l';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/ru.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'сводка';
$L['hours'] = 'по часам';
$L['days'] = 'по дням';
$L['months'] = 'по месяцам';
 
// main table headers
$L['Summary'] = 'Сводка';
$L['Top 10 days'] = 'Топ 10 дней';
$L['Last 24 hours'] = 'Последние 24 часа';
$L['Last 30 days'] = 'Последние 30 дней';
$L['Last 12 months'] = 'Последние 12 месяцев';
 
// traffic table columns
$L['In'] = 'Входящий';
$L['Out'] = 'Исходящий';
$L['Total'] = 'Общий';
 
// summary rows
$L['This hour'] = 'Текущий час';
$L['This day'] = 'Текущий день';
$L['This month'] = 'Текущий месяц';
$L['All time'] = 'За все время';
 
// graph text
$L['Traffic data for'] = 'Статистика трафика для';
$L['bytes in'] = 'получено';
$L['bytes out'] = 'передано';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%H:%M';
$L['datefmt_hours_img'] = '%H';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/lang/sk.php
0,0 → 1,39
<?php
 
// sidebar labels
$L['summary'] = 'zhrnutie';
$L['hours'] = 'hodiny';
$L['days'] = 'dni';
$L['months'] = 'mesiace';
 
// main table headers
$L['Summary'] = 'Zhrnutie';
$L['Top 10 days'] = 'Naj 10 dni';
$L['Last 24 hours'] = 'Posledných 24 hodin';
$L['Last 30 days'] = 'Posledných 30 dni';
$L['Last 12 months'] = 'Posledných 12 mesiacov';
 
// traffic table columns
$L['In'] = 'Sťahovanie';
$L['Out'] = 'Posielanie';
$L['Total'] = 'Celkom';
 
// summary rows
$L['This hour'] = 'Túto hodinu';
$L['This day'] = 'Tento deň';
$L['This month'] = 'Tento mesiac';
$L['All time'] = 'Celkom';
 
// graph text
$L['Traffic data for'] = 'Prehlad pre';
$L['bytes in'] = 'bajtov stiahnuté';
$L['bytes out'] = 'bajtov poslané';
 
// date formats
$L['datefmt_days'] = '%d %B';
$L['datefmt_days_img'] = '%d';
$L['datefmt_months'] = '%B %Y';
$L['datefmt_months_img'] = '%b';
$L['datefmt_hours'] = '%l%p';
$L['datefmt_hours_img'] = '%l';
$L['datefmt_top'] = '%d %B %Y';
/web/acc/manager/stats/themes/light/style.css
4,6 → 4,18
padding: 0;
}
 
a[href]:link,
a[href]:visited {
color: #00f;
text-decoration: none;
}
a[href]:hover,
a[href]:active,
a[href]:focus {
color: #c00;
text-decoration: none;
}
 
#wrap
{
xwidth: 868px;
26,13 → 38,24
background-color: #eef;
}
 
#sidebar li.iface ul
{
display: none;
}
#sidebar li.iface.active ul
{
display: block;
}
#sidebar li.iface:hover ul
{
display: block;
}
#sidebar li.iface
{
margin: 0;
margin: 2px;
padding: 0;
list-style-type: none;
font-family: 'Trebuchet MS', Verdana, sans-serif;
font-size: 1em;
font-size: 12px;
font-weight: bold;
xborder-top: 1px solid #99b;
border-bottom: 1px solid #99b;
105,7 → 128,8
{
padding: 8px;
border-left: 1px solid #99b;
border-right: 1px solid #99b;
border-right: 1px solid #99b;
border-bottom: 1px solid #99b;
border-collapse: collapse;
}
 
/web/acc/manager/stats/vnstat.php
17,10 → 17,10
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
//
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// see file COPYING or at http://www.gnu.org/licenses/gpl.html
// for more information.
//
 
//
// Valid values for other parameters you can pass to the script.
// Input parameters will always be limited to one of the values listed here.
39,17 → 39,17
{
die('can\'t determine script name!');
}
 
$page_list = array('s','h','d','m');
 
$graph_list = array('large','small','none');
 
$page_title['s'] = T('summary');
$page_title['h'] = T('hours');
$page_title['d'] = T('days');
$page_title['m'] = T('months');
 
 
//
// functions
//
83,14 → 83,14
}
 
$tp = "./themes/$style";
if (!is_dir($tp) || !file_exists("$tp/theme.php"))
if (!is_dir($tp) || !file_exists("$tp/theme.php") || !preg_match('/^[a-z0-9-_]+$/i', $style))
{
$style = DEFAULT_COLORSCHEME;
}
}
 
function get_vnstat_data()
 
function get_vnstat_data($use_label=true)
{
global $iface, $vnstat_bin, $data_dir;
global $hour,$day,$month,$top,$summary;
100,7 → 100,7
if (file_exists("$data_dir/vnstat_dump_$iface"))
{
$vnstat_data = file("$data_dir/vnstat_dump_$iface");
}
}
else
{
$vnstat_data = array();
123,10 → 123,14
$month = array();
$top = array();
 
if (strpos($vnstat_data[0], 'Error') !== false) {
return;
}
 
//
// extract data
//
foreach($vnstat_data as $line)
foreach($vnstat_data as $line)
{
$d = explode(';', trim($line));
if ($d[0] == 'd')
135,16 → 139,16
$day[$d[1]]['rx'] = $d[3] * 1024 + $d[5];
$day[$d[1]]['tx'] = $d[4] * 1024 + $d[6];
$day[$d[1]]['act'] = $d[7];
if ($d[2] != 0)
if ($d[2] != 0 && $use_label)
{
$day[$d[1]]['label'] = strftime(T('datefmt_days'),$d[2]);
$day[$d[1]]['img_label'] = strftime(T('datefmt_days_img'), $d[2]);
}
else
elseif($use_label)
{
$day[$d[1]]['label'] = '';
$day[$d[1]]['img_label'] = '';
}
$day[$d[1]]['img_label'] = '';
}
}
else if ($d[0] == 'm')
{
152,15 → 156,15
$month[$d[1]]['rx'] = $d[3] * 1024 + $d[5];
$month[$d[1]]['tx'] = $d[4] * 1024 + $d[6];
$month[$d[1]]['act'] = $d[7];
if ($d[2] != 0)
if ($d[2] != 0 && $use_label)
{
$month[$d[1]]['label'] = strftime(T('datefmt_months'), $d[2]);
$month[$d[1]]['img_label'] = strftime(T('datefmt_months_img'), $d[2]);
}
else
else if ($use_label)
{
$month[$d[1]]['label'] = '';
$month[$d[1]]['img_label'] = '';
$month[$d[1]]['img_label'] = '';
}
}
else if ($d[0] == 'h')
169,7 → 173,7
$hour[$d[1]]['rx'] = $d[3];
$hour[$d[1]]['tx'] = $d[4];
$hour[$d[1]]['act'] = 1;
if ($d[2] != 0)
if ($d[2] != 0 && $use_label)
{
$st = $d[2] - ($d[2] % 3600);
$et = $st + 3600;
176,7 → 180,7
$hour[$d[1]]['label'] = strftime(T('datefmt_hours'), $st).' - '.strftime(T('datefmt_hours'), $et);
$hour[$d[1]]['img_label'] = strftime(T('datefmt_hours_img'), $d[2]);
}
else
else if ($use_label)
{
$hour[$d[1]]['label'] = '';
$hour[$d[1]]['img_label'] = '';
183,13 → 187,16
}
}
else if ($d[0] == 't')
{
{
$top[$d[1]]['time'] = $d[2];
$top[$d[1]]['rx'] = $d[3] * 1024 + $d[5];
$top[$d[1]]['tx'] = $d[4] * 1024 + $d[6];
$top[$d[1]]['act'] = $d[7];
$top[$d[1]]['label'] = strftime(T('datefmt_top'), $d[2]);
$top[$d[1]]['img_label'] = '';
if($use_label)
{
$top[$d[1]]['label'] = strftime(T('datefmt_top'), $d[2]);
$top[$d[1]]['img_label'] = '';
}
}
else
{
196,16 → 203,9
$summary[$d[0]] = isset($d[1]) ? $d[1] : '';
}
}
if (count($day) == 0)
$day[0] = 'nodata';
 
rsort($day);
 
if (count($month) == 0)
$month[0] = 'nodata';
rsort($month);
 
if (count($hour) == 0)
$hour[0] = 'nodata';
rsort($hour);
}
?>