Project

General

Profile

Download (11.9 KB) Statistics
| Branch: | Tag: | Revision:
1 5b237745 Scott Ullrich
<?php
2
/*
3 aaec5634 Renato Botelho
 * firewall_shaper.php
4 fd9ebcd5 Stephen Beaver
 *
5 aaec5634 Renato Botelho
 * part of pfSense (https://www.pfsense.org)
6 2a2396a6 Renato Botelho
 * Copyright (c) 2004-2016 Rubicon Communications, LLC (Netgate)
7 aaec5634 Renato Botelho
 * All rights reserved.
8 fd9ebcd5 Stephen Beaver
 *
9 aaec5634 Renato Botelho
 * Redistribution and use in source and binary forms, with or without
10
 * modification, are permitted provided that the following conditions are met:
11 fd9ebcd5 Stephen Beaver
 *
12 aaec5634 Renato Botelho
 * 1. Redistributions of source code must retain the above copyright notice,
13
 *    this list of conditions and the following disclaimer.
14 fd9ebcd5 Stephen Beaver
 *
15 aaec5634 Renato Botelho
 * 2. Redistributions in binary form must reproduce the above copyright
16
 *    notice, this list of conditions and the following disclaimer in
17
 *    the documentation and/or other materials provided with the
18
 *    distribution.
19 fd9ebcd5 Stephen Beaver
 *
20 aaec5634 Renato Botelho
 * 3. All advertising materials mentioning features or use of this software
21
 *    must display the following acknowledgment:
22
 *    "This product includes software developed by the pfSense Project
23
 *    for use in the pfSense® software distribution. (http://www.pfsense.org/).
24 fd9ebcd5 Stephen Beaver
 *
25 aaec5634 Renato Botelho
 * 4. The names "pfSense" and "pfSense Project" must not be used to
26
 *    endorse or promote products derived from this software without
27
 *    prior written permission. For written permission, please contact
28
 *    coreteam@pfsense.org.
29 fd9ebcd5 Stephen Beaver
 *
30 aaec5634 Renato Botelho
 * 5. Products derived from this software may not be called "pfSense"
31
 *    nor may "pfSense" appear in their names without prior written
32
 *    permission of the Electric Sheep Fencing, LLC.
33 fd9ebcd5 Stephen Beaver
 *
34 aaec5634 Renato Botelho
 * 6. Redistributions of any form whatsoever must retain the following
35
 *    acknowledgment:
36 919d91f9 Phil Davis
 *
37 aaec5634 Renato Botelho
 * "This product includes software developed by the pfSense Project
38
 * for use in the pfSense software distribution (http://www.pfsense.org/).
39 fd9ebcd5 Stephen Beaver
 *
40 aaec5634 Renato Botelho
 * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
41
 * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
42
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
43
 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
44
 * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
45
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
46
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
47
 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
48
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
49
 * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
50
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
51
 * OF THE POSSIBILITY OF SUCH DAMAGE.
52 fd9ebcd5 Stephen Beaver
 */
53 5b237745 Scott Ullrich
54 6b07c15a Matthew Grooms
##|+PRIV
55
##|*IDENT=page-firewall-trafficshaper
56 5230f468 jim-p
##|*NAME=Firewall: Traffic Shaper
57 6b07c15a Matthew Grooms
##|*DESCR=Allow access to the 'Firewall: Traffic Shaper' page.
58
##|*MATCH=firewall_shaper.php*
59
##|-PRIV
60
61 aceaf18c Phil Davis
require_once("guiconfig.inc");
62 7a927e67 Scott Ullrich
require_once("functions.inc");
63
require_once("filter.inc");
64
require_once("shaper.inc");
65 a5f07f09 Ermal Lu?i
require_once("rrd.inc");
66 5b237745 Scott Ullrich
67 e6f34d22 Phil Davis
if ($_GET['reset'] != "") {
68 7ac5a4cb Scott Ullrich
	/* XXX: Huh, why are we killing php? */
69
	mwexec("killall -9 pfctl php");
70 8f8a97c8 Ermal Luçi
	exit;
71 1b2c6c29 Ermal Luçi
}
72
73 02fb3a41 k-paulius
$pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("By Interface"));
74 b32dd0a6 jim-p
$shortcut_section = "trafficshaper";
75 09eafb8b Scott Ullrich
76 9d5b21c6 Ermal Luçi
$shaperIFlist = get_configured_interface_with_descr();
77 197bfe96 Ermal Luçi
read_altq_config();
78 806942d0 Stephen Beaver
/*
79 197bfe96 Ermal Luçi
 * The whole logic in these code maybe can be specified.
80
 * If you find a better way contact me :).
81
 */
