summaryrefslogtreecommitdiffstats
path: root/src/usr
diff options
context:
space:
mode:
authorRenato Botelho <renato@netgate.com>2015-12-10 10:10:27 -0200
committerRenato Botelho <renato@netgate.com>2015-12-10 19:04:35 -0200
commit9a333a97fbc370c8a9bcb072c02b6c2d86a69ab3 (patch)
tree6b25a3c1d8a68097cdc2b82e87a5a37839830404 /src/usr
parentf4f60018fa4e726eb7da7fb38496be7ff142e12d (diff)
downloadpfsense-9a333a97fbc370c8a9bcb072c02b6c2d86a69ab3.zip
pfsense-9a333a97fbc370c8a9bcb072c02b6c2d86a69ab3.tar.gz
Simplify logic and break some long lines, no functional changes
Diffstat (limited to 'src/usr')
-rw-r--r--src/usr/local/www/system_gateways_edit.php177
1 files changed, 78 insertions, 99 deletions
diff --git a/src/usr/local/www/system_gateways_edit.php b/src/usr/local/www/system_gateways_edit.php
index 13a0991..e6c800c 100644
--- a/src/usr/local/www/system_gateways_edit.php
+++ b/src/usr/local/www/system_gateways_edit.php
@@ -313,165 +313,144 @@ if ($_POST) {
if ($_POST['latencylow']) {
if (!is_numeric($_POST['latencylow'])) {
$input_errors[] = gettext("The low latency threshold needs to be a numeric value.");
- } else {
- if ($_POST['latencylow'] < 1) {
- $input_errors[] = gettext("The low latency threshold needs to be positive.");
- }
+ } else if ($_POST['latencylow'] < 1) {
+ $input_errors[] = gettext("The low latency threshold needs to be positive.");
}
}
if ($_POST['latencyhigh']) {
if (!is_numeric($_POST['latencyhigh'])) {
$input_errors[] = gettext("The high latency threshold needs to be a numeric value.");
- } else {
- if ($_POST['latencyhigh'] < 1) {
- $input_errors[] = gettext("The high latency threshold needs to be positive.");
- }
+ } else if ($_POST['latencyhigh'] < 1) {
+ $input_errors[] = gettext("The high latency threshold needs to be positive.");
}
}
if ($_POST['losslow']) {
if (!is_numeric($_POST['losslow'])) {
$input_errors[] = gettext("The low Packet Loss threshold needs to be a numeric value.");
- } else {
- if ($_POST['losslow'] < 1) {
- $input_errors[] = gettext("The low Packet Loss threshold needs to be positive.");
- }
- if ($_POST['losslow'] >= 100) {
- $input_errors[] = gettext("The low Packet Loss threshold needs to be less than 100.");
- }
+ } else if ($_POST['losslow'] < 1) {
+ $input_errors[] = gettext("The low Packet Loss threshold needs to be positive.");
+ } else if ($_POST['losslow'] >= 100) {
+ $input_errors[] = gettext("The low Packet Loss threshold needs to be less than 100.");
}
}
if ($_POST['losshigh']) {
if (!is_numeric($_POST['losshigh'])) {
$input_errors[] = gettext("The high Packet Loss threshold needs to be a numeric value.");
- } else {
- if ($_POST['losshigh'] < 1) {
- $input_errors[] = gettext("The high Packet Loss threshold needs to be positive.");
- }
- if ($_POST['losshigh'] > 100) {
- $input_errors[] = gettext("The high Packet Loss threshold needs to be 100 or less.");
- }
+ } else if ($_POST['losshigh'] < 1) {
+ $input_errors[] = gettext("The high Packet Loss threshold needs to be positive.");
+ } else if ($_POST['losshigh'] > 100) {
+ $input_errors[] = gettext("The high Packet Loss threshold needs to be 100 or less.");
}
}
if (($_POST['latencylow']) && ($_POST['latencyhigh'])) {
- if ((is_numeric($_POST['latencylow'])) && (is_numeric($_POST['latencyhigh']))) {
- if (($_POST['latencylow'] > $_POST['latencyhigh'])) {
- $input_errors[] = gettext("The high latency threshold needs to be higher than the low latency threshold");
- }
- }
- } else {
- if ($_POST['latencylow']) {
- if (is_numeric($_POST['latencylow'])) {
- if ($_POST['latencylow'] > $dpinger_default['latencyhigh']) {
- $input_errors[] = gettext(sprintf("The low latency threshold needs to be less than the default high latency threshold (%d)", $dpinger_default['latencyhigh']));
- }
- }
- }
- if ($_POST['latencyhigh']) {
- if (is_numeric($_POST['latencyhigh'])) {
- if ($_POST['latencyhigh'] < $dpinger_default['latencylow']) {
- $input_errors[] = gettext(sprintf("The high latency threshold needs to be higher than the default low latency threshold (%d)", $dpinger_default['latencylow']));
- }
- }
+ if ((is_numeric($_POST['latencylow'])) &&
+ (is_numeric($_POST['latencyhigh'])) &&
+ ($_POST['latencylow'] >= $_POST['latencyhigh'])) {
+ $input_errors[] = gettext(
+ "The high latency threshold needs to be higher than the low latency threshold");
+ }
+ } else if ($_POST['latencylow']) {
+ if (is_numeric($_POST['latencylow']) &&
+ ($_POST['latencylow'] > $dpinger_default['latencyhigh'])) {
+ $input_errors[] = gettext(sprintf(
+ "The low latency threshold needs to be less than the default high latency threshold (%d)",
+ $dpinger_default['latencyhigh']));
+ }
+ } else if ($_POST['latencyhigh']) {
+ if (is_numeric($_POST['latencyhigh']) &&
+ ($_POST['latencyhigh'] < $dpinger_default['latencylow'])) {
+ $input_errors[] = gettext(sprintf(
+ "The high latency threshold needs to be higher than the default low latency threshold (%d)",
+ $dpinger_default['latencylow']));
}
}
if (($_POST['losslow']) && ($_POST['losshigh'])) {
- if ((is_numeric($_POST['losslow'])) && (is_numeric($_POST['losshigh']))) {
- if ($_POST['losslow'] > $_POST['losshigh']) {
- $input_errors[] = gettext("The high Packet Loss threshold needs to be higher than the low Packet Loss threshold");
- }
- }
- } else {
- if ($_POST['losslow']) {
- if (is_numeric($_POST['losslow'])) {
- if ($_POST['losslow'] > $dpinger_default['losshigh']) {
- $input_errors[] = gettext(sprintf("The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)", $dpinger_default['losshigh']));
- }
- }
- }
- if ($_POST['losshigh']) {
- if (is_numeric($_POST['losshigh'])) {
- if ($_POST['losshigh'] < $dpinger_default['losslow']) {
- $input_errors[] = gettext(sprintf("The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)", $dpinger_default['losslow']));
- }
- }
+ if ((is_numeric($_POST['losslow'])) &&
+ (is_numeric($_POST['losshigh'])) &&
+ ($_POST['losslow'] > $_POST['losshigh'])) {
+ $input_errors[] = gettext(
+ "The high Packet Loss threshold needs to be higher than the low Packet Loss threshold");
+ }
+ } else if ($_POST['losslow']) {
+ if (is_numeric($_POST['losslow']) &&
+ ($_POST['losslow'] > $dpinger_default['losshigh'])) {
+ $input_errors[] = gettext(sprintf(
+ "The low Packet Loss threshold needs to be less than the default high Packet Loss threshold (%d)",
+ $dpinger_default['losshigh']));
+ }
+ } else if ($_POST['losshigh']) {
+ if (is_numeric($_POST['losshigh']) &&
+ ($_POST['losshigh'] < $dpinger_default['losslow'])) {
+ $input_errors[] = gettext(sprintf(
+ "The high Packet Loss threshold needs to be higher than the default low Packet Loss threshold (%d)",
+ $dpinger_default['losslow']));
}
}
if ($_POST['interval']) {
if (!is_numeric($_POST['interval'])) {
$input_errors[] = gettext("The probe interval needs to be a numeric value.");
- } else {
- if ($_POST['interval'] < 1) {
- $input_errors[] = gettext("The probe interval needs to be positive.");
- }
+ } else if ($_POST['interval'] < 1) {
+ $input_errors[] = gettext("The probe interval needs to be positive.");
}
}
if ($_POST['down']) {
if (!is_numeric($_POST['down'])) {
$input_errors[] = gettext("The down time setting needs to be a numeric value.");
- } else {
- if ($_POST['down'] < 1) {
- $input_errors[] = gettext("The down time setting needs to be positive.");
- }
+ } else if ($_POST['down'] < 1) {
+ $input_errors[] = gettext("The down time setting needs to be positive.");
}
}
if (($_POST['interval']) && ($_POST['down'])) {
- if ((is_numeric($_POST['interval'])) && (is_numeric($_POST['down']))) {
- if ($_POST['interval'] > $_POST['down']) {
- $input_errors[] = gettext("The probe interval needs to be less than the down time setting.");
- }
- }
- } else {
- if ($_POST['interval']) {
- if (is_numeric($_POST['interval'])) {
- if ($_POST['interval'] > $dpinger_default['down']) {
- $input_errors[] = gettext(sprintf("The probe interval needs to be less than the default down time setting (%d)", $dpinger_default['down']));
- }
- }
- }
- if ($_POST['down']) {
- if (is_numeric($_POST['down'])) {
- if ($_POST['down'] < $dpinger_default['interval']) {
- $input_errors[] = gettext(sprintf("The down time setting needs to be higher than the default probe interval (%d)", $dpinger_default['interval']));
- }
- }
+ if ((is_numeric($_POST['interval'])) &&
+ (is_numeric($_POST['down'])) &&
+ ($_POST['interval'] > $_POST['down'])) {
+ $input_errors[] = gettext("The probe interval needs to be less than the down time setting.");
+ }
+ } else if ($_POST['interval']) {
+ if (is_numeric($_POST['interval']) &&
+ ($_POST['interval'] > $dpinger_default['down'])) {
+ $input_errors[] = gettext(sprintf(
+ "The probe interval needs to be less than the default down time setting (%d)",
+ $dpinger_default['down']));
+ }
+ } else if ($_POST['down']) {
+ if (is_numeric($_POST['down']) &&
+ ($_POST['down'] < $dpinger_default['interval'])) {
+ $input_errors[] = gettext(sprintf(
+ "The down time setting needs to be higher than the default probe interval (%d)",
+ $dpinger_default['interval']));
}
}
if ($_POST['avg_delay_samples']) {
if (!is_numeric($_POST['avg_delay_samples'])) {
$input_errors[] = gettext("The average delay replies qty needs to be a numeric value.");
- } else {
- if ($_POST['avg_delay_samples'] < 1) {
- $input_errors[] = gettext("The average delay replies qty needs to be positive.");
- }
+ } else if ($_POST['avg_delay_samples'] < 1) {
+ $input_errors[] = gettext("The average delay replies qty needs to be positive.");
}
}
if ($_POST['avg_loss_samples']) {
if (!is_numeric($_POST['avg_loss_samples'])) {
$input_errors[] = gettext("The average packet loss probes qty needs to be a numeric value.");
- } else {
- if ($_POST['avg_loss_samples'] < 1) {
- $input_errors[] = gettext("The average packet loss probes qty needs to be positive.");
- }
+ } else if ($_POST['avg_loss_samples'] < 1) {
+ $input_errors[] = gettext("The average packet loss probes qty needs to be positive.");
}
}
if ($_POST['avg_loss_delay_samples']) {
if (!is_numeric($_POST['avg_loss_delay_samples'])) {
$input_errors[] = gettext("The lost probe delay needs to be a numeric value.");
- } else {
- if ($_POST['avg_loss_delay_samples'] < 1) {
- $input_errors[] = gettext("The lost probe delay needs to be positive.");
- }
+ } else if ($_POST['avg_loss_delay_samples'] < 1) {
+ $input_errors[] = gettext("The lost probe delay needs to be positive.");
}
}
OpenPOWER on IntegriCloud