Projet

Général

Profil

Télécharger (3,29 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / widgets / widgets / carp_status.widget.php @ 56898132

1
<?php
2
/*
3
	$Id$
4
    carp_status.widget.php
5
    Copyright (C) 2007 Sam Wenham
6
    All rights reserved.
7

    
8
    Redistribution and use in source and binary forms, with or without
9
    modification, are permitted provided that the following conditions are met:
10

    
11
    1. Redistributions of source code must retain the above copyright notice,
12
       this list of conditions and the following disclaimer.
13

    
14
    2. Redistributions in binary form must reproduce the above copyright
15
       notice, this list of conditions and the following disclaimer in the
16
       documentation and/or other materials provided with the distribution.
17

    
18
    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19
    INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20
    AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21
    AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
22
    OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23
    SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24
    INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
25
    CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26
    ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
27
    POSSIBILITY OF SUCH DAMAGE.
28
*/
29

    
30
$nocsrf = true;
31

    
32
require_once("guiconfig.inc");
33
require_once("pfsense-utils.inc");
34
require_once("functions.inc");
35
require_once("/usr/local/www/widgets/include/carp_status.inc");
36

    
37
$carp_enabled = get_carp_status();
38

    
39
?>
40
<table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0" summary="carp status">
41
<?php
42
	if(is_array($config['virtualip']['vip'])) {
43
		$carpint=0;
44
		foreach($config['virtualip']['vip'] as $carp) {
45
			if ($carp['mode'] != "carp")
46
				continue;
47
			$ipaddress = $carp['subnet'];
48
			$password = $carp['password'];
49
			$netmask = $carp['subnet_bits'];
50
			$vhid = $carp['vhid'];
51
			$advskew = $carp['advskew'];
52
			$status = get_carp_interface_status("{$carp['interface']}_vip{$vhid}");
53
?>
54
<tr>
55
	<td class="vncellt" width="35%">
56
		<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_cablenic.gif" alt="cablenic" />&nbsp;
57
		<strong><a href="/system_hasync.php">
58
		<span style="color:#000000"><?=htmlspecialchars(convert_friendly_interface_to_friendly_descr($carp['interface']) . "@{$vhid}");?></span></a></strong>
59
	</td>
60
	<td width="65%"  class="listr">
61
<?php
62
			if($carp_enabled == false) {
63
				$status = "DISABLED";
64
				echo "<img src='/themes/".$g['theme']."/images/icons/icon_block.gif' title=\"$status\" alt=\"$status\" />";
65
			} else {
66
				if($status == "MASTER") {
67
					echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass.gif' title=\"$status\" alt=\"$status\" />";
68
				} else if($status == "BACKUP") {
69
					echo "<img src='/themes/".$g['theme']."/images/icons/icon_pass_d.gif' title=\"$status\" alt=\"$status\" />";
70
				} else if($status == "INIT") {
71
					echo "<img src='/themes/".$g['theme']."/images/icons/icon_log.gif' title=\"$status\" alt=\"$status\" />";
72
				}
73
			}
74
			if ($ipaddress){ ?> &nbsp;
75
				<?=htmlspecialchars($status);?> &nbsp;
76
				<?=htmlspecialchars($ipaddress);}?>
77
</td></tr><?php	}
78
	} else { ?>
79
		<tr><td class="listr">No CARP Interfaces Defined. Click <a href="carp_status.php">here</a> to configure CARP.</td></tr>
80
<?php	} ?>
81
</table>
(2-2/21)