82 57b89461 Scott Ullrich
83 197bfe96 Ermal Luçi
if ($_GET) {
84 6aaec445 Phil Davis
	if ($_GET['queue']) {
85 e52c3c88 jim-p
		$qname = htmlspecialchars(trim($_GET['queue']));
86 6aaec445 Phil Davis
	}
87
	if ($_GET['interface']) {
88
		$interface = htmlspecialchars(trim($_GET['interface']));
89
	}
90
	if ($_GET['action']) {
91
		$action = htmlspecialchars($_GET['action']);
92
	}
93 197bfe96 Ermal Luçi
}
94 aef9d8fe Stephen Beaver
95 197bfe96 Ermal Luçi
if ($_POST) {
96 6aaec445 Phil Davis
	if ($_POST['name']) {
97
		$qname = htmlspecialchars(trim($_POST['name']));
98
	}
99
	if ($_POST['interface']) {
100
		$interface = htmlspecialchars(trim($_POST['interface']));
101
	}
102
	if ($_POST['parentqueue']) {
103 daab67a1 Scott Ullrich
		$parentqueue = htmlspecialchars(trim($_POST['parentqueue']));
104 6aaec445 Phil Davis
	}
105 57b89461 Scott Ullrich
}
106
107 197bfe96 Ermal Luçi
if ($interface) {
108
	$altq = $altq_list_queues[$interface];
109 806942d0 Stephen Beaver
110 197bfe96 Ermal Luçi
	if ($altq) {
111
		$queue =& $altq->find_queue($interface, $qname);
112 6aaec445 Phil Davis
	} else {
113 aef9d8fe Stephen Beaver
		$addnewaltq = true;
114 6aaec445 Phil Davis
	}
115 57b89461 Scott Ullrich
}
116
117 197bfe96 Ermal Luçi
$dontshow = false;
118
$newqueue = false;
119 aef9d8fe Stephen Beaver
$dfltmsg = false;
120 5b237745 Scott Ullrich
121 197bfe96 Ermal Luçi
if ($_GET) {
122
	switch ($action) {
123 6aaec445 Phil Davis
		case "delete":
124 197bfe96 Ermal Luçi
			if ($queue) {
125
				$queue->delete_queue();
126 6aaec445 Phil Davis
				if (write_config()) {
127 3a343d73 jim-p
					mark_subsystem_dirty('shaper');
128 6aaec445 Phil Davis
				}
129 197bfe96 Ermal Luçi
			}
130 3b6dedf3 Stephen Beaver
131 197bfe96 Ermal Luçi
			header("Location: firewall_shaper.php");
132
			exit;
133 6aaec445 Phil Davis
			break;
134
		case "resetall":
135
			foreach ($altq_list_queues as $altq) {
136 26dfbf80 Ermal Luçi
				$altq->delete_all();
137 6aaec445 Phil Davis
			}
138 26dfbf80 Ermal Luçi
			unset($altq_list_queues);
139
			$altq_list_queues = array();
140
			$tree = "<ul class=\"tree\" >";
141
			$tree .= get_interface_list_to_show();
142
			$tree .= "</ul>";
143
			unset($config['shaper']['queue']);
144
			unset($queue);
145
			unset($altq);
146
			$can_add = false;
147
			$can_enable = false;
148
			$dontshow = true;
149
			foreach ($config['filter']['rule'] as $key => $rule) {
150 6aaec445 Phil Davis
				if (isset($rule['wizard']) && $rule['wizard'] == "yes") {
151 26dfbf80 Ermal Luçi
					unset($config['filter']['rule'][$key]);
152 6aaec445 Phil Davis
				}
153 26dfbf80 Ermal Luçi
			}
154 806942d0 Stephen Beaver
155 3a343d73 jim-p
			if (write_config()) {
156
				$retval = 0;
157
				$retval |= filter_configure();
158 26dfbf80 Ermal Luçi
159 6aaec445 Phil Davis
				if (stristr($retval, "error") <> true) {
160 3a343d73 jim-p
					$savemsg = get_std_save_message($retval);
161 881132ed Phil Davis
					$class = 'success';
162 6aaec445 Phil Davis
				} else {
163 3a343d73 jim-p
					$savemsg = $retval;
164 881132ed Phil Davis
					$class = 'warning';
165 6aaec445 Phil Davis
				}
166 3a343d73 jim-p
			} else {
167 8545adde k-paulius
				$savemsg = gettext("Unable to write config.xml (Access Denied?).");
168 881132ed Phil Davis
				$class = 'warning';
169 3a343d73 jim-p
			}
170 806942d0 Stephen Beaver
171 aef9d8fe Stephen Beaver
			$dfltmsg = true;
172
173 26dfbf80 Ermal Luçi
174
		break;
175 3b6dedf3 Stephen Beaver
176 197bfe96 Ermal Luçi
	case "add":
177
			/* XXX: Find better way because we shouldn't know about this */
178
		if ($altq) {
179 3b6dedf3 Stephen Beaver
180 7903dd5e Stephen Beaver
			switch ($altq->GetScheduler()) {
181
				case "PRIQ":
182
					$q = new priq_queue();
183 c563b7a8 Ermal Luçi
				break;
184 7903dd5e Stephen Beaver
				case "FAIRQ":
185
					$q = new fairq_queue();
186
				break;
187
				case "HFSC":
188
					$q = new hfsc_queue();
189
				break;
190
				case "CBQ":
191
						$q = new cbq_queue();
192
				break;
193
				default:
194
					/* XXX: Happens when sched==NONE?! */
195
					$q = new altq_root_queue();
196
				break;
197
			}
198 197bfe96 Ermal Luçi
		} else if ($addnewaltq) {
199
			$q = new altq_root_queue();
200 a4af095c Renato Botelho
		} else {
201 2a9559e1 Stephen Beaver
			$input_errors[] = gettext("Could not create new queue/discipline! Any recent changes may need to be applied first.");
202 5605a0c4 Stephen Beaver
		}
203 197bfe96 Ermal Luçi
204 5605a0c4 Stephen Beaver
		if ($q) {
205
			$q->SetInterface($interface);
206
			$sform = $q->build_form();
207
			$sform->addGlobal(new Form_Input(
208
				'parentqueue',
209
				null,
210
				'hidden',
211
				$qname
212
			));
213
214
			$newjavascript = $q->build_javascript();
215
			unset($q);
216
			$newqueue = true;
217
		}
218
		break;
219 197bfe96 Ermal Luçi
		case "show":
220 aef9d8fe Stephen Beaver
			if ($queue) {
221 806942d0 Stephen Beaver
				$sform = $queue->build_form();
222 7841a35c Colin Fleming
			} else {
223 aef9d8fe Stephen Beaver
				$input_errors[] = gettext("Queue not found!");
224 7841a35c Colin Fleming
			}
225 197bfe96 Ermal Luçi
		break;
226
		case "enable":
227
			if ($queue) {
228 7841a35c Colin Fleming
				$queue->SetEnabled("on");
229
				$sform = $queue->build_form();
230
				if (write_config()) {
231
					mark_subsystem_dirty('shaper');
232
				}
233 6aaec445 Phil Davis
			} else {
234 7841a35c Colin Fleming
				$input_errors[] = gettext("Queue not found!");
235 6aaec445 Phil Davis
			}
236
			break;
237 197bfe96 Ermal Luçi
		case "disable":
238
			if ($queue) {
239 6aaec445 Phil Davis
				$queue->SetEnabled("");
240 a51c7c7f Stephen Beaver
				$sform = $queue->build_form();
241 6aaec445 Phil Davis
				if (write_config()) {
242
					mark_subsystem_dirty('shaper');
243
				}
244
			} else {
245 7841a35c Colin Fleming
				$input_errors[] = gettext("Queue not found!");
246 6aaec445 Phil Davis
			}
247
			break;
248 197bfe96 Ermal Luçi
		default:
249 aef9d8fe Stephen Beaver
			$dfltmsg = true;
250 197bfe96 Ermal Luçi
			$dontshow = true;
251
			break;
252 5b237745 Scott Ullrich
	}
253 aef9d8fe Stephen Beaver
}
254
255
if ($_POST) {
256 197bfe96 Ermal Luçi
	unset($input_errors);
257 5b237745 Scott Ullrich
258 197bfe96 Ermal Luçi
	if ($addnewaltq) {
259 23ca5695 Chris Buechler
		$altq =& new altq_root_queue();
260 197bfe96 Ermal Luçi
		$altq->SetInterface($interface);
261
		$altq->ReadConfig($_POST);
262 ea51e9f8 Renato Botelho
		$altq->validate_input($_POST, $input_errors);
263 92125c97 Ermal Luçi
		if (!$input_errors) {
264
			unset($tmppath);
265
			$tmppath[] = $altq->GetInterface();
266 806942d0 Stephen Beaver
			$altq->SetLink($tmppath);
267 92125c97 Ermal Luçi
			$altq->wconfig();
268 6aaec445 Phil Davis
			if (write_config()) {
269 3a343d73 jim-p
				mark_subsystem_dirty('shaper');
270 6aaec445 Phil Davis
			}
271 92125c97 Ermal Luçi
			$can_enable = true;
272 aef9d8fe Stephen Beaver
			$can_add = true;
273 92125c97 Ermal Luçi
		}
274 aef9d8fe Stephen Beaver
275 48d418e8 Ermal Luçi
		read_altq_config();
276 a51c7c7f Stephen Beaver
		$sform = $altq->build_form();
277 197bfe96 Ermal Luçi
	} else if ($parentqueue) { /* Add a new queue */
278
		$qtmp =& $altq->find_queue($interface, $parentqueue);
279
		if ($qtmp) {
280
			$tmppath =& $qtmp->GetLink();
281
			array_push($tmppath, $qname);
282 ea51e9f8 Renato Botelho
			$tmp =& $qtmp->add_queue($interface, $_POST, $tmppath, $input_errors);
283 92125c97 Ermal Luçi
			if (!$input_errors) {
284
				array_pop($tmppath);
285
				$tmp->wconfig();
286
				$can_enable = true;
287 70b139a3 Chris Buechler
				if ($tmp->CanHaveChildren() && $can_enable) {
288 6aaec445 Phil Davis
					if ($tmp->GetDefault() <> "") {
289 3b6dedf3 Stephen Beaver
						$can_add = false;
290 6aaec445 Phil Davis
					} else {
291 3b6dedf3 Stephen Beaver
						$can_add = true;
292 6aaec445 Phil Davis
					}
293
				} else {
294 92125c97 Ermal Luçi
					$can_add = false;
295 6aaec445 Phil Davis
				}
296
				if (write_config()) {
297 3a343d73 jim-p
					mark_subsystem_dirty('shaper');
298 6aaec445 Phil Davis
				}
299 92125c97 Ermal Luçi
				$can_enable = true;
300 6aaec445 Phil Davis
				if ($altq->GetScheduler() != "PRIQ") { /* XXX */
301
					if ($tmp->GetDefault() <> "") {
302 3b6dedf3 Stephen Beaver
						$can_add = false;
303 6aaec445 Phil Davis
					} else {
304 3b6dedf3 Stephen Beaver
						$can_add = true;
305 6aaec445 Phil Davis
					}
306
				}
307 92125c97 Ermal Luçi
			}
308 48d418e8 Ermal Luçi
			read_altq_config();
309 a51c7c7f Stephen Beaver
			$sform = $tmp->build_form();
310 6aaec445 Phil Davis
		} else {
311 2f8fe6af Carlos Eduardo Ramos
			$input_errors[] = gettext("Could not add new queue.");
312 6aaec445 Phil Davis
		}
313 197bfe96 Ermal Luçi
	} else if ($_POST['apply']) {
314 6aaec445 Phil Davis
		write_config();
315 0df08a41 Scott Ullrich
316 6aaec445 Phil Davis
		$retval = 0;
317
		$retval = filter_configure();
318 806942d0 Stephen Beaver
319 6aaec445 Phil Davis
		if (stristr($retval, "error") <> true) {
320 0027de0a Ermal Lu?i
			$savemsg = get_std_save_message($retval);
321 881132ed Phil Davis
			$class = 'success';
322 6aaec445 Phil Davis
		} else {
323
			$savemsg = $retval;
324 881132ed Phil Davis
			$class = 'warning';
325 6aaec445 Phil Davis
		}
326 5b237745 Scott Ullrich
327 806942d0 Stephen Beaver
		/* reset rrd queues */
328 7ac5a4cb Scott Ullrich
		system("rm -f /var/db/rrd/*queuedrops.rrd");
329
		system("rm -f /var/db/rrd/*queues.rrd");
330
		enable_rrd_graphing();
331 1f276138 Scott Ullrich
332 a368a026 Ermal Lu?i
		clear_subsystem_dirty('shaper');
333 806942d0 Stephen Beaver
334 6aaec445 Phil Davis
		if ($queue) {
335 a51c7c7f Stephen Beaver
			$sform = $queue->build_form();
336 6aaec445 Phil Davis
			$dontshow = false;
337
		} else {
338 a51c7c7f Stephen Beaver
			$sform = $default_shaper_message;
339 6aaec445 Phil Davis
			$dontshow = true;
340
		}
341 197bfe96 Ermal Luçi
	} else if ($queue) {
342 6aaec445 Phil Davis
		$queue->validate_input($_POST, $input_errors);
343
		if (!$input_errors) {
344
			$queue->update_altq_queue_data($_POST);
345
			$queue->wconfig();
346
			if (write_config()) {
347
				mark_subsystem_dirty('shaper');
348
			}
349
			$dontshow = false;
350
		}
351 48d418e8 Ermal Luçi
		read_altq_config();
352 a51c7c7f Stephen Beaver
		$sform = $queue->build_form();
353 806942d0 Stephen Beaver
	} else	{
354 aef9d8fe Stephen Beaver
		$dfltmsg = true;
355 92125c97 Ermal Luçi
		$dontshow = true;
356
	}
357 5f471c95 Ermal
	mwexec("killall qstats");
358 aef9d8fe Stephen Beaver
}
359
360 e6f34d22 Phil Davis
if (!$_POST && !$_GET) {
361 aef9d8fe Stephen Beaver
	$dfltmsg = true;
362 197bfe96 Ermal Luçi
	$dontshow = true;
363
}
364 0ceb8927 Bill Marquette
365 fce82460 Ermal Luçi
if ($queue) {
366 6aaec445 Phil Davis
	if ($queue->GetEnabled()) {
367 aef9d8fe Stephen Beaver
		$can_enable = true;
368 6aaec445 Phil Davis
	} else {
369 aef9d8fe Stephen Beaver
		$can_enable = false;
370 6aaec445 Phil Davis
	}
371 806942d0 Stephen Beaver
	if ($queue->CanHaveChildren() && $can_enable) {
372 6aaec445 Phil Davis
		if ($altq->GetQname() <> $queue->GetQname() && $queue->GetDefault() <> "") {
373 aef9d8fe Stephen Beaver
			$can_add = false;
374 6aaec445 Phil Davis
		} else {
375 aef9d8fe Stephen Beaver
			$can_add = true;
376 6aaec445 Phil Davis
		}
377
	} else {
378 aef9d8fe Stephen Beaver
		$can_add = false;
379 6aaec445 Phil Davis
	}
380 fce82460 Ermal Luçi
}
381
382 aef9d8fe Stephen Beaver
include("head.inc");
383
384
$tree = '<ul class="tree" >';
385 fce82460 Ermal Luçi
if (is_array($altq_list_queues)) {
386 3b6dedf3 Stephen Beaver
	foreach ($altq_list_queues as $tmpaltq) {
387 6aaec445 Phil Davis
		$tree .= $tmpaltq->build_tree();
388 3b6dedf3 Stephen Beaver
	}
389 6aaec445 Phil Davis
	$tree .= get_interface_list_to_show();
390 fce82460 Ermal Luçi
}
391 0ceb8927 Bill Marquette
392 aef9d8fe Stephen Beaver
$tree .= "</ul>";
393 197bfe96 Ermal Luçi
394 7841a35c Colin Fleming
if ($queue) {
395 aef9d8fe Stephen Beaver
	print($queue->build_javascript());
396 7841a35c Colin Fleming
}
397 806942d0 Stephen Beaver
398 aef9d8fe Stephen Beaver
print($newjavascript);
399
400 7841a35c Colin Fleming
if ($input_errors) {
401 806942d0 Stephen Beaver
	print_input_errors($input_errors);
402 7841a35c Colin Fleming
}
403 aef9d8fe Stephen Beaver
404 7841a35c Colin Fleming
if ($savemsg) {
405 881132ed Phil Davis
	print_info_box($savemsg, $class);
406 7841a35c Colin Fleming
}
407 806942d0 Stephen Beaver
408 7841a35c Colin Fleming
if (is_subsystem_dirty('shaper')) {
409 2a9559e1 Stephen Beaver
	print_apply_box(gettext("The traffic shaper configuration has been changed.") . "<br />" . gettext("The changes must be applied for them to take effect."));
410 7841a35c Colin Fleming
}
411 aef9d8fe Stephen Beaver
412
$tab_array = array();
413
$tab_array[] = array(gettext("By Interface"), true, "firewall_shaper.php");
414
$tab_array[] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
415 544af3fe k-paulius
$tab_array[] = array(gettext("Limiters"), false, "firewall_shaper_vinterface.php");
416 aef9d8fe Stephen Beaver
$tab_array[] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
417
display_top_tabs($tab_array);
418 806942d0 Stephen Beaver
419 5b237745 Scott Ullrich
?>
420 8ed6b8e3 Stephen Beaver
<script type="text/javascript" src="./vendor/tree/tree.js"></script>
421 df5c0bc0 Colin Fleming
422 aef9d8fe Stephen Beaver
<div class="table-responsive">
423
	<table class="table">
