diff options
author | Chris Buechler <cmb@pfsense.org> | 2015-08-08 01:28:46 -0500 |
---|---|---|
committer | Chris Buechler <cmb@pfsense.org> | 2015-08-08 01:28:46 -0500 |
commit | c5bb49a943bbbcd058273ef06fa29e2d83c27810 (patch) | |
tree | d5188ce4a4a166cc7d204ac7e8fe29e66f062113 | |
parent | 2c3a0b1fea61b27c76621bfe116665cfd31f20d9 (diff) | |
parent | 83ae1d4fbfb8b8976b59bfd37fa00c91463cf174 (diff) | |
download | pfsense-packages-c5bb49a943bbbcd058273ef06fa29e2d83c27810.tar.gz pfsense-packages-c5bb49a943bbbcd058273ef06fa29e2d83c27810.tar.bz2 pfsense-packages-c5bb49a943bbbcd058273ef06fa29e2d83c27810.zip |
Merge pull request #956 from doktornotor/patch-8
-rw-r--r-- | config/vnstat2/vnstat2.inc | 100 | ||||
-rw-r--r-- | config/vnstat2/vnstat2.xml | 83 | ||||
-rw-r--r-- | config/vnstat2/vnstati.xml | 50 | ||||
-rw-r--r-- | config/vnstat2/vnstatoutput.xml | 50 | ||||
-rw-r--r-- | config/vnstat2/www/diag_vnstat.php | 55 | ||||
-rw-r--r-- | config/vnstat2/www/diag_vnstat2.php | 53 | ||||
-rw-r--r-- | config/vnstat2/www/vnstat2_img.php | 28 | ||||
-rw-r--r-- | config/vnstat2/www/vnstati.php | 41 | ||||
-rw-r--r-- | pkg_config.10.xml | 2 |
9 files changed, 289 insertions, 173 deletions
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc index ca8d869d..89a8b7c2 100644 --- a/config/vnstat2/vnstat2.inc +++ b/config/vnstat2/vnstat2.inc @@ -1,15 +1,42 @@ <?php +/* + vnstat2.inc + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2010 PerryMason + Copyright (C) 2015 ESF, LLC + All rights reserved. + 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. + + 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. +*/ require_once("util.inc"); function vnstat_install_deinstall() { conf_mount_rw(); global $config; // 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"); + exec("/bin/rm -d -R /usr/local/www/vnstat2"); + exec("/bin/rm -d -R /usr/local/www/vnstati"); + exec("/bin/rm -d -R /usr/local/pkg/vnstat2"); + exec("/bin/rm /usr/local/etc/vnstat.conf"); // Remove vnstat cron entry from config.xml vnstat2_install_cron(false); conf_mount_ro(); @@ -22,29 +49,29 @@ function vnstat2_install_cron($vnstat_cron_value) { return; } $x=0; - foreach($config['cron']['item'] as $item) { + foreach ($config['cron']['item'] as $item) { if (strstr($item['command'], "/usr/local/pkg/vnstat2/vnstat2.sh")) { $is_installed = true; break; } $x++; } - switch($vnstat_cron_value) { + switch ($vnstat_cron_value) { case true: 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"; + $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; write_config(); configure_cron(); } - break; + break; case false: if ($is_installed == true) { if ($x > 0) { @@ -53,7 +80,7 @@ function vnstat2_install_cron($vnstat_cron_value) { } configure_cron(); } - break; + break; } } @@ -61,14 +88,14 @@ function change_vnstat_conf() { conf_mount_rw(); global $config; $config['installedpackages']['vnstat2']['config'][0]['monthrotate'] = $_POST['monthrotate']; - $config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'] = $_POST['vnstat_phpfrontend']; + $config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'] = $_POST['vnstat_phpfrontend']; 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"); + exec("[ -d /usr/local/www/vnstat2 ] && /bin/rm -d -R /usr/local/www/vnstat2"); } conf_mount_ro(); } @@ -77,9 +104,9 @@ 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 +# vnStat 1.12 config file ## # location of the database directory @@ -106,7 +133,7 @@ CRxD "-" CTxD "-" EOF; - $hf2 = fopen("/usr/local/etc/vnstat.conf","w"); + $hf2 = fopen("/usr/local/etc/vnstat.conf", "w"); if (!$hf2) { log_error("could not open /usr/local/etc/vnstat.conf for writing"); exit; @@ -124,11 +151,11 @@ function create_vnstati_image() { $iface = $_POST['vnstat_interface']; $ifaces_final = convert_friendly_interface_to_real_interface_name($iface); $config['installedpackages']['vnstat2']['config'][0]['vnstat_interface'] = $ifaces_final; - @mkdir($vnstat_tmp); - exec("/usr/local/bin/vnstati -i ". escapeshellarg($ifaces_final) ." -vs -o {$vnstat_tmp}/newpicture1.png"); - exec("/usr/local/bin/vnstati -i ". escapeshellarg($ifaces_final) ." -m -o {$vnstat_tmp}/newpicture2.png"); - exec("/usr/local/bin/vnstati -i ". escapeshellarg($ifaces_final) ." -d -o {$vnstat_tmp}/newpicture3.png"); - exec("/usr/local/bin/vnstati -i ". escapeshellarg($ifaces_final) ." -t -o {$vnstat_tmp}/newpicture4.png"); + safe_mkdir($vnstat_tmp); + exec("/usr/local/bin/vnstati -i " . escapeshellarg($ifaces_final) . " -vs -o {$vnstat_tmp}/newpicture1.png"); + exec("/usr/local/bin/vnstati -i " . escapeshellarg($ifaces_final) . " -m -o {$vnstat_tmp}/newpicture2.png"); + exec("/usr/local/bin/vnstati -i " . escapeshellarg($ifaces_final) . " -d -o {$vnstat_tmp}/newpicture3.png"); + exec("/usr/local/bin/vnstati -i " . escapeshellarg($ifaces_final) . " -t -o {$vnstat_tmp}/newpicture4.png"); write_config(); conf_mount_ro(); } @@ -136,7 +163,7 @@ function create_vnstati_image() { function create_vnstat_output() { conf_mount_rw(); global $config; - $iface2 = $_POST['vnstat_interface2']; + $iface2 = $_POST['vnstat_interface2']; $ifaces_final2 = convert_friendly_interface_to_real_interface_name($iface2); $config['installedpackages']['vnstat2']['config'][0]['vnstat_interface2'] = $ifaces_final2; write_config(); @@ -144,7 +171,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"; @@ -157,7 +184,7 @@ function vnstat_create_nic_dbs() { global $config; conf_mount_rw(); $vnstat_db_prefix = "/conf/vnstat"; - @mkdir($vnstat_db_prefix); + safe_mkdir($vnstat_db_prefix); // Locate NICs and create associated databases $array_of_real_nic_names = array(); @@ -189,9 +216,8 @@ function vnstat_install_config() { if (is_dir("/usr/local/pkg/vnstat2/vnstat")) { @rename("/usr/local/pkg/vnstat2/vnstat", $vnstat_db_prefix); } - if (!is_dir($vnstat_db_prefix)) { - @mkdir($vnstat_db_prefix); - } + safe_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'] == "") { @@ -212,9 +238,9 @@ function vnstat_php_frontend() { global $config; // 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 written in config.php // $iface_list_array_items - exec("ls /conf/vnstat/ | grep -v '\.'", $vnstat_nic_in); + exec("/bin/ls /conf/vnstat/ | /usr/bin/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 @@ -235,8 +261,8 @@ function vnstat_php_frontend() { } } $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 + // PHP in 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';"; @@ -245,7 +271,7 @@ function vnstat_php_frontend() { $colorscheme2 = "\$colorscheme['light'] = array("; $colorscheme3 = "\$colorscheme['red'] = array("; $colorscheme4 = "\$colorscheme['pfSense'] = array("; - // ************ Write new config.php ****************** + // Write new config.php $config_file = <<<EOF <?php // @@ -320,7 +346,7 @@ function vnstat_php_frontend() { ?> EOF; - $hf = fopen("/usr/local/www/vnstat2/config.php","w"); + $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; diff --git a/config/vnstat2/vnstat2.xml b/config/vnstat2/vnstat2.xml index f696850a..7e65d465 100644 --- a/config/vnstat2/vnstat2.xml +++ b/config/vnstat2/vnstat2.xml @@ -1,19 +1,53 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> -<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> - <copyright></copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ====================================================================================== */ +/* + vnstat2.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 PerryMason + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ +/* + 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. + + 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. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <name>vnstat2</name> - <version>11.2,3</version> + <version>1.12.5</version> <title>Vnstat2</title> <aftersaveredirect>/pkg_edit.php?xml=vnstat2.xml&id=0</aftersaveredirect> <include_file>/usr/local/pkg/vnstat2/vnstat2.inc</include_file> <menu> <name>Vnstat2</name> - <tooltiptext></tooltiptext> <section>Status</section> <url>/pkg_edit.php?xml=vnstat2.xml&id=0</url> </menu> @@ -42,17 +76,14 @@ </tabs> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat2.inc</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstati.xml</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstatoutput.xml</item> </additional_files_needed> <additional_files_needed> @@ -62,137 +93,110 @@ </additional_files_needed> <additional_files_needed> <prefix>/usr/local/www/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/www/diag_vnstat.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/www/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/www/diag_vnstat2.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/www/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/www/vnstat2_img.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/www/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/www/vnstati.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/lang/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/lang/cs.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/lang/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/lang/en.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/lang/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/lang/nl.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/dark/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/dark/style.css</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/dark/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/dark/theme.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/espresso/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/espresso/style.css</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/espresso/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/espresso/theme.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/light/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/light/style.css</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/light/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/light/theme.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/pfSense/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/pfSense/style.css</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/pfSense/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/pfSense/theme.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/red/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/red/style.css</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/themes/red/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/themes/red/theme.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/config.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/COPYING</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/graph.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/graph_svg.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/index.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/localize.php</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/README</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/vera_copyright.txt</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/VeraBd.ttf</item> </additional_files_needed> <additional_files_needed> <prefix>/usr/local/pkg/vnstat2/vnstat_php_frontend/</prefix> - <chmod>0644</chmod> <item>https://packages.pfsense.org/packages/config/vnstat2/vnstat_php_frontend/vnstat.php</item> </additional_files_needed> <fields> @@ -235,14 +239,13 @@ </options> </field> <field> - <description>Enable vnstat php frontend (Note that no login will be needed)</description> - <fielddescr>Enable php frontend for vnstat</fielddescr> + <description>Enable vnstat PHP frontend</description> + <fielddescr>Enable PHP frontend for vnstat. (Note that no login will be needed.)</fielddescr> <fieldname>vnstat_phpfrontend</fieldname> <type>checkbox</type> </field> </fields> <custom_add_php_command>change_vnstat_conf();</custom_add_php_command> - <custom_php_resync_config_command></custom_php_resync_config_command> <custom_php_install_command>vnstat_install_config();</custom_php_install_command> <custom_php_deinstall_command>vnstat_install_deinstall();</custom_php_deinstall_command> </packagegui> diff --git a/config/vnstat2/vnstati.xml b/config/vnstat2/vnstati.xml index 84a104dd..b395e65f 100644 --- a/config/vnstat2/vnstati.xml +++ b/config/vnstat2/vnstati.xml @@ -1,19 +1,53 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> -<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> - <copyright></copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ====================================================================================== */ +/* + vnstati.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2010 PerryMason + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ +/* + 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. + + 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. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <name>vnstat2</name> - <version>1.0</version> + <version>1.12.5</version> <title>Vnstat2</title> <aftersaveredirect>/vnstati.php</aftersaveredirect> <include_file>/usr/local/pkg/vnstat2/vnstat2.inc</include_file> <menu> <name>vnstat2</name> - <tooltiptext></tooltiptext> <section>Status</section> <url>/pkg_edit.php?xml=vnstat2.xml&id=0</url> </menu> @@ -48,9 +82,7 @@ <type>interfaces_selection</type> </field> </fields> - <custom_php_global_functions></custom_php_global_functions> <custom_add_php_command>create_vnstati_image();</custom_add_php_command> - <custom_php_resync_config_command></custom_php_resync_config_command> <custom_php_install_command>vnstat_install_config();</custom_php_install_command> <custom_php_deinstall_command>vnstat_install_deinstall();</custom_php_deinstall_command> </packagegui> diff --git a/config/vnstat2/vnstatoutput.xml b/config/vnstat2/vnstatoutput.xml index 5062be1f..297c171a 100644 --- a/config/vnstat2/vnstatoutput.xml +++ b/config/vnstat2/vnstatoutput.xml @@ -1,19 +1,53 @@ <?xml version="1.0" encoding="utf-8" ?> <!DOCTYPE packagegui SYSTEM "../schema/packages.dtd"> -<?xml-stylesheet type="text/xsl" href="./xsl/package.xsl"?> +<?xml-stylesheet type="text/xsl" href="../xsl/package.xsl"?> <packagegui> - <copyright></copyright> - <description>Describe your package here</description> - <requirements>Describe your package requirements here</requirements> - <faq>Currently there are no FAQ items provided.</faq> + <copyright> + <![CDATA[ +/* $Id$ */ +/* ====================================================================================== */ +/* + vnstatoutput.xml + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 PerryMason + Copyright (C) 2015 ESF, LLC + All rights reserved. +*/ +/* ====================================================================================== */ +/* + 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. + + 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. +*/ +/* ====================================================================================== */ + ]]> + </copyright> <name>vnstat2</name> - <version>1.0</version> + <version>1.12.5</version> <title>Vnstat2</title> <aftersaveredirect>/diag_vnstat2.php</aftersaveredirect> <include_file>/usr/local/pkg/vnstat2/vnstat2.inc</include_file> <menu> <name>vnstat2</name> - <tooltiptext></tooltiptext> <section>Status</section> <url>/pkg_edit.php?xml=vnstat2.xml&id=0</url> </menu> @@ -48,9 +82,7 @@ <type>interfaces_selection</type> </field> </fields> - <custom_php_global_functions></custom_php_global_functions> <custom_add_php_command>create_vnstat_output();</custom_add_php_command> - <custom_php_resync_config_command></custom_php_resync_config_command> <custom_php_install_command>vnstat_install_config();</custom_php_install_command> <custom_php_deinstall_command>vnstat_install_deinstall();</custom_php_deinstall_command> </packagegui> diff --git a/config/vnstat2/www/diag_vnstat.php b/config/vnstat2/www/diag_vnstat.php index 5e6524c7..e5014120 100644 --- a/config/vnstat2/www/diag_vnstat.php +++ b/config/vnstat2/www/diag_vnstat.php @@ -1,8 +1,9 @@ <?php -/* $Id$ */ /* - diag_pf_info.php - Copyright (C) 2010 Scott Ullrich + diag_vnstat.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 PerryMason + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -26,26 +27,10 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -/* - pfSense_BUILDER_BINARIES: /usr/bin/top - pfSense_MODULE: system -*/ - -##|+PRIV -##|*IDENT=page-diag-system-activity -##|*NAME=Diagnostics: System Activity -##|*DESCR=Allows access to the 'Diagnostics: System Activity' page -##|*MATCH=diag_system_activity* -##|-PRIV - -require("guiconfig.inc"); - -$pf_version=substr(trim(file_get_contents("/etc/version")),0,3); - -$pgtitle = gettext("Vnstat2 summary "); +require_once("guiconfig.inc"); +$pgtitle = gettext("Vnstat2 summary"); if ($_REQUEST['getactivity']) { - $text = `vnstat`; + $text = shell_exec("/usr/local/bin/vnstat"); $text .= "<p/>"; echo $text; exit; @@ -55,8 +40,8 @@ include("head.inc"); ?> <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> - <script type="text/javascript"> +//<![CDATA[ function getcpuactivity() { var url = "/diag_vnstat.php"; var pars = 'getactivity=yes'; @@ -69,37 +54,36 @@ include("head.inc"); }); } function activitycallback(transport) { - $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; - setTimeout('getcpuactivity()', 2000); + $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; + setTimeout('getcpuactivity()', 2000); } - setTimeout('getcpuactivity()', 5000); + setTimeout('getcpuactivity()', 5000); +//]]> </script> <div id='maincontent'> <?php - include("fbegin.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 />"; + include("fbegin.inc"); + if ($savemsg) { echo "<div id='savemsg'>"; print_info_box($savemsg); - echo "</div>"; + echo "</div>"; } - if ($input_errors) + if ($input_errors) { print_input_errors($input_errors); + } ?> -<table width="100%" border="0" cellpadding="0" cellspacing="0"> +<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...");?> + <strong><?=gettext("Gathering vnstat information, please wait...");?></strong> </div> </td> </tr> @@ -107,7 +91,6 @@ include("head.inc"); </td> </tr> </table> - </div> </td> </tr> </table> diff --git a/config/vnstat2/www/diag_vnstat2.php b/config/vnstat2/www/diag_vnstat2.php index 504fd534..2153cc18 100644 --- a/config/vnstat2/www/diag_vnstat2.php +++ b/config/vnstat2/www/diag_vnstat2.php @@ -1,8 +1,9 @@ <?php -/* $Id$ */ /* - diag_system_pftop.php - Copyright (C) 2008-2009 Scott Ullrich + diag_vnstat2.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 PerryMason + Copyright (C) 2015 ESF, LLC All rights reserved. Redistribution and use in source and binary forms, with or without @@ -26,24 +27,10 @@ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ - -/* - pfSense_MODULE: filter -*/ - -##|+PRIV -##|*IDENT=page-diag-system-activity -##|*NAME=Diagnostics: System Activity -##|*DESCR=Allows access to the 'Diagnostics: System Activity' page -##|*MATCH=diag_system_pftop* -##|-PRIV - -require("guiconfig.inc"); +require_once("guiconfig.inc"); global $config; $aaaa = $config['installedpackages']['vnstat2']['config'][0]['vnstat_interface2']; $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']) { @@ -51,9 +38,9 @@ if ($_REQUEST['getactivity']) { $sorttype = escapeshellarg($_REQUEST['sorttype']); } else { $sorttype = gettext("-h"); + $text = shell_exec("/usr/local/bin/vnstat -i {$aaaa} {$sorttype}"); + echo $text; } - $text = `vnstat -i $aaaa {$sorttype}`; - echo $text; exit; } @@ -69,6 +56,7 @@ if ($_REQUEST['sorttype']) { <body link="#0000CC" vlink="#0000CC" alink="#0000CC"> <form method="post" action="diag_vnstat2.php"> <script type="text/javascript"> +//<![CDATA[ function getcpuactivity() { var url = "/diag_vnstat2.php"; var pars = 'getactivity=yes&sorttype=' + $('sorttype').value; @@ -81,22 +69,19 @@ if ($_REQUEST['sorttype']) { }); } function activitycallback(transport) { - $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; - setTimeout('getcpuactivity()', 2500); + $('cpuactivitydiv').innerHTML = '<font face="Courier"><font size="2"><b><pre>' + transport.responseText + '</pre></font>'; + setTimeout('getcpuactivity()', 2500); } - setTimeout('getcpuactivity()', 1000); + setTimeout('getcpuactivity()', 1000); +//]]> </script> <div id='maincontent'> <?php - include("fbegin.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 />"; + include("fbegin.inc"); if ($savemsg) { echo "<div id='savemsg'>"; print_info_box($savemsg); - echo "</div>"; + echo "</div>"; } if ($input_errors) { print_input_errors($input_errors); @@ -104,7 +89,7 @@ if ($_REQUEST['sorttype']) { ?> <form method="post"> <?=gettext("Sort type:"); ?> - <select name='sorttype' id='sorttype' onChange='this.form.submit();'> + <select name='sorttype' id='sorttype' onchange='this.form.submit();'> <option value='<?=$sorttype?>'><?=$sorttype?></option> <option value='-h'><?=gettext("Show traffic for the last 24 hours.");?></option> <option value='-d'><?=gettext("Show traffic for days.");?></option> @@ -113,19 +98,18 @@ if ($_REQUEST['sorttype']) { <option value='-tr'><?=gettext("Calculate 5sec. of traffic.");?></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"> + <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...");?> + <strong><?=gettext("Gathering vnstat activity, please wait...");?></strong> </div> </td> </tr> @@ -133,7 +117,6 @@ if ($_REQUEST['sorttype']) { </td> </tr> </table> - </div> </td> </tr> </table> diff --git a/config/vnstat2/www/vnstat2_img.php b/config/vnstat2/www/vnstat2_img.php index a83c3b06..fce29a4c 100644 --- a/config/vnstat2/www/vnstat2_img.php +++ b/config/vnstat2/www/vnstat2_img.php @@ -1,4 +1,32 @@ <?php +/* + vnstat2_img.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 PerryMason + Copyright (C) 2015 ESF, LLC + All rights reserved. + + 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. + + 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. +*/ require_once("guiconfig.inc"); $image = basename($_GET['image']); header("Content-type: image/png"); diff --git a/config/vnstat2/www/vnstati.php b/config/vnstat2/www/vnstati.php index 01eca208..d5f8d9bf 100644 --- a/config/vnstat2/www/vnstati.php +++ b/config/vnstat2/www/vnstati.php @@ -1,16 +1,45 @@ <?php +/* + vnstati.php + part of pfSense (https://www.pfSense.org/) + Copyright (C) 2009 PerryMason + Copyright (C) 2015 ESF, LLC + All rights reserved. + + 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. + + 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. +*/ require_once("guiconfig.inc"); global $config; include("head.inc"); +echo '<body link="#0000CC" vlink="#0000CC" alink="#0000CC">'; include("fbegin.inc"); $aaaa = $config['installedpackages']['vnstat2']['config'][0]['vnstat_interface']; $cccc = convert_real_interface_to_friendly_descr($aaaa); $pgtitle = gettext("Vnstati info for $cccc ($aaaa)"); -echo "<a href=$myurl/pkg_edit.php?xml=vnstati.xml&id=0>Go Back</a><br />"; -echo "<center><p class=\"pgtitle\">{$pgtitle}</p>"; ?> -<center><img src="vnstat2_img.php?image=newpicture1.png" style="border:1px solid black; center;"><br /> -<center><img src="vnstat2_img.php?image=newpicture2.png" style="border:1px solid black; center;"><br /> -<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 /> +<p style="text-align: center"><img src="vnstat2_img.php?image=newpicture1.png" alt="" style="border:1px solid black; center;" /></p> +<p style="text-align: center"><img src="vnstat2_img.php?image=newpicture2.png" alt="" style="border:1px solid black; center;" /></p> +<p style="text-align: center"><img src="vnstat2_img.php?image=newpicture3.png" alt="" style="border:1px solid black; center;" /></p> +<p style="text-align: center"><img src="vnstat2_img.php?image=newpicture4.png" alt="" style="border:1px solid black; center;" /></p> <?php include("fend.inc"); ?> +</body> +</html> diff --git a/pkg_config.10.xml b/pkg_config.10.xml index 01082486..cbf88ce6 100644 --- a/pkg_config.10.xml +++ b/pkg_config.10.xml @@ -673,7 +673,7 @@ <build_pbi> <port>net/vnstat</port> </build_pbi> - <version>1.12_4</version> + <version>1.12.5</version> <status>Stable</status> <required_version>2.2</required_version> <maintainer>crazypark2@yahoo.dk</maintainer> |