]> git.ipfire.org Git - ipfire-2.x.git/blob - src/wio/wiographs.cgi
ipsec-interfaces: Apply static routes (again) after creating IPsec interfaces
[ipfire-2.x.git] / src / wio / wiographs.cgi
1 #!/usr/bin/perl
2 #
3 ###############################################################################
4 # #
5 # IPFire.org - A linux based firewall #
6 # Copyright (C) 2017-2018 Stephan Feddersen <sfeddersen@ipfire.org> #
7 # All Rights Reserved. #
8 # #
9 # This program is free software: you can redistribute it and/or modify #
10 # it under the terms of the GNU General Public License as published by #
11 # the Free Software Foundation, either version 3 of the License, or #
12 # (at your option) any later version. #
13 # #
14 # This program is distributed in the hope that it will be useful, #
15 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
16 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
17 # GNU General Public License for more details. #
18 # #
19 # You should have received a copy of the GNU General Public License #
20 # along with this program. If not, see <http://www.gnu.org/licenses/>. #
21 # #
22 ###############################################################################
23 #
24 # Version: 2017/08/27 14:07:23
25 #
26 # This wiographs.cgi is based on the Code from the IPCop WIO Addon
27 # and is extremly adapted to work with IPFire.
28 #
29 # Autor: Stephan Feddersen
30 # Co-Autor: Alexander Marx
31 #
32
33 use strict;
34
35 # enable only the following on debugging purpose
36 #use warnings;
37 #no warnings 'once';
38 #use CGI::Carp 'fatalsToBrowser';
39
40 use CGI;
41 my $cgi = new CGI;
42 my $hostid = $cgi->param("HOSTID");
43 my $hostname = $cgi->param("HOSTNAME");
44
45 require '/var/ipfire/general-functions.pl';
46 require '/var/ipfire/header.pl';
47 require '/var/ipfire/lang.pl';
48 require '/usr/lib/wio/wio-graphs.pl';
49
50 my @querry = split(/\?/,$ENV{'QUERY_STRING'});
51
52 $querry[0] = '' unless defined $querry[0]; # hostid
53 $querry[1] = '' unless defined $querry[1]; # period
54 $querry[2] = '' unless defined $querry[2]; # hostname
55
56 if ($querry[0] =~ "$hostid") {
57 print "Content-type: image/png\n\n";
58 binmode(STDOUT);
59 &WIOGraphs::wio($querry[0], $querry[2], $querry[1]);
60 }
61 else {
62 &Header::showhttpheaders();
63 &Header::openpage("$Lang::tr{'wio'}", 1, '');
64 &Header::openbigbox('100%', 'left');
65 &Header::openbox('100%', 'left', "$Lang::tr{'wio_graphs_stat'} $hostname");
66 &WIOGraphs::wiographbox("wiographs.cgi","$hostid","day","$hostname");
67 print"<table width='100%'><tr><td align='center'><a href='/cgi-bin/wio.cgi'><img src='/images/wio/back.png' alt='$Lang::tr{'wio_back'}' title='$Lang::tr{'wio_back'}' /></a></td></tr></table>";
68 &Header::closebox();
69 &Header::closebigbox();
70 &Header::closepage();
71 }
72
73 1;