424
		<tbody>
425
			<tr class="tabcont">
426 806942d0 Stephen Beaver
				<td class="col-md-1">
427
<?php
428
// Display the shaper tree
429 aef9d8fe Stephen Beaver
print($tree);
430 5b237745 Scott Ullrich
431 806942d0 Stephen Beaver
if (count($altq_list_queues) > 0) {
432 92125c97 Ermal Luçi
?>
433 6cb05fa7 Colin Fleming
					<a href="firewall_shaper.php?action=resetall" class="btn btn-sm btn-danger">
434 37676f4e jim-p
						<i class="fa fa-trash icon-embed-btn"></i>
435 aef9d8fe Stephen Beaver
						<?=gettext('Remove Shaper')?>
436
					</a>
437 806942d0 Stephen Beaver
<?php
438 aef9d8fe Stephen Beaver
}
439 197bfe96 Ermal Luçi
?>
440 aef9d8fe Stephen Beaver
				</td>
441
				<td>
442
<?php
443
444 f7d2d5aa Stephen Beaver
if (!$dfltmsg && $sform)  {
445 aef9d8fe Stephen Beaver
	// Add global buttons
446
	if (!$dontshow || $newqueue) {
447
		if ($can_add || $addnewaltq) {
448 7841a35c Colin Fleming
			if ($queue) {
449 aef9d8fe Stephen Beaver
				$url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=add';
450 7841a35c Colin Fleming
			} else {
451 aef9d8fe Stephen Beaver
				$url = 'firewall_shaper.php?interface='. $interface . '&action=add';
452 7841a35c Colin Fleming
			}
453 806942d0 Stephen Beaver
454 aef9d8fe Stephen Beaver
			$sform->addGlobal(new Form_Button(
455
				'add',
456 faab522f Renato Botelho
				'Add new Queue',
457 37676f4e jim-p
				$url,
458
				'fa-plus'
459 27d6a45b jim-p
			))->addClass('btn-success');
460 a51c7c7f Stephen Beaver
461 aef9d8fe Stephen Beaver
		}
462 806942d0 Stephen Beaver
463 7841a35c Colin Fleming
		if ($queue) {
464 aef9d8fe Stephen Beaver
			$url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=delete';
465 7841a35c Colin Fleming
		} else {
466 aef9d8fe Stephen Beaver
			$url = 'firewall_shaper.php?interface='. $interface . '&action=delete';
467 7841a35c Colin Fleming
		}
468 806942d0 Stephen Beaver
469 aef9d8fe Stephen Beaver
		$sform->addGlobal(new Form_Button(
470
			'delete',
471 faab522f Renato Botelho
			$queue ? 'Delete this queue':'Disable shaper on interface',
472 37676f4e jim-p
			$url,
473
			'fa-trash'
474 27d6a45b jim-p
		))->addClass('btn-danger');
475 a51c7c7f Stephen Beaver
476 aef9d8fe Stephen Beaver
	}
477 806942d0 Stephen Beaver
478 aef9d8fe Stephen Beaver
	print($sform);
479
}
480 806942d0 Stephen Beaver
?>
481 aef9d8fe Stephen Beaver
				</td>
482
			</tr>
483
		</tbody>
484
	</table>
485 806942d0 Stephen Beaver
</div>
486
487
<?php
488 a51c7c7f Stephen Beaver
if ($dfltmsg) {
489
?>
490
<div>
491 35681930 Stephen Beaver
	<div class="infoblock">
492 f6aebbcc NewEraCracker
		<?php print_info_box($default_shaper_msg, 'info', false); ?>
493 a51c7c7f Stephen Beaver
	</div>
494
</div>
495
<?php
496
}
497 c10cb196 Stephen Beaver
include("foot.inc");