summaryrefslogtreecommitdiffstats
path: root/usr/local/www/widgets/widgets/gateways.widget.php
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-06-07 19:17:00 +0000
committerErmal <eri@pfsense.org>2010-06-07 19:17:00 +0000
commitbeb7b8140c31f2c99166d00575fd5da2772168e8 (patch)
tree293c312fcfe20f1e83ef0acbd3f407c8722ea8a5 /usr/local/www/widgets/widgets/gateways.widget.php
parent04969976308ab51b50408f9d804f3cd9af5a329d (diff)
downloadpfsense-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/widgets/widgets/gateways.widget.php')
-rw-r--r--usr/local/www/widgets/widgets/gateways.widget.php51
1 files changed, 19 insertions, 32 deletions
diff --git a/usr/local/www/widgets/widgets/gateways.widget.php b/usr/local/www/widgets/widgets/gateways.widget.php
index 7d67570..a9ba45f 100644
--- a/usr/local/www/widgets/widgets/gateways.widget.php
+++ b/usr/local/www/widgets/widgets/gateways.widget.php
@@ -30,8 +30,6 @@ require_once("guiconfig.inc");
require_once("pfsense-utils.inc");
require_once("functions.inc");
-$a_gateways = return_gateways_array();
-
$gateways_status = array();
$gateways_status = return_gateways_status();
@@ -46,13 +44,13 @@ $counter = 1;
<td width="10%" class="listhdrr">Loss</td>
<td width="30%" class="listhdrr">Status</td>
</tr>
- <?php foreach ($a_gateways as $gateway) { ?>
+ <?php foreach ($gateways_status as $gateway) { ?>
<?php
$monitor = $gateway['monitor'];
- if(empty($monitor)) {
- $monitor = $gateway['gateway'];
- }
- ?>
+ if(empty($monitor)) {
+ $monitor = $gateway['gateway'];
+ }
+ ?>
<tr>
<td class="listlr" id="gateway<?= $counter; ?>">
<?=$gateway['name'];?>
@@ -73,30 +71,20 @@ $counter = 1;
<td class="listr" id=\"gateway<?=$counter?>\" >
<table border="0" cellpadding="0" cellspacing="2">
<?php
- $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;
- default:
- $online = "Gathering data";
- }
+ 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";
+ } else
+ $online = "Gathering data";
echo "<tr><td bgcolor=\"$bgcolor\" > $online </td>";
$counter++;
?>
@@ -104,7 +92,6 @@ $counter = 1;
</td>
</tr>
<?php
- $i++;
}
?>
</table>
OpenPOWER on IntegriCloud