Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
OpnSense
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Kulya
OpnSense
Commits
a31f377d
Commit
a31f377d
authored
May 01, 2016
by
Ad Schellevis
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
(dashboard/widgets) code cleanup carp_status.widget.php
parent
50c22a27
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
43 additions
and
44 deletions
+43
-44
carp_status.widget.php
src/www/widgets/widgets/carp_status.widget.php
+43
-44
No files found.
src/www/widgets/widgets/carp_status.widget.php
View file @
a31f377d
<?php
/*
Copyright (C) 2014 Deciso B.V.
Copyright (C) 2014
-2016
Deciso B.V.
Copyright (C) 2007 Sam Wenham
All rights reserved.
...
...
@@ -27,61 +27,60 @@
POSSIBILITY OF SUCH DAMAGE.
*/
$nocsrf
=
true
;
require_once
(
"guiconfig.inc"
);
require_once
(
"pfsense-utils.inc"
);
require_once
(
"interfaces.inc"
);
require_once
(
"widgets/include/carp_status.inc"
);
$carp_enabled
=
(
get_single_sysctl
(
'net.inet.carp.allow'
)
>
0
);
if
(
!
isset
(
$config
[
'virtualip'
][
'vip'
]))
{
$config
[
'virtualip'
][
'vip'
]
=
array
();
}
?>
<table
class=
"table table-striped"
width=
"100%"
border=
"0"
cellspacing=
"0"
cellpadding=
"0"
summary=
"carp status"
>
<table
class=
"table table-striped"
>
<?php
if
(
isset
(
$config
[
'virtualip'
][
'vip'
]))
{
$carpint
=
0
;
foreach
(
$config
[
'virtualip'
][
'vip'
]
as
$carp
)
{
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'
];
$status
=
get_carp_interface_status
(
"
{
$carp
[
'interface'
]
}
_vip
{
$vhid
}
"
);
?>
<tr>
<td
class=
"vncellt"
width=
"35%"
>
<span
alt=
"cablenic"
class=
"glyphicon glyphicon-transfer text-success"
></span>
<strong><a
href=
"/system_hasync.php"
>
<span>
<?=
htmlspecialchars
(
convert_friendly_interface_to_friendly_descr
(
$carp
[
'interface'
])
.
"@
{
$vhid
}
"
);
?>
</span></a></strong>
</td>
<td
width=
"65%"
class=
"listr"
>
$status
=
get_carp_interface_status
(
"
{
$carp
[
'interface'
]
}
_vip
{
$carp
[
'vhid'
]
}
"
);
?>
<tr>
<td>
<span
class=
"glyphicon glyphicon-transfer text-success"
></span>
<strong>
<a
href=
"/system_hasync.php"
>
<span>
<?=
htmlspecialchars
(
convert_friendly_interface_to_friendly_descr
(
$carp
[
'interface'
])
.
"@
{
$carp
[
'vhid'
]
}
"
);
?>
</span>
</a>
</strong>
</td>
<td>
<?php
if
(
$carp_enabled
==
false
)
{
if
(
get_single_sysctl
(
'net.inet.carp.allow'
)
<=
0
)
{
$status
=
gettext
(
"DISABLED"
);
echo
"<span class=
\"
glyphicon glyphicon-remove text-danger
\"
title=
\"
$status
\"
alt=
\"
$status
\"
></span>"
;
}
else
{
if
(
$status
==
gettext
(
"MASTER"
))
{
}
elseif
(
$status
==
gettext
(
"MASTER"
))
{
echo
"<span class=
\"
glyphicon glyphicon-play text-success
\"
title=
\"
$status
\"
alt=
\"
$status
\"
></span>"
;
}
elseif
(
$status
==
gettext
(
"BACKUP"
))
{
echo
"<span class=
\"
glyphicon glyphicon-play text-muted
\"
title=
\"
$status
\"
alt=
\"
$status
\"
></span>"
;
}
elseif
(
$status
==
gettext
(
"INIT"
))
{
echo
"<span class=
\"
glyphicon glyphicon-info-sign
\"
title=
\"
$status
\"
alt=
\"
$status
\"
></span>"
;
}
}
if
(
$ipaddress
)
{
?>
if
(
!
empty
(
$carp
[
'subnet'
]))
:?>
&
nbsp
;
<?=
htmlspecialchars
(
$status
);
?>
<?=
htmlspecialchars
(
$ipaddress
);
}
?>
</td></tr>
<?php
}
}
else
{
?>
<tr><td
class=
"listr"
>
<?=
sprintf
(
gettext
(
'No CARP Interfaces Defined. Click %shere%s to configure CARP.'
),
'<a href="carp_status.php">'
,
'</a>'
);
?>
</td></tr>
<?=
htmlspecialchars
(
$carp
[
'subnet'
]);
?>
<?php
endif
;
?>
</td>
</tr>
<?php
endforeach
;
if
(
count
(
$config
[
'virtualip'
][
'vip'
])
==
0
)
:?>
<
tr
>
<
td
>
<?=
sprintf
(
gettext
(
'No CARP Interfaces Defined. Click %shere%s to configure CARP.'
),
'<a href="carp_status.php">'
,
'</a>'
);
?>
</td>
</tr>
<?php
}
?>
endif
;
?>
</table>
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment