Projet

Général

Profil

Télécharger (4,72 ko) Statistiques
| Branche: | Tag: | Révision:

univnautes / usr / local / www / widgets / widgets / interfaces.widget.php @ fab1cd2f

1
<?php
2
/*
3
        $Id$
4
        Copyright 2007 Scott Dale
5
        Part of pfSense widgets (https://www.pfsense.org)
6
        originally based on m0n0wall (http://m0n0.ch/wall)
7

    
8
        Copyright (C) 2004-2005 T. Lechat <dev@lechat.org>, Manuel Kasper <mk@neon1.net>
9
        and Jonathan Watt <jwatt@jwatt.org>.
10
        All rights reserved.
11

    
12
        Redistribution and use in source and binary forms, with or without
13
        modification, are permitted provided that the following conditions are met:
14

    
15
        1. Redistributions of source code must retain the above copyright notice,
16
           this list of conditions and the following disclaimer.
17

    
18
        2. Redistributions in binary form must reproduce the above copyright
19
           notice, this list of conditions and the following disclaimer in the
20
           documentation and/or other materials provided with the distribution.
21

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

    
34
$nocsrf = true;
35

    
36
require_once("guiconfig.inc");
37
require_once("pfsense-utils.inc");
38
require_once("functions.inc");
39
require_once("/usr/local/www/widgets/include/interfaces.inc");
40

    
41
		$i = 0;
42
		$ifdescrs = get_configured_interface_with_descr();
43
?>
44

    
45
	         <table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0" summary="interfaces">
46
				<?php
47
				foreach ($ifdescrs as $ifdescr => $ifname) {
48
					$ifinfo = get_interface_info($ifdescr);
49
					$iswireless = is_interface_wireless($ifdescr);
50
				?>
51
				<tr>
52
				<td class="vncellt" width="40%">
53
				<?php
54
				if($ifinfo['ppplink']) {
55
					echo "<img src='./themes/{$g['theme']}/images/icons/icon_3g.gif' alt='3g' />";
56
				} else if($iswireless) {
57
					if($ifinfo['status'] == "associated") { ?>
58
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_wlan.gif" alt="wlan" />
59
					<?php } else { ?>
60
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_wlan_d.gif" alt="wlan_d" />
61
					<?php } ?>
62
				<?php } else { ?>
63
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_cablenic.gif" alt="cablenic" />
64
				<?php } ?>&nbsp;
65
				<strong><u>
66
				<span onclick="location.href='/interfaces.php?if=<?=$ifdescr; ?>'" style="cursor:pointer">
67
				<?=htmlspecialchars($ifname);?></span></u></strong>
68
				<?php
69
					if ($ifinfo['dhcplink'])
70
						echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(DHCP)";
71
				?>
72
				</td>
73
				<td width="60%"  class="listr">
74
	                 		<table width="100%" border="0" cellspacing="0" cellpadding="0" summary="status">
75
						<tr>
76
		                 <?php if($ifinfo['status'] == "up" || $ifinfo['status'] == "associated") { ?>
77
							<td>
78
								<div id="<?php echo $ifname;?>-up" style="display:inline" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_interface_up.gif" title="<?=$ifname;?> is up" alt="up" /></div>
79
							</td>
80
		                <?php } else if ($ifinfo['status'] == "no carrier") { ?>
81
							<td>
82
								<div id="<?php echo $ifname;?>-down" style="display:inline" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_interface_down.gif" title="<?=$ifname;?> is down" alt="down" /></div>
83
							</td>
84
				<?php }  else if ($ifinfo['status'] == "down") { ?>
85
							<td>
86
								<div id="<?php echo $ifname;?>-block" style="display:inline" ><img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" title="<?=$ifname;?> is disabled" alt="disabled" /></div>
87
							</td>
88
		                <?php } else { ?><?=htmlspecialchars($ifinfo['status']); }?>
89
							<td>
90
								<div id="<?php echo $ifname;?>-media" style="display:inline"><?=htmlspecialchars($ifinfo['media']);?></div>
91
							</td>
92
						</tr>
93
					</table>
94
					<table  width="100%" border="0" cellspacing="0" cellpadding="0" summary="summary">
95
						<tr>
96
							<td class="vncellt" width="100%">
97
								<div id="<?php echo $ifname;?>-ip" style="display:inline"><?=htmlspecialchars($ifinfo['ipaddr']);?> </div>
98
								<br />
99
								<div id="<?php echo $ifname;?>-ipv6" style="display:inline"><?=htmlspecialchars($ifinfo['ipaddrv6']);?> </div>
100
							</td>
101
						</tr>
102
					</table>
103
		          </td></tr>
104
				<?php 	}//end for each ?>
105
			</table>
(8-8/21)