summaryrefslogtreecommitdiffstats
path: root/usr/local/www/wizards
diff options
context:
space:
mode:
authorRenato Botelho <garga@FreeBSD.org>2014-07-24 15:44:55 -0300
committerRenato Botelho <garga@FreeBSD.org>2014-07-24 18:28:00 -0300
commit4844813b3e6cdfcbeae47dad4195bb6f0091f1e7 (patch)
tree0fd66dbf27fad743d201a05c444e3ce9ea42c34a /usr/local/www/wizards
parentd69332134bb81a8106fdadaf75dec8fc268792d1 (diff)
downloadpfsense-4844813b3e6cdfcbeae47dad4195bb6f0091f1e7.zip
pfsense-4844813b3e6cdfcbeae47dad4195bb6f0091f1e7.tar.gz
Fix indent and whitespaces
Diffstat (limited to 'usr/local/www/wizards')
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc554
-rw-r--r--usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc218
2 files changed, 386 insertions, 386 deletions
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
index bd3e648..461877f 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc
@@ -1,33 +1,33 @@
<?php
/*
- traffic_shaper_wizard_dedicated.inc
- part of pfSense (https://www.pfsense.org/)
-
- Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
- Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
- Copyright (C) 2008-2010 Ermal Luçi
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ traffic_shaper_wizard_dedicated.inc
+ part of pfSense (https://www.pfsense.org/)
+
+ Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
+ Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
+ Copyright (C) 2008-2010 Ermal Luçi
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
function step1_submitphpaction() {
@@ -37,12 +37,12 @@ function step1_submitphpaction() {
$savemsg=gettext("You need to specify the number of connections.");
$stepid--;
return;
- }
+ }
if (intval($_POST['numberofconnections']) < 1) {
$savemsg=gettext("The number of connections should be greater than 1.");
$stepid--;
return;
- }
+ }
}
function step2_stepbeforeformdisplay() {
@@ -51,12 +51,12 @@ function step2_stepbeforeformdisplay() {
$numberofinterfaces = 0;
$iflist = array();
- $iflisttmp = get_configured_interface_with_descr();
- foreach ($iflisttmp as $if => $ifdesc) {
- if (!is_altq_capable(get_real_interface($if)))
- continue;
- $numberofinterfaces++;
- $iflist[$if] = $ifdesc;
+ $iflisttmp = get_configured_interface_with_descr();
+ foreach ($iflisttmp as $if => $ifdesc) {
+ if (!is_altq_capable(get_real_interface($if)))
+ continue;
+ $numberofinterfaces++;
+ $iflist[$if] = $ifdesc;
}
$numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
if ($numberofconnections > ($numberofinterfaces/2)) {
@@ -68,7 +68,7 @@ function step2_stepbeforeformdisplay() {
$cfgname = "traffic_shaper_wizard_dedicated.xml";
$fields =& $pkg['step'][1]['fields']['field'];
-
+
/*
unset($config['ezshaper']['step2']);
$config['ezshaper']['step2'] = array();
@@ -94,10 +94,10 @@ function step2_stepbeforeformdisplay() {
if ($ifcnt == ($ifsel + 1))
$field['value'] = $ifname;
$opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
$ifcnt++;
}
$field['combinefieldsbegin'] = "true";
@@ -105,15 +105,15 @@ function step2_stepbeforeformdisplay() {
$fields[] = $field;
$field = array();
- $field['combinefieldsend'] = "true";
+ $field['combinefieldsend'] = "true";
$field['dontdisplayname'] = "true";
$field['dontcombinecells'] = "true";
- $field['name'] = "local{$i}downloadscheduler";
- $field['type'] = "select";
- $field['typehint'] = "Queueing discipline to apply on the download of this connection.";
- $field['options']['option'] = array();
+ $field['name'] = "local{$i}downloadscheduler";
+ $field['type'] = "select";
+ $field['typehint'] = "Queueing discipline to apply on the download of this connection.";
+ $field['options']['option'] = array();
$opts = array();
- $opts['name'] = "HFSC";
+ $opts['name'] = "HFSC";
$opts['value'] = "HFSC";
$field['options']['option'][] = $opts;
$opts = array();
@@ -137,10 +137,10 @@ function step2_stepbeforeformdisplay() {
if ($ifcnt == $ifsel)
$field['value'] = $ifname;
$opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
$ifcnt++;
}
$field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
@@ -149,7 +149,7 @@ function step2_stepbeforeformdisplay() {
$field = array();
$field['name'] = "conn{$i}uploadscheduler";
- $field['combinefieldsend'] = "true";
+ $field['combinefieldsend'] = "true";
$field['dontdisplayname'] = "true";
$field['dontcombinecells'] = "true";
$field['type'] = "select";
@@ -179,7 +179,7 @@ function step2_stepbeforeformdisplay() {
$fields[] = $field;
$field = array();
- $field['combinefieldsend'] = "true";
+ $field['combinefieldsend'] = "true";
$field['dontdisplayname'] = "true";
$field['dontcombinecells'] = "true";
$field['name'] = "conn{$i}uploadspeed";
@@ -242,7 +242,7 @@ function step2_stepsubmitphpaction() {
global $config;
global $stepid, $savemsg;
$sumdownloads = 0;
-
+
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
@@ -265,9 +265,9 @@ function step2_stepsubmitphpaction() {
$upbw = $_POST["conn{$i}upload"];
$downbw = $_POST["conn{$i}download"];
if ($upbw < 1 || $downbw < 1) {
- $savemsg = gettext("You cannot specify bandwidth smaller than 1!");
+ $savemsg = gettext("You cannot specify bandwidth smaller than 1!");
$stepid--;
- return;
+ return;
}
if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") {
$savemsg=gettext("Uploads smaller than 128Kbit/s is not supported for connection {$i} on CBQ scheduler.");
@@ -280,7 +280,7 @@ function step2_stepsubmitphpaction() {
return;
}
}
- }
+ }
/* This is necessary since the wizard expects pecnefined fields. */
unset($config['ezshaper']['step2']);
@@ -371,39 +371,39 @@ function step3_stepbeforeformdisplay() {
$field['name'] = "Connection #{$connum} parameters";
$field['type'] = "listtopic";
$voipfields[] = $field;
-
+
$field = array();
- $field['displayname'] = "Upload";
- $field['name'] = "conn{$i}upload";
+ $field['displayname'] = "Upload";
+ $field['name'] = "conn{$i}upload";
$enablefields[] = "conn{$i}upload";
- $field['type'] = "input";
- $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
+ $field['type'] = "input";
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}upload";
$field['combinefieldsbegin'] = "true";
- $voipfields[] = $field;
+ $voipfields[] = $field;
$field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "conn{$i}uploadspeed";
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "conn{$i}uploadspeed";
$enablefields[] = "conn{$i}uploadspeed";
- $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
- $voipfields[] = $field;
+ $field['typehint'] = "Upload bandwidth guarantee for VOIP phone(s) on connection {$i}.";
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->conn{$i}uploadspeed";
+ $voipfields[] = $field;
$field = array();
$field['displayname'] = "Download";
@@ -415,34 +415,34 @@ function step3_stepbeforeformdisplay() {
$voipfields[] = $field;
$field = array();
- $field['combinefieldsend'] = "true";
- $field['dontdisplayname'] = "true";
- $field['dontcombinecells'] = "true";
- $field['name'] = "local{$i}downloadspeed";
+ $field['combinefieldsend'] = "true";
+ $field['dontdisplayname'] = "true";
+ $field['dontcombinecells'] = "true";
+ $field['name'] = "local{$i}downloadspeed";
$enablefields[] = "local{$i}downloadspeed";
$field['typehint'] = "Download bandwidth guarantee for VOIP phone(s) on connections.";
- $field['type'] = "select";
- $field['options']['option'] = array();
- $opts = array();
- $opts['value'] = "Kb";
- $opts['name'] = "Kbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Mb";
- $opts['name'] = "Mbit/s";
- $field['options']['option'][] = $opts;
- $opts = array();
- $opts['value'] = "Gb";
- $opts['name'] = "Gbit/s";
- $field['options']['option'][] = $opts;
- $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed";
- $voipfields[] = $field;
+ $field['type'] = "select";
+ $field['options']['option'] = array();
+ $opts = array();
+ $opts['value'] = "Kb";
+ $opts['name'] = "Kbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Mb";
+ $opts['name'] = "Mbit/s";
+ $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['value'] = "Gb";
+ $opts['name'] = "Gbit/s";
+ $field['options']['option'][] = $opts;
+ $field['bindstofield'] = "ezshaper->step3->local{$i}downloadspeed";
+ $voipfields[] = $field;
}
$field = array();
- $field['name'] = "Next";
- $field['type'] = "submit";
- $voipfields[] = $field;
+ $field['name'] = "Next";
+ $field['type'] = "submit";
+ $voipfields[] = $field;
$voipfields[0]['enablefields'] = implode(",", $enablefields);
}
@@ -450,8 +450,8 @@ function step3_stepsubmitphpaction() {
global $config;
global $stepid, $savemsg;
- if (!$_POST['enable'])
- return;
+ if (!$_POST['enable'])
+ return;
if($_POST['address']) {
if(!is_ipaddroralias($_POST['address'])) {
@@ -477,7 +477,7 @@ function step3_stepsubmitphpaction() {
}
} else {
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}upload"]);
$factor = wizard_get_bandwidthtype_scale($_POST["conn{$i}uploadspeed"]);
$input_bw = $factor * floatval($_POST["conn{$i}upload"]);
if ((0.8 * $ifbw) < $input_bw) {
@@ -485,7 +485,7 @@ function step3_stepsubmitphpaction() {
$stepid--;
return;
}
- }
+ }
if (!is_numeric($_POST["local{$i}download"])) {
$savemsg = gettext("Download bandwidth of connection {$i} is not valid.");
@@ -500,7 +500,7 @@ function step3_stepsubmitphpaction() {
}
} else {
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conn{$i}download"]);
$factor = wizard_get_bandwidthtype_scale($_POST["local{$i}downloadspeed"]);
$input_bw = $factor * floatval($_POST["local{$i}download"]);
if ((0.8 * $ifbw) < $input_bw) {
@@ -508,7 +508,7 @@ function step3_stepsubmitphpaction() {
$stepid--;
return;
}
- }
+ }
}
for ($i = 0; $i < $steps; $i++) {
@@ -606,9 +606,9 @@ function apply_all_choosen_items() {
require_once("wizardapp.inc");
- /*
+ /*
* Wipe previous config.
- * Doing it here makes sense since we can wipe the previous config only after
+ * Doing it here makes sense since we can wipe the previous config only after
* the user decides to do so, finishing the wizard.
*/
if(isset($config['shaper']['queue']))
@@ -630,7 +630,7 @@ function apply_all_choosen_items() {
for ($i = 0; $i < $steps; $i++) {
- $tmppath = array();
+ $tmppath = array();
$altq =& new altq_root_queue();
$altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]);
@@ -660,13 +660,13 @@ function apply_all_choosen_items() {
$remainbw = 0;
$factor = 0;
$upfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}uploadspeed"]);
- $upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor;
+ $upbw = floatval($config['ezshaper']['step2']["conn{$i}upload"]) * $upfactor;
- if ($config['ezshaper']['step3']['enable']) {
+ if ($config['ezshaper']['step3']['enable']) {
$voip = true;
$voipbw = $config['ezshaper']['step3']["conn{$i}upload"];
$voipbwunit = $config['ezshaper']['step3']["conn{$i}uploadspeed"];
- if ($voipbwunit == "%")
+ if ($voipbwunit == "%")
$factor = $upbw/100;
else
$factor = wizard_get_bandwidthtype_scale($voipbwunit);
@@ -710,12 +710,12 @@ function apply_all_choosen_items() {
} else {
$games = false;
}
-
+
if ($config['ezshaper']['step7']['enable']) {
$otherpriority = true;
} else {
$otherpriority = false;
- }
+ }
$remainbw = round($remainbw / $upbw * 100, 2);
if (intval($remainbw) > 0 && intval($remainbw) > 30) {
@@ -723,47 +723,47 @@ function apply_all_choosen_items() {
header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$savemsg}");
exit;
} else {
- $remainbw = 100 - $remainbw;
+ $remainbw = 100 - $remainbw;
}
- if ($sched != "PRIQ") {
- if ($sched == "CBQ")
- $q =& new cbq_queue();
- else if ($sched == "HFSC")
- $q =& new hfsc_queue();
- $tmpcf = array();
- $tmpcf['name'] = "qInternet";
- //$tmpcf['priority'] = 6;
- $tmpcf['ecn'] = "on";
- $tmpcf['enabled'] = "on";
- If ($sched == "CBQ") {
- $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]);
- $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
- }
- else if ($sched == "HFSC") {
- $tmpcf['upperlimit'] = "on";
- $tmpcf['upperlimit3'] =
- floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
- $tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
- $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]);
- $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
- }
- array_push($tmppath, "qInternet");
- $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
- //array_pop($tmppath);
- //echo "qInternet <br />";
- //var_dump($input_errors);
- $qtmp->wconfig();
- $altq =& $qtmp;
+ if ($sched != "PRIQ") {
+ if ($sched == "CBQ")
+ $q =& new cbq_queue();
+ else if ($sched == "HFSC")
+ $q =& new hfsc_queue();
+ $tmpcf = array();
+ $tmpcf['name'] = "qInternet";
+ //$tmpcf['priority'] = 6;
+ $tmpcf['ecn'] = "on";
+ $tmpcf['enabled'] = "on";
+ If ($sched == "CBQ") {
+ $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]);
+ $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
+ }
+ else if ($sched == "HFSC") {
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] =
+ floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]) . $config['ezshaper']['step2']["conn{$i}uploadspeed"];
+ $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}upload"]);
+ $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}uploadspeed"];
+ }
+ array_push($tmppath, "qInternet");
+ $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
+ //array_pop($tmppath);
+ //echo "qInternet <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ $altq =& $qtmp;
}
if ($sched == "PRIQ")
$q =& new priq_queue();
else if ($sched == "CBQ")
- $q =& new cbq_queue();
+ $q =& new cbq_queue();
else if ($sched == "HFSC")
- $q =& new hfsc_queue();
+ $q =& new hfsc_queue();
$tmpcf = array();
$tmpcf['name'] = "qACK";
$tmpcf['priority'] = 6;
@@ -773,12 +773,12 @@ function apply_all_choosen_items() {
$tmpcf['borrow'] = "on";
$tmpcf['bandwidth'] = $remainbw * 0.2;
$tmpcf['bandwidthtype'] = "%";
- }
+ }
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
$tmpcf['linkshare'] = "on";
- $tmpcf['bandwidth'] = $lkbw;
+ $tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
}
array_push($tmppath, "qACK");
@@ -842,10 +842,10 @@ function apply_all_choosen_items() {
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['bandwidth'] = $p2pcatchbw;
- $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
}
- $tmpcf['default'] = "on";
-
+ $tmpcf['default'] = "on";
+
} else {
if ($sched == "CBQ") {
$tmpcf['borrow'] = "on";
@@ -854,10 +854,10 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = "{$tmpbw}%";
- $tmpcf['upperlimit'] = "on";
- $tmpcf['upperlimit3'] = "{$tmpbw}%";
- $tmpcf['bandwidth'] = $tmpbw;
+ $tmpcf['linkshare3'] = "{$tmpbw}%";
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] = "{$tmpbw}%";
+ $tmpcf['bandwidth'] = $tmpbw;
$tmpcf['bandwidthtype'] = "%";
}
}
@@ -868,7 +868,7 @@ function apply_all_choosen_items() {
//var_dump($input_errors);
$qtmp->wconfig();
}
-
+
if ($voip) {
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -908,7 +908,7 @@ function apply_all_choosen_items() {
//var_dump($input_errors);
$qtmp->wconfig();
}
-
+
if ($games) {
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -926,9 +926,9 @@ function apply_all_choosen_items() {
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['bandwidthtype'] = "%";
} else if ($sched == "HFSC") {
- $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
+ $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = "{$gamesbw}%";
+ $tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
}
@@ -939,7 +939,7 @@ function apply_all_choosen_items() {
//var_dump($input_errors);
$qtmp->wconfig();
}
-
+
if ($otherpriority) {
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -969,7 +969,7 @@ function apply_all_choosen_items() {
//echo "qHigh <br />";
//var_dump($input_errors);
$qtmp->wconfig();
-
+
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -1000,7 +1000,7 @@ function apply_all_choosen_items() {
$lsbw = $remainbw * 0.05;
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
- $tmpcf['bandwidthtype'] = "%";
+ $tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
}
@@ -1013,45 +1013,45 @@ function apply_all_choosen_items() {
}
array_pop($tmppath);
- $downfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
- $downbw = floatval($config['ezshaper']['step2']["conn{$i}download"]) * $downfactor;
+ $downfactor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
+ $downbw = floatval($config['ezshaper']['step2']["conn{$i}download"]) * $downfactor;
- $tmppath = array();
- $altq =& new altq_root_queue();
+ $tmppath = array();
+ $altq =& new altq_root_queue();
- $altq->SetInterface($config['ezshaper']['step2']["local{$i}interface"]);
- $altq->SetScheduler($config['ezshaper']['step2']["local{$i}downloadscheduler"]);
- //$altq->SetBandwidth($config['ezshaper']['step2']["conn{$i}download"]);
- //$altq->SetBwscale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
- $altq->SetEnabled("on");
- $altq_list_queues[$altq->GetQname()] =& $altq;
- array_push($tmppath, $config['ezshaper']['step2']["local{$i}interface"]);
- $altq->SetLink($tmppath);
- //var_dump($input_errors);
- $altq->wconfig();
+ $altq->SetInterface($config['ezshaper']['step2']["local{$i}interface"]);
+ $altq->SetScheduler($config['ezshaper']['step2']["local{$i}downloadscheduler"]);
+ //$altq->SetBandwidth($config['ezshaper']['step2']["conn{$i}download"]);
+ //$altq->SetBwscale($config['ezshaper']['step2']["conn{$i}downloadspeed"]);
+ $altq->SetEnabled("on");
+ $altq_list_queues[$altq->GetQname()] =& $altq;
+ array_push($tmppath, $config['ezshaper']['step2']["local{$i}interface"]);
+ $altq->SetLink($tmppath);
+ //var_dump($input_errors);
+ $altq->wconfig();
- $sched = $config['ezshaper']['step2']["local{$i}downloadscheduler"];
- $voipbw =0;
- $voipbwunit = "%";
- $voip = false;
- $penalty = false;
- $penaltybw = 0;
- $penaltybwunit = "%";
- $p2p = false;
- $p2pcatchall = false;
- $p2pcatchbw = 0;
- $games = false;
- $otherpriority = false;
- $remainbw = 0;
+ $sched = $config['ezshaper']['step2']["local{$i}downloadscheduler"];
+ $voipbw =0;
+ $voipbwunit = "%";
+ $voip = false;
+ $penalty = false;
+ $penaltybw = 0;
+ $penaltybwunit = "%";
+ $p2p = false;
+ $p2pcatchall = false;
+ $p2pcatchbw = 0;
+ $games = false;
+ $otherpriority = false;
+ $remainbw = 0;
- if ($config['ezshaper']['step3']['enable']) {
- $voip = true;
- $voipbw = $config['ezshaper']['step3']["local{$i}download"];
- $voipbwunit = $config['ezshaper']['step3']["local{$i}downloadspeed"];
- if ($sched != HFSC) {
- if ($penaltybwunit == "%")
- $factor = $downbw/100;
- else
+ if ($config['ezshaper']['step3']['enable']) {
+ $voip = true;
+ $voipbw = $config['ezshaper']['step3']["local{$i}download"];
+ $voipbwunit = $config['ezshaper']['step3']["local{$i}downloadspeed"];
+ if ($sched != HFSC) {
+ if ($penaltybwunit == "%")
+ $factor = $downbw/100;
+ else
$factor = wizard_get_bandwidthtype_scale($voipbwunit);
$remainbw += floatval($voipbw) * $factor;
} else
@@ -1100,7 +1100,7 @@ function apply_all_choosen_items() {
$otherpriority = true;
} else {
$otherpriority = false;
- }
+ }
$remainbw = round($remainbw / $downbw * 100, 2);
if (intval($remainbw) > 0 && intval($remainbw) > 40) {
$savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
@@ -1140,41 +1140,41 @@ function apply_all_choosen_items() {
$qtmp->wconfig();
}
- if ($sched != "PRIQ") {
- if ($sched == "CBQ")
- $q =& new cbq_queue();
- else if ($sched == "HFSC")
- $q =& new hfsc_queue();
- $tmpcf = array();
- $tmpcf['name'] = "qInternet";
- //$tmpcf['priority'] = 6;
- $tmpcf['ecn'] = "on";
- $tmpcf['enabled'] = "on";
- If ($sched == "CBQ") {
- $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}download"]);
- $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"];
- }
- else if ($sched == "HFSC") {
+ if ($sched != "PRIQ") {
+ if ($sched == "CBQ")
+ $q =& new cbq_queue();
+ else if ($sched == "HFSC")
+ $q =& new hfsc_queue();
+ $tmpcf = array();
+ $tmpcf['name'] = "qInternet";
+ //$tmpcf['priority'] = 6;
+ $tmpcf['ecn'] = "on";
+ $tmpcf['enabled'] = "on";
+ If ($sched == "CBQ") {
+ $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}download"]);
+ $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"];
+ }
+ else if ($sched == "HFSC") {
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"];
- $tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"];
- $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}download"]);
- $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"];
- }
- array_push($tmppath, "qInternet");
- $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
- //array_pop($tmppath);
- //echo "qInternet <br />";
- //var_dump($input_errors);
- $qtmp->wconfig();
- $altq =& $qtmp;
+ $tmpcf['linkshare'] = "on";
+ $tmpcf['linkshare3'] = floatval($config['ezshaper']['step2']["conn{$i}download"]) . $config['ezshaper']['step2']["conn{$i}downloadspeed"];
+ $tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conn{$i}download"]);
+ $tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conn{$i}downloadspeed"];
+ }
+ array_push($tmppath, "qInternet");
+ $qtmp =& $altq->add_queue($q, $tmpcf, $tmppath, $input_errors);
+ //array_pop($tmppath);
+ //echo "qInternet <br />";
+ //var_dump($input_errors);
+ $qtmp->wconfig();
+ $altq =& $qtmp;
}
if ($sched == "PRIQ")
$q =& new priq_queue();
else if ($sched == "CBQ")
- $q =& new cbq_queue();
+ $q =& new cbq_queue();
else if ($sched == "HFSC")
$q =& new hfsc_queue();
$tmpcf = array();
@@ -1190,7 +1190,7 @@ function apply_all_choosen_items() {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
$tmpcf['linkshare'] = "on";
- $tmpcf['bandwidth'] = $lkbw;
+ $tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
}
array_push($tmppath, "qACK");
@@ -1223,9 +1223,9 @@ function apply_all_choosen_items() {
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['bandwidth'] = $p2pcatchbw;
- $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
}
- $tmpcf['default'] = "on";
+ $tmpcf['default'] = "on";
$tmpcf['qlimit'] = 500;
} else {
if ($sched == "CBQ") {
@@ -1235,10 +1235,10 @@ function apply_all_choosen_items() {
} else if ($sched == "HFSC") {
$tmpbw = $remainbw * 0.05; /* 5% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = "{$tmpbw}%";
- $tmpcf['upperlimit'] = "on";
- $tmpcf['upperlimit3'] = "{$tmpbw}%";
- $tmpcf['bandwidth'] = $tmpbw;
+ $tmpcf['linkshare3'] = "{$tmpbw}%";
+ $tmpcf['upperlimit'] = "on";
+ $tmpcf['upperlimit3'] = "{$tmpbw}%";
+ $tmpcf['bandwidth'] = $tmpbw;
$tmpcf['bandwidthtype'] = "%";
}
}
@@ -1307,9 +1307,9 @@ function apply_all_choosen_items() {
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['bandwidthtype'] = "%";
} else if ($sched == "HFSC") {
- $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
+ $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = "{$gamesbw}%";
+ $tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
}
@@ -1380,7 +1380,7 @@ function apply_all_choosen_items() {
$lsbw = $remainbw * 0.05;
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
- $tmpcf['bandwidthtype'] = "%";
+ $tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
}
@@ -1395,25 +1395,25 @@ function apply_all_choosen_items() {
}
if (!is_array($config['filter']['rule']))
- $config['filter']['rule'] = array();
+ $config['filter']['rule'] = array();
$interfacelist = implode(",", $interfacelist);
/* Rules */
if ($penalty) {
if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
- $rule = array();
- $rule['type'] = "match";
- $rule['interface'] = $interfacelist;
- $rule['descr'] = gettext("Penalty Box");
- $rule['defaultqueue'] = "qOthersLow";
- $rule['source']['address'] = $config['ezshaper']['step4']['address'];
- $rule['destination']['any'] = TRUE;
- $rule['floating'] = "yes";
- $rule['wizard'] = "yes";
- $rule['enabled'] = "on";
- $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
- $config['filter']['rule'][] = $rule;
+ $rule = array();
+ $rule['type'] = "match";
+ $rule['interface'] = $interfacelist;
+ $rule['descr'] = gettext("Penalty Box");
+ $rule['defaultqueue'] = "qOthersLow";
+ $rule['source']['address'] = $config['ezshaper']['step4']['address'];
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
+ $config['filter']['rule'][] = $rule;
}
}
@@ -1453,7 +1453,7 @@ function apply_all_choosen_items() {
/* create VOIP rules */
$rule = array();
$rule['type'] = "match";
- $rule['interface'] = $interfacelist;
+ $rule['interface'] = $interfacelist;
$rule['descr'] = "DiffServ/Lowdelay/Upload";
$rule['protocol'] = "udp";
$rule['source']['any'] = TRUE;
@@ -1486,7 +1486,7 @@ function apply_all_choosen_items() {
$config['filter']['rule'][] = $rule;
}
}
- }
+ }
/* loop through p2plist[] */
if ($p2p) {
@@ -1498,7 +1498,7 @@ function apply_all_choosen_items() {
$rule['type'] = "match";
$rule['interface'] = $interfacelist;
$rule['defaultqueue'] = 'qP2P';
- $rule['source']['any'] = TRUE;
+ $rule['source']['any'] = TRUE;
$rule['destination']['any'] = TRUE;
$rule['descr'] = "m_P2P {$p2pclient[0]} outbound";
$rule['floating'] = "yes";
@@ -1537,7 +1537,7 @@ function apply_all_choosen_items() {
}
}
}
-
+
/* loop through othersplist[] */
if ($otherpriority) {
foreach($config['ezshaper']['step7'] as $key => $val) {
@@ -1595,22 +1595,22 @@ function apply_all_choosen_items() {
}
function wizard_get_bandwidthtype_scale($type = "b") {
- switch ($type) {
- case "Gb":
- $factor = 1024 * 1024 * 1024;
- break;
- case "Mb":
- $factor = 1024 * 1024;
- break;
- case "Kb":
- $factor = 1024;
- break;
- case "b":
- default:
- $factor = 1;
- break;
- }
- return intval($factor);
+ switch ($type) {
+ case "Gb":
+ $factor = 1024 * 1024 * 1024;
+ break;
+ case "Mb":
+ $factor = 1024 * 1024;
+ break;
+ case "Kb":
+ $factor = 1024;
+ break;
+ case "b":
+ default:
+ $factor = 1;
+ break;
+ }
+ return intval($factor);
}
?>
diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
index 11909bd..80403ef 100644
--- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
+++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc
@@ -1,33 +1,33 @@
<?php
/*
- traffic_shaper_wizard_multi_lan.inc
- part of pfSense (https://www.pfsense.org/)
-
- Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
- Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
- Copyright (C) 2008-2010 Ermal Luçi
- All rights reserved.
-
- Redistribution and use in source and binary forms, with or without
- modification, are permitted provided that the following conditions are met:
-
- 1. Redistributions of source code must retain the above copyright notice,
- this list of conditions and the following disclaimer.
-
- 2. Redistributions in binary form must reproduce the above copyright
- notice, this list of conditions and the following disclaimer in the
- documentation and/or other materials provided with the distribution.
-
- THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
- INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
- AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
- AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
- OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
- POSSIBILITY OF SUCH DAMAGE.
+ traffic_shaper_wizard_multi_lan.inc
+ part of pfSense (https://www.pfsense.org/)
+
+ Copyright (C) 2006 Bill Marquette - bill.marquette@gmail.com.
+ Copyright (C) 2006 Scott Ullrich - sullrich@pfsense.com.
+ Copyright (C) 2008-2010 Ermal Luçi
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+ 1. Redistributions of source code must retain the above copyright notice,
+ this list of conditions and the following disclaimer.
+
+ 2. Redistributions in binary form must reproduce the above copyright
+ notice, this list of conditions and the following disclaimer in the
+ documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+ INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+ AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
+ AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+ OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+ POSSIBILITY OF SUCH DAMAGE.
*/
function step1_submitphpaction() {
@@ -36,11 +36,11 @@ function step1_submitphpaction() {
if (!isset($_POST['numberofconnections'])) {
$savemsg=gettext("You need to specify the number of local interfaces connected.");
$stepid--;
- }
+ }
if (intval($_POST['numberofconnections']) < 1) {
$savemsg=gettext("The number of local connection needs to be greater than 1.");
$stepid--;
- }
+ }
}
function step2_stepbeforeformdisplay() {
@@ -50,13 +50,13 @@ function step2_stepbeforeformdisplay() {
$numberofinterfaces = 0;
$iflist = array();
$iflisttmp = get_configured_interface_with_descr();
- foreach ($iflisttmp as $if => $ifdesc) {
- if (!is_altq_capable(get_real_interface($if)))
- continue;
+ foreach ($iflisttmp as $if => $ifdesc) {
+ if (!is_altq_capable(get_real_interface($if)))
+ continue;
if ($if == "wan")
continue;
- $numberofinterfaces++;
- $iflist[$if] = $ifdesc;
+ $numberofinterfaces++;
+ $iflist[$if] = $ifdesc;
}
$numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']);
if ($numberofconnections > $numberofinterfaces) {
@@ -66,7 +66,7 @@ function step2_stepbeforeformdisplay() {
}
$fields =& $pkg['step'][1]['fields']['field'];
-
+
/*
unset($config['ezshaper']['step2']);
$config['ezshaper']['step2'] = array();
@@ -111,7 +111,7 @@ function step2_stepbeforeformdisplay() {
$fields[] = $field;
$field = array();
- $field['combinefieldsend'] = "true";
+ $field['combinefieldsend'] = "true";
$field['dontdisplayname'] = "true";
$field['dontcombinecells'] = "true";
$field['name'] = "connuploadspeed";
@@ -182,11 +182,11 @@ function step2_stepbeforeformdisplay() {
foreach ($iflist as $ifname => $ifdescr) {
if ($ifselect > 0 && $ifselect == ($i + 1))
$field['value'] = $ifname;
- $opts = array();
- $opts['displayname'] = $ifdescr;
- $opts['name'] = $ifname;
- $opts['value'] = $ifname;
- $field['options']['option'][] = $opts;
+ $opts = array();
+ $opts['displayname'] = $ifdescr;
+ $opts['name'] = $ifname;
+ $opts['value'] = $ifname;
+ $field['options']['option'][] = $opts;
$ifselect++;
}
$field['bindstofield'] = "ezshaper->step2->conn{$i}interface";
@@ -224,7 +224,7 @@ function step2_stepsubmitphpaction() {
global $config;
global $stepid, $savemsg;
$sumdownloads = 0;
-
+
/* Input Validation */
$steps = intval($config['ezshaper']['step1']['numberofconnections']);
for ($i = 0; $i < $steps; $i++) {
@@ -277,7 +277,7 @@ function step2_stepsubmitphpaction() {
for ($i = 0; $i < $steps; $i++) {
$config['ezshaper']['step2']["conn{$i}downloadscheduler"] = $_POST["conn{$i}downloadscheduler"];
$config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"];
- }
+ }
}
function step3_stepsubmitphpaction() {
@@ -285,7 +285,7 @@ function step3_stepsubmitphpaction() {
global $stepid, $savemsg;
if (!$_POST['enable'])
- return;
+ return;
if($_POST['address']) {
if(!is_ipaddroralias($_POST['address'])) {
@@ -310,7 +310,7 @@ function step3_stepsubmitphpaction() {
}
} else {
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["connuploadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["connupload"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["connupload"]);
$factor = wizard_get_bandwidthtype_scale($_POST["connuploadspeed"]);
$input_bw = $factor * floatval($_POST["connupload"]);
if ((0.8 * $ifbw) < $input_bw) {
@@ -318,7 +318,7 @@ function step3_stepsubmitphpaction() {
$stepid--;
return;
}
- }
+ }
if ($_POST["conndownloadspeed"] == "%") {
if (intval($_POST['conndownload']) > 80) {
$savemsg=gettext("You cannot set the VoIP download bandwidth on connection higher than 80% of the connection.");
@@ -327,7 +327,7 @@ function step3_stepsubmitphpaction() {
}
} else {
$factor = wizard_get_bandwidthtype_scale($config['ezshaper']['step2']["conndownloadspeed"]);
- $ifbw = $factor * floatval($config['ezshaper']['step2']["conndownload"]);
+ $ifbw = $factor * floatval($config['ezshaper']['step2']["conndownload"]);
$factor = wizard_get_bandwidthtype_scale($_POST["conndownloadspeed"]);
$input_bw = $factor * floatval($_POST["conndownload"]);
if ((0.8 * $ifbw) < $input_bw) {
@@ -372,7 +372,7 @@ function step4_stepsubmitphpaction() {
$savemsg=gettext("Address must be a valid IP address or Firewall Alias. Please correct this value to continue.");
$stepid--;
return;
- }
+ }
}
}
}
@@ -430,9 +430,9 @@ function apply_all_choosen_items() {
require_once("wizardapp.inc");
- /*
+ /*
* Wipe previous config.
- * Doing it here makes sense since we can wipe the previous config only after
+ * Doing it here makes sense since we can wipe the previous config only after
* the user decides to do so, finishing the wizard.
*/
if (isset($config['shaper']['queue']))
@@ -452,7 +452,7 @@ function apply_all_choosen_items() {
for ($i = 0; $i < $steps; $i++) {
- $tmppath = array();
+ $tmppath = array();
$altq =& new altq_root_queue();
$altq->SetInterface($config['ezshaper']['step2']["conn{$i}interface"]);
@@ -486,7 +486,7 @@ function apply_all_choosen_items() {
$voip = true;
$voipbw = $config['ezshaper']['step3']["conndownload"];
$voipbwunit = $config['ezshaper']['step3']["conndownloadspeed"];
- if ($voipbwunit == "%")
+ if ($voipbwunit == "%")
$factor = $upbw/100;
else
$factor = wizard_get_bandwidthtype_scale($voipbwunit);
@@ -530,12 +530,12 @@ function apply_all_choosen_items() {
} else {
$games = false;
}
-
+
if ($config['ezshaper']['step7']['enable']) {
$otherpriority = true;
} else {
$otherpriority = false;
- }
+ }
$remainbw = round($remainbw / $upbw * 100, 2);
if ($remainbw > 0 && $remainbw > 30) {
@@ -590,10 +590,10 @@ function apply_all_choosen_items() {
$tmpcf['bandwidth'] = floatval($config['ezshaper']['step2']["conndownload"]);
$tmpcf['bandwidthtype'] = $config['ezshaper']['step2']["conndownloadspeed"];
} else if ($sched == "HFSC") {
- $tmpcf['linkshare3'] =
+ $tmpcf['linkshare3'] =
floatval($config['ezshaper']['step2']["conndownload"]) . $config['ezshaper']['step2']["conndownloadspeed"];
$tmpcf['upperlimit'] = "on";
- $tmpcf['upperlimit3'] =
+ $tmpcf['upperlimit3'] =
floatval($config['ezshaper']['step2']["conndownload"]) . $config['ezshaper']['step2']["conndownloadspeed"];
$tmpcf['linkshare'] = "on";
@@ -612,7 +612,7 @@ function apply_all_choosen_items() {
if ($sched == "PRIQ")
$q =& new priq_queue();
else if ($sched == "CBQ")
- $q =& new cbq_queue();
+ $q =& new cbq_queue();
else if ($sched == "HFSC")
$q =& new hfsc_queue();
@@ -625,12 +625,12 @@ function apply_all_choosen_items() {
$tmpcf['borrow'] = "on";
$tmpcf['bandwidth'] = $remainbw * 0.2;
$tmpcf['bandwidthtype'] = "%";
- }
+ }
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
$tmpcf['linkshare'] = "on";
- $tmpcf['bandwidth'] = $lkbw;
+ $tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
}
array_push($tmppath, "qACK");
@@ -663,9 +663,9 @@ function apply_all_choosen_items() {
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['bandwidth'] = $p2pcatchbw;
- $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
}
- $tmpcf['default'] = "on";
+ $tmpcf['default'] = "on";
$tmpcf['qlimit'] = 500;
} else {
if ($sched == "CBQ") {
@@ -747,9 +747,9 @@ function apply_all_choosen_items() {
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['bandwidthtype'] = "%";
} else if ($sched == "HFSC") {
- $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
+ $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = "{$gamesbw}%";
+ $tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
}
@@ -790,7 +790,7 @@ function apply_all_choosen_items() {
//echo "qHigh <br />";
//var_dump($input_errors);
$qtmp->wconfig();
-
+
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -819,7 +819,7 @@ function apply_all_choosen_items() {
$lsbw = $remainbw * 0.05;
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
- $tmpcf['bandwidthtype'] = "%";
+ $tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
}
@@ -870,7 +870,7 @@ function apply_all_choosen_items() {
$voipbw = $config['ezshaper']['step3']["connupload"];
$voipbwunit = $config['ezshaper']['step3']["connuploadspeed"];
if ($sched != "HFSC") {
- if ($voipbwunit == "%")
+ if ($voipbwunit == "%")
$factor = $lanbw/100;
else
$factor = wizard_get_bandwidthtype_scale($voipbwunit);
@@ -878,7 +878,7 @@ function apply_all_choosen_items() {
} else
$remainbw += 32000; /* 32Kbit/s forHFSC linksharing */
}
-
+
if ($config['ezshaper']['step4']['enable']) {
$penalty = true;
$penaltybw = $config['ezshaper']['step4']['bandwidth'];
@@ -919,12 +919,12 @@ function apply_all_choosen_items() {
} else {
$games = false;
}
-
+
if ($config['ezshaper']['step7']['enable']) {
$otherpriority = true;
} else {
$otherpriority = false;
- }
+ }
$remainbw = round($remainbw / $lanbw * 100, 2);
if ($remainbw > 0 && $remainbw > 30) {
$savemsg=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue.");
@@ -938,9 +938,9 @@ function apply_all_choosen_items() {
if ($sched == "PRIQ")
$q =& new priq_queue();
else if ($sched == "CBQ")
- $q =& new cbq_queue();
+ $q =& new cbq_queue();
else if ($sched == "HFSC")
- $q =& new hfsc_queue();
+ $q =& new hfsc_queue();
$tmpcf = array();
$tmpcf['name'] = "qACK";
$tmpcf['priority'] = 6;
@@ -950,12 +950,12 @@ function apply_all_choosen_items() {
$tmpcf['borrow'] = "on";
$tmpcf['bandwidth'] = $remainbw * 0.2;
$tmpcf['bandwidthtype'] = "%";
- }
+ }
else if ($sched == "HFSC") {
$lkbw = 0.20 * $remainbw;
$tmpcf['linkshare3'] = "{$lkbw}%";
$tmpcf['linkshare'] = "on";
- $tmpcf['bandwidth'] = $lkbw;
+ $tmpcf['bandwidth'] = $lkbw;
$tmpcf['bandwidthtype'] = "%";
}
array_push($tmppath, "qACK");
@@ -1020,10 +1020,10 @@ function apply_all_choosen_items() {
$tmpcf['upperlimit'] = "on";
$tmpcf['upperlimit3'] = "{$p2pcatchbw}{$p2pcatchbwunit}";
$tmpcf['bandwidth'] = $p2pcatchbw;
- $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
+ $tmpcf['bandwidthtype'] = $p2pcatchbwunit;
}
- $tmpcf['default'] = "on";
-
+ $tmpcf['default'] = "on";
+
} else {
if ($sched == "CBQ") {
$tmpcf['borrow'] = "on";
@@ -1046,7 +1046,7 @@ function apply_all_choosen_items() {
//var_dump($input_errors);
$qtmp->wconfig();
}
-
+
if ($voip) {
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -1086,7 +1086,7 @@ function apply_all_choosen_items() {
//var_dump($input_errors);
$qtmp->wconfig();
}
-
+
if ($games) {
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -1104,9 +1104,9 @@ function apply_all_choosen_items() {
$tmpcf['bandwidth'] = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['bandwidthtype'] = "%";
} else if ($sched == "HFSC") {
- $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
+ $gamesbw = $remainbw * 0.2; /* 20% bandwidth */
$tmpcf['linkshare'] = "on";
- $tmpcf['linkshare3'] = "{$gamesbw}%";
+ $tmpcf['linkshare3'] = "{$gamesbw}%";
$tmpcf['bandwidth'] = "{$gamesbw}";
$tmpcf['bandwidthtype'] = "%";
}
@@ -1117,7 +1117,7 @@ function apply_all_choosen_items() {
//var_dump($input_errors);
$qtmp->wconfig();
}
-
+
if ($otherpriority) {
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -1147,7 +1147,7 @@ function apply_all_choosen_items() {
//echo "qHigh <br />";
//var_dump($input_errors);
$qtmp->wconfig();
-
+
if ($sched == "PRIQ")
$q =& new priq_queue();
@@ -1176,7 +1176,7 @@ function apply_all_choosen_items() {
$lsbw = $remainbw * 0.05;
$tmpcf['linkshare3'] = "{$lsbw}%"; /* 5% bandwidth */
$tmpcf['bandwidth'] = $lsbw;
- $tmpcf['bandwidthtype'] = "%";
+ $tmpcf['bandwidthtype'] = "%";
}
$tmpcf['linkshare'] = "on";
}
@@ -1194,23 +1194,23 @@ function apply_all_choosen_items() {
if (!is_array($config['filter']['rule']))
- $config['filter']['rule'] = array();
+ $config['filter']['rule'] = array();
/* Rules */
if ($penalty) {
if( is_ipaddr($config['ezshaper']['step4']['address']) || is_alias($config['ezshaper']['step4']['address'])) {
- $rule = array();
- $rule['type'] = "match";
- $rule['interface'] = "wan";
- $rule['descr'] = gettext("Penalty Box");
- $rule['defaultqueue'] = "qOthersLow";
- $rule['source']['address'] = $config['ezshaper']['step4']['address'];
- $rule['destination']['any'] = TRUE;
- $rule['floating'] = "yes";
- $rule['wizard'] = "yes";
- $rule['enabled'] = "on";
- $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
- $config['filter']['rule'][] = $rule;
+ $rule = array();
+ $rule['type'] = "match";
+ $rule['interface'] = "wan";
+ $rule['descr'] = gettext("Penalty Box");
+ $rule['defaultqueue'] = "qOthersLow";
+ $rule['source']['address'] = $config['ezshaper']['step4']['address'];
+ $rule['destination']['any'] = TRUE;
+ $rule['floating'] = "yes";
+ $rule['wizard'] = "yes";
+ $rule['enabled'] = "on";
+ $rule['created'] = make_config_revision_entry(null, gettext("Traffic Shaper Wizard"));
+ $config['filter']['rule'][] = $rule;
}
}
@@ -1251,7 +1251,7 @@ function apply_all_choosen_items() {
/* create VOIP rules */
$rule = array();
$rule['type'] = "match";
- $rule['interface'] = "wan";
+ $rule['interface'] = "wan";
$rule['descr'] = "DiffServ/Lowdelay/Upload";
$rule['protocol'] = "udp";
$rule['source']['any'] = TRUE;
@@ -1284,7 +1284,7 @@ function apply_all_choosen_items() {
$config['filter']['rule'][] = $rule;
}
}
- }
+ }
/* loop through p2plist[] */
if ($p2p) {
@@ -1296,7 +1296,7 @@ function apply_all_choosen_items() {
$rule['type'] = "match";
$rule['interface'] = "wan";
$rule['defaultqueue'] = 'qP2P';
- $rule['source']['any'] = TRUE;
+ $rule['source']['any'] = TRUE;
$rule['destination']['any'] = TRUE;
$rule['descr'] = "m_P2P {$p2pclient[0]} outbound";
$rule['floating'] = "yes";
@@ -1309,7 +1309,7 @@ function apply_all_choosen_items() {
}
}
}
-
+
/* loop through gamesplist[] */
if ($games) {
foreach($config['ezshaper']['step6'] as $key => $val) {
@@ -1336,7 +1336,7 @@ function apply_all_choosen_items() {
}
}
}
-
+
/* loop through othersplist[] */
if ($otherpriority) {
foreach($config['ezshaper']['step7'] as $key => $val) {
@@ -1356,7 +1356,7 @@ function apply_all_choosen_items() {
case "L":
$rule['defaultqueue'] = 'qOthersLow'; /* posted value H or L */
if ($otherclient[1] == "tcp")
- $rule['ackqueue'] = 'qACK';
+ $rule['ackqueue'] = 'qACK';
$loop = 0;
break;
case "D":
@@ -1378,7 +1378,7 @@ function apply_all_choosen_items() {
$rule['wizard'] = "yes";
$rule['enabled'] = "on";
$rule['descr'] = "m_Other {$otherclient[0]} outbound";
-
+
if($otherclient[2] or $otherclient[3]) {
$rule['destination']['port'] = $otherclient[2]."-".$otherclient[3];
}
@@ -1390,24 +1390,24 @@ function apply_all_choosen_items() {
}
}
}
-
+
write_config();
}
function wizard_get_bandwidthtype_scale($type = "b") {
switch ($type) {
case "Gb":
- $factor = 1024 * 1024 * 1024;
+ $factor = 1024 * 1024 * 1024;
break;
case "Mb":
- $factor = 1024 * 1024;
+ $factor = 1024 * 1024;
break;
case "Kb":
- $factor = 1024;
+ $factor = 1024;
break;
case "b":
default:
- $factor = 1;
+ $factor = 1;
break;
}
return intval($factor);
OpenPOWER on IntegriCloud