summaryrefslogtreecommitdiffstats
path: root/usr/local/www/widgets/widgets/interfaces.widget.php
blob: 608130d62e0e7e1e720dad8debd3b1363abb765a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?php $i = 0; $ifdescrs = array('wan' => 'WAN', 'lan' => 'LAN');
					for ($j = 1; isset($config['interfaces']['opt' . $j]); $j++) {
						$ifdescrs['opt' . $j] = $config['interfaces']['opt' . $j]['descr'];
					}?>
			
	         <table bgcolor="#990000" width="100%" border="0" cellspacing="0" cellpadding="0">
			<?php 
			$counter = 1;
			foreach ($ifdescrs as $ifdescr => $ifname){
					$ifinfo = get_interface_info($ifdescr);
					$iswireless = is_interface_wireless($ifdescr);
				?>
				<tr> 
				<td class="vncellt" width="30%">
				<?php if($iswireless) {
						 if($ifinfo['status'] == "associated") { ?> 
		                  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_wlan.gif" />
		                  <? } else { ?>
		                  	<img src="./themes/<?= $g['theme']; ?>/images/icons/icon_wlan_d.gif" />
		                  	<? } ?>
		              <? } else { ?>
		                  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_cablenic.gif"/>
		                  <? } ?>&nbsp; 
				<strong>
				<?php
				if ($ifname == "WAN") { ?>
					<span onClick="location.href='/interfaces_wan.php'" style="cursor:pointer">				
				<? } else if ($ifname == "LAN") { ?>
					<span onClick="location.href='/interfaces_lan.php'" style="cursor:pointer">
				<? } else { ?>				
					<span onClick="location.href='/interfaces_opt.php?index=<?=$counter; ?>'" style="cursor:pointer">
				<? 
				$counter++;
				} ?>			
				
				
				<?=htmlspecialchars($ifname);?></span></a></strong>
				</td>
				<td width="70%"  class="listr">
				
				  <?php if ($ifinfo['dhcplink'] != "down" && $ifinfo['pppoelink'] != "down" && $ifinfo['pptplink'] != "down"){ ?>
	                 <?php if($ifinfo['status'] == "up") { ?> 
		                  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_interface_up.gif" title="<?=$ifname;?> is up" />&nbsp; 
		                  <? } else if ($ifinfo['status'] == "no carrier") { ?>
		                  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_interface_down.gif" title="<?=$ifname;?> is down" />&nbsp; 
		                  <? }  else if ($ifinfo['status'] == "down") { ?>
		                  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_block.gif" title="<?=$ifname;?> is disabled" />&nbsp; 
		                  <? } else if ($ifinfo['status'] == "associated") { ?>
		                  <img src="./themes/<?= $g['theme']; ?>/images/icons/icon_interface_up.gif" title="<?=$ifname;?> is associated" />&nbsp; 
		                  <? } else { ?><?=htmlspecialchars($ifinfo['status']);
				}?>				
				  <?php if ($ifinfo['ipaddr']){ ?>
	                 <?=htmlspecialchars($ifinfo['ipaddr']);}?>&nbsp;                 
		              <?=htmlspecialchars($ifinfo['media']);?>
	            </tr><?php }
			}
			?> 
			</table>
OpenPOWER on IntegriCloud