diff options
author | Renato Botelho <garga@FreeBSD.org> | 2014-07-24 15:44:55 -0300 |
---|---|---|
committer | Renato Botelho <garga@FreeBSD.org> | 2014-07-24 18:28:00 -0300 |
commit | 4844813b3e6cdfcbeae47dad4195bb6f0091f1e7 (patch) | |
tree | 0fd66dbf27fad743d201a05c444e3ce9ea42c34a /usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc | |
parent | d69332134bb81a8106fdadaf75dec8fc268792d1 (diff) | |
download | pfsense-4844813b3e6cdfcbeae47dad4195bb6f0091f1e7.zip pfsense-4844813b3e6cdfcbeae47dad4195bb6f0091f1e7.tar.gz |
Fix indent and whitespaces
Diffstat (limited to 'usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc')
-rw-r--r-- | usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc | 218 |
1 files changed, 109 insertions, 109 deletions
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); |