diff options
author | Ermal <eri@pfsense.org> | 2010-06-07 19:17:00 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-06-07 19:17:00 +0000 |
commit | beb7b8140c31f2c99166d00575fd5da2772168e8 (patch) | |
tree | 293c312fcfe20f1e83ef0acbd3f407c8722ea8a5 /usr/local/www/status_gateway_groups.php | |
parent | 04969976308ab51b50408f9d804f3cd9af5a329d (diff) | |
download | pfsense-beb7b8140c31f2c99166d00575fd5da2772168e8.zip pfsense-beb7b8140c31f2c99166d00575fd5da2772168e8.tar.gz |
Correctly control status of gateways. These code is tripled in these pages not sure what is the best solution.
Diffstat (limited to 'usr/local/www/status_gateway_groups.php')
-rwxr-xr-x | usr/local/www/status_gateway_groups.php | 39 |
1 files changed, 17 insertions, 22 deletions
diff --git a/usr/local/www/status_gateway_groups.php b/usr/local/www/status_gateway_groups.php index 353f025..d4f0d85 100755 --- a/usr/local/www/status_gateway_groups.php +++ b/usr/local/www/status_gateway_groups.php @@ -116,29 +116,24 @@ include("head.inc"); echo "<tr>"; $c = 1; while($c <= $priority_count) { + $monitor = lookup_gateway_monitor_ip_by_name($member); if($p == $c) { - $monitor = lookup_gateway_monitor_ip_by_name($member); - switch($gateways_status[$monitor]['status']) { - case "None": - $online = "Online"; - $bgcolor = "lightgreen"; - break; - case "\"down\"": - $online = "Offline"; - $bgcolor = "lightcoral"; - break; - case "\"delay\"": - $online = "Latency"; - $bgcolor = "khaki"; - break; - case "\"loss\"": - $online = "Packetloss"; - $bgcolor = "khaki"; - break; - default: - $online = "Unknown"; - $bgcolor = "lightblue"; - break; + $status = $gateways_status[$monitor]['status']; + if (stristr($status, "down")) { + $online = "Offline"; + $bgcolor = "lightcoral"; + } elseif (stristr($status, "loss")) { + $online = "Warning, Packetloss"; + $bgcolor = "khaki"; + } elseif (stristr($status, "delay")) { + $online = "Warning, Latency"; + $bgcolor = "khaki"; + } elseif (stristr($status, "none")) { + $online = "Online"; + $bgcolor = "lightgreen"; + } else { + $online = "Unknown"; + $bgcolor = "lightblue"; } echo "<td bgcolor='$bgcolor'>". htmlspecialchars($member) .", $online</td>"; } else { |