Project

General

Profile

« Previous | Next » 

Revision c966d0cc

Added by Jim Pingle over 2 years ago

PHP 8 fixes in Dedicated Links Shaper Wizard. Fixes #13915

While here, clean up some formatting.

View differences:

src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
27 27

  
28 28
function step1_stepbeforeformdisplay() {
29 29
	global $stepid, $savemsg, $pkg;
30

  
31
	$fields = &$pkg['step'][0]['fields']['field'];
30
	$fields = array_get_path($pkg, 'step/0/fields/field', []);
32 31

  
33 32
	$wans = 0;
34 33
	$lans = 0;
35 34

  
36 35
	$iflisttmp = get_configured_interface_with_descr();
37 36
	foreach ($iflisttmp as $if => $ifdesc) {
38
		if (!is_altq_capable(get_real_interface($if)))
37
		if (!is_altq_capable(get_real_interface($if))) {
39 38
			continue;
40
		if (interface_has_gateway($if) || interface_has_gatewayv6($if))
39
		}
40
		if (interface_has_gateway($if) ||
41
		    interface_has_gatewayv6($if)) {
41 42
			$wans++;
42
		else
43
		} else {
43 44
			$lans++;
45
		}
44 46
	}
45 47

  
46
	foreach ($fields as &$field)
48
	foreach ($fields as &$field) {
47 49
		if ($field['name'] == 'numberofconnections') {
48 50
			$field['value'] = ($wans < $lans ? $wans : $lans);
49 51
			if (($wans == 0) && ($lans == 0)) {
50 52
				$field['description'] .= sprint_info_box(gettext("This firewall does not have any interfaces assigned that are capable of using ALTQ traffic shaping."), 'danger', false);
51 53
			}
52 54
		}
55
	}
56

  
57
	if (!empty($fields)) {
58
		array_set_path($pkg, 'step/0/fields/field', $fields);
59
	}
53 60
}
54 61

  
55 62
function step1_submitphpaction() {
......
73 80

  
74 81
	$wans = 0;
75 82
	$lans = 0;
76
	$iflist = array();
83
	$iflist = [];
77 84
	$iflisttmp = get_configured_interface_with_descr();
78 85
	foreach ($iflisttmp as $if => $ifdesc) {
79
		if (!is_altq_capable(get_real_interface($if)))
86
		if (!is_altq_capable(get_real_interface($if))) {
80 87
			continue;
81
		if (interface_has_gateway($if) || interface_has_gatewayv6($if))
88
		}
89
		if (interface_has_gateway($if) ||
90
		    interface_has_gatewayv6($if)) {
82 91
			$wans++;
83
		else
92
		} else {
84 93
			$lans++;
94
		}
85 95
		$iflist[$if] = $ifdesc;
86 96
	}
87
	$numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
97
	$numberofconnections = intval(config_get_path('ezshaper/step1/numberofconnections', 0));
88 98
	if ($numberofconnections > ($wans < $lans ? $wans : $lans)) {
89 99
		$savemsg=gettext("The specified number of connections is greater than the number of ALTQ-capable assigned interfaces!");
90 100
		$stepid--;
......
93 103

  
94 104
	$cfgname = "traffic_shaper_wizard_dedicated.xml";
95 105

  
96
	$fields = &$pkg['step'][1]['fields']['field'];
97

  
98
	$fields = array();
106
	$fields = [];
99 107

  
100 108
	for ($i = 0; $i < $numberofconnections; $i++) {
101
		$field = array();
109
		$field = [];
102 110
		$linknum = $i+1;
103 111
		$ifsel = ($i * 2);
104 112
		$field['name'] = "Connection #{$linknum} parameters";
105 113
		$field['type'] = "listtopic";
106 114
		$fields[] = $field;
107 115

  
108
		$field = array();
116
		$field = [];
109 117
		$field['displayname'] = "Local Interface";
110 118
		$field['name'] = "local{$i}interface";
111 119
		$field['type'] = "select";
112
		$field['options']['option'] = array();
120
		$field['options'] = [];
121
		$field['options']['option'] = [];
113 122
		$ifcnt = 0;
114 123
		foreach ($iflist as $ifname => $ifdescr) {
115 124
			// Skip wan interfaces here
116
			if (interface_has_gateway($ifname) || interface_has_gatewayv6($ifname))
125
			if (interface_has_gateway($ifname) ||
126
			    interface_has_gatewayv6($ifname)) {
117 127
				continue;
118
			if ($ifcnt == ($ifsel + 1))
128
			}
129
			if ($ifcnt == ($ifsel + 1)) {
119 130
				$field['value'] = $ifname;
120
			$opts = array();
131
			}
132
			$opts = [];
121 133
			$opts['displayname'] = $ifdescr;
122 134
			$opts['name'] = $ifname;
123 135
			$opts['value'] = $ifname;
......
128 140
		$field['bindstofield'] = "ezshaper->step2->local{$i}interface";
129 141
		$fields[] = $field;
130 142

  
131
		$field = array();
143
		$field = [];
132 144
		$field['combinefieldsend'] = "true";
133 145
		$field['dontdisplayname'] = "true";
134 146
		$field['dontcombinecells'] = "true";
......
136 148
		$field['name'] = "local{$i}downloadscheduler";
137 149
		$field['type'] = "select";
138 150
		$field['typehint'] = "Queueing discipline to apply on the download of this connection.";
139
		$field['options']['option'] = array();
140
		$opts = array();
151
		$field['options'] = [];
152
		$field['options']['option'] = [];
153
		$opts = [];
141 154
		$opts['name'] = "PRIQ";
142 155
		$opts['value'] = "PRIQ";
143 156
		$field['options']['option'][] = $opts;
144
		$opts = array();
157
		$opts = [];
145 158
		$opts['name'] = "HFSC";
146 159
		$opts['value'] = "HFSC";
147 160
		$field['options']['option'][] = $opts;
148
		$opts = array();
161
		$opts = [];
149 162
		$opts['name'] = "CBQ";
150 163
		$opts['value'] = "CBQ";
151 164
		$field['options']['option'][] = $opts;
152 165
		$field['bindstofield'] = "ezshaper->step2->local{$i}downloadscheduler";
153 166
		$fields[] = $field;
154 167

  
155
		$field = array();
168
		$field = [];
156 169
		$field['displayname'] = "WAN Interface";
157 170
		$field['name'] = "conn{$i}interface";
158 171
		$field['type'] = "select";
159
		$field['options']['option'] = array();
172
		$field['options'] = [];
173
		$field['options']['option'] = [];
160 174
		$ifcnt = 0;
161 175
		foreach ($iflist as $ifname => $ifdescr) {
162 176
			// Skip lan interfaces here
163
			if (!interface_has_gateway($ifname) && !interface_has_gatewayv6($ifname))
177
			if (!interface_has_gateway($ifname) &&
178
			    !interface_has_gatewayv6($ifname)) {
164 179
				continue;
165
			if ($ifcnt == $ifsel)
180
			}
181
			if ($ifcnt == $ifsel) {
166 182
				$field['value'] = $ifname;
167
			$opts = array();
183
			}
184
			$opts = [];
168 185
			$opts['displayname'] = $ifdescr;
169 186
			$opts['name'] = $ifname;
170 187
			$opts['value'] = $ifname;
......
175 192
		$field['combinefieldsbegin'] = "true";
176 193
		$fields[] = $field;
177 194

  
178
		$field = array();
195
		$field = [];
179 196
		$field['displayname'] = "WAN Interface Scheduler";
180 197
		$field['name'] = "conn{$i}uploadscheduler";
181 198
		$field['combinefieldsend'] = "true";
......
183 200
		$field['dontcombinecells'] = "true";
184 201
		$field['type'] = "select";
185 202
		$field['typehint'] = "Queueing discipline to apply on the upload of this connection.";
186
		$field['options']['option'] = array();
187
		$opts = array();
203
		$field['options'] = [];
204
		$field['options']['option'] = [];
205
		$opts = [];
188 206
		$opts['name'] = "PRIQ";
189 207
		$opts['value'] = "PRIQ";
190 208
		$field['options']['option'][] = $opts;
191
		$opts = array();
209
		$opts = [];
192 210
		$opts['name'] = "HFSC";
193 211
		$opts['value'] = "HFSC";
194 212
		$field['options']['option'][] = $opts;
195
		$opts = array();
213
		$opts = [];
196 214
		$opts['name'] = "CBQ";
197 215
		$opts['value'] = "CBQ";
198 216
		$field['options']['option'][] = $opts;
199 217
		$field['bindstofield'] = "ezshaper->step2->conn{$i}uploadscheduler";
200 218
		$fields[] = $field;
201 219

  
202
		$field = array();
220
		$field = [];
203 221
		$field['displayname'] = "Upload";
204 222
		$field['name'] = "conn{$i}upload";
205 223
		$field['type'] = "input";
......
207 225
		$field['combinefieldsbegin'] = "true";
208 226
		$fields[] = $field;
209 227

  
210
		$field = array();
228
		$field = [];
211 229
		$field['combinefieldsend'] = "true";
212 230
		$field['dontdisplayname'] = "true";
213 231
		$field['dontcombinecells'] = "true";
......
215 233
		$field['typehint'] = "Upload bandwidth on this connection.";
216 234
		$field['type'] = "select";
217 235
		$field['value'] = "Mb";
218
		$field['options']['option'] = array();
219
		$opts = array();
236
		$field['options'] = [];
237
		$field['options']['option'] = [];
238
		$opts = [];
220 239
		$opts['value'] = "Kb";
221 240
		$opts['name'] = "Kbit/s";
222 241
		$field['options']['option'][] = $opts;
223
		$opts = array();
242
		$opts = [];
224 243
		$opts['value'] = "Mb";
225 244
		$opts['name'] = "Mbit/s";
226 245
		$field['options']['option'][] = $opts;
227
		$opts = array();
246
		$opts = [];
228 247
		$opts['value'] = "Gb";
229 248
		$opts['name'] = "Gbit/s";
230 249
		$field['options']['option'][] = $opts;
231 250
		$field['bindstofield'] = "ezshaper->step2->conn{$i}uploadspeed";
232 251
		$fields[] = $field;
233 252

  
234
		$field = array();
253
		$field = [];
235 254
		$field['displayname'] = "Download";
236 255
		$field['name'] = "conn{$i}download";
237 256
		$field['type'] = "input";
......
239 258
		$field['combinefieldsbegin'] = "true";
240 259
		$fields[] = $field;
241 260

  
242
		$field = array();
261
		$field = [];
243 262
		$field['combinefieldsend'] = "true";
244 263
		$field['dontdisplayname'] = "true";
245 264
		$field['dontcombinecells'] = "true";
......
247 266
		$field['typehint'] = "Download bandwidth on this connection.";
248 267
		$field['type'] = "select";
249 268
		$field['value'] = "Mb";
250
		$field['options']['option'] = array();
251
		$opts = array();
269
		$field['options'] = [];
270
		$field['options']['option'] = [];
271
		$opts = [];
252 272
		$opts['value'] = "Kb";
253 273
		$opts['name'] = "Kbit/s";
254 274
		$field['options']['option'][] = $opts;
255
		$opts = array();
275
		$opts = [];
256 276
		$opts['value'] = "Mb";
257 277
		$opts['name'] = "Mbit/s";
258 278
		$field['options']['option'][] = $opts;
259
		$opts = array();
279
		$opts = [];
260 280
		$opts['value'] = "Gb";
261 281
		$opts['name'] = "Gbit/s";
262 282
		$field['options']['option'][] = $opts;
263 283
		$field['bindstofield'] = "ezshaper->step2->conn{$i}downloadspeed";
264 284
		$fields[] = $field;
265 285
	}
266
	$field = array();
286
	$field = [];
267 287
	$field['name'] = "Next";
268 288
	$field['type'] = "submit";
269 289
	$fields[] = $field;
290

  
291
	if (!empty($fields)) {
292
		array_set_path($pkg, 'step/1/fields/field', $fields);
293
	}
270 294
}
271 295

  
272 296
function step2_stepsubmitphpaction() {
......
275 299
	$sumdownloads = 0;
276 300

  
277 301
	/* Input Validation */
278
	$steps = intval($config['ezshaper']['step1']['numberofconnections']);
302
	$steps = intval(config_get_path('ezshaper/step1/numberofconnections', 0));
279 303
	for ($i = 0; $i < $steps; $i++) {
280 304
		for ($j = $i + 1; $j <= $steps; $j++) {
281 305
			if ($_POST["conn{$i}interface"] == $_POST["conn{$j}interface"] || $_POST["conn{$i}interface"] == $_POST["local{$j}interface"]) {
......
315 339
		}
316 340
	}
317 341

  
318
	config_del_path('ezshaper/step2');
319
	$config['ezshaper']['step2'] = array();
342
	config_set_path('ezshaper/step2', []);
320 343

  
321 344
	for ($i = 0; $i < $steps; $i++) {
322
		$config['ezshaper']['step2']["local{$i}downloadscheduler"] = $_POST["local{$i}downloadscheduler"];
323
		$config['ezshaper']['step2']["local{$i}interface"] = $_POST["local{$i}interface"];
324
		$config['ezshaper']['step2']["conn{$i}uploadscheduler"] = $_POST["conn{$i}uploadscheduler"];
325
		$config['ezshaper']['step2']["conn{$i}upload"] = $_POST["conn{$i}upload"];
326
		$config['ezshaper']['step2']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"];
327
		$config['ezshaper']['step2']["conn{$i}download"] = $_POST["conn{$i}download"];
328
		$config['ezshaper']['step2']["conn{$i}downloadspeed"] = $_POST["conn{$i}downloadspeed"];
329
		$config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"];
345
		config_set_path("ezshaper/step2/local{$i}downloadscheduler", $_POST["local{$i}downloadscheduler"]);
346
		config_set_path("ezshaper/step2/local{$i}interface", $_POST["local{$i}interface"]);
347
		config_set_path("ezshaper/step2/conn{$i}uploadscheduler", $_POST["conn{$i}uploadscheduler"]);
348
		config_set_path("ezshaper/step2/conn{$i}upload", $_POST["conn{$i}upload"]);
349
		config_set_path("ezshaper/step2/conn{$i}uploadspeed", $_POST["conn{$i}uploadspeed"]);
350
		config_set_path("ezshaper/step2/conn{$i}download", $_POST["conn{$i}download"]);
351
		config_set_path("ezshaper/step2/conn{$i}downloadspeed", $_POST["conn{$i}downloadspeed"]);
352
		config_set_path("ezshaper/step2/conn${i}interface", $_POST["conn{$i}interface"]);
330 353
	}
331 354
}
332 355

  
......
336 359

  
337 360
	$cfgname = "traffic_shaper_wizard_dedicated.xml";
338 361

  
339
	$numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
362
	$numberofconnections = intval(config_get_path('ezshaper/step1/numberofconnections', 0));
340 363

  
341
	$fields = &$pkg['step'][1]['fields']['field'];
342
	$voipfields = &$pkg['step'][2]['fields']['field'];
364
	$voipfields = [];
365
	$enablefields = [];
343 366

  
344
	$voipfields = array();
345
	$enablefields = array();
346

  
347
	$field = array();
367
	$field = [];
348 368
	$field['name'] = "Enable";
349 369
	$field['type'] = "checkbox";
350 370
	$field['typehint'] = "Prioritize Voice over IP traffic.";
......
352 372
	$field['descritpion'] = "This will raise the priority of VOIP traffic above all other traffic.";
353 373
	$voipfields[] = $field;
354 374

  
355
	$field = array();
375
	$field = [];
356 376
	$field['name'] = "VOIP specific settings";
357 377
	$field['type'] = "listtopic";
358 378
	$voipfields[] = $field;
359 379

  
360
	$field = array();
380
	$field = [];
361 381
	$field['name'] = "Provider";
362 382
	$enablefields[] = "Provider";
363 383
	$field['type'] = "select";
364 384
	$field['description'] = "Choose Generic if the provider isn't listed.";
365
	$field['options']['option'] = array();
366
	$opts = array();
385
	$field['options'] = [];
386
	$field['options']['option'] = [];
387
	$opts = [];
367 388
	$opts['name'] = "Generic (lowdelay)";
368 389
	$opts['value'] = "Generic";
369 390
	$field['options']['option'][] = $opts;
370
	$opts = array();
391
	$opts = [];
371 392
	$opts['name'] = "VoicePulse";
372 393
	$opts['value'] = "VoicePulse";
373 394
	$field['options']['option'][] = $opts;
374
	$opts = array();
395
	$opts = [];
375 396
	$opts['name'] = "Asterisk/Vonage";
376 397
	$opts['value'] = "Asterisk";
377 398
	$field['options']['option'][] = $opts;
378
	$opts = array();
399
	$opts = [];
379 400
	$opts['name'] = "PanasonicTDA";
380 401
	$opts['value'] = "Panasonic";
381 402
	$field['options']['option'][] = $opts;
382 403
	$field['bindstofield'] = "ezshaper->step3->provider";
383 404
	$voipfields[] = $field;
384 405

  
385
	$field = array();
406
	$field = [];
386 407
	$field['displayname'] = "Upstream SIP Server";
387 408
	$field['name'] = "upstream_sip_server";
388 409
	$enablefields[] = "upstream_sip_server";
......
394 415

  
395 416
	for ($i = 0; $i < $numberofconnections; $i++) {
396 417
		$connum = $i + 1;
397
		$field = array();
418
		$field = [];
398 419
		$field['name'] = "Connection #{$connum} parameters";
399 420
		$field['type'] = "listtopic";
400 421
		$voipfields[] = $field;
401 422

  
402
		$field = array();
423
		$field = [];
403 424
		$field['displayname'] = "Upload rate";
404 425
		$field['name'] = "conn{$i}upload";
405 426
		$enablefields[] = "conn{$i}upload";
......
408 429
		$field['combinefieldsbegin'] = "true";
409 430
		$voipfields[] = $field;
410 431

  
411
		$field = array();
432
		$field = [];
412 433
		$field['displayname'] = "Units";
413 434
		$field['combinefieldsend'] = "true";
414 435
		$field['dontdisplayname'] = "true";
......
417 438
		$enablefields[] = "conn{$i}uploadspeed";
418 439
		$field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
419 440
		$field['type'] = "select";
420
		$field['options']['option'] = array();
421
		$opts = array();
441
		$field['options'] = [];
442
		$field['options']['option'] = [];
443
		$opts = [];
422 444
		$opts['value'] = "Kb";
423 445
		$opts['name'] = "Kbit/s";
424 446
		$field['options']['option'][] = $opts;
425
		$opts = array();
447
		$opts = [];
426 448
		$opts['value'] = "Mb";
427 449
		$opts['name'] = "Mbit/s";
428 450
		$field['options']['option'][] = $opts;
429
		$opts = array();
451
		$opts = [];
430 452
		$opts['value'] = "Gb";
431 453
		$opts['name'] = "Gbit/s";
432 454
		$field['options']['option'][] = $opts;
433 455
		$field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
434 456
		$voipfields[] = $field;
435 457

  
436
		$field = array();
458
		$field = [];
437 459
		$field['displayname'] = "Download rate";
438 460
		$field['name'] = "local{$i}download";
439 461
		$enablefields[] = "local{$i}download";
......
442 464
		$field['combinefieldsbegin'] = "true";
443 465
		$voipfields[] = $field;
444 466

  
445
		$field = array();
467
		$field = [];
446 468
		$field['combinefieldsend'] = "true";
447 469
		$field['displayname'] = "Units";
448 470
		$field['dontdisplayname'] = "true";
......
451 473
		$enablefields[] = "local{$i}downloadspeed";
452 474
		$field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
453 475
		$field['type'] = "select";
454
		$field['options']['option'] = array();
455
		$opts = array();
476
		$field['options'] = [];
477
		$field['options']['option'] = [];
478
		$opts = [];
456 479
		$opts['value'] = "Kb";
457 480
		$opts['name'] = "Kbit/s";
458 481
		$field['options']['option'][] = $opts;
459
		$opts = array();
482
		$opts = [];
460 483
		$opts['value'] = "Mb";
461 484
		$opts['name'] = "Mbit/s";
462 485
		$field['options']['option'][] = $opts;
463
		$opts = array();
486
		$opts = [];
464 487
		$opts['value'] = "Gb";
465 488
		$opts['name'] = "Gbit/s";
466 489
		$field['options']['option'][] = $opts;
......
468 491
		$voipfields[] = $field;
469 492
	}
470 493

  
471
	$field = array();
494
	$field = [];
472 495
	$field['name'] = "Next";
473 496
	$field['type'] = "submit";
474 497
	$voipfields[] = $field;
475
	$voipfields[0]['enablefields'] = implode(",", $enablefields);
498
	array_set_path($voipfields, '0/enablefields', implode(",", $enablefields));
499
	array_set_path($pkg, 'step/2/fields/field', $voipfields);
476 500
}
477 501

  
478 502
function step3_stepsubmitphpaction() {
479 503
	global $config;
480 504
	global $stepid, $savemsg;
481 505

  
482
	if (!$_POST['enable'])
506
	if (!$_POST['enable']) {
483 507
		return;
508
	}
484 509

  
485 510
	if ($_POST['upstream_sip_server']) {
486 511
		if (!is_ipaddroralias($_POST['upstream_sip_server'])) {
......
491 516
		}
492 517
	}
493 518

  
494
	$steps = intval($config['ezshaper']['step1']['numberofconnections']);
519
	$steps = intval(config_get_path('ezshaper/step1/numberofconnections', 0));
495 520
	for ($i = 0; $i < $steps; $i++) {
496
		if ($config['ezshaper']['step2']["conn{$i}uploadscheduler"] != "PRIQ") {
521
		if (config_get_path("ezshaper/step2/conn{$i}uploadscheduler", "") != "PRIQ") {
497 522
			if (!is_numeric($_POST["conn{$i}upload"])) {
498 523
				$savemsg = gettext("Upload bandwidth of connection {$i} is not valid.");
499 524
				$stepid--;
......
506 531
					return;
507 532
				}
508 533
			} else {
509
				$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
510
				$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
534
				$factor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn{$i}uploadspeed"));
535
				$ifbw = $factor * floatval(config_get_path("ezshaper/step2/conn{$i}upload", 0.0));
511 536
				$factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
512 537
				$input_bw = $factor * floatval($_POST["conn{$i}upload"]);
513 538
				if ((0.8 * $ifbw) < $input_bw) {
......
518 543
			}
519 544
		}
520 545

  
521
		if ($config['ezshaper']['step2']["local{$i}downloadscheduler"] != "PRIQ") {
546
		if (config_get_path("ezshaper/step2/local{$i}downloadscheduler") != "PRIQ") {
522 547
			if (!is_numeric($_POST["local{$i}download"])) {
523 548
				$savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
524 549
				$stepid--;
......
531 556
					return;
532 557
				}
533 558
			} else {
534
				$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
535
				$ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
559
				$factor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn{$j}downloadspeed"));
560
				$ifbw = $factor * floatval(config_get_path("ezshaper/step2/conn{$j}download", 0.0));
536 561
				$factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
537 562
				$input_bw = $factor * floatval($_POST["local{$i}download"]);
538 563
				if ((0.8 * $ifbw) < $input_bw) {
......
544 569
		}
545 570
	}
546 571

  
547
	config_del_path('ezshaper/step3');
548
	$config['ezshaper']['step3'] = array();
572
	config_set_path('ezshaper/step3', []);
549 573

  
550
	if (!empty($_POST['upstream_sip_server']))
551
		$config['ezshaper']['step3']['address'] = $_POST['upstream_sip_server'];
552
	if ($_POST['enable'] == 'on')
553
		$config['ezshaper']['step3']['enable'] = 'on';
574
	if (!empty($_POST['upstream_sip_server'])) {
575
		config_set_path("ezshaper/step3/address", $_POST['upstream_sip_server']);
576
	}
577
	if ($_POST['enable'] == 'on') {
578
		config_set_path("ezshaper/step3/enable", 'on');
579
	}
554 580
	for ($i = 0; $i < $steps; $i++) {
555
		$config['ezshaper']['step3']["local{$i}download"] = $_POST["local{$i}download"];
556
		$config['ezshaper']['step3']["local{$i}downloadspeed"] = $_POST["local{$i}downloadspeed"];
557
		$config['ezshaper']['step3']["conn{$i}upload"] = $_POST["conn{$i}upload"];
558
		$config['ezshaper']['step3']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"];
581
		config_set_path("ezshaper/step3/local{$i}download", $_POST["local{$i}download"]);
582
		config_set_path("ezshaper/step3/local{$i}downloadspeed", $_POST["local{$i}downloadspeed"]);
583
		config_set_path("ezshaper/step3/conn{$i}upload", $_POST["conn{$i}upload"]);
584
		config_set_path("ezshaper/step3/conn{$i}uploadspeed", $_POST["conn{$i}uploadspeed"]);
559 585
	}
560 586
}
561 587

  
......
574 600
			$stepid--;
575 601
			return;
576 602
		}
577

  
578 603
		if ($_POST['bandwidthspeed'] <> "%") {
579 604
			$savemsg = gettext("Only percentage bandwidth specification is allowed.");
580 605
			$stepid--;
......
596 621

  
597 622
function step5_stepsubmitphpaction() {
598 623
	global $stepid, $savemsg;
599

  
600 624
	if ( $_POST['enable'] ) {
601 625
		if ($_POST['p2pcatchall']) {
602 626
			if (!is_numeric($_POST['bandwidth'])) {
......
651 675
	 * Doing it here makes sense since we can wipe the previous config only after
652 676
	 * the user decides to do so, finishing the wizard.
653 677
	 */
654
	if (isset($config['shaper']['queue']))
655
		config_del_path('shaper/queue');
656
	/* XXX: This is redundant, because this should be handled by converter at startup. */
657
	if (isset($config['shaper']['rule']))
658
		config_del_path('shaper/rule');
659
	foreach ($config['filter']['rule'] as $key => $rule)
660
		if ($rule['wizard'] == "yes")
678
	config_del_path('shaper/queue');
679
	config_del_path('shaper/rule');
680
	foreach (config_get_path('filter/rule', []) as $key => $rule) {
681
		if ($rule['wizard'] == "yes") {
661 682
			config_del_path("filter/rule/{$key}");
683
		}
684
	}
662 685

  
663 686
	/* restart the cached config */
664 687
	unset($altq_list_queues);
665
	$altq_list_queues = array();
666

  
667
	$steps = intval($config['ezshaper']['step1']['numberofconnections']);
688
	$altq_list_queues = [];
668 689

  
669
	$interfacelist = array();
690
	$steps = intval(config_get_path('ezshaper/step1/numberofconnections', 0));
691
	$interfacelist = [];
670 692

  
671 693
	for ($i = 0; $i < $steps; $i++) {
672

  
673
		$tmppath = array();
694
		$tmppath = [];
674 695
		$__tmp_altq = new altq_root_queue(); $altq =& $__tmp_altq;
675 696

  
676
		$altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]);
677
		$interfacelist[] = $config['ezshaper']['step2']["conn{$i}interface"];
678
		$altq->SetScheduler($config['ezshaper']['step2']["conn{$i}uploadscheduler"]);
679
		$altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}upload"]));
680
		$altq->SetBwscale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
697
		$altq->SetInterface(config_get_path("ezshaper/step2/conn${i}interface"));
698
		$interfacelist[] = config_get_path("ezshaper/step2/conn${i}interface");
699
		$altq->SetScheduler(config_get_path("ezshaper/step2/conn${i}uploadscheduler"));
700
		$altq->SetBandwidth(floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)));
701
		$altq->SetBwscale(config_get_path("ezshaper/step2/conn${i}uploadspeed"));
681 702
		$altq->SetEnabled("on");
682 703
		$altq_list_queues[$altq->GetQname()] =& $altq;
683
		array_push($tmppath, $config['ezshaper']['step2']["conn{$i}interface"]);
704
		array_push($tmppath, config_get_path("ezshaper/step2/conn${i}interface"));
684 705
		$altq->SetLink($tmppath);
685 706
		$altq->wconfig();
686 707

  
687
		$sched = $config['ezshaper']['step2']["conn{$i}uploadscheduler"];
708
		$sched = config_get_path("ezshaper/step2/conn${i}uploadscheduler");
688 709
		$voipbw =0;
689 710
		$voipbwunit = "Kb";
690 711
		$voip = false;
......
699 720
		$otherpriority = false;
700 721
		$remainbw = 0;
701 722
		$factor = 0;
702
		$upfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
703
		$upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor;
723
		$upfactor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn{$i}uploadspeed"));
724
		$upbw = floatval(config_get_path("ezshaper/step2/conn{$i}upload", 0.0)) * $upfactor;
704 725

  
705
		if ($config['ezshaper']['step3']['enable']) {
726
		if (config_path_enabled('ezshaper/step3')) {
706 727
			$voip = true;
707 728
			if ($sched != "PRIQ") {
708
				$voipbw = $config['ezshaper']['step3']["conn{$i}upload"];
709
				$voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"];
710
				if ($voipbwunit == "%")
729
				$voipbw = config_get_path("ezshaper/step3/conn${i}upload");
730
				$voipbwunit = config_get_path("ezshaper/step3/conn${i}uploadspeed");
731
				if ($voipbwunit == "%") {
711 732
					$factor =  $upbw/100;
712
				else
733
				} else {
713 734
					$factor = wizard_get_bandwidthtype_scale($voipbwunit);
735
				}
714 736
				$remainbw += $voipbw * $factor;
715 737
			}
716 738
		}
717
		if ($config['ezshaper']['step4']['enable']) {
739
		if (config_path_enabled('ezshaper/step4')) {
718 740
			$penalty = true;
719 741
			if ($sched != "PRIQ") {
720
				$penaltybw = $config['ezshaper']['step4']['bandwidth'];
721
				$penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
722
				if ($penaltybwunit == "%")
742
				$penaltybw = config_get_path('ezshaper/step4/bandwidth');
743
				$penaltybwunit = config_get_path('ezshaper/step4/bandwidthunit');
744
				if ($penaltybwunit == "%") {
723 745
					$factor = $upbw/100;
724
				else
746
				} else {
725 747
					$factor = wizard_get_bandwidthtype_scale($penaltybwunit);
748
				}
726 749
				$remainbw += $penaltybw * $factor;
727 750
			}
728 751
		}
729
		if ($config['ezshaper']['step5']['enable']) {
752
		if (config_path_enabled('ezshaper/step5')) {
730 753
			$p2p = true;
731
			if ($config['ezshaper']['step5']['p2pcatchall']) {
754
			if (!empty(config_get_path('ezshaper/step5/p2pcatchall'))) {
732 755
				$p2pcatchall = true;
733 756
				if ($sched != "PRIQ") {
734
					$p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
735
					$p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
736
					if ($p2pcatchbwunit == "%")
757
					$p2pcatchbw = config_get_path('ezshaper/step5/bandwidth');
758
					$p2pcatchbwunit = config_get_path('ezshaper/step5/bandwidthunit');
759
					if ($p2pcatchbwunit == "%") {
737 760
						$factor = $upbw/100;
738
					else
761
					} else {
739 762
						$factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
763
					}
740 764
					$remainbw += $p2pcatchbw * $factor;
741 765
				}
742 766
			} else {
......
748 772
			$p2pcatchall = false;
749 773
			$p2pcatchbw = 0;
750 774
		}
751
		if ($config['ezshaper']['step6']['enable']) {
775
		if (config_path_enabled('ezshaper/step6')) {
752 776
			$games = true;
753 777
		} else {
754 778
			$games = false;
755 779
		}
756 780

  
757
		if ($config['ezshaper']['step7']['enable']) {
781
		if (config_path_enabled('ezshaper/step7')) {
758 782
			$otherpriority = true;
759 783
		} else  {
760 784
			$otherpriority = false;
......
774 798
				if ($sched == "CBQ") {
775 799
					$__tmp_q = new cbq_queue();
776 800
					$q =& $__tmp_q;
777
				} else if ($sched == "HFSC") {
801
				} elseif ($sched == "HFSC") {
778 802
					$__tmp_q = new hfsc_queue();
779 803
					$q =& $__tmp_q;
780 804
				}
781 805

  
782
				$tmpcf = array();
806
				$tmpcf = [];
783 807
				$tmpcf['name'] = "qInternet";
784 808
				//$tmpcf['priority'] = 6;
785 809
				$tmpcf['ecn'] = "on";
786 810
				$tmpcf['enabled'] = "on";
787 811
				If ($sched == "CBQ") {
788
					$tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]);
789
					$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
790
				}
791
				else if ($sched == "HFSC") {
812
					$tmpcf['bandwidth'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
813
					$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
814
				} elseif ($sched == "HFSC") {
792 815
					$tmpcf['upperlimit'] = "on";
793
					$tmpcf['upperlimit3'] =
794
						floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
816
					$tmpcf['upperlimit3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) . config_get_path("ezshaper/step2/conn${i}uploadspeed");
795 817
					$tmpcf['linkshare'] = "on";
796
					$tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
797
					$tmpcf['bandwidth'] =  floatval($config['ezshaper']['step2']["conn{$i}upload"]);
798
					$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
818
					$tmpcf['linkshare3'] = floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0)) . config_get_path("ezshaper/step2/conn${i}uploadspeed");
819
					$tmpcf['bandwidth'] =  floatval(config_get_path("ezshaper/step2/conn${i}upload", 0.0));
820
					$tmpcf['bandwidthtype'] = config_get_path("ezshaper/step2/conn${i}uploadspeed");
799 821
				}
800 822
				array_push($tmppath, "qInternet");
801 823
				$qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
......
808 830

  
809 831
			if ($sched == "PRIQ") {
810 832
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
811
			} else if ($sched == "CBQ") {
833
			} elseif ($sched == "CBQ") {
812 834
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
813
			} else if ($sched == "HFSC") {
835
			} elseif ($sched == "HFSC") {
814 836
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
815 837
			}
816
			$tmpcf = array();
838
			$tmpcf = [];
817 839
			$tmpcf['name'] = "qACK";
818 840
			$tmpcf['priority'] = 6;
819 841
			$tmpcf['ecn'] = "on";
......
822 844
				$tmpcf['borrow'] = "on";
823 845
				$tmpcf['bandwidth'] = $remainbw * 0.2;
824 846
				$tmpcf['bandwidthtype'] = "%";
825
			}
826
			else if ($sched == "HFSC") {
847
			} elseif ($sched == "HFSC") {
827 848
				$lkbw = 0.20 * $remainbw;
828 849
				$tmpcf['linkshare3'] = "{$lkbw}%";
829 850
				$tmpcf['linkshare'] = "on";
......
839 860

  
840 861
			if ($sched == "PRIQ") {
841 862
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
842
			} else if ($sched == "CBQ") {
863
			} elseif ($sched == "CBQ") {
843 864
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
844
			} else if ($sched == "HFSC") {
865
			} elseif ($sched == "HFSC") {
845 866
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
846 867
			}
847
			$tmpcf = array();
848
			if ($p2pcatchall)
868
			$tmpcf = [];
869
			if ($p2pcatchall) {
849 870
				$tmpcf['name'] = "qOthersDefault";
850
			else
871
			} else {
851 872
				$tmpcf['name'] = "qDefault";
873
			}
852 874
			$tmpcf['priority'] = 3;
853 875
			$tmpcf['enabled'] = "on";
854
			if (!$p2pcatchall)
876
			if (!$p2pcatchall) {
855 877
				$tmpcf['default'] = "on";
878
			}
856 879
			$tmpcf['ecn'] = "on";
857 880
			if ($sched == "CBQ") {
858 881
				$tmpcf['borrow'] = "on";
859 882
				$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
860 883
				$tmpcf['bandwidthtype'] = "%";
861
			} else if ($sched == "HFSC") {
884
			} elseif ($sched == "HFSC") {
862 885
				$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
863 886
				$tmpcf['bandwidthtype'] = "%";
864 887
			}
......
872 895
			if ($p2p) {
873 896
				if ($sched == "PRIQ") {
874 897
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
875
				} else if ($sched == "CBQ") {
898
				} elseif ($sched == "CBQ") {
876 899
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
877
				} else if ($sched == "HFSC") {
900
				} elseif ($sched == "HFSC") {
878 901
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
879 902
				}
880
				$tmpcf = array();
903
				$tmpcf = [];
881 904
				$tmpcf['name'] = "qP2P";
882 905
				$tmpcf['priority'] = 1;
883 906
				$tmpcf['ecn'] = "on";
......
887 910
						$tmpcf['borrow'] = "on";
888 911
						$tmpcf['bandwidth'] = $p2pcatchbw;
889 912
						$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
890
					} else if ($sched == "HFSC") {
913
					} elseif ($sched == "HFSC") {
891 914
						$tmpcf['linkshare'] = "on";
892 915
						$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
893 916
						$tmpcf['upperlimit'] = "on";
......
902 925
						$tmpcf['borrow'] = "on";
903 926
						$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
904 927
						$tmpcf['bandwidthtype'] = "%";
905
					} else if ($sched == "HFSC") {
928
					} elseif ($sched == "HFSC") {
906 929
						$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
907 930
						$tmpcf['linkshare'] = "on";
908 931
						$tmpcf['linkshare3'] = "{$tmpbw}%";
......
923 946
			if ($voip) {
924 947
				if ($sched == "PRIQ") {
925 948
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
926
				} else if ($sched == "CBQ") {
949
				} elseif ($sched == "CBQ") {
927 950
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
928
				} else if ($sched == "HFSC") {
951
				} elseif ($sched == "HFSC") {
929 952
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
930 953
				}
931
				$tmpcf = array();
954
				$tmpcf = [];
932 955
				$tmpcf['name'] = "qVoIP";
933 956
				$tmpcf['priority'] = 7;
934 957
				$tmpcf['ecn'] = "on";
......
942 965
						$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
943 966
						$tmpcf['bandwidthtype'] = "%";
944 967
					}
945
				} else if ($sched == "HFSC") {
968
				} elseif ($sched == "HFSC") {
946 969
					if ($voipbw > 0) {
947 970
						$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
948 971
					} else {
......
964 987
			if ($games) {
965 988
				if ($sched == "PRIQ") {
966 989
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
967
				} else if ($sched == "CBQ") {
990
				} elseif ($sched == "CBQ") {
968 991
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
969
				} else if ($sched == "HFSC") {
992
				} elseif ($sched == "HFSC") {
970 993
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
971 994
				}
972
				$tmpcf = array();
995
				$tmpcf = [];
973 996
				$tmpcf['name'] = "qGames";
974 997
				$tmpcf['priority'] = 5;
975 998
				$tmpcf['enabled'] = "on";
......
978 1001
					$tmpcf['borrow'] = "on";
979 1002
					$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
980 1003
					$tmpcf['bandwidthtype'] = "%";
981
				} else if ($sched == "HFSC") {
1004
				} elseif ($sched == "HFSC") {
982 1005
					$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
983 1006
					$tmpcf['linkshare'] = "on";
984 1007
					$tmpcf['linkshare3'] = "{$gamesbw}%";
......
996 1019
			if ($otherpriority) {
997 1020
				if ($sched == "PRIQ") {
998 1021
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
999
				} else if ($sched == "CBQ") {
1022
				} elseif ($sched == "CBQ") {
1000 1023
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1001
				} else if ($sched == "HFSC") {
1024
				} elseif ($sched == "HFSC") {
1002 1025
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1003 1026
				}
1004
				$tmpcf = array();
1027
				$tmpcf = [];
1005 1028
				$tmpcf['name'] = "qOthersHigh";
1006 1029
				$tmpcf['priority'] = 4;
1007 1030
				$tmpcf['ecn'] = "on";
......
1010 1033
					$tmpcf['borrow'] = "on";
1011 1034
					$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
1012 1035
					$tmpcf['bandwidthtype'] = "%";
1013
				} else if ($sched == "HFSC") {
1036
				} elseif ($sched == "HFSC") {
1014 1037
					$tmpcf['linkshare'] = "on";
1015 1038
					$otherbw = $remainbw * 0.1; /* 10% bandwidth */
1016 1039
					$tmpcf['linkshare3'] = "{$otherbw}%";
......
1027 1050

  
1028 1051
				if ($sched == "PRIQ") {
1029 1052
					$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1030
				} else if ($sched == "CBQ") {
1053
				} elseif ($sched == "CBQ") {
1031 1054
					$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1032
				} else if ($sched == "HFSC") {
1055
				} elseif ($sched == "HFSC") {
1033 1056
					$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1034 1057
				}
1035
				$tmpcf = array();
1058
				$tmpcf = [];
1036 1059
				$tmpcf['name'] = "qOthersLow";
1037 1060
				$tmpcf['priority'] = 2;
1038 1061
				$tmpcf['ecn'] = "on";
......
1046 1069
						$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
1047 1070
						$tmpcf['bandwidthtype'] = "%";
1048 1071
					}
1049
				} else if ($sched == "HFSC") {
1072
				} elseif ($sched == "HFSC") {
1050 1073
					if ($penalty) {
1051 1074
						$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
1052 1075
						$tmpcf['bandwidth'] = $penaltybw;
......
1068 1091
			}
1069 1092
			array_pop($tmppath);
1070 1093

  
1071
			$downfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
1072
			$downbw = floatval($config['ezshaper']['step2']["conn{$i}download"]) * $downfactor;
1094
			$downfactor = wizard_get_bandwidthtype_scale(config_get_path("ezshaper/step2/conn${i}downloadspeed"));
1095
			$downbw = floatval(config_get_path("ezshaper/step2/conn${i}download", 0.0)) * $downfactor;
1073 1096

  
1074
			$tmppath = array();
1097
			$tmppath = [];
1075 1098
			$__tmp_altq = new altq_root_queue(); $altq =& $__tmp_altq;
1076 1099

  
1077
			$altq->SetInterface($config['ezshaper']['step2']["local{$i}interface"]);
1078
			$altq->SetScheduler($config['ezshaper']['step2']["local{$i}downloadscheduler"]);
1079
			$altq->SetBandwidth(floatval($config['ezshaper']['step2']["conn{$i}download"]));
1080
			$altq->SetBwscale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
1100
			$altq->SetInterface(config_get_path("ezshaper/step2/local${i}interface"));
1101
			$altq->SetScheduler(config_get_path("ezshaper/step2/local{$i}downloadscheduler"));
1102
			$altq->SetBandwidth(floatval(config_get_path("ezshaper/step2/conn${i}download", 0.0)));
1103
			$altq->SetBwscale(config_get_path("ezshaper/step2/conn${i}downloadspeed"));
1081 1104
			$altq->SetEnabled("on");
1082 1105
			$altq_list_queues[$altq->GetQname()] =& $altq;
1083
			array_push($tmppath, $config['ezshaper']['step2']["local{$i}interface"]);
1106
			array_push($tmppath, config_get_path("ezshaper/step2/local${i}interface"));
1084 1107
			$altq->SetLink($tmppath);
1085 1108
			//var_dump($input_errors);
1086 1109
			$altq->wconfig();
1087 1110

  
1088
			$sched = $config['ezshaper']['step2']["local{$i}downloadscheduler"];
1111
			$sched = config_get_path("ezshaper/step2/local{$i}downloadscheduler");
1089 1112
			$voipbw =0;
1090 1113
			$voipbwunit = "%";
1091 1114
			$voip = false;
......
1099 1122
			$otherpriority = false;
1100 1123
			$remainbw = 0;
1101 1124

  
1102
			if ($config['ezshaper']['step3']['enable']) {
1125
			if (config_path_enabled('ezshaper/step3')) {
1103 1126
				$voip = true;
1104 1127
				if ($sched != "PRIQ") {
1105
					$voipbw = $config['ezshaper']['step3']["local{$i}download"];
1106
					$voipbwunit = $config['ezshaper']['step3']["local{$i}downloadspeed"];
1128
					$voipbw = config_get_path("ezshaper/step3/local{$i}download");
1129
					$voipbwunit = config_get_path("ezshaper/step3/local{$i}downloadspeed");
1107 1130
					if ($sched != 'HFSC') {
1108
						if ($voipbwunit == "%")
1131
						if ($voipbwunit == "%") {
1109 1132
							$factor = $downbw/100;
1110
						else
1133
						} else {
1111 1134
							$factor = wizard_get_bandwidthtype_scale($voipbwunit);
1135
						}
1112 1136
						$remainbw += floatval($voipbw) * $factor;
1113
					} else
1114
					$remainbw += 32000; /* 32Kbit/s reserved for HFSC link sharing */
1137
					} else {
1138
						$remainbw += 32000; /* 32Kbit/s reserved for HFSC link sharing */
1139
					}
1115 1140
				}
1116 1141
			}
1117
			if ($config['ezshaper']['step4']['enable']) {
1142
			if (config_path_enabled('ezshaper/step4')) {
1118 1143
				$penalty = true;
1119 1144
				if ($sched != "PRIQ") {
1120
					$penaltybw = $config['ezshaper']['step4']['bandwidth'];
1121
					$penaltybwunit = $config['ezshaper']['step4']['bandwidthunit'];
1122
					if ($penaltybwunit == "%")
1145
					$penaltybw = config_get_path('ezshaper/step4/bandwidth');
1146
					$penaltybwunit = config_get_path('ezshaper/step4/bandwidthunit');
1147
					if ($penaltybwunit == "%") {
1123 1148
						$factor = $downbw/100;
1124
					else
1149
					} else {
1125 1150
						$factor = wizard_get_bandwidthtype_scale($penaltybwunit);
1151
					}
1126 1152
					$remainbw += floatval($penaltybw) * $factor;
1127 1153
				}
1128 1154
			}
1129
			if ($config['ezshaper']['step5']['enable']) {
1155
			if (config_path_enabled('ezshaper/step5')) {
1130 1156
				$p2p = true;
1131
				if ($config['ezshaper']['step5']['p2pcatchall']) {
1157
				if (!empty(config_get_path('ezshaper/step5/p2pcatchall'))) {
1132 1158
					$p2pcatchall = true;
1133 1159
					if ($sched != "PRIQ") {
1134
						$p2pcatchbw = $config['ezshaper']['step5']['bandwidth'];
1135
						$p2pcatchbwunit = $config['ezshaper']['step5']['bandwidthunit'];
1136
						if ($p2pcatchbwunit == "%")
1160
						$p2pcatchbw = config_get_path('ezshaper/step5/bandwidth');
1161
						$p2pcatchbwunit = config_get_path('ezshaper/step5/bandwidthunit');
1162
						if ($p2pcatchbwunit == "%") {
1137 1163
							$factor = $downbw/100;
1138
						else
1164
						} else {
1139 1165
							$factor = wizard_get_bandwidthtype_scale($p2pcatchbwunit);
1166
						}
1140 1167
						$remainbw += floatval($p2pcatchbw) * $factor;
1141 1168
					}
1142 1169
				} else {
......
1148 1175
				$p2pcatchall = false;
1149 1176
				$p2pcatchbw = 0;
1150 1177
			}
1151
		if ($config['ezshaper']['step6']['enable']) {
1178
		if (config_path_enabled('ezshaper/step6')) {
1152 1179
			$games = true;
1153 1180
		} else {
1154 1181
			$games = false;
1155 1182
		}
1156 1183

  
1157
		if ($config['ezshaper']['step7']['enable']) {
1184
		if (config_path_enabled('ezshaper/step7')) {
1158 1185
			$otherpriority = true;
1159 1186
		} else  {
1160 1187
			$otherpriority = false;
......
1174 1201
		if (!$p2pcatchall) {
1175 1202
			if ($sched == "PRIQ") {
1176 1203
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1177
			} else if ($sched == "CBQ") {
1204
			} elseif ($sched == "CBQ") {
1178 1205
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1179
			} else if ($sched == "HFSC") {
1206
			} elseif ($sched == "HFSC") {
1180 1207
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1181 1208
			}
1182
			$tmpcf = array();
1209
			$tmpcf = [];
1183 1210
			$tmpcf['name'] = "qLink";
1184 1211
			$tmpcf['priority'] = 2;
1185 1212
			$tmpcf['enabled'] = "on";
......
1190 1217
				$tmpcf['borrow'] = "on";
1191 1218
				$tmpcf['bandwidth'] = 20; /* 20% bandwidth */
1192 1219
				$tmpcf['bandwidthtype'] = "%";
1193
			} else if ($sched == "HFSC") {
1220
			} elseif ($sched == "HFSC") {
1194 1221
				$tmpcf['bandwidth'] = 20; /* 20% bandwidth */
1195 1222
				$tmpcf['bandwidthtype'] = "%";
1196 1223
			}
......
1207 1234
		if ($sched != "PRIQ") {
1208 1235
			if ($sched == "CBQ") {
1209 1236
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1210
			} else if ($sched == "HFSC") {
1237
			} elseif ($sched == "HFSC") {
1211 1238
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1212 1239
			}
1213
			$tmpcf = array();
1240
			$tmpcf = [];
1214 1241
			$tmpcf['name'] = "qInternet";
1215 1242
			//$tmpcf['priority'] = 6;
1216 1243
			$tmpcf['ecn'] = "on";
......
1218 1245
			If ($sched == "CBQ") {
1219 1246
				$tmpcf['bandwidth'] = $downqbw / 1000;
1220 1247
				$tmpcf['bandwidthtype'] = "Kb";
1221
			}
1222
			else if ($sched == "HFSC") {
1248
			} elseif ($sched == "HFSC") {
1223 1249
				$tmpcf['upperlimit'] = "on";
1224 1250
				$tmpcf['upperlimit3'] = ($downqbw / 1000) . "Kb";
1225 1251
				$tmpcf['linkshare'] = "on";
......
1238 1264

  
1239 1265
		if ($sched == "PRIQ") {
1240 1266
			$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1241
		} else if ($sched == "CBQ") {
1267
		} elseif ($sched == "CBQ") {
1242 1268
			$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1243
		} else if ($sched == "HFSC") {
1269
		} elseif ($sched == "HFSC") {
1244 1270
			$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1245 1271
		}
1246
		$tmpcf = array();
1272
		$tmpcf = [];
1247 1273
		$tmpcf['name'] = "qACK";
1248 1274
		$tmpcf['priority'] = 6;
1249 1275
		$tmpcf['ecn'] = "on";
......
1252 1278
			$tmpcf['borrow'] = "on";
1253 1279
			$tmpcf['bandwidth'] = $remainbw * 0.2;
1254 1280
			$tmpcf['bandwidthtype'] = "%";
1255
		} else if ($sched == "HFSC") {
1281
		} elseif ($sched == "HFSC") {
1256 1282
			$lkbw = 0.20 * $remainbw;
1257 1283
			$tmpcf['linkshare3'] = "{$lkbw}%";
1258 1284
			$tmpcf['linkshare'] = "on";
......
1269 1295
		if ($p2p) {
1270 1296
			if ($sched == "PRIQ") {
1271 1297
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1272
			} else if ($sched == "CBQ") {
1298
			} elseif ($sched == "CBQ") {
1273 1299
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1274
			} else if ($sched == "HFSC") {
1300
			} elseif ($sched == "HFSC") {
1275 1301
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1276 1302
			}
1277
			$tmpcf = array();
1303
			$tmpcf = [];
1278 1304
			$tmpcf['name'] = "qP2P";
1279 1305
			$tmpcf['priority'] = 1;
1280 1306
			$tmpcf['ecn'] = "on";
......
1284 1310
					$tmpcf['borrow'] = "on";
1285 1311
					$tmpcf['bandwidth'] = $p2pcatchbw;
1286 1312
					$tmpcf['bandwidthtype'] = $p2pcatchbwunit;
1287
				} else if ($sched == "HFSC") {
1313
				} elseif ($sched == "HFSC") {
1288 1314
					$tmpcf['linkshare'] = "on";
1289 1315
					$tmpcf['linkshare3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
1290 1316
					$tmpcf['upperlimit'] = "on";
......
1299 1325
					$tmpcf['borrow'] = "on";
1300 1326
					$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
1301 1327
					$tmpcf['bandwidthtype'] = "%";
1302
				} else if ($sched == "HFSC") {
1328
				} elseif ($sched == "HFSC") {
1303 1329
					$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
1304 1330
					$tmpcf['linkshare'] = "on";
1305 1331
					$tmpcf['linkshare3'] = "{$tmpbw}%";
......
1320 1346
		if ($voip) {
1321 1347
			if ($sched == "PRIQ") {
1322 1348
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1323
			} else if ($sched == "CBQ") {
1349
			} elseif ($sched == "CBQ") {
1324 1350
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1325
			} else if ($sched == "HFSC") {
1351
			} elseif ($sched == "HFSC") {
1326 1352
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1327 1353
			}
1328
			$tmpcf = array();
1354
			$tmpcf = [];
1329 1355
			$tmpcf['name'] = "qVoIP";
1330 1356
			$tmpcf['priority'] = 7;
1331 1357
			$tmpcf['ecn'] = "on";
......
1339 1365
					$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
1340 1366
					$tmpcf['bandwidthtype'] = "%";
1341 1367
				}
1342
			} else if ($sched == "HFSC") {
1368
			} elseif ($sched == "HFSC") {
1343 1369
				if ($voipbw > 0) {
1344 1370
					$tmpcf['realtime3'] = "{$voipbw}{$voipbwunit}";
1345 1371
				} else {
......
1361 1387
		if ($games) {
1362 1388
			if ($sched == "PRIQ") {
1363 1389
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1364
			} else if ($sched == "CBQ") {
1390
			} elseif ($sched == "CBQ") {
1365 1391
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1366
			} else if ($sched == "HFSC") {
1392
			} elseif ($sched == "HFSC") {
1367 1393
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1368 1394
			}
1369
			$tmpcf = array();
1395
			$tmpcf = [];
1370 1396
			$tmpcf['name'] = "qGames";
1371 1397
			$tmpcf['priority'] = 5;
1372 1398
			$tmpcf['enabled'] = "on";
......
1375 1401
				$tmpcf['borrow'] = "on";
1376 1402
				$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
1377 1403
				$tmpcf['bandwidthtype'] = "%";
1378
			} else if ($sched == "HFSC") {
1404
			} elseif ($sched == "HFSC") {
1379 1405
				$gamesbw = $remainbw * 0.2; /* 20% bandwidth */
1380 1406
				$tmpcf['linkshare'] = "on";
1381 1407
				$tmpcf['linkshare3'] = "{$gamesbw}%";
......
1393 1419
		if ($otherpriority) {
1394 1420
			if ($sched == "PRIQ") {
1395 1421
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1396
			} else if ($sched == "CBQ") {
1422
			} elseif ($sched == "CBQ") {
1397 1423
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1398
			} else if ($sched == "HFSC") {
1424
			} elseif ($sched == "HFSC") {
1399 1425
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1400 1426
			}
1401
			$tmpcf = array();
1427
			$tmpcf = [];
1402 1428
			$tmpcf['name'] = "qOthersHigh";
1403 1429
			$tmpcf['priority'] = 4;
1404 1430
			$tmpcf['ecn'] = "on";
......
1407 1433
				$tmpcf['borrow'] = "on";
1408 1434
				$tmpcf['bandwidth'] = $remainbw * 0.1; /* 10% bandwidth */
1409 1435
				$tmpcf['bandwidthtype'] = "%";
1410
			} else if ($sched == "HFSC") {
1436
			} elseif ($sched == "HFSC") {
1411 1437
				$tmpcf['linkshare'] = "on";
1412 1438
				$otherbw = $remainbw * 0.1; /* 10% bandwidth */
1413 1439
				$tmpcf['linkshare3'] = "{$otherbw}%";
......
1423 1449

  
1424 1450
			if ($sched == "PRIQ") {
1425 1451
				$__tmp_q = new priq_queue(); $q =& $__tmp_q;
1426
			} else if ($sched == "CBQ") {
1452
			} elseif ($sched == "CBQ") {
1427 1453
				$__tmp_q = new cbq_queue(); $q =& $__tmp_q;
1428
			} else if ($sched == "HFSC") {
1454
			} elseif ($sched == "HFSC") {
1429 1455
				$__tmp_q = new hfsc_queue(); $q =& $__tmp_q;
1430 1456
			}
1431
			$tmpcf = array();
1457
			$tmpcf = [];
1432 1458
			$tmpcf['name'] = "qOthersLow";
1433 1459
			$tmpcf['priority'] = 3;
1434 1460
			$tmpcf['ecn'] = "on";
......
1442 1468
					$tmpcf['bandwidthtype'] = "%";
1443 1469
					$tmpcf['bandwidth'] = $remainbw * 0.05; /* 5% bandwidth */
1444 1470
				}
1445
			} else if ($sched == "HFSC") {
1471
			} elseif ($sched == "HFSC") {
1446 1472
				if ($penalty) {
1447 1473
					$tmpcf['linkshare3'] = "{$penaltybw}{$penaltybwunit}";
1448 1474
					$tmpcf['bandwidth'] = $penaltybw;
......
1465 1491
		array_pop($tmppath);
1466 1492
	}
1467 1493

  
1468
	if (!is_array($config['filter']['rule']))
1469
		$config['filter']['rule'] = array();
1494
	$filter_rules = config_get_path('filter/rule', []);
1470 1495

  
1471 1496
	if (!empty($interfacelist)) {
1472 1497
		$interfacelist = implode(",", $interfacelist);
......
1477 1502
	/* Rules */
1478 1503
	$tracker = (int)microtime(true);
1479 1504
	if ($penalty) {
1480
		if (is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
1481
			$rule = array();
1505
		if (is_ipaddr(config_get_path('ezshaper/step4/address')) ||
1506
		    is_alias(config_get_path('ezshaper/step4/address'))) {
1507
			$rule = [];
1482 1508
			$rule['type'] = "match";
1483 1509
			$rule['interface'] = $interfacelist;
1484
			if (is_ipaddrv4($config['ezshaper']['step4']['address'])) {
1510
			if (is_ipaddrv4(config_get_path('ezshaper/step4/address'))) {
1485 1511
				$rule['ipprotocol'] = "inet";
1486
			} elseif (is_ipaddrv6($config['ezshaper']['step4']['address'])) {
1512
			} elseif (is_ipaddrv6(config_get_path('ezshaper/step4/address'))) {
1487 1513
				$rule['ipprotocol'] = "inet6";
1488 1514
			} else {
1489 1515
				$rule['ipprotocol'] = "inet46";
......
1494 1520
			} else {
1495 1521
				$rule['defaultqueue'] = "qDefault";
1496 1522
			}
1497
			$rule['source']['address'] = $config['ezshaper']['step4']['address'];
1523
			$rule['source'] = [];
1524
			$rule['source']['address'] = config_get_path('ezshaper/step4/address');
1525
			$rule['destination'] = [];
1498 1526
			$rule['destination']['any'] = TRUE;
1499 1527
			$rule['floating'] = "yes";
1500 1528
			$rule['wizard'] = "yes";
1501 1529
			$rule['enabled'] = "on";
1502 1530
			$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1503 1531
			$rule['tracker'] = $tracker++;
1504
			$config['filter']['rule'][] = $rule;
1532
			$filter_rules[] = $rule;
1505 1533
		}
1506 1534
	}
1507 1535

  
1508 1536
	/* If user specifies an IP, we don't bother with providers */
1509 1537
	if ($voip) {
1510
		if (is_ipaddr($config['ezshaper']['step3']['address']) || is_alias($config['ezshaper']['step3']['address'])) {
1538
		if (is_ipaddr(config_get_path('ezshaper/step3/address')) ||
1539
		    is_alias(config_get_path('ezshaper/step3/address'))) {
1511 1540
			/* create VOIP rules */
1512
			$rule = array();
1541
			$rule = [];
1513 1542
			$rule['type'] = "match";
1514
			if (is_ipaddrv4($config['ezshaper']['step3']['address'])) {
1543
			if (is_ipaddrv4(config_get_path('ezshaper/step3/address'))) {
1515 1544
				$ipprotocol = "inet";
1516
			} elseif (is_ipaddrv6($config['ezshaper']['step3']['address'])) {
1545
			} elseif (is_ipaddrv6(config_get_path('ezshaper/step3/address'))) {
1517 1546
				$ipprotocol = "inet6";
1518 1547
			} else {
1519 1548
				$ipprotocol = "inet46";
......
1523 1552
			$rule['descr'] = gettext("Connections From Upstream SIP Server");
1524 1553
			$rule['protocol'] = "udp";
1525 1554
			$rule['defaultqueue'] = "qVoIP";
1526
			$rule['source']['address'] = $config['ezshaper']['step3']['address'];
1555
			$rule['source'] = [];
1556
			$rule['source']['address'] = config_get_path('ezshaper/step3/address');
1557
			$rule['destination'] = [];
1527 1558
			$rule['destination']['any'] = TRUE;
1528 1559
			$rule['floating'] = "yes";
1529 1560
			$rule['wizard'] = "yes";
1530 1561
			$rule['enabled'] = "on";
1531 1562
			$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1532 1563
			$rule['tracker'] = $tracker++;
1533
			$config['filter']['rule'][] = $rule;
1564
			$filter_rules[] = $rule;
1534 1565

  
1535
			$rule = array();
1566
			$rule = [];
1536 1567
			$rule['type'] = "match";
1537 1568
			$rule['interface'] = "any";
1538 1569
			$rule['ipprotocol'] = $ipprotocol;
1539 1570
			$rule['descr'] = gettext("Connections To Upstream SIP Server");
1540 1571
			$rule['protocol'] = "udp";
1541 1572
			$rule['defaultqueue'] = "qVoIP";
1573
			$rule['source'] = [];
1542 1574
			$rule['source']['any'] = TRUE;
1543
			$rule['destination']['address'] = $config['ezshaper']['step3']['address'];
1575
			$rule['destination'] = [];
1576
			$rule['destination']['address'] = config_get_path('ezshaper/step3/address');
1544 1577
			$rule['floating'] = "yes";
1545 1578
			$rule['wizard'] = "yes";
1546 1579
			$rule['enabled'] = "on";
1547 1580
			$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1548 1581
			$rule['tracker'] = $tracker++;
1549
			$config['filter']['rule'][] = $rule;
1582
			$filter_rules[] = $rule;
1550 1583

  
1551
		} elseif ($config['ezshaper']['step3']['provider'] == "Generic") {
1584
		} elseif (config_get_path('ezshaper/step3/provider') == "Generic") {
1552 1585
			/* create VOIP rules */
1553
			$rule = array();
1586
			$rule = [];
1554 1587
			$rule['type'] = "match";
1555 1588
			$rule['interface'] = $interfacelist;
1556 1589
			$rule['ipprotocol'] = "inet46";
1557 1590
			$rule['descr'] = "DiffServ/Lowdelay/Upload";
1558 1591
			$rule['protocol'] = "udp";
1592
			$rule['source'] = [];
1559 1593
			$rule['source']['any'] = TRUE;
1560 1594
			$rule['defaultqueue'] = "qVoIP";
1595
			$rule['destination'] = [];
1561 1596
			$rule['destination']['any'] = TRUE;
1562 1597
			$rule['iptos'] = "lowdelay";
1563 1598
			$rule['floating'] = "yes";
......
1565 1600
			$rule['enabled'] = "on";
1566 1601
			$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1567 1602
			$rule['tracker'] = $tracker++;
1568
			$config['filter']['rule'][] = $rule;
1569
		} elseif (array_key_exists($config['ezshaper']['step3']['provider'], $voiplist)) {
1603
			$filter_rules[] = $rule;
1604
		} elseif (array_key_exists(config_get_path('ezshaper/step3/provider'), $voiplist)) {
1570 1605
			/* loop through voiplist[] */
1571
			foreach ($voiplist[$config['ezshaper']['step3']['provider']] as $voip) {
1572
				$rule = array();
1606
			foreach ($voiplist[config_get_path('ezshaper/step3/provider')] as $voip) {
1607
				$rule = [];
1573 1608
				$rule['type'] = "match";
1574 1609
				$rule['interface'] = $interfacelist;
1575 1610
				$rule['ipprotocol'] = "inet46";
1576 1611
				$rule['defaultqueue'] = 'qVoIP';
1612
				$rule['source'] = [];
1577 1613
				$rule['source']['any'] = TRUE;
1614
				$rule['destination'] = [];
1578 1615
				$rule['destination']['any'] = TRUE;
1579 1616
				$rule['descr'] = "m_voip {$voip[0]} outbound";
1580 1617
				$rule['floating'] = "yes";
1581 1618
				$rule['wizard'] = "yes";
1582 1619
				$rule['enabled'] = "on";
1583 1620
				$rule['destination']['port'] = $voip[2]."-".$voip[3];
1584
				if ($voip[1] != '')
1621
				if ($voip[1] != '') {
1585 1622
					$rule['protocol'] = $voip[1];
1623
				}
1586 1624
				$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1587 1625
				$rule['tracker'] = $tracker++;
1588
				$config['filter']['rule'][] = $rule;
1626
				$filter_rules[] = $rule;
1589 1627
			}
1590 1628
		}
1591 1629
	}
1592 1630

  
1593 1631
	/* loop through p2plist[] */
1594 1632
	if ($p2p) {
1595
		foreach ($config['ezshaper']['step5'] as $key => $val) {
1596
			if (!is_array($p2plist[$key]))
1633
		foreach (config_get_path('ezshaper/step5', []) as $key => $val) {
1634
			if (!is_array($p2plist[$key])) {
1597 1635
				continue;
1636
			}
1598 1637
			foreach ($p2plist[$key] as $p2pclient) {
1599
				$rule = array();
1638
				$rule = [];
1600 1639
				$rule['type'] = "match";
1601 1640
				$rule['interface'] = $interfacelist;
1602 1641
				$rule['ipprotocol'] = "inet46";
1603 1642
				$rule['defaultqueue'] = 'qP2P';
1643
				$rule['source'] = [];
1604 1644
				$rule['source']['any'] = TRUE;
1645
				$rule['destination'] = [];
1605 1646
				$rule['destination']['any'] = TRUE;
1606 1647
				$rule['descr'] = "m_P2P {$p2pclient[0]} outbound";
1607 1648
				$rule['floating'] = "yes";
1608 1649
				$rule['wizard'] = "yes";
1609 1650
				$rule['destination']['port'] = $p2pclient[2]."-".$p2pclient[3];
1610
				if ($p2pclient[1] != '')
1651
				if ($p2pclient[1] != '') {
1611 1652
					$rule['protocol'] = $p2pclient[1];
1653
				}
1612 1654
				$rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
1613 1655
				$rule['tracker'] = $tracker++;
1614
				$config['filter']['rule'][] = $rule;
1656
				$filter_rules[] = $rule;
1615 1657
			}
1616 1658
		}
1617 1659
	}
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff