aboutsummaryrefslogtreecommitdiffstats
path: root/config/vnstat2
diff options
context:
space:
mode:
authork-paulius <k.dash.paulius@gmail.com>2015-07-13 22:15:10 -0500
committerk-paulius <k.dash.paulius@gmail.com>2015-07-13 22:15:10 -0500
commit1d8944e08c21254c9e81b46c1edc64e9fde7da8e (patch)
treefb99e913f88f35285e5b23e15e8ab73b02c52cf3 /config/vnstat2
parenta9038c8009754693948ba92155e61529dd6d3fb7 (diff)
downloadpfsense-packages-1d8944e08c21254c9e81b46c1edc64e9fde7da8e.tar.gz
pfsense-packages-1d8944e08c21254c9e81b46c1edc64e9fde7da8e.tar.bz2
pfsense-packages-1d8944e08c21254c9e81b46c1edc64e9fde7da8e.zip
formatted vnstat2 php code
Diffstat (limited to 'config/vnstat2')
-rw-r--r--config/vnstat2/vnstat2.inc273
-rw-r--r--config/vnstat2/www/diag_vnstat.php84
-rw-r--r--config/vnstat2/www/diag_vnstat2.php106
-rw-r--r--config/vnstat2/www/vnstati.php1
4 files changed, 234 insertions, 230 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc
index c875be52..afbf270a 100644
--- a/config/vnstat2/vnstat2.inc
+++ b/config/vnstat2/vnstat2.inc
@@ -1,15 +1,16 @@
<?php
+
require_once("util.inc");
+
function vnstat_install_deinstall() {
conf_mount_rw();
global $config;
-// Remove Vnstat package and files
+ // Remove Vnstat package and files
exec("rm -d -R /usr/local/www/vnstat2");
exec("rm -d -R /usr/local/www/vnstati");
exec("rm -d -R /usr/local/pkg/vnstat2");
exec("rm /usr/local/etc/vnstat.conf");
-
-// Remove vnstat cron entry from config.xml
+ // Remove vnstat cron entry from config.xml
vnstat2_install_cron(false);
conf_mount_ro();
}
@@ -17,11 +18,12 @@ function vnstat_install_deinstall() {
function vnstat2_install_cron($vnstat_cron_value) {
global $config;
$is_installed = false;
- if(!$config['cron']['item'])
+ if (!$config['cron']['item']) {
return;
+ }
$x=0;
foreach($config['cron']['item'] as $item) {
- if(strstr($item['command'], "/usr/local/pkg/vnstat2/vnstat2.sh")) {
+ if (strstr($item['command'], "/usr/local/pkg/vnstat2/vnstat2.sh")) {
$is_installed = true;
break;
}
@@ -29,23 +31,23 @@ function vnstat2_install_cron($vnstat_cron_value) {
}
switch($vnstat_cron_value) {
case true:
- if(!$is_installed) {
+ if (!$is_installed) {
$cron_item = array();
$cron_item['minute'] = "*/1";
- $cron_item['hour'] = "*";
- $cron_item['mday'] = "*";
- $cron_item['month'] = "*";
- $cron_item['wday'] = "*";
- $cron_item['who'] = "root";
- $cron_item['command'] = "/usr/local/pkg/vnstat2/vnstat2.sh";
- $config['cron']['item'][] = $cron_item;
+ $cron_item['hour'] = "*";
+ $cron_item['mday'] = "*";
+ $cron_item['month'] = "*";
+ $cron_item['wday'] = "*";
+ $cron_item['who'] = "root";
+ $cron_item['command'] = "/usr/local/pkg/vnstat2/vnstat2.sh";
+ $config['cron']['item'][] = $cron_item;
write_config();
configure_cron();
}
break;
case false:
- if($is_installed == true) {
- if($x > 0) {
+ if ($is_installed == true) {
+ if ($x > 0) {
unset($config['cron']['item'][$x]);
write_config();
}
@@ -55,8 +57,7 @@ function vnstat2_install_cron($vnstat_cron_value) {
}
}
-
-function change_vnstat_conf(){
+function change_vnstat_conf() {
conf_mount_rw();
global $config;
$config['installedpackages']['vnstat2']['config'][0]['monthrotate'] = $_POST['monthrotate'];
@@ -64,21 +65,19 @@ function change_vnstat_conf(){
write_conf_f();
write_config();
- if ($config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'] == "on"){
- vnstat_php_frontend();
- }
- else {
- exec("[ -d /usr/local/www/vnstat2 ] && rm -d -R /usr/local/www/vnstat2");
+ if ($config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'] == "on") {
+ vnstat_php_frontend();
+ } else {
+ exec("[ -d /usr/local/www/vnstat2 ] && rm -d -R /usr/local/www/vnstat2");
}
conf_mount_ro();
}
-function write_conf_f(){
+function write_conf_f() {
global $config;
$monthrotate = $config['installedpackages']['vnstat2']['config'][0]['monthrotate'];
-// ************ Write new vnstat.conf *****************
-
+ // ************ Write new vnstat.conf *****************
$vnstat_conf_file = <<<EOF
# vnStat 1.10 config file
##
@@ -108,9 +107,9 @@ CTxD "-"
EOF;
$hf2 = fopen("/usr/local/etc/vnstat.conf","w");
- if(!$hf2) {
- log_error("could not open /usr/local/etc/vnstat.conf for writing");
- exit;
+ if (!$hf2) {
+ log_error("could not open /usr/local/etc/vnstat.conf for writing");
+ exit;
}
fwrite($hf2, $vnstat_conf_file);
fclose($hf2);
@@ -145,7 +144,7 @@ function create_vnstat_output() {
}
function vnstat_link_config() {
-// Check for pbi install and arch type then create symlinks
+ // Check for pbi install and arch type then create symlinks
if (file_exists('/usr/pbi/vnstat-' . php_uname("m"))) {
$conf_path = "/usr/local/etc/vnstat.conf";
$pbi_conf_path = "/usr/pbi/vnstat-" . php_uname("m") . "/etc/vnstat.conf";
@@ -179,14 +178,13 @@ function vnstat_create_nic_dbs() {
foreach ($leftovers as $nic) {
exec("/usr/local/bin/vnstat -u -i ". escapeshellarg($nic));
}
-
conf_mount_ro();
}
function vnstat_install_config() {
$vnstat_db_prefix = "/conf/vnstat";
conf_mount_rw();
-// Create vnstat database dir where it also will work for nanobsd
+ // Create vnstat database dir where it also will work for nanobsd
if (is_dir("/usr/local/pkg/vnstat2/vnstat")) {
@rename("/usr/local/pkg/vnstat2/vnstat", $vnstat_db_prefix);
}
@@ -194,141 +192,140 @@ function vnstat_install_config() {
@mkdir($vnstat_db_prefix);
}
vnstat_link_config();
-// Add MonthRotate value to config.xml and write /usr/local/etc/vnstat.conf
- if ($config['installedpackages']['vnstat2']['config'][0]['monthrotate'] == ""){
+ // Add MonthRotate value to config.xml and write /usr/local/etc/vnstat.conf
+ if ($config['installedpackages']['vnstat2']['config'][0]['monthrotate'] == "") {
$config['installedpackages']['vnstat2']['config'][0]['monthrotate'] = "1";
}
- if ($config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'] == "on"){
+ if ($config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'] == "on") {
vnstat_php_frontend();
}
write_conf_f();
-// Add cron job to config.xml
+ // Add cron job to config.xml
vnstat2_install_cron(true);
vnstat_create_nic_dbs();
write_config();
conf_mount_ro();
}
-function vnstat_php_frontend(){
+function vnstat_php_frontend() {
global $config;
-// Copy vnstat_php_frontend to www
+ // Copy vnstat_php_frontend to www
exec("/bin/cp -a /usr/local/pkg/vnstat2/vnstat_php_frontend/. /usr/local/www/vnstat2/");
-// Find information to be writing in config.php
+ // Find information to be writing in config.php
// $iface_list_array_items
- exec("ls /conf/vnstat/ | grep -v '\.'", $vnstat_nic_in);
- $iface_list_array_items = implode("', '", $vnstat_nic_in);
- $iface_list_array = "\$iface_list = array('$iface_list_array_items');";
- // $iface_title_array_items
- $iface_title_array_items = array();
- $iface_title_array_items2 = array();
- foreach ($vnstat_nic_in as $vnstat_nic_out)
- {
- $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
+ exec("ls /conf/vnstat/ | grep -v '\.'", $vnstat_nic_in);
+ $iface_list_array_items = implode("', '", $vnstat_nic_in);
+ $iface_list_array = "\$iface_list = array('$iface_list_array_items');";
+ // $iface_title_array_items
+ $iface_title_array_items = array();
+ $iface_title_array_items2 = array();
+ foreach ($vnstat_nic_in as $vnstat_nic_out) {
+ $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
}
- foreach ($ifdescrs as $ifdescr => $ifname):
- $real_nic_names3 = get_real_interface($ifdescr);
- If ($real_nic_names3 == $vnstat_nic_out)
- {
- $ifname_out = convert_friendly_interface_to_friendly_descr($ifdescr);
- $iface_title_array_items = "\$iface_title['$vnstat_nic_out'] = '$ifname_out';\n";
- array_push($iface_title_array_items2, $iface_title_array_items);
- }
- endforeach;
+ foreach ($ifdescrs as $ifdescr => $ifname) {
+ $real_nic_names3 = get_real_interface($ifdescr);
+ if ($real_nic_names3 == $vnstat_nic_out) {
+ $ifname_out = convert_friendly_interface_to_friendly_descr($ifdescr);
+ $iface_title_array_items = "\$iface_title['$vnstat_nic_out'] = '$ifname_out';\n";
+ array_push($iface_title_array_items2, $iface_title_array_items);
+ }
+ }
}
- $iface_title_array = implode($iface_title_array_items2);
+ $iface_title_array = implode($iface_title_array_items2);
// php in php static items
// added to new items for the front end version 1.5.1
- $locale = "\$locale = 'en_US.UTF-8';";
- $language = "\$language = 'en';";
- $vnstat_bin2 = "\$vnstat_bin = '/usr/local/bin/vnstat';";
- $data_dir2 = "\$data_dir = './dumps';";
- $graph_format2 ="\$graph_format='svg';";
- $colorscheme2 = "\$colorscheme['light'] = array(";
- $colorscheme3 = "\$colorscheme['red'] = array(";
- $colorscheme4 = "\$colorscheme['pfSense'] = array(";
-// ************ Write new config.php ******************
- $config_file = <<<EOF
+ $locale = "\$locale = 'en_US.UTF-8';";
+ $language = "\$language = 'en';";
+ $vnstat_bin2 = "\$vnstat_bin = '/usr/local/bin/vnstat';";
+ $data_dir2 = "\$data_dir = './dumps';";
+ $graph_format2 ="\$graph_format='svg';";
+ $colorscheme2 = "\$colorscheme['light'] = array(";
+ $colorscheme3 = "\$colorscheme['red'] = array(";
+ $colorscheme4 = "\$colorscheme['pfSense'] = array(";
+ // ************ Write new config.php ******************
+ $config_file = <<<EOF
<?php
- //
- // vnStat PHP frontend 1.5.1 (c)2006-2008 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.
- //
- //error_reporting(E_ALL | E_NOTICE);
-
- //
- // configuration parameters
- //
- // edit these to reflect your particular situation
- //
-$locale
-$language
- // list of network interfaces monitored by vnStat
-$iface_list_array
+ //
+ // vnStat PHP frontend 1.5.1 (c)2006-2008 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.
+ //
+ //error_reporting(E_ALL | E_NOTICE);
+
+ //
+ // configuration parameters
+ //
+ // edit these to reflect your particular situation
+ //
+ $locale
+ $language
+ // list of network interfaces monitored by vnStat
+ $iface_list_array
- //
- // optional names for interfaces
- // if there's no name set for an interface then the interface identifier
- // will be displayed instead
-$iface_title_array
+ //
+ // optional names for interfaces
+ // if there's no name set for an interface then the interface identifier
+ // will be displayed instead
+ $iface_title_array
- //
- // There are two possible sources for vnstat data. If the
- // variable is set then vnstat is called directly from the PHP script
- // 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 variable
- // must be cleared and set to the location where the dumps
- // are stored. Dumps must be named 'vnstat_dump_'.
- //
- // You can generate vnstat dumps with the command:
- // vnstat --dumpdb -i > /path/to/data_dir/vnstat_dump_
- //
-$vnstat_bin2
-$data_dir2
+ //
+ // There are two possible sources for vnstat data. If the
+ // variable is set then vnstat is called directly from the PHP script
+ // 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 variable
+ // must be cleared and set to the location where the dumps
+ // are stored. Dumps must be named 'vnstat_dump_'.
+ //
+ // You can generate vnstat dumps with the command:
+ // vnstat --dumpdb -i > /path/to/data_dir/vnstat_dump_
+ //
+ $vnstat_bin2
+ $data_dir2
- // graphics format to use: svg or png
-$graph_format2
-
- // Font to use for PNG graphs
- define('GRAPH_FONT',dirname(__FILE__).'/VeraBd.ttf');
+ // graphics format to use: svg or png
+ $graph_format2
- // Font to use for SVG graphs
- define('SVG_FONT', 'Verdana');
+ // Font to use for PNG graphs
+ define('GRAPH_FONT',dirname(__FILE__).'/VeraBd.ttf');
- // color schemes
- // colors are defined as R,G,B,ALPHA quads where R, G and B range from 0-255
- // and ALPHA from 0-127 where 0 is opaque and 127 completely transparent.
- //
- define('DEFAULT_COLORSCHEME', 'pfSense');
+ // Font to use for SVG graphs
+ define('SVG_FONT', 'Verdana');
+
+ // color schemes
+ // colors are defined as R,G,B,ALPHA quads where R, G and B range from 0-255
+ // and ALPHA from 0-127 where 0 is opaque and 127 completely transparent.
+ //
+ define('DEFAULT_COLORSCHEME', 'pfSense');
?>
EOF;
- $hf = fopen("/usr/local/www/vnstat2/config.php","w");
- if(!$hf) {
- log_error("could not open /usr/local/www/vnstat2/config.php for writing");
- exit;
- }
- fwrite($hf, $config_file);
- fclose($hf);
+ $hf = fopen("/usr/local/www/vnstat2/config.php","w");
+ if (!$hf) {
+ log_error("could not open /usr/local/www/vnstat2/config.php for writing");
+ exit;
+ }
+ fwrite($hf, $config_file);
+ fclose($hf);
}
+
?>
diff --git a/config/vnstat2/www/diag_vnstat.php b/config/vnstat2/www/diag_vnstat.php
index 04e03911..5e6524c7 100644
--- a/config/vnstat2/www/diag_vnstat.php
+++ b/config/vnstat2/www/diag_vnstat.php
@@ -1,30 +1,30 @@
<?php
/* $Id$ */
/*
- diag_pf_info.php
- Copyright (C) 2010 Scott Ullrich
- All rights reserved.
+ diag_pf_info.php
+ Copyright (C) 2010 Scott Ullrich
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -44,7 +44,7 @@ require("guiconfig.inc");
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
$pgtitle = gettext("Vnstat2 summary ");
-if($_REQUEST['getactivity']) {
+if ($_REQUEST['getactivity']) {
$text = `vnstat`;
$text .= "<p/>";
echo $text;
@@ -80,7 +80,7 @@ include("head.inc");
if ($pf_version < 2.0)
echo "<p class=\"pgtitle\">{$pgtitle}</p>";
echo "<a href=$myurl/pkg_edit.php?xml=vnstatoutput.xml&id=0>Go Back</a><br />";
- if($savemsg) {
+ if ($savemsg) {
echo "<div id='savemsg'>";
print_info_box($savemsg);
echo "</div>";
@@ -89,25 +89,27 @@ include("head.inc");
print_input_errors($input_errors);
?>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <center>
- <table>
- <tr><td>
- <div name='cpuactivitydiv' id='cpuactivitydiv'>
- <b><?=gettext("Gathering vnstat information, please wait...");?>
- </div>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
+ <tr>
+ <td>
+ <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td>
+ <center>
+ <table>
+ <tr>
+ <td>
+ <div name='cpuactivitydiv' id='cpuactivitydiv'>
+ <b><?=gettext("Gathering vnstat information, please wait...");?>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/config/vnstat2/www/diag_vnstat2.php b/config/vnstat2/www/diag_vnstat2.php
index e5ce1de5..504fd534 100644
--- a/config/vnstat2/www/diag_vnstat2.php
+++ b/config/vnstat2/www/diag_vnstat2.php
@@ -1,30 +1,30 @@
<?php
/* $Id$ */
/*
- diag_system_pftop.php
- Copyright (C) 2008-2009 Scott Ullrich
- All rights reserved.
+ diag_system_pftop.php
+ Copyright (C) 2008-2009 Scott Ullrich
+ All rights reserved.
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
/*
@@ -46,11 +46,12 @@ $bbbb = convert_real_interface_to_friendly_descr($aaaa);
$pf_version=substr(trim(file_get_contents("/etc/version")),0,3);
$pgtitle = gettext("Vnstat2 info for $bbbb ($aaaa)");
-if($_REQUEST['getactivity']) {
- if($_REQUEST['sorttype'])
+if ($_REQUEST['getactivity']) {
+ if ($_REQUEST['sorttype']) {
$sorttype = escapeshellarg($_REQUEST['sorttype']);
- else
- $sorttype = gettext("-h");
+ } else {
+ $sorttype = gettext("-h");
+ }
$text = `vnstat -i $aaaa {$sorttype}`;
echo $text;
exit;
@@ -58,10 +59,11 @@ if($_REQUEST['getactivity']) {
include("head.inc");
-if($_REQUEST['sorttype'])
+if ($_REQUEST['sorttype']) {
$sorttype = htmlentities($_REQUEST['sorttype']);
-else
+} else {
$sorttype = "-h";
+}
?>
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
@@ -87,16 +89,18 @@ else
<div id='maincontent'>
<?php
include("fbegin.inc");
- if ($pf_version < 2.0)
+ if ($pf_version < 2.0) {
echo "<p class=\"pgtitle\">{$pgtitle}</p>";
- echo "<a href=$myurl/pkg_edit.php?xml=vnstatoutput.xml&id=0>Go Back</a><br />";
- if($savemsg) {
+ }
+ echo "<a href=$myurl/pkg_edit.php?xml=vnstatoutput.xml&id=0>Go Back</a><br />";
+ if ($savemsg) {
echo "<div id='savemsg'>";
print_info_box($savemsg);
echo "</div>";
}
- if ($input_errors)
+ if ($input_errors) {
print_input_errors($input_errors);
+ }
?>
<form method="post">
<?=gettext("Sort type:"); ?>
@@ -107,29 +111,31 @@ else
<option value='-m'><?=gettext("Show traffic for months.");?></option>
<option value='-t'><?=gettext("Show all time top10 traffic.");?></option>
<option value='-tr'><?=gettext("Calculate 5sec. of traffic.");?></option>
- <option value='-w'><?=gettext("Show traffic for 7 days, current and previous week.");?></option>
+ <option value='-w'><?=gettext("Show traffic for 7 days, current and previous week.");?></option>
</select>
<p/>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
- <tr>
- <td>
- <center>
- <table>
- <tr><td>
- <div name='cpuactivitydiv' id='cpuactivitydiv'>
- <b><?=gettext("Gathering vnstat activity, please wait...");?>
- </div>
- </td></tr>
- </table>
- </td>
- </tr>
- </table>
- </div>
- </td>
- </tr>
+ <tr>
+ <td>
+ <table id="backuptable" class="tabcont" align="center" width="100%" border="0" cellpadding="6" cellspacing="0">
+ <tr>
+ <td>
+ <center>
+ <table>
+ <tr>
+ <td>
+ <div name='cpuactivitydiv' id='cpuactivitydiv'>
+ <b><?=gettext("Gathering vnstat activity, please wait...");?>
+ </div>
+ </td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </td>
+ </tr>
</table>
</form>
<?php include("fend.inc"); ?>
diff --git a/config/vnstat2/www/vnstati.php b/config/vnstat2/www/vnstati.php
index e5ddcd21..01eca208 100644
--- a/config/vnstat2/www/vnstati.php
+++ b/config/vnstat2/www/vnstati.php
@@ -14,4 +14,3 @@ echo "<center><p class=\"pgtitle\">{$pgtitle}</p>";
<center><img src="vnstat2_img.php?image=newpicture3.png" style="border:1px solid black; center;"><br />
<center><img src="vnstat2_img.php?image=newpicture4.png" style="border:1px solid black; center;"><br />
<?php include("fend.inc"); ?>
-