Project

General

Profile

Download (12.4 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 f7d2d5aa Stephen Beaver
			$input_errors[] = gettext("Could not create new queue/discipline! Did you remember to apply any recent changes?");
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 806942d0 Stephen Beaver
264 92125c97 Ermal Luçi
		switch ($altq->GetBwscale()) {
265
				case "Mb":
266
					$factor = 1000 * 1000;
267 aef9d8fe Stephen Beaver
					break;
268 92125c97 Ermal Luçi
				case "Kb":
269
					$factor = 1000;
270
					break;
271
				case "b":
272
					$factor = 1;
273
					break;
274
				case "Gb":
275
					$factor = 1000 * 1000 * 1000;
276
					break;
277
				case "%": /* We don't use it for root_XXX queues. */
278
				default: /* XXX assume Kb by default. */
279
					$factor = 1000;
280
					break;
281 806942d0 Stephen Beaver
			}
282 aef9d8fe Stephen Beaver
283 92125c97 Ermal Luçi
		$altq->SetAvailableBandwidth($altq->GetBandwidth() * $factor);
284 197bfe96 Ermal Luçi
		$altq->ReadConfig($_POST);
285 ea51e9f8 Renato Botelho
		$altq->validate_input($_POST, $input_errors);
286 92125c97 Ermal Luçi
		if (!$input_errors) {
287
			unset($tmppath);
288
			$tmppath[] = $altq->GetInterface();
289 806942d0 Stephen Beaver
			$altq->SetLink($tmppath);
290 92125c97 Ermal Luçi
			$altq->wconfig();
291 6aaec445 Phil Davis
			if (write_config()) {
292 3a343d73 jim-p
				mark_subsystem_dirty('shaper');
293 6aaec445 Phil Davis
			}
294 92125c97 Ermal Luçi
			$can_enable = true;
295 aef9d8fe Stephen Beaver
			$can_add = true;
296 92125c97 Ermal Luçi
		}
297 aef9d8fe Stephen Beaver
298 48d418e8 Ermal Luçi
		read_altq_config();
299 a51c7c7f Stephen Beaver
		$sform = $altq->build_form();
300 197bfe96 Ermal Luçi
	} else if ($parentqueue) { /* Add a new queue */
301
		$qtmp =& $altq->find_queue($interface, $parentqueue);
302
		if ($qtmp) {
303
			$tmppath =& $qtmp->GetLink();
304
			array_push($tmppath, $qname);
305 ea51e9f8 Renato Botelho
			$tmp =& $qtmp->add_queue($interface, $_POST, $tmppath, $input_errors);
306 92125c97 Ermal Luçi
			if (!$input_errors) {
307
				array_pop($tmppath);
308
				$tmp->wconfig();
309
				$can_enable = true;
310 70b139a3 Chris Buechler
				if ($tmp->CanHaveChildren() && $can_enable) {
311 6aaec445 Phil Davis
					if ($tmp->GetDefault() <> "") {
312 3b6dedf3 Stephen Beaver
						$can_add = false;
313 6aaec445 Phil Davis
					} else {
314 3b6dedf3 Stephen Beaver
						$can_add = true;
315 6aaec445 Phil Davis
					}
316
				} else {
317 92125c97 Ermal Luçi
					$can_add = false;
318 6aaec445 Phil Davis
				}
319
				if (write_config()) {
320 3a343d73 jim-p
					mark_subsystem_dirty('shaper');
321 6aaec445 Phil Davis
				}
322 92125c97 Ermal Luçi
				$can_enable = true;
323 6aaec445 Phil Davis
				if ($altq->GetScheduler() != "PRIQ") { /* XXX */
324
					if ($tmp->GetDefault() <> "") {
325 3b6dedf3 Stephen Beaver
						$can_add = false;
326 6aaec445 Phil Davis
					} else {
327 3b6dedf3 Stephen Beaver
						$can_add = true;
328 6aaec445 Phil Davis
					}
329
				}
330 92125c97 Ermal Luçi
			}
331 48d418e8 Ermal Luçi
			read_altq_config();
332 a51c7c7f Stephen Beaver
			$sform = $tmp->build_form();
333 6aaec445 Phil Davis
		} else {
334 2f8fe6af Carlos Eduardo Ramos
			$input_errors[] = gettext("Could not add new queue.");
335 6aaec445 Phil Davis
		}
336 197bfe96 Ermal Luçi
	} else if ($_POST['apply']) {
337 6aaec445 Phil Davis
		write_config();
338 0df08a41 Scott Ullrich
339 6aaec445 Phil Davis
		$retval = 0;
340
		$retval = filter_configure();
341 806942d0 Stephen Beaver
342 6aaec445 Phil Davis
		if (stristr($retval, "error") <> true) {
343 0027de0a Ermal Lu?i
			$savemsg = get_std_save_message($retval);
344 881132ed Phil Davis
			$class = 'success';
345 6aaec445 Phil Davis
		} else {
346
			$savemsg = $retval;
347 881132ed Phil Davis
			$class = 'warning';
348 6aaec445 Phil Davis
		}
349 5b237745 Scott Ullrich
350 806942d0 Stephen Beaver
		/* reset rrd queues */
351 7ac5a4cb Scott Ullrich
		system("rm -f /var/db/rrd/*queuedrops.rrd");
352
		system("rm -f /var/db/rrd/*queues.rrd");
353
		enable_rrd_graphing();
354 1f276138 Scott Ullrich
355 a368a026 Ermal Lu?i
		clear_subsystem_dirty('shaper');
356 806942d0 Stephen Beaver
357 6aaec445 Phil Davis
		if ($queue) {
358 a51c7c7f Stephen Beaver
			$sform = $queue->build_form();
359 6aaec445 Phil Davis
			$dontshow = false;
360
		} else {
361 a51c7c7f Stephen Beaver
			$sform = $default_shaper_message;
362 6aaec445 Phil Davis
			$dontshow = true;
363
		}
364 197bfe96 Ermal Luçi
	} else if ($queue) {
365 6aaec445 Phil Davis
		$queue->validate_input($_POST, $input_errors);
366
		if (!$input_errors) {
367
			$queue->update_altq_queue_data($_POST);
368
			$queue->wconfig();
369
			if (write_config()) {
370
				mark_subsystem_dirty('shaper');
371
			}
372
			$dontshow = false;
373
		}
374 48d418e8 Ermal Luçi
		read_altq_config();
375 a51c7c7f Stephen Beaver
		$sform = $queue->build_form();
376 806942d0 Stephen Beaver
	} else	{
377 aef9d8fe Stephen Beaver
		$dfltmsg = true;
378 92125c97 Ermal Luçi
		$dontshow = true;
379
	}
