Project

General

Profile

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