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_gateways.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_gateways.php')
-rwxr-xr-x | usr/local/www/status_gateways.php | 52 |
1 files changed, 17 insertions, 35 deletions
diff --git a/usr/local/www/status_gateways.php b/usr/local/www/status_gateways.php index fa9aa72..eca1eec 100755 --- a/usr/local/www/status_gateways.php +++ b/usr/local/www/status_gateways.php @@ -42,7 +42,6 @@ require("guiconfig.inc"); $a_gateways = return_gateways_array(); - $gateways_status = array(); $gateways_status = return_gateways_status(); @@ -76,8 +75,7 @@ include("head.inc"); <td width="30%" class="listhdrr">Status</td> <td width="30%" class="listhdr">Description</td> </tr> - <?php foreach ($a_gateways as $gateway) { - $i = 2; + <?php foreach ($gateways_status as $gateway) { ?> <tr> <td class="listlr"> @@ -92,35 +90,21 @@ include("head.inc"); <td class="listr" > <table border="0" cellpadding="0" cellspacing="2"> <?php - if($gateway['gateway'] == "dynamic") { - $gateway['monitor'] = "127.0.0.{$i}"; - $i++; - } - $monitor = $gateway['monitor']; - if(empty($monitor)) { - $monitor = $gateway['gateway']; - } - switch($gateways_status[$monitor]['status']) { - case "None": - $online = "Online"; - $bgcolor = "lightgreen"; - break; - case "\"down\"": - $online = "Offline"; - $bgcolor = "lightcoral"; - break; - case "\"delay\"": - $online = "Warning, Latency"; - $bgcolor = "khaki"; - break; - case "\"loss\"": - $online = "Warning, Packetloss"; - $bgcolor = "khaki"; - break; + if (stristr($gateway['status'], "down")) { + $online = "Offline"; + $bgcolor = "lightcoral"; + } elseif (stristr($gateway['status'], "loss")) { + $online = "Warning, Packetloss"; + $bgcolor = "khaki"; + } elseif (stristr($gateway['status'], "delay")) { + $online = "Warning, Latency"; + $bgcolor = "khaki"; + } elseif (stristr($gateway['status'], "none")) { + $online = "Online"; + $bgcolor = "lightgreen"; } - - PRINT "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>"; - $lastchange = $gateways_status[$monitor]['lastcheck']; + echo "<tr><td bgcolor=\"$bgcolor\" > $online </td><td>"; + $lastchange = $gateway['lastcheck']; if(!empty($lastchange)) { $lastchange = explode(" ", $lastchange); array_shift($lastchange); @@ -130,13 +114,11 @@ include("head.inc"); } else { print "Gathering data"; } - PRINT "</td></tr>"; + echo "</td></tr>"; ?> </table> </td> - <td class="listbg" > - <?=$gateway['descr'];?></font> - </td> + <td class="listbg"> <?=$a_gateway[$gateway['name']]['descr']; ?></td> </tr> <?php } ?> </table> |