380 5f471c95 Ermal
	mwexec("killall qstats");
381 aef9d8fe Stephen Beaver
}
382
383 e6f34d22 Phil Davis
if (!$_POST && !$_GET) {
384 aef9d8fe Stephen Beaver
	$dfltmsg = true;
385 197bfe96 Ermal Luçi
	$dontshow = true;
386
}
387 0ceb8927 Bill Marquette
388 fce82460 Ermal Luçi
if ($queue) {
389 6aaec445 Phil Davis
	if ($queue->GetEnabled()) {
390 aef9d8fe Stephen Beaver
		$can_enable = true;
391 6aaec445 Phil Davis
	} else {
392 aef9d8fe Stephen Beaver
		$can_enable = false;
393 6aaec445 Phil Davis
	}
394 806942d0 Stephen Beaver
	if ($queue->CanHaveChildren() && $can_enable) {
395 6aaec445 Phil Davis
		if ($altq->GetQname() <> $queue->GetQname() && $queue->GetDefault() <> "") {
396 aef9d8fe Stephen Beaver
			$can_add = false;
397 6aaec445 Phil Davis
		} else {
398 aef9d8fe Stephen Beaver
			$can_add = true;
399 6aaec445 Phil Davis
		}
400
	} else {
401 aef9d8fe Stephen Beaver
		$can_add = false;
402 6aaec445 Phil Davis
	}
403 fce82460 Ermal Luçi
}
404
405 aef9d8fe Stephen Beaver
include("head.inc");
406
407
$tree = '<ul class="tree" >';
408 fce82460 Ermal Luçi
if (is_array($altq_list_queues)) {
409 3b6dedf3 Stephen Beaver
	foreach ($altq_list_queues as $tmpaltq) {
410 6aaec445 Phil Davis
		$tree .= $tmpaltq->build_tree();
411 3b6dedf3 Stephen Beaver
	}
412 6aaec445 Phil Davis
	$tree .= get_interface_list_to_show();
413 fce82460 Ermal Luçi
}
414 0ceb8927 Bill Marquette
415 aef9d8fe Stephen Beaver
$tree .= "</ul>";
416 197bfe96 Ermal Luçi
417 7841a35c Colin Fleming
if ($queue) {
418 aef9d8fe Stephen Beaver
	print($queue->build_javascript());
419 7841a35c Colin Fleming
}
420 806942d0 Stephen Beaver
421 aef9d8fe Stephen Beaver
print($newjavascript);
422
423 7841a35c Colin Fleming
if ($input_errors) {
424 806942d0 Stephen Beaver
	print_input_errors($input_errors);
425 7841a35c Colin Fleming
}
426 aef9d8fe Stephen Beaver
427 7841a35c Colin Fleming
if ($savemsg) {
428 881132ed Phil Davis
	print_info_box($savemsg, $class);
429 7841a35c Colin Fleming
}
430 806942d0 Stephen Beaver
431 7841a35c Colin Fleming
if (is_subsystem_dirty('shaper')) {
432 464358b4 Phil Davis
	print_apply_box(gettext("The traffic shaper configuration has been changed.") . "<br />" . gettext("You must apply the changes in order for them to take effect."));
433 7841a35c Colin Fleming
}
434 aef9d8fe Stephen Beaver
435
$tab_array = array();
436
$tab_array[] = array(gettext("By Interface"), true, "firewall_shaper.php");
437
$tab_array[] = array(gettext("By Queue"), false, "firewall_shaper_queues.php");
438 544af3fe k-paulius
$tab_array[] = array(gettext("Limiters"), false, "firewall_shaper_vinterface.php");
439 aef9d8fe Stephen Beaver
$tab_array[] = array(gettext("Wizards"), false, "firewall_shaper_wizards.php");
440
display_top_tabs($tab_array);
441 806942d0 Stephen Beaver
442 5b237745 Scott Ullrich
?>
443 197bfe96 Ermal Luçi
<script type="text/javascript" src="./tree/tree.js"></script>
444 df5c0bc0 Colin Fleming
445 aef9d8fe Stephen Beaver
<div class="table-responsive">
446
	<table class="table">
