#!/usr/bin/perl
+###############################################################################
+# #
+# IPFire.org - A linux based firewall #
+# Copyright (C) 2007 Michael Tremer & Christian Schmidt #
+# #
+# 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 3 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, see <http://www.gnu.org/licenses/>. #
+# #
+###############################################################################
sub showmenu() {
print <<EOF
my $extrahead = shift;
@URI=split ('\?', $ENV{'REQUEST_URI'} );
- &readhash("${swroot}/main/settings", \%settings);
+ &General::readhash("${swroot}/main/settings", \%settings);
&genmenu();
my $h2 = gettitle($menu);
function swapVisibility(id) {
el = document.getElementById(id);
- if(el.style.display != 'block') {
- el.style.display = 'block'
- }
- else {
- el.style.display = 'none'
- }
+ if(el.style.display != 'block') {
+ el.style.display = 'block'
+ }
+ else {
+ el.style.display = 'none'
+ }
}
</script>
-
+END
+;
+if ($settings{'SPEED'} ne 'off') {
+print <<END
+ <script type="text/javascript" src="/include/jquery-1.9.1.min.js"></script>
+ <script type="text/javascript">
+ var t_current;
+ var t_last;
+ var rxb_current;
+ var rxb_last;
+ var txb_current;
+ var txb_last;
+ function refreshInetInfo() {
+ \$.ajax({
+ url: '/cgi-bin/speed.cgi',
+ success: function(xml){
+ t_current = new Date();
+ var t_diff = t_current - t_last;
+ t_last = t_current;
+
+ rxb_current = \$("rxb",xml).text();
+ var rxb_diff = rxb_current - rxb_last;
+ rxb_last = rxb_current;
+
+ var rx_kbs = rxb_diff/t_diff;
+ rx_kbs = Math.round(rx_kbs*10)/10;
+
+ txb_current = \$("txb",xml).text();
+ var txb_diff = txb_current - txb_last;
+ txb_last = txb_current;
+
+ var tx_kbs = txb_diff/t_diff;
+ tx_kbs = Math.round(tx_kbs*10)/10;
+
+ \$("#rx_kbs").text(rx_kbs + ' kb/s');
+ \$("#tx_kbs").text(tx_kbs + ' kb/s');
+ }
+ });
+ window.setTimeout("refreshInetInfo()", 3000);
+ }
+ \$(document).ready(function(){
+ refreshInetInfo();
+ });
+ </script>
</head>
<body>
+END
+;
+}
+else {
+print "</head>\n<body>";}
+print <<END
<!-- IPFIRE HEADER -->
<div id="header">
my $extrahead = shift;
@URI=split ('\?', $ENV{'REQUEST_URI'} );
- &readhash("${swroot}/main/settings", \%settings);
+ &General::readhash("${swroot}/main/settings", \%settings);
&genmenu();
my $h2 = gettitle($menu);
<br class="clear" />
<div id="footer" class="fixed">
- <b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD
- </div>
- </div>
+ <b>Status:</b> $status <b>Uptime:</b>$uptime
+END
+;
+if ($settings{'SPEED'} ne 'off') {
+print <<END
+ <br />
+ <b>$Lang::tr{'bandwidth usage'}:</b>
+ $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span>
+
+END
+;
+}
+print <<END
+ </div>
+ </div>
</div>
</body>
</html>