aboutsummaryrefslogtreecommitdiffstats
path: root/config
diff options
context:
space:
mode:
authorPerry Mason <crazypark2@yahoo.dk>2011-01-05 20:36:42 +0100
committerPerry Mason <crazypark2@yahoo.dk>2011-01-05 20:36:42 +0100
commit3a7497ce62b693025cb60e05626647495f54de48 (patch)
tree475384587221fcc80e60deca4dd1c19b44f2ca06 /config
parent5d5724ca830023d6c6492ef463044f901045c33f (diff)
downloadpfsense-packages-3a7497ce62b693025cb60e05626647495f54de48.tar.gz
pfsense-packages-3a7497ce62b693025cb60e05626647495f54de48.tar.bz2
pfsense-packages-3a7497ce62b693025cb60e05626647495f54de48.zip
[vnstat2] Make php frontend an option
Diffstat (limited to 'config')
-rw-r--r--config/vnstat2/bin/vnstati.abc3
-rw-r--r--config/vnstat2/vnstat2.inc31
-rw-r--r--[-rwxr-xr-x]config/vnstat2/vnstat2.sh0
-rw-r--r--config/vnstat2/vnstat2.xml6
4 files changed, 30 insertions, 10 deletions
diff --git a/config/vnstat2/bin/vnstati.abc b/config/vnstat2/bin/vnstati.abc
index 10fa8bfb..aa76a4b3 100644
--- a/config/vnstat2/bin/vnstati.abc
+++ b/config/vnstat2/bin/vnstati.abc
@@ -5,8 +5,7 @@ include("head.inc");
include("fbegin.inc");
$aaaa = $config['installedpackages']['vnstat2']['config'][0]['vnstat_interface'];
$bbbb = convert_friendly_interface_to_real_interface_name($aaaa);
-$cccc = convert_friendly_interface_to_friendly_descr($aaaa);
-$pgtitle = gettext("Vnstati info for $cccc ($bbbb)");
+$pgtitle = gettext("Vnstati info for $aaaa ($bbbb)");
echo "<a href=$myurl/pkg_edit.php?xml=vnstati.xml&id=0>Go Back</a><br />";
echo "<center><p class=\"pgtitle\">{$pgtitle}</p>";
?>
diff --git a/config/vnstat2/vnstat2.inc b/config/vnstat2/vnstat2.inc
index 08c6a28c..896dfd92 100644
--- a/config/vnstat2/vnstat2.inc
+++ b/config/vnstat2/vnstat2.inc
@@ -63,8 +63,17 @@ function vnstat2_install_cron($vnstat_cron_value) {
function change_vnstat_conf(){
conf_mount_rw();
global $config;
- $config['installedpackages']['vnstat2']['config'][0]['monthrotate'] = $_POST['monthrotate'];
+ $config['installedpackages']['vnstat2']['config'][0]['monthrotate'] = $_POST['monthrotate'];
+ $config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'] = $_POST['vnstat_phpfrontend'];
write_conf_f();
+ write_config();
+ $no_vnstat_phpfrontend = $config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'];
+ if ($no_vnstat_phpfrontend == "on"){
+ vnstat_php_frontend();
+ }
+ else {
+ exec("[ -d /usr/local/www/vnstat2 ] && rm -d -R /usr/local/www/vnstat2");
+}
conf_mount_ro();
}
@@ -145,15 +154,15 @@ function vnstat_install_config() {
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");
- exec("mv vnstat_php_frontend-1.4.1 /usr/local/www/vnstat2");
// Add MonthRotate value to config.xml and write /usr/local/etc/vnstat.conf
$no_monthrotate = $config['installedpackages']['vnstat2']['config'][0]['monthrotate'];
if ($no_monthrotate == ""){
$config['installedpackages']['vnstat2']['config'][0]['monthrotate'] = "1";
}
+ $no_vnstat_phpfrontend = $config['installedpackages']['vnstat2']['config'][0]['vnstat_phpfrontend'];
+ if ($no_vnstat_phpfrontend == "on"){
+ vnstat_php_frontend();
+ }
write_conf_f();
// Add cron job to config.xml
vnstat2_install_cron(true);
@@ -177,7 +186,16 @@ function vnstat_install_config() {
{
exec("/usr/local/bin/vnstat -u -i ". $result2);
}
+ write_config();
+ conf_mount_ro();
+}
+function vnstat_php_frontend(){
+ global $config;
+// Unpack and move Vnstat frontend
+ exec("cd ..");
+ exec("tar -zxovf /usr/local/pkg/vnstat_php_frontend-1.4.1.tar.gz");
+ exec("mv vnstat_php_frontend-1.4.1 /usr/local/www/vnstat2");
// Find information to be writing in config.php
// $iface_list_array_items
exec("ls /conf/vnstat/ | grep -v '\.'", $vnstat_nic_in);
@@ -210,7 +228,6 @@ function vnstat_install_config() {
$colorscheme2 = "\$colorscheme['light'] = array(";
$colorscheme3 = "\$colorscheme['red'] = array(";
$colorscheme4 = "\$colorscheme['pfSense'] = array(";
-
// ************ Write new config.php ******************
$config_file = <<<EOF
<?php
@@ -339,7 +356,5 @@ EOF;
}
fwrite($hf, $config_file);
fclose($hf);
- write_config();
- conf_mount_ro();
}
?>
diff --git a/config/vnstat2/vnstat2.sh b/config/vnstat2/vnstat2.sh
index 05fb1136..05fb1136 100755..100644
--- a/config/vnstat2/vnstat2.sh
+++ b/config/vnstat2/vnstat2.sh
diff --git a/config/vnstat2/vnstat2.xml b/config/vnstat2/vnstat2.xml
index 9357a145..08bfc91d 100644
--- a/config/vnstat2/vnstat2.xml
+++ b/config/vnstat2/vnstat2.xml
@@ -124,6 +124,12 @@
<option><name>28</name><value>28</value></option>
</options>
</field>
+ <field>
+ <description>Enable vnstat php frontend (Note that no login will be needed)</description>
+ <fielddescr>Enable php frontend for vnstat</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>