447
		<tbody>
448
			<tr class="tabcont">
449 806942d0 Stephen Beaver
				<td class="col-md-1">
450
<?php
451
// Display the shaper tree
452 aef9d8fe Stephen Beaver
print($tree);
453 5b237745 Scott Ullrich
454 806942d0 Stephen Beaver
if (count($altq_list_queues) > 0) {
455 92125c97 Ermal Luçi
?>
456 6cb05fa7 Colin Fleming
					<a href="firewall_shaper.php?action=resetall" class="btn btn-sm btn-danger">
457 aef9d8fe Stephen Beaver
						<?=gettext('Remove Shaper')?>
458
					</a>
459 806942d0 Stephen Beaver
<?php
460 aef9d8fe Stephen Beaver
}
461 197bfe96 Ermal Luçi
?>
462 aef9d8fe Stephen Beaver
				</td>
463
				<td>
464
<?php
465
466 f7d2d5aa Stephen Beaver
if (!$dfltmsg && $sform)  {
467 aef9d8fe Stephen Beaver
	// Add global buttons
468
	if (!$dontshow || $newqueue) {
469
		if ($can_add || $addnewaltq) {
470 7841a35c Colin Fleming
			if ($queue) {
471 aef9d8fe Stephen Beaver
				$url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=add';
472 7841a35c Colin Fleming
			} else {
473 aef9d8fe Stephen Beaver
				$url = 'firewall_shaper.php?interface='. $interface . '&action=add';
474 7841a35c Colin Fleming
			}
475 806942d0 Stephen Beaver
476 aef9d8fe Stephen Beaver
			$sform->addGlobal(new Form_Button(
477
				'add',
478
				'Add new Queue',
479
				$url
480 3b6dedf3 Stephen Beaver
			))->removeClass('btn-default')->addClass('btn-success');
481 a51c7c7f Stephen Beaver
482 aef9d8fe Stephen Beaver
		}
483 806942d0 Stephen Beaver
484 7841a35c Colin Fleming
		if ($queue) {
485 aef9d8fe Stephen Beaver
			$url = 'firewall_shaper.php?interface='. $interface . '&queue=' . $queue->GetQname() . '&action=delete';
486 7841a35c Colin Fleming
		} else {
487 aef9d8fe Stephen Beaver
			$url = 'firewall_shaper.php?interface='. $interface . '&action=delete';
488 7841a35c Colin Fleming
		}
489 806942d0 Stephen Beaver
490 aef9d8fe Stephen Beaver
		$sform->addGlobal(new Form_Button(
491
			'delete',
492
			$queue ? 'Delete this queue':'Disable shaper on interface',
493
			$url
494 3b6dedf3 Stephen Beaver
		))->removeClass('btn-default')->addClass('btn-danger');
495 a51c7c7f Stephen Beaver
496 aef9d8fe Stephen Beaver
	}
497 806942d0 Stephen Beaver
498 aef9d8fe Stephen Beaver
	print($sform);
499
}
500 806942d0 Stephen Beaver
?>
501 aef9d8fe Stephen Beaver
				</td>
502
			</tr>
503
		</tbody>
504
	</table>
505 806942d0 Stephen Beaver
</div>
506
507
<?php
508 a51c7c7f Stephen Beaver
if ($dfltmsg) {
509
?>
510
<div>
511 35681930 Stephen Beaver
	<div class="infoblock">
512 f6aebbcc NewEraCracker
		<?php print_info_box($default_shaper_msg, 'info', false); ?>
513 a51c7c7f Stephen Beaver
	</div>
514
</div>
515
<?php
516
}
517 c10cb196 Stephen Beaver
include("foot.inc");