From 64d0a55d1ab63800183920f5e9b736f3e719e41c Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 23 Sep 2009 15:47:06 -0400 Subject: Uncomment safety-belt checks that are required to avoid filter errors. Not sure why they are uncommented? Unfinished testing is my first guess. --- usr/local/www/wizards/traffic_shaper_wizard.inc | 37 +++++++++---------- .../wizards/traffic_shaper_wizard_dedicated.inc | 40 ++++++++------------- .../wizards/traffic_shaper_wizard_multi_all.inc | 41 ++++++++-------------- .../wizards/traffic_shaper_wizard_multi_lan.inc | 29 ++++++--------- 4 files changed, 55 insertions(+), 92 deletions(-) (limited to 'usr/local/www/wizards') diff --git a/usr/local/www/wizards/traffic_shaper_wizard.inc b/usr/local/www/wizards/traffic_shaper_wizard.inc index b76292b..7ef612e 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard.inc @@ -242,24 +242,22 @@ function step2_stepsubmitphpaction() { $upbw = $_POST["conn{$i}upload"]; $downbw = $_POST["conn{$i}download"]; if ($upbw == 0 || $downbw = 0) { - $message = gettext("You cannot specify 0 bandwidth!") -; - header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message -={$message}"); + $message = gettext("You cannot specify 0 bandwidth!"); + header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}"); exit; } -/* + if ($upbw < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") { $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler."); header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}"); exit; } if ($downbw < 128 && $_POST["conn{$i}downloadspeed"] == "Kb" && trim($_POST["downloadscheduler"]) == "CBQ") { - $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler."); - header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}"); - exit; - } -*/ + $message=gettext("We do not support Bandwidths smaller than 128Kbit/s for CBQ scheduler."); + header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=1&message={$message}"); + exit; + } + } } /* This is necessary since the wizard expects predefined fields. */ @@ -486,7 +484,7 @@ function step4_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}"); exit; } -/* + if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}"); @@ -498,7 +496,6 @@ function step4_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}"); exit; } -*/ if($_POST['address'] <> "" && !is_ipaddr($_POST['address'])) { if(!is_alias($_POST['address'])) { @@ -520,7 +517,7 @@ function step5_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}"); } -/* + if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=4&message={$message}"); @@ -532,7 +529,7 @@ function step5_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=3&message={$message}"); exit; } -*/ + } } } @@ -997,15 +994,14 @@ $othersplist = array(); $otherpriority = false; } $remainbw = round($remainbw / $upbw * 100, 2); - /* + if ($remainbw > 0 && $remainbw > 30) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}"); exit; } else { - */ $remainbw = 100 - $remainbw; - //} + } if ($sched == "PRIQ") $q =& new priq_queue(); @@ -1365,15 +1361,14 @@ $othersplist = array(); $otherpriority = false; } $remainbw = round($remainbw / $lanbw * 100, 2); - /* + if ($remainbw > 0 && $remainbw > 30) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard.xml&stepid=2&message={$message}"); exit; } else { - */ $remainbw = 100 - $remainbw; - //} + } if ($sched != "PRIQ") { if ($sched == "CBQ") @@ -1876,4 +1871,4 @@ function wizard_get_bandwidthtype_scale($type) { return floatval($factor); } -?> +?> \ No newline at end of file diff --git a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index 1b9b0a0..b0525b0 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -251,10 +251,8 @@ function step2_stepsubmitphpaction() { $upbw = $_POST["conn{$i}upload"]; $downbw = $_POST["conn{$i}download"]; if ($upbw == 0 || $downbw = 0) { - $message = gettext("You cannot specify 0 bandwidth!") -; - header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message -={$message}"); + $message = gettext("You cannot specify 0 bandwidth!"); + header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=1&message={$message}"); exit; } if (intval($upbw) < 128 && $_POST["conn{$i}uploadspeed"] == "Kb" && trim($_POST["conn{$i}scheduler"]) == "CBQ") { @@ -285,8 +283,6 @@ function step2_stepsubmitphpaction() { $config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"]; } - /* Not needed, called by wizard.php */ -// write_config(); } function step3_stepbeforeformdisplay() { @@ -497,7 +493,7 @@ function step4_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}"); exit; } -/* + if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}"); @@ -509,7 +505,6 @@ function step4_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}"); exit; } -*/ if($_POST['address'] <> "" && !is_ipaddr($_POST['address'])) { if(!is_alias($_POST['address'])) { @@ -523,7 +518,6 @@ function step4_stepsubmitphpaction() { } function step5_stepsubmitphpaction() { - if ( $_POST['enable'] ) { if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") { if(!is_numeric($_POST['bandwidth'])) { @@ -531,19 +525,17 @@ function step5_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=4&message={$message}"); } -/* if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=4&message={$message}"); exit; } - $bw = wizard_get_bw($_POST['bandwidth']); - if($bw > 15 && $bw < 2) { - $message="Values should be between 2% and 15%!"; - header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}"); - exit; - } -*/ + $bw = wizard_get_bw($_POST['bandwidth']); + if($bw > 15 && $bw < 2) { + $message="Values should be between 2% and 15%!"; + header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=3&message={$message}"); + exit; + } } } } @@ -570,6 +562,7 @@ function step8_stepsubmitphpaction() { /* Head over and check out the groovy queue stats */ header("Location: status_filter_reload.php"); } + function step9_stepsubmitphpaction() { global $g, $config; header("status_filter_reload.php"); @@ -1007,15 +1000,14 @@ $othersplist = array(); } //echo "
" .$remainbw . "
"; $remainbw = round($remainbw / $upbw * 100, 2); - /*echo $remainbw; + if (intval($remainbw) > 0 && intval($remainbw) > 30) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}"); exit; } else { - */ - $remainbw = 100 - $remainbw; - //} + $remainbw = 100 - $remainbw; + } if ($sched != "PRIQ") { if ($sched == "CBQ") @@ -1415,15 +1407,13 @@ $othersplist = array(); $otherpriority = false; } $remainbw = round($remainbw / $downbw * 100, 2); - /*echo $remainbw; if (intval($remainbw) > 0 && intval($remainbw) > 40) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard_dedicated.xml&stepid=2&message={$message}"); exit; } else { - */ $remainbw = 100 - $remainbw; - //} + } if ($sched != "PRIQ") { if ($sched == "CBQ") @@ -1929,4 +1919,4 @@ function wizard_get_bandwidthtype_scale($type) { return intval($factor); } -?> +?> \ No newline at end of file diff --git a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index f129244..2703c3e 100755 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -329,8 +329,6 @@ function step2_stepsubmitphpaction() { $config['ezshaper']['step2']["conn${i}interface"] = $_POST["conn{$i}interface"]; } - /* Not needed, called by wizard.php */ -// write_config(); } function step3_stepbeforeformdisplay() { @@ -530,10 +528,6 @@ function step3_stepsubmitphpaction() { $config['ezshaper']['step3']["conn{$i}upload"] = $_POST["conn{$i}upload"]; $config['ezshaper']['step3']["conn{$i}uploadspeed"] = $_POST["conn{$i}uploadspeed"]; } - - /* Not needed, called by wizard.php */ - //write_config(); - } function step4_stepsubmitphpaction() { @@ -550,7 +544,7 @@ function step4_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}"); exit; } -/* + if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}"); @@ -561,8 +555,7 @@ function step4_stepsubmitphpaction() { $message="Values should be between 2% and 15%!"; header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}"); exit; - } -*/ + } if($_POST['address'] <> "" && !is_ipaddr($_POST['address'])) { if(!is_alias($_POST['address'])) { @@ -576,27 +569,23 @@ function step4_stepsubmitphpaction() { } function step5_stepsubmitphpaction() { - if ( $_POST['enable'] ) { if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") { if(!is_numeric($_POST['bandwidth'])) { $message="Posted value is not a valid bandwidth."; header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=4&message={$message}"); - } -/* if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=4&message={$message}"); exit; } - $bw = wizard_get_bw($_POST['bandwidth']); - if($bw > 15 && $bw < 2) { - $message="Values should be between 2% and 15%!"; - header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}"); - exit; - } -*/ + $bw = wizard_get_bw($_POST['bandwidth']); + if($bw > 15 && $bw < 2) { + $message="Values should be between 2% and 15%!"; + header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=3&message={$message}"); + exit; + } } } } @@ -1058,17 +1047,16 @@ $othersplist = array(); } else { $otherpriority = false; } - //echo "
" .$remainbw . "
"; + $remainbw = round($remainbw / $upbw * 100, 2); - /*echo $remainbw; + if (intval($remainbw) > 0 && intval($remainbw) > 30) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}"); exit; } else { - */ $remainbw = 100 - $remainbw; - //} + } if ($sched != "PRIQ") { if ($sched == "CBQ") @@ -1476,15 +1464,14 @@ $othersplist = array(); $otherpriority = false; } $remainbw = round($remainbw / $lanbw * 100, 2); - /*echo $remainbw; + if (intval($remainbw) > 0 && intval($remainbw) > 40) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_all.xml&stepid=2&message={$message}"); exit; } else { - */ $remainbw = 100 - $remainbw; - //} + } if ($sched != "PRIQ") { if ($sched == "CBQ") @@ -1987,4 +1974,4 @@ function wizard_get_bandwidthtype_scale($type) { return intval($factor); } -?> +?> \ No newline at end of file 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 a6b00ed..f231886 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc +++ b/usr/local/www/wizards/traffic_shaper_wizard_multi_lan.inc @@ -288,7 +288,7 @@ function step3_stepsubmitphpaction() { } } } -/* + $steps = intval($config['ezshaper']['step1']['numberofconnections']); for ($i = 0; $i < $steps; $i++) { if ($_POST["connupload"]) { @@ -308,7 +308,6 @@ function step3_stepsubmitphpaction() { } } } -*/ } function step4_stepsubmitphpaction() { @@ -325,7 +324,7 @@ function step4_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}"); exit; } -/* + if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}"); @@ -337,7 +336,6 @@ function step4_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}"); exit; } -*/ if($_POST['address'] <> "" && !is_ipaddr($_POST['address'])) { if(!is_alias($_POST['address'])) { @@ -351,7 +349,6 @@ function step4_stepsubmitphpaction() { } function step5_stepsubmitphpaction() { - if ( $_POST['enable'] ) { if (isset($_POST['bandwidth']) && $_POST['bandwidth'] <> "") { if(!is_numeric($_POST['bandwidth'])) { @@ -359,19 +356,17 @@ function step5_stepsubmitphpaction() { header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=4&message={$message}"); } -/* if (wizard_get_bwunit($_POST['bandwidth']) <> "%") { $message = gettext("Only percentage bandwidth specification is allowed."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=4&message={$message}"); exit; } - $bw = wizard_get_bw($_POST['bandwidth']); - if($bw > 15 && $bw < 2) { - $message="Values should be between 2% and 15%!"; - header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}"); - exit; - } -*/ + $bw = wizard_get_bw($_POST['bandwidth']); + if($bw > 15 && $bw < 2) { + $message="Values should be between 2% and 15%!"; + header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=3&message={$message}"); + exit; + } } } } @@ -829,15 +824,13 @@ function apply_all_choosen_items() { } $remainbw = round($remainbw / $upbw * 100, 2); - /* if ($remainbw > 0 && $remainbw > 30) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=2&message={$message}"); exit; } else { - */ $remainbw = 100 - $remainbw; - //} + } if ($sched != "PRIQ") { if ($sched == "CBQ") @@ -1238,15 +1231,13 @@ function apply_all_choosen_items() { $otherpriority = false; } $remainbw = round($remainbw / $lanbw * 100, 2); - /* if ($remainbw > 0 && $remainbw > 30) { $message=gettext("Custom Bandwidths are greater than 30%. Please lower them for the wizard to continue."); header("Location: wizard.php?xml=traffic_shaper_wizard_multi_lan.xml&stepid=2&message={$message}"); exit; } else { - */ $remainbw = 100 - $remainbw; - //} + } if ($sched == "PRIQ") -- cgit v1.1