From 46fbcd64170802436776ad822db94435851e8e2c Mon Sep 17 00:00:00 2001 From: Perry Mason Date: Wed, 22 Dec 2010 09:03:35 +0100 Subject: [vnstat2] Change vnstati, fix monthrate on install, add go back link --- config/vnstat2/bin/diag_vnstat.abc | 2 +- config/vnstat2/bin/diag_vnstat2.abc | 2 +- config/vnstat2/bin/vnstat2_img.abc | 6 ++++++ config/vnstat2/bin/vnstati.abc | 17 +++++++++++++++++ config/vnstat2/vnstat2.inc | 16 +++++++++++----- config/vnstat2/vnstat2.xml | 24 +++++++++++++++++------- config/vnstat2/vnstati.xml | 18 +----------------- 7 files changed, 54 insertions(+), 31 deletions(-) mode change 100755 => 100644 config/vnstat2/bin/diag_vnstat2.abc create mode 100644 config/vnstat2/bin/vnstat2_img.abc create mode 100644 config/vnstat2/bin/vnstati.abc (limited to 'config/vnstat2') diff --git a/config/vnstat2/bin/diag_vnstat.abc b/config/vnstat2/bin/diag_vnstat.abc index db683a15..afef3849 100644 --- a/config/vnstat2/bin/diag_vnstat.abc +++ b/config/vnstat2/bin/diag_vnstat.abc @@ -44,7 +44,6 @@ require("guiconfig.inc"); $pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); $pgtitle = gettext("Vnstat2 summary "); - if($_REQUEST['getactivity']) { $text = `vnstat`; $text .= "

"; @@ -80,6 +79,7 @@ include("head.inc"); include("fbegin.inc"); if(strstr($pfSversion, "1.2")) echo "

{$pgtitle}

"; + echo "Go Back
"; if($savemsg) { echo "
"; print_info_box($savemsg); diff --git a/config/vnstat2/bin/diag_vnstat2.abc b/config/vnstat2/bin/diag_vnstat2.abc old mode 100755 new mode 100644 index e41f9dc1..e4ef0f21 --- a/config/vnstat2/bin/diag_vnstat2.abc +++ b/config/vnstat2/bin/diag_vnstat2.abc @@ -44,7 +44,6 @@ $aaaa = $config['installedpackages']['vnstat2']['config'][0]['vnstat_output_nic' $bbbb = convert_real_interface_to_friendly_descr($aaaa); $pfSversion = str_replace("\n", "", file_get_contents("/etc/version")); - $pgtitle = gettext("Vnstat2 info for $bbbb ($aaaa)"); if($_REQUEST['getactivity']) { @@ -90,6 +89,7 @@ else include("fbegin.inc"); if(strstr($pfSversion, "1.2")) echo "

{$pgtitle}

"; + echo "Go Back
"; if($savemsg) { echo "
"; print_info_box($savemsg); diff --git a/config/vnstat2/bin/vnstat2_img.abc b/config/vnstat2/bin/vnstat2_img.abc new file mode 100644 index 00000000..85644309 --- /dev/null +++ b/config/vnstat2/bin/vnstat2_img.abc @@ -0,0 +1,6 @@ + diff --git a/config/vnstat2/bin/vnstati.abc b/config/vnstat2/bin/vnstati.abc new file mode 100644 index 00000000..aa76a4b3 --- /dev/null +++ b/config/vnstat2/bin/vnstati.abc @@ -0,0 +1,17 @@ +Go Back
"; +echo "

{$pgtitle}

"; +?> +

+

+

+

+ + diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc index a8ebe5d5..08c6a28c 100644 --- a/config/vnstat2/vnstat2.inc +++ b/config/vnstat2/vnstat2.inc @@ -11,6 +11,8 @@ function vnstat_install_deinstall() { exec("rm /usr/local/etc/vnstat2.conf"); exec("rm /usr/local/www/diag_vnstat.php"); exec("rm /usr/local/www/diag_vnstat2.php"); + exec("rm /usr/local/www/vnstati.php"); + exec("rm /usr/local/www/vnstat2_img.php"); // Remove vnstat cron entry from config.xml vnstat2_install_cron(false); conf_mount_ro(); @@ -112,12 +114,13 @@ EOF; function create_vnstati_image() { conf_mount_rw(); global $config; - exec("[ ! -d /usr/local/www/vnstati ] && mkdir /usr/local/www/vnstati"); - $iface = $_POST['vnstat_interface']; - $iface2 = $_POST['output_type']; + $iface = $_POST['vnstat_interface']; + $config['installedpackages']['vnstat2']['config'][0]['vnstati_interface'] = $iface; $ifaces_final = convert_friendly_interface_to_real_interface_name($iface); -// exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -". $iface2 ." -o /usr/local/www/vnstati/". $ifaces_final ."-". $iface2 .".png"); - exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -". $iface2 ." -o /usr/local/www/vnstati/newpicture.png"); + exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -vs -o /tmp/newpicture1.png"); + exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -m -o /tmp/newpicture2.png"); + exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -d -o /tmp/newpicture3.png"); + exec("/usr/local/bin/vnstati -i ". $ifaces_final ." -t -o /tmp/newpicture4.png"); conf_mount_ro(); } @@ -140,6 +143,8 @@ function vnstat_install_config() { exec("[ ! -d /conf/vnstat ] && mkdir /conf/vnstat"); exec("[ ! -f /usr/local/www/diag_vnstat2.php ] && cp /usr/local/pkg/diag_vnstat2.abc /usr/local/www/diag_vnstat2.php"); exec("[ ! -f /usr/local/www/diag_vnstat.php ] && cp /usr/local/pkg/diag_vnstat.abc /usr/local/www/diag_vnstat.php"); + exec("[ ! -f /usr/local/www/vnstati.php ] && cp /usr/local/pkg/vnstati.abc /usr/local/www/vnstati.php"); + exec("[ ! -f /usr/local/www/vnstat2_img.php ] && cp /usr/local/pkg/vnstat2_img.abc /usr/local/www/vnstat2_img.php"); // Unpack and move Vnstat frontend exec("cd .."); exec("tar -zxovf /usr/local/pkg/vnstat_php_frontend-1.4.1.tar.gz"); @@ -334,6 +339,7 @@ EOF; } fwrite($hf, $config_file); fclose($hf); + write_config(); conf_mount_ro(); } ?> diff --git a/config/vnstat2/vnstat2.xml b/config/vnstat2/vnstat2.xml index 564bdcfb..31e99890 100644 --- a/config/vnstat2/vnstat2.xml +++ b/config/vnstat2/vnstat2.xml @@ -43,37 +43,47 @@ /usr/local/pkg/ 0644 - http://www.pfsense.com/packages/config/vnstat2/vnstat2.inc + http://www,pfsense.com/packages/config/vnstat2/vnstat2.inc /usr/local/pkg/ 0644 - http://www.pfsense.com/packages/config/vnstat2/bin/vnstat_php_frontend-1.4.1.tar.gz + http://www,pfsense.com/packages/config/vnstat2/bin/vnstat_php_frontend-1.4.1.tar.gz /usr/local/pkg/ 0644 - http://www.pfsense.com/packages/config/vnstat2/vnstati.xml + http://www,pfsense.com/packages/config/vnstat2/vnstati.xml /usr/local/pkg/ 0744 - http://www.pfsense.com/packages/config/vnstat2/vnstat2.sh + http://www,pfsense.com/packages/config/vnstat2/vnstat2.sh /usr/local/pkg/ 0644 - http://www.pfsense.com/packages/config/vnstat2/vnstatoutput.xml + http://www,pfsense.com/packages/config/vnstat2/vnstatoutput.xml /usr/local/pkg/ 0644 - http://www.pfsense.com/packages/config/vnstat2/bin/diag_vnstat.abc + http://www,pfsense.com/packages/config/vnstat2/bin/diag_vnstat.abc /usr/local/pkg/ 0644 - http://www.pfsense.com/packages/config/vnstat2/bin/diag_vnstat2.abc + http://www,pfsense.com/packages/config/vnstat2/bin/diag_vnstat2.abc + + + /usr/local/pkg/ + 0644 + http://www,pfsense.com/packages/config/vnstat2/bin/vnstat2_img.abc + + + /usr/local/pkg/ + 0644 + http://www,pfsense.com/packages/config/vnstat2/bin/vnstati.abc diff --git a/config/vnstat2/vnstati.xml b/config/vnstat2/vnstati.xml index 8c616cc2..e2246ca0 100644 --- a/config/vnstat2/vnstati.xml +++ b/config/vnstat2/vnstati.xml @@ -9,7 +9,7 @@ vnstat2 1.0 Vnstat2 - /vnstati/newpicture.png + /vnstati.php /usr/local/pkg/vnstat2.inc vnstat2 @@ -47,22 +47,6 @@ Select interface interfaces_selection - - Select output type - Output Type - output_type - select - 7 - - - - - - - - - - create_vnstati_image(); -- cgit v1.2.3