Project

General

Profile

Download (6.4 KB) Statistics
| Branch: | Tag: | Revision:
1 db7b006f Seth Mos
<?php
2
/* $Id$ */
3
/*
4
	status_rrd_graph.php
5
	Part of pfSense
6
	Copyright (C) 2007 Seth Mos <seth.mos@xs4all.nl>
7
	All rights reserved.
8
9
	Redistribution and use in source and binary forms, with or without
10
	modification, are permitted provided that the following conditions are met:
11
12
	1. Redistributions of source code must retain the above copyright notice,
13
	   this list of conditions and the following disclaimer.
14
15
	2. Redistributions in binary form must reproduce the above copyright
16
	   notice, this list of conditions and the following disclaimer in the
17
	   documentation and/or other materials provided with the distribution.
18
19
	THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
20
	INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
21
	AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
22
	AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
23
	OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
24
	SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25
	INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
26
	CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27
	ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
28
	POSSIBILITY OF SUCH DAMAGE.
29
*/
30 1d333258 Scott Ullrich
/*
31
	pfSense_MODULE:	routing
32
*/
33 db7b006f Seth Mos
34
##|+PRIV
35
##|*IDENT=page-status-rrdgraphs
36
##|*NAME=Status: RRD Graphs page
37
##|*DESCR=Allow access to the 'Status: RRD Graphs' page.
38
##|*MATCH=status_rrd_graph_settings.php*
39
##|-PRIV
40
41 03d92c40 Scott Ullrich
require("guiconfig.inc");
42 db7b006f Seth Mos
43
if (!is_array($config['gateways']['settings']))
44
	$config['gateways']['settings'] = array();
45
46
$a_settings = &$config['gateways']['settings'];
47
48 573439f1 Vinicius Coque
$changedesc = gettext("Gateways") . ": ";
49 6c5334c7 Seth Mos
$input_errors = array();
50 db7b006f Seth Mos
51
if (empty($a_settings)) {
52
	$pconfig['latencylow'] = "100";
53
	$pconfig['latencyhigh'] = "500";
54
	$pconfig['losslow'] = "10";
55
	$pconfig['losshigh'] = "20";
56
} else {
57
	$pconfig['latencylow'] = $a_settings['latencylow'];
58
	$pconfig['latencyhigh'] = $a_settings['latencyhigh'];
59
	$pconfig['losslow'] = $a_settings['losslow'];
60
	$pconfig['losshigh'] = $a_settings['losshigh'];
61
}
62
63
if ($_POST) {
64
65
	unset($input_errors);
66
	$pconfig = $_POST;
67
68
	/* input validation */
69 6c5334c7 Seth Mos
	if($_POST['latencylow']) {
70
		if (! is_numeric($_POST['latencylow'])) {
71 573439f1 Vinicius Coque
			$input_errors[] = gettext("The low latency watermark needs to be a numeric value.");
72 6c5334c7 Seth Mos
		}
73 db7b006f Seth Mos
	}
74 6c5334c7 Seth Mos
75
	if($_POST['latencyhigh']) {
76
		if (! is_numeric($_POST['latencyhigh'])) {
77 573439f1 Vinicius Coque
			$input_errors[] = gettext("The high latency watermark needs to be a numeric value.");
78 6c5334c7 Seth Mos
		}
79
	}
80
	if($_POST['losslow']) {
81
		if (! is_numeric($_POST['losslow'])) {
82 573439f1 Vinicius Coque
			$input_errors[] = gettext("The low loss watermark needs to be a numeric value.");
83 6c5334c7 Seth Mos
		}
84
	}
85
	if($_POST['losshigh']) {
86
		if (! is_numeric($_POST['losshigh'])) {
87 573439f1 Vinicius Coque
			$input_errors[] = gettext("The high loss watermark needs to be a numeric value.");
88 6c5334c7 Seth Mos
		}
89
	}
90
91
	if(($_POST['latencylow']) && ($_POST['latencyhigh'])){
92
		if(($_POST['latencylow'] > $_POST['latencyhigh'])) {
93 573439f1 Vinicius Coque
			$input_errors[] = gettext("The High latency watermark needs to be higher then the low latency watermark");
94 6c5334c7 Seth Mos
		}
95 db7b006f Seth Mos
	}
96
97 6c5334c7 Seth Mos
	if(($_POST['losslow']) && ($_POST['losshigh'])){
98
		if($_POST['losslow'] > $_POST['losshigh']) {
99 573439f1 Vinicius Coque
			$input_errors[] = gettext("The High packet loss watermark needs to be higher then the low packet loss watermark");
100 6c5334c7 Seth Mos
		}
101
	}
102
103
104
105 db7b006f Seth Mos
        if (!$input_errors) {
106
		$a_settings['latencylow'] = $_POST['latencylow'];
107
		$a_settings['latencyhigh'] = $_POST['latencyhigh'];
108
		$a_settings['losslow'] = $_POST['losslow'];
109
		$a_settings['losshigh'] = $_POST['losshigh'];
110
		
111
112
		$config['gateways']['settings'] = $a_settings;
113
114
                $retval = 0;
115
                $retval = setup_gateways_monitor();
116
		write_config();
117
118
                $savemsg = get_std_save_message($retval);
119
	}
120
}
121
122 573439f1 Vinicius Coque
$pgtitle = array(gettext("Gateways"),gettext("Settings"));
123 db7b006f Seth Mos
include("head.inc");
124
125
?>
126
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
127
<?php include("fbegin.inc"); ?>
128
<?php if ($input_errors) print_input_errors($input_errors); ?>
129
<?php if ($savemsg) print_info_box($savemsg); ?>
130
<form action="system_gateways_settings.php" method="post" name="iform" id="iform">
131
<table width="100%" border="0" cellpadding="0" cellspacing="0">
132
        <tr>
