summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjim-p <jimp@pfsense.org>2011-11-07 12:29:49 -0500
committerjim-p <jimp@pfsense.org>2011-11-07 12:31:04 -0500
commit9b1a73f3cad2d9e194697a5cbc78f1990e8c4e8e (patch)
tree366408b74a33f033638629f287b81e84712e05d1
parent783321d0059c9c51eb2d6d10b931b22b370afd19 (diff)
downloadpfsense-9b1a73f3cad2d9e194697a5cbc78f1990e8c4e8e.zip
pfsense-9b1a73f3cad2d9e194697a5cbc78f1990e8c4e8e.tar.gz
Fix display of CARP widget to properly show Disabled status, bring code more in line with the carp status page, and clean it up a bit.
-rw-r--r--usr/local/www/widgets/widgets/carp_status.widget.php62
1 files changed, 32 insertions, 30 deletions
diff --git a/usr/local/www/widgets/widgets/carp_status.widget.php b/usr/local/www/widgets/widgets/carp_status.widget.php
index a671308..8fbb9b1 100644
--- a/usr/local/www/widgets/widgets/carp_status.widget.php
+++ b/usr/local/www/widgets/widgets/carp_status.widget.php
@@ -34,21 +34,23 @@ require_once("pfsense-utils.inc");
require_once("functions.inc");
require_once("/usr/local/www/widgets/include/carp_status.inc");
+$carp_enabled = get_carp_status();
+
?>
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0">
<?php
if(is_array($config['virtualip']['vip'])) {
- $carpint=0;
- foreach($config['virtualip']['vip'] as $carp) {
- if ($carp['mode'] != "carp")
- continue;
- $ipaddress = $carp['subnet'];
- $password = $carp['password'];
- $netmask = $carp['subnet_bits'];
- $vhid = $carp['vhid'];
- $advskew = $carp['advskew'];
- $carp_int = "vip{$vhid}";
- $status = get_carp_interface_status($carp_int);
+ $carpint=0;
+ foreach($config['virtualip']['vip'] as $carp) {
+ if ($carp['mode'] != "carp")
+ continue;
+ $ipaddress = $carp['subnet'];
+ $password = $carp['password'];
+ $netmask = $carp['subnet_bits'];
+ $vhid = $carp['vhid'];
+ $advskew = $carp['advskew'];
+ $carp_int = "vip{$vhid}";
+ $status = get_carp_interface_status($carp_int);
?>
<tr>
<td class="vncellt" width="30%">
@@ -58,23 +60,23 @@ require_once("/usr/local/www/widgets/include/carp_status.inc");
</td>
<td width="70%" class="listr">
<?php
- if($status == "MASTER") {
- echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass.gif' title=\"$status\">";
- } else if($status == "BACKUP") {
- echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass_d.gif' title=\"$status\">";
- } else if($status == "INIT") {
- echo "<img src='/themes/".$g['theme']."/images/icons/icon_log.gif' title=\"$status\">";
- }
- if ($ipaddress){ ?> &nbsp;
- <?=htmlspecialchars($status);?> &nbsp;
- <?=htmlspecialchars($ipaddress);}?>
- </tr><?php }
- }
- else
- {
- ?>
- <tr><td class="listr">No CARP Interfaces Defined. Click <a href="carp_status.php">here</a> to configure CARP.</td></tr>
- <?php
- }
- ?>
+ if($carp_enabled == false) {
+ $status = "DISABLED";
+ echo "<img src='/themes/".$g['theme']."/images/icons/icon_block.gif' title=\"$status\">";
+ } else {
+ if($status == "MASTER") {
+ echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass.gif' title=\"$status\">";
+ } else if($status == "BACKUP") {
+ echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass_d.gif' title=\"$status\">";
+ } else if($status == "INIT") {
+ echo "<img src='/themes/".$g['theme']."/images/icons/icon_log.gif' title=\"$status\">";
+ }
+ }
+ if ($ipaddress){ ?> &nbsp;
+ <?=htmlspecialchars($status);?> &nbsp;
+ <?=htmlspecialchars($ipaddress);}?>
+</tr><?php }
+ } else { ?>
+ <tr><td class="listr">No CARP Interfaces Defined. Click <a href="carp_status.php">here</a> to configure CARP.</td></tr>
+<?php } ?>
</table>
OpenPOWER on IntegriCloud