diff options
29 files changed, 804 insertions, 173 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc index 9a684aa1..7418530f 100644 --- a/config/vnstat2/vnstat2.inc +++ b/config/vnstat2/vnstat2.inc @@ -248,7 +248,7 @@ function vnstat_php_frontend(){ // see file COPYING or at http://www.gnu.org/licenses/gpl.html // for more information. // - error_reporting(E_ALL | E_NOTICE); + //error_reporting(E_ALL | E_NOTICE); // // configuration parameters diff --git a/config/vnstat2/vnstat_php_frontend/README b/config/vnstat2/vnstat_php_frontend/README index 20053152..c0259cfa 100644 --- a/config/vnstat2/vnstat_php_frontend/README +++ b/config/vnstat2/vnstat_php_frontend/README @@ -26,8 +26,8 @@ explained in config.php. 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 diff --git a/config/vnstat2/vnstat_php_frontend/config.php b/config/vnstat2/vnstat_php_frontend/config.php index 3a4cd51a..9f2102ac 100644 --- a/config/vnstat2/vnstat_php_frontend/config.php +++ b/config/vnstat2/vnstat_php_frontend/config.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. // - error_reporting(E_ALL | E_NOTICE); + //error_reporting(E_ALL | E_NOTICE); // // configuration parameters @@ -30,6 +30,9 @@ $locale = 'en_US.UTF-8'; $language = 'en'; + // Set local timezone + date_default_timezone_set("Europe/Amsterdam"); + // list of network interfaces monitored by vnStat $iface_list = array('em0', 'em1'); @@ -43,7 +46,7 @@ // // 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,18 +55,23 @@ // // You can generate vnstat dumps with the command: // vnstat --dumpdb -i $iface > /path/to/data_dir/vnstat_dump_$iface - // + // $vnstat_bin = '/usr/local/bin/vnstat'; $data_dir = './dumps'; // graphics format to use: svg or png $graph_format='svg'; - + // Font to use for PNG graphs define('GRAPH_FONT',dirname(__FILE__).'/VeraBd.ttf'); // Font to use for SVG graphs define('SVG_FONT', 'Verdana'); - define('DEFAULT_COLORSCHEME', 'pfSense'); -?>
\ No newline at end of file + // Default theme + define('DEFAULT_COLORSCHEME', 'pfSense'); + + // SVG Depth scaling factor + define('SVG_DEPTH_SCALING', 1); + +?> diff --git a/config/vnstat2/vnstat_php_frontend/graph.php b/config/vnstat2/vnstat_php_frontend/graph.php index fb00be67..3ef72f1a 100644 --- a/config/vnstat2/vnstat_php_frontend/graph.php +++ b/config/vnstat2/vnstat_php_frontend/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; $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; @@ -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) // @@ -187,7 +186,7 @@ if ($data[0] == 'nodata') { - $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(); -?> +?> diff --git a/config/vnstat2/vnstat_php_frontend/graph_svg.php b/config/vnstat2/vnstat_php_frontend/graph_svg.php index 8992ed12..e67a894f 100644 --- a/config/vnstat2/vnstat_php_frontend/graph_svg.php +++ b/config/vnstat2/vnstat_php_frontend/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,14 +116,14 @@ if ($graph == 'small') { $iw = 300 + $xrm + $xlm; - $ih = 100 + $ytm + $ybm; + $ih = 100 + $ytm + $ybm; } else { $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,14 +161,14 @@ 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; $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; @@ -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,7 +241,7 @@ } draw_grid($x_ticks, $y_ticks); - + // // graph scale factor (per pixel) // @@ -256,22 +256,22 @@ { // // 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); $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(); -?> +?> diff --git a/config/vnstat2/vnstat_php_frontend/index.php b/config/vnstat2/vnstat_php_frontend/index.php index 70c0427f..478665ee 100644 --- a/config/vnstat2/vnstat_php_frontend/index.php +++ b/config/vnstat2/vnstat_php_frontend/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 = "&graph=$graph&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,17 +53,17 @@ { print $if; } + print "</a>"; print "<ul class=\"page\">\n"; foreach ($page_list as $pg) { print "<li class=\"page\"><a href=\"$script?if=$if$p&page=$pg\">".$page_title[$pg]."</a></li>\n"; } print "</ul></li>\n"; - } - print "</ul>\n"; + print "</ul>\n"; } - + function kbytes_to_string($kb) { @@ -70,10 +75,10 @@ { $ui++; $scale = $scale / 1024; - } + } return sprintf("%0.2f %s", ($kb/$scale),$units[$ui]); } - + function write_summary() { global $summary,$top,$day,$hour,$month; @@ -108,8 +113,8 @@ 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 +123,7 @@ print "<th class=\"label\" style=\"width:120px;\"> </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 +153,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> @@ -168,7 +173,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 +181,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 - ©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 - ©2006-2011 Bjorge Dijkstra (bjd _at_ jooz.net)</div> </div> </div> diff --git a/config/vnstat2/vnstat_php_frontend/json.php b/config/vnstat2/vnstat_php_frontend/json.php new file mode 100644 index 00000000..89d4c78e --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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&page=$page&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)); + } + ?>
\ No newline at end of file diff --git a/config/vnstat2/vnstat_php_frontend/lang/br.php b/config/vnstat2/vnstat_php_frontend/lang/br.php new file mode 100644 index 00000000..ea2fd103 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/cn.php b/config/vnstat2/vnstat_php_frontend/lang/cn.php new file mode 100644 index 00000000..3be03cd5 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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日'; + diff --git a/config/vnstat2/vnstat_php_frontend/lang/de.php b/config/vnstat2/vnstat_php_frontend/lang/de.php new file mode 100644 index 00000000..b77fff83 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; + diff --git a/config/vnstat2/vnstat_php_frontend/lang/es.php b/config/vnstat2/vnstat_php_frontend/lang/es.php new file mode 100644 index 00000000..a2456295 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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 diff --git a/config/vnstat2/vnstat_php_frontend/lang/fi.php b/config/vnstat2/vnstat_php_frontend/lang/fi.php new file mode 100644 index 00000000..f1ce59b4 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/fr.php b/config/vnstat2/vnstat_php_frontend/lang/fr.php new file mode 100644 index 00000000..abb76b0a --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/hr.php b/config/vnstat2/vnstat_php_frontend/lang/hr.php new file mode 100644 index 00000000..f547f29d --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/hu.php b/config/vnstat2/vnstat_php_frontend/lang/hu.php new file mode 100644 index 00000000..94a445f3 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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';
\ No newline at end of file diff --git a/config/vnstat2/vnstat_php_frontend/lang/it.php b/config/vnstat2/vnstat_php_frontend/lang/it.php new file mode 100644 index 00000000..d86cb479 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/no.php b/config/vnstat2/vnstat_php_frontend/lang/no.php new file mode 100644 index 00000000..9f214942 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/pl.php b/config/vnstat2/vnstat_php_frontend/lang/pl.php new file mode 100644 index 00000000..d04e5166 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/ru.php b/config/vnstat2/vnstat_php_frontend/lang/ru.php new file mode 100644 index 00000000..7a105b38 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/lang/sk.php b/config/vnstat2/vnstat_php_frontend/lang/sk.php new file mode 100644 index 00000000..bc972503 --- /dev/null +++ b/config/vnstat2/vnstat_php_frontend/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'; diff --git a/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php b/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php index 6df45cb2..91c6fca0 100644 --- a/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php +++ b/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php @@ -1,16 +1,16 @@ <?php - // A dark colorscheme based on a contribution by Mart Visser - $colorscheme = array( - 'image_background' => array( 36, 36, 36, 0 ), - 'graph_background' => array( 220, 220, 230, 0 ), - 'graph_background_2' => array( 205, 205, 220, 0 ), - 'grid_stipple_1' => array( 140, 140, 140, 0 ), - 'grid_stipple_2' => array( 200, 200, 200, 0 ), - 'border' => array( 71, 71, 71, 0 ), - 'text' => array( 255, 255, 255,0 ), - 'rx' => array( 10, 180, 10, 50 ), - 'rx_border' => array( 0, 120, 0, 90 ), - 'tx' => array( 130, 130, 130, 50 ), - 'tx_border' => array( 60, 60, 60, 90 ) - ); + // A dark colorscheme based on a contribution by Mart Visser + $colorscheme = array( + 'image_background' => array( 36, 36, 36, 0 ), + 'graph_background' => array( 220, 220, 230, 0 ), + 'graph_background_2' => array( 205, 205, 220, 0 ), + 'grid_stipple_1' => array( 140, 140, 140, 0 ), + 'grid_stipple_2' => array( 200, 200, 200, 0 ), + 'border' => array( 71, 71, 71, 0 ), + 'text' => array( 255, 255, 255, 0 ), + 'rx' => array( 10, 180, 10, 50 ), + 'rx_border' => array( 0, 120, 0, 90 ), + 'tx' => array( 130, 130, 130, 50 ), + 'tx_border' => array( 60, 60, 60, 90 ) + ); ?> diff --git a/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php b/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php index 3c7818f5..22a361f1 100644 --- a/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php +++ b/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php @@ -1,17 +1,17 @@ <?php - // A dark colorscheme based on a contribution by Márcio Bremm - // It is based also on Espresso (gtkrc theme) by Jesse L. Kay - $colorscheme = array( - 'image_background' => array( 065, 061, 057, 0 ), - 'graph_background' => array( 117, 111, 104, 30 ), - 'graph_background_2' => array( 128, 122, 102, 30 ), - 'grid_stipple_1' => array( 140, 140, 140, 0 ), - 'grid_stipple_2' => array( 200, 200, 200, 0 ), - 'border' => array( 211, 202, 170, 0 ), - 'text' => array( 211, 202, 170, 0 ), - 'rx' => array( 211, 202, 170, 50 ), - 'rx_border' => array( 80, 40, 40, 90 ), - 'tx' => array( 163, 156, 131, 50 ), - 'tx_border' => array( 60, 60, 60, 90 ) - ); + // A dark colorscheme based on a contribution by Márcio Bremm + // It is based also on Espresso (gtkrc theme) by Jesse L. Kay + $colorscheme = array( + 'image_background' => array( 065, 061, 057, 0 ), + 'graph_background' => array( 117, 111, 104, 30 ), + 'graph_background_2' => array( 128, 122, 102, 30 ), + 'grid_stipple_1' => array( 140, 140, 140, 0 ), + 'grid_stipple_2' => array( 200, 200, 200, 0 ), + 'border' => array( 211, 202, 170, 0 ), + 'text' => array( 211, 202, 170, 0 ), + 'rx' => array( 211, 202, 170, 50 ), + 'rx_border' => array( 80, 40, 40, 90 ), + 'tx' => array( 163, 156, 131, 50 ), + 'tx_border' => array( 60, 60, 60, 90 ) + ); ?> diff --git a/config/vnstat2/vnstat_php_frontend/themes/light/style.css b/config/vnstat2/vnstat_php_frontend/themes/light/style.css index 28503f1d..6893d2a6 100644 --- a/config/vnstat2/vnstat_php_frontend/themes/light/style.css +++ b/config/vnstat2/vnstat_php_frontend/themes/light/style.css @@ -4,6 +4,18 @@ body 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 @@ body 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 @@ body { 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; } diff --git a/config/vnstat2/vnstat_php_frontend/themes/light/theme.php b/config/vnstat2/vnstat_php_frontend/themes/light/theme.php index 2516c874..63bc234d 100644 --- a/config/vnstat2/vnstat_php_frontend/themes/light/theme.php +++ b/config/vnstat2/vnstat_php_frontend/themes/light/theme.php @@ -1,15 +1,15 @@ <?php - $colorscheme = array( - 'image_background' => array( 255, 255, 255, 0 ), - 'graph_background' => array( 220, 220, 230, 0 ), - 'graph_background_2' => array( 205, 205, 220, 0 ), - 'grid_stipple_1' => array( 140, 140, 140, 0 ), - 'grid_stipple_2' => array( 200, 200, 200, 0 ), - 'border' => array( 0, 0, 0, 0 ), - 'text' => array( 0, 0, 0, 0 ), - 'rx' => array( 190, 190, 20, 50 ), - 'rx_border' => array( 40, 80, 40, 90 ), - 'tx' => array( 130, 160, 100, 50 ), - 'tx_border' => array( 80, 40, 40, 90 ) - ); + $colorscheme = array( + 'image_background' => array( 255, 255, 255, 0 ), + 'graph_background' => array( 220, 220, 230, 0 ), + 'graph_background_2' => array( 205, 205, 220, 0 ), + 'grid_stipple_1' => array( 140, 140, 140, 0 ), + 'grid_stipple_2' => array( 200, 200, 200, 0 ), + 'border' => array( 0, 0, 0, 0 ), + 'text' => array( 0, 0, 0, 0 ), + 'rx' => array( 190, 190, 20, 50 ), + 'rx_border' => array( 40, 80, 40, 90 ), + 'tx' => array( 130, 160, 100, 50 ), + 'tx_border' => array( 80, 40, 40, 90 ) + ); ?> diff --git a/config/vnstat2/vnstat_php_frontend/themes/red/theme.php b/config/vnstat2/vnstat_php_frontend/themes/red/theme.php index 2c9ba6f4..5edacbd2 100644 --- a/config/vnstat2/vnstat_php_frontend/themes/red/theme.php +++ b/config/vnstat2/vnstat_php_frontend/themes/red/theme.php @@ -1,16 +1,16 @@ <?php - // A red colorscheme based on a contribution by Enrico Tröger - $colorscheme = array( - 'image_background' => array( 225, 225, 225, 0 ), - 'graph_background' => array( 220, 220, 230, 0 ), - 'graph_background_2' => array( 205, 205, 220, 0 ), - 'grid_stipple_1' => array( 140, 140, 140, 0 ), - 'grid_stipple_2' => array( 200, 200, 200, 0 ), - 'border' => array( 0, 0, 0, 0 ), - 'text' => array( 0, 0, 0, 0 ), - 'rx' => array( 190, 20, 20, 50 ), - 'rx_border' => array( 80, 40, 40, 90 ), - 'tx' => array( 130, 130, 130, 50 ), - 'tx_border' => array( 60, 60, 60, 90 ) - ); + // A red colorscheme based on a contribution by Enrico Tröger + $colorscheme = array( + 'image_background' => array( 225, 225, 225, 0 ), + 'graph_background' => array( 220, 220, 230, 0 ), + 'graph_background_2' => array( 205, 205, 220, 0 ), + 'grid_stipple_1' => array( 140, 140, 140, 0 ), + 'grid_stipple_2' => array( 200, 200, 200, 0 ), + 'border' => array( 0, 0, 0, 0 ), + 'text' => array( 0, 0, 0, 0 ), + 'rx' => array( 190, 20, 20, 50 ), + 'rx_border' => array( 80, 40, 40, 90 ), + 'tx' => array( 130, 130, 130, 50 ), + 'tx_border' => array( 60, 60, 60, 90 ) + ); ?> diff --git a/config/vnstat2/vnstat_php_frontend/vnstat.php b/config/vnstat2/vnstat_php_frontend/vnstat.php index 9c7e211c..82e0e51f 100644 --- a/config/vnstat2/vnstat_php_frontend/vnstat.php +++ b/config/vnstat2/vnstat_php_frontend/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,16 +39,16 @@ { 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 @@ -88,9 +88,9 @@ $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(); @@ -126,7 +126,7 @@ // // extract data // - foreach($vnstat_data as $line) + foreach($vnstat_data as $line) { $d = explode(';', trim($line)); if ($d[0] == 'd') @@ -135,16 +135,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 +152,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,27 +169,30 @@ $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; $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'] = ''; } } 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 { diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 5b6650d0..03a46153 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -590,7 +590,7 @@ <build_pbi> <port>net/vnstat</port> </build_pbi> - <version>1.11_6</version> + <version>1.11_6,2</version> <status>Stable</status> <required_version>2.2</required_version> <maintainer>crazypark2@yahoo.dk</maintainer> diff --git a/pkg_config.8.xml b/pkg_config.8.xml index 0b07a441..0bb51f42 100644 --- a/pkg_config.8.xml +++ b/pkg_config.8.xml @@ -755,7 +755,7 @@ <depends_on_package>vnstat-1.11.tbz</depends_on_package> <depends_on_package_pbi>vnstat-1.11_1-i386.pbi</depends_on_package_pbi> <build_port_path>/usr/ports/net/vnstat</build_port_path> - <version>1.11_1</version> + <version>1.11_1,2</version> <status>Stable</status> <required_version>2.0</required_version> <maintainer>bryan.paradis@gmail.com</maintainer> diff --git a/pkg_config.8.xml.amd64 b/pkg_config.8.xml.amd64 index b69713af..0397f780 100644 --- a/pkg_config.8.xml.amd64 +++ b/pkg_config.8.xml.amd64 @@ -742,7 +742,7 @@ <depends_on_package>vnstat-1.11.tbz</depends_on_package> <depends_on_package_pbi>vnstat-1.11_1-amd64.pbi</depends_on_package_pbi> <build_port_path>/usr/ports/net/vnstat</build_port_path> - <version>1.11_1</version> + <version>1.11_1,2</version> <status>Stable</status> <required_version>2.0</required_version> <maintainer>bryan.paradis@gmail.com</maintainer> |