1
|
<?php
|
2
|
/* $Id$ */
|
3
|
/*
|
4
|
status_graph.php
|
5
|
Part of pfSense
|
6
|
Copyright (C) 2004 Scott Ullrich
|
7
|
All rights reserved.
|
8
|
|
9
|
Originally part of m0n0wall (http://m0n0.ch/wall)
|
10
|
Copyright (C) 2003-2004 Manuel Kasper <mk@neon1.net>.
|
11
|
All rights reserved.
|
12
|
|
13
|
Redistribution and use in source and binary forms, with or without
|
14
|
modification, are permitted provided that the following conditions are met:
|
15
|
|
16
|
1. Redistributions of source code must retain the above copyright notice,
|
17
|
this list of conditions and the following disclaimer.
|
18
|
|
19
|
2. Redistributions in binary form must reproduce the above copyright
|
20
|
notice, this list of conditions and the following disclaimer in the
|
21
|
documentation and/or other materials provided with the distribution.
|
22
|
|
23
|
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
24
|
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
25
|
AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
26
|
AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
|
27
|
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
28
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
29
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
30
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
31
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
32
|
POSSIBILITY OF SUCH DAMAGE.
|
33
|
*/
|
34
|
|
35
|
require("guiconfig.inc");
|
36
|
|
37
|
if ($_POST['width'])
|
38
|
$width = $_POST['width'];
|
39
|
else
|
40
|
$width = "550";
|
41
|
|
42
|
if ($_POST['height'])
|
43
|
$height = $_POST['height'];
|
44
|
else
|
45
|
$height = "275";
|
46
|
|
47
|
if ($_GET['if']) {
|
48
|
$curif = $_GET['if'];
|
49
|
$ifnum = $config['interfaces'][$curif]['if'];
|
50
|
} else {
|
51
|
$curif = "wan";
|
52
|
$ifnum = get_real_wan_interface();
|
53
|
}
|
54
|
|
55
|
$pgtitle = "Status: Traffic Graph";
|
56
|
include("head.inc");
|
57
|
|
58
|
?>
|
59
|
|
60
|
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
|
61
|
<?php include("fbegin.inc"); ?>
|
62
|
<p class="pgtitle"><?=$pgtitle?></p>
|
63
|
<?php
|
64
|
$ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
|
65
|
|
66
|
for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
|
67
|
$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
|
68
|
}
|
69
|
?>
|
70
|
<form name="form1" action="status_graph.php" method="get" style="padding-bottom: 10px; margin-bottom: 14px; border-bottom: 1px solid #999999">
|
71
|
Interface:
|
72
|
<select name="if" class="formfld" style="z-index: -10;" onchange="document.form1.submit()">
|
73
|
<?php
|
74
|
foreach ($ifdescrs as $ifn => $ifd) {
|
75
|
echo "<option value=\"$ifn\"";
|
76
|
if ($ifn == $curif) echo " selected";
|
77
|
echo ">" . htmlspecialchars($ifd) . "</option>\n";
|
78
|
}
|
79
|
?>
|
80
|
</select>
|
81
|
</form>
|
82
|
<p><span class="red"><strong>Note:</strong></span> the <a href="http://www.adobe.com/svg/viewer/install/" target="_blank">Adobe SVG viewer</a> or FireFox 1.5 is required to view the graph.
|
83
|
<p><form method="post" action="status_graph.php">
|
84
|
Graph Width: <input name="width" value="<? echo $width; ?>"> Height: <input name="height" value="<? echo $height; ?>"> <input type="submit" value="Change Graph Size"></p>
|
85
|
</form>
|
86
|
<p>
|
87
|
<div>
|
88
|
<embed id="graph" src="graph.php?ifnum=<?=$ifnum;?>&ifname=<?=rawurlencode($ifdescrs[$curif]);?>" type="image/svg+xml"
|
89
|
width="<? echo $width; ?>" height="<? echo $height; ?>" pluginspage="http://www.adobe.com/svg/viewer/install/auto" />
|
90
|
</div>
|
91
|
|
92
|
<?php include("fend.inc"); ?>
|
93
|
</body>
|
94
|
</html>
|