aboutsummaryrefslogtreecommitdiffstats
path: root/config/vnstat2
diff options
context:
space:
mode:
Diffstat (limited to 'config/vnstat2')
-rw-r--r--config/vnstat2/www/diag_vnstat2.php53
1 files changed, 18 insertions, 35 deletions
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>