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 1eaee2f9 Scott Dale
<?php
2
/*
3
        $Id$
4
        Copyright 2007 Scott Dale
5 184016fc Chris Buechler
        Part of pfSense widgets (https://www.pfsense.org)
6 1eaee2f9 Scott Dale
        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 e9a17661 Scott Ullrich
34
$nocsrf = true;
35
36 9d488ea4 Scott Dale
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 1eaee2f9 Scott Dale
41 9b50c0ed Charlie Marshall
		$i = 0;
42 b6db9217 Ermal Luçi
		$ifdescrs = get_configured_interface_with_descr();
43
?>
44 9b50c0ed Charlie Marshall
45 319f65ec Colin Fleming
	         <table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0" summary="interfaces">
46 9b50c0ed Charlie Marshall
				<?php
47 46aa2c26 Scott Ullrich
				foreach ($ifdescrs as $ifdescr => $ifname) {
48 c5b5f501 Scott Ullrich
					$ifinfo = get_interface_info($ifdescr);
49
					$iswireless = is_interface_wireless($ifdescr);
50 1db766df Scott Dale
				?>
51 9b50c0ed Charlie Marshall
				<tr>
52 fab1cd2f Renato Botelho
				<td class="vncellt" width="40%">
53 9b50c0ed Charlie Marshall
				<?php
54 611ae852 Ermal
				if($ifinfo['ppplink']) {
55 319f65ec Colin Fleming
					echo "<img src='./themes/{$g['theme']}/images/icons/icon_3g.gif' alt='3g' />";
56 c5b5f501 Scott Ullrich
				} else if($iswireless) {
57 9b50c0ed Charlie Marshall
					if($ifinfo['status'] == "associated") { ?>
58 319f65ec Colin Fleming
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_wlan.gif" alt="wlan" />
59 a3381369 Colin Fleming
					<?php } else { ?>
60 319f65ec Colin Fleming
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_wlan_d.gif" alt="wlan_d" />
61 a3381369 Colin Fleming
					<?php } ?>
62
				<?php } else { ?>
63 319f65ec Colin Fleming
						<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_cablenic.gif" alt="cablenic" />
64 9b50c0ed Charlie Marshall
				<?php } ?>&nbsp;
65 3226e695 Scott Dale
				<strong><u>
66 319f65ec Colin Fleming
				<span onclick="location.href='/interfaces.php?if=<?=$ifdescr; ?>'" style="cursor:pointer">
67 3226e695 Scott Dale
				<?=htmlspecialchars($ifname);?></span></u></strong>
68 9b50c0ed Charlie Marshall
				<?php
69
					if ($ifinfo['dhcplink'])
70 46aa2c26 Scott Ullrich
						echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(DHCP)";
71
				?>
72 1db766df Scott Dale
				</td>
73 fab1cd2f Renato Botelho
				<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 319f65ec Colin Fleming
								<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 8525bd86 Seth Mos
							</td>
80 a3381369 Colin Fleming
		                <?php } else if ($ifinfo['status'] == "no carrier") { ?>
81 fab1cd2f Renato Botelho
							<td>
82 319f65ec Colin Fleming
								<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 8525bd86 Seth Mos
							</td>
84 a3381369 Colin Fleming
				<?php }  else if ($ifinfo['status'] == "down") { ?>
85 fab1cd2f Renato Botelho
							<td>
86 319f65ec Colin Fleming
								<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 8525bd86 Seth Mos
							</td>
88 a3381369 Colin Fleming
		                <?php } else { ?><?=htmlspecialchars($ifinfo['status']); }?>
89 fab1cd2f Renato Botelho
							<td>
90 8525bd86 Seth Mos
								<div id="<?php echo $ifname;?>-media" style="display:inline"><?=htmlspecialchars($ifinfo['media']);?></div>
91
							</td>
92
						</tr>
93 fab1cd2f Renato Botelho
					</table>
94
					<table  width="100%" border="0" cellspacing="0" cellpadding="0" summary="summary">
95 8525bd86 Seth Mos
						<tr>
96 fab1cd2f Renato Botelho
							<td class="vncellt" width="100%">
97 8525bd86 Seth Mos
								<div id="<?php echo $ifname;?>-ip" style="display:inline"><?=htmlspecialchars($ifinfo['ipaddr']);?> </div>
98 8cd558b6 ayvis
								<br />
99 8525bd86 Seth Mos
								<div id="<?php echo $ifname;?>-ipv6" style="display:inline"><?=htmlspecialchars($ifinfo['ipaddrv6']);?> </div>
100
							</td>
101
						</tr>
102 fab1cd2f Renato Botelho
					</table>
103
		          </td></tr>
104 319f65ec Colin Fleming
				<?php 	}//end for each ?>
105 b6db9217 Ermal Luçi
			</table>