133
                <td>
134
			<?php
135
				$tab_array = array();
136 573439f1 Vinicius Coque
				$tab_array[0] = array(gettext("Gateways"), false, "system_gateways.php");
137
				$tab_array[1] = array(gettext("Routes"), false, "system_routes.php");
138
				$tab_array[2] = array(gettext("Groups"), false, "system_gateway_groups.php");
139
				$tab_array[3] = array(gettext("Settings"), true, "system_gateways_settings.php");
140 db7b006f Seth Mos
				display_top_tabs($tab_array);
141
			?>
142
                </td>
143
        </tr>
144
        <tr>
145
                <td>
146
                        <div id="mainarea">
147
                        <table class="tabcont" width="100%" border="0" cellspacing="0" cellpadding="6">
148
			<tr>
149 573439f1 Vinicius Coque
                        	<td width="22%" valign="top" class="vncellreq"><?=gettext("Latency thresholds");?></td>
150 db7b006f Seth Mos
	                        <td width="78%" class="vtable">
151 573439f1 Vinicius Coque
				<?=gettext("From");?> 
152 db7b006f Seth Mos
				    <input name="latencylow" type="text" class="formfld unknown" id="latencylow" size="2" 
153
					value="<?=htmlspecialchars($pconfig['latencylow']);?>">
154 573439f1 Vinicius Coque
				<?=gettext("To");?>
155 db7b006f Seth Mos
				    <input name="latencyhigh" type="text" class="formfld unknown" id="latencyhigh" size="2" 
156
					value="<?=htmlspecialchars($pconfig['latencyhigh']);?>">
157 573439f1 Vinicius Coque
				    <br> <span class="vexpl"><?=gettext("These define the low and high water marks for latency in milliseconds.");?></span></td>
158 db7b006f Seth Mos
				</td>
159
			</tr>
160
			<tr>
161 573439f1 Vinicius Coque
                        	<td width="22%" valign="top" class="vncellreq"><?=gettext("Packet Loss thresholds");?></td>
162 db7b006f Seth Mos
	                        <td width="78%" class="vtable">
163 573439f1 Vinicius Coque
				<?=gettext("From");?> 
164 db7b006f Seth Mos
				    <input name="losslow" type="text" class="formfld unknown" id="losslow" size="2" 
165
					value="<?=htmlspecialchars($pconfig['losslow']);?>">
166 573439f1 Vinicius Coque
				<?=gettext("To");?>
167 db7b006f Seth Mos
				    <input name="losshigh" type="text" class="formfld unknown" id="losshigh" size="2" 
168
					value="<?=htmlspecialchars($pconfig['losshigh']);?>">
169 573439f1 Vinicius Coque
				    <br> <span class="vexpl"><?=gettext("These define the low and high water marks for packet loss in %.");?></span></td>
170 db7b006f Seth Mos
				</td>
171
			</tr>
172
			<tr>
173
				<td width="22%" valign="top">&nbsp;</td>
174
				<td width="78%">
175 573439f1 Vinicius Coque
					<input name="Submit" type="submit" class="formbtn" value="<?=gettext("Save");?>" onclick="enable_change(true)">
176 db7b006f Seth Mos
				</td>
177
			</tr>
178
			</table>
179
		</div>
180
		</td>
181
	</tr>
182
</table>
183
184
</form>
185
<?php include("fend.inc"); ?>
186
</body>
187
</html>