| 
									
										
										
										
											2009-09-07 11:07:59 +00:00
										 |  |  | <?php | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | if (!isset($vars['view'])) { | 
					
						
							|  |  |  |     $vars['view'] = 'graphs'; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | $port = dbFetchRow('SELECT * FROM `ports` WHERE `port_id` = ?', array($vars['port'])); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | $port_details = 1; | 
					
						
							| 
									
										
										
										
											2009-06-19 10:43:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | $hostname = $device['hostname']; | 
					
						
							| 
									
										
										
										
											2012-05-16 13:25:50 +00:00
										 |  |  | $hostid   = $device['port_id']; | 
					
						
							| 
									
										
										
										
											2011-09-18 13:11:04 +00:00
										 |  |  | $ifname   = $port['ifDescr']; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $ifIndex  = $port['ifIndex']; | 
					
						
							|  |  |  | $speed    = humanspeed($port['ifSpeed']); | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-18 13:11:04 +00:00
										 |  |  | $ifalias = $port['name']; | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | if ($port['ifPhysAddress']) { | 
					
						
							|  |  |  |     $mac = "$port[ifPhysAddress]"; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $color = 'black'; | 
					
						
							|  |  |  | if ($port['ifAdminStatus'] == 'down') { | 
					
						
							|  |  |  |     $status = "<span class='grey'>Disabled</span>"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] == 'down') { | 
					
						
							|  |  |  |     $status = "<span class='red'>Enabled / Disconnected</span>"; | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if ($port['ifAdminStatus'] == 'up' && $port['ifOperStatus'] == 'up') { | 
					
						
							|  |  |  |     $status = "<span class='green'>Enabled / Connected</span>"; | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $i   = 1; | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | $inf = fixifName($ifname); | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $bg = '#ffffff'; | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | $show_all = 1; | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | echo "<div class=ifcell style='margin: 0px;'><table width=100% cellpadding=10 cellspacing=0>"; | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | require 'includes/print-interface.inc.php'; | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | echo '</table></div>'; | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $pos = strpos(strtolower($ifname), 'vlan'); | 
					
						
							|  |  |  | if ($pos !== false) { | 
					
						
							|  |  |  |     $broke = yes; | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $pos = strpos(strtolower($ifname), 'loopback'); | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | if ($pos !== false) { | 
					
						
							|  |  |  |     $broke = yes; | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | echo "<div style='clear: both;'>"; | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2010-01-13 23:56:33 +00:00
										 |  |  | print_optionbar_start(); | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $link_array = array( | 
					
						
							|  |  |  |     'page'   => 'device', | 
					
						
							|  |  |  |     'device' => $device['device_id'], | 
					
						
							|  |  |  |     'tab'    => 'port', | 
					
						
							|  |  |  |     'port'   => $port['port_id'], | 
					
						
							|  |  |  | ); | 
					
						
							| 
									
										
										
										
											2011-09-08 02:57:02 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2011-09-18 13:11:04 +00:00
										 |  |  | $menu_options['graphs']   = 'Graphs'; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $menu_options['realtime'] = 'Real time'; | 
					
						
							|  |  |  | // FIXME CONDITIONAL
 | 
					
						
							|  |  |  | $menu_options['arp']    = 'ARP Table'; | 
					
						
							|  |  |  | $menu_options['events'] = 'Eventlog'; | 
					
						
							| 
									
										
										
										
											2016-01-03 02:12:41 +01:00
										 |  |  | $menu_options['notes'] = 'Notes'; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | 
 | 
					
						
							|  |  |  | if (dbFetchCell("SELECT COUNT(*) FROM `ports_adsl` WHERE `port_id` = '".$port['port_id']."'")) { | 
					
						
							|  |  |  |     $menu_options['adsl'] = 'ADSL'; | 
					
						
							| 
									
										
										
										
											2011-04-09 16:04:04 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | if (dbFetchCell("SELECT COUNT(*) FROM `ports` WHERE `pagpGroupIfIndex` = '".$port['ifIndex']."' and `device_id` = '".$device['device_id']."'")) { | 
					
						
							|  |  |  |     $menu_options['pagp'] = 'PAgP'; | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-05-11 13:43:59 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | if (dbFetchCell("SELECT COUNT(*) FROM `ports_vlans` WHERE `port_id` = '".$port['port_id']."' and `device_id` = '".$device['device_id']."'")) { | 
					
						
							|  |  |  |     $menu_options['vlans'] = 'VLANs'; | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-10-28 13:49:37 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | $sep = ''; | 
					
						
							|  |  |  | foreach ($menu_options as $option => $text) { | 
					
						
							|  |  |  |     echo $sep; | 
					
						
							|  |  |  |     if ($vars['view'] == $option) { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo generate_link($text, $link_array, array('view' => $option)); | 
					
						
							|  |  |  |     if ($vars['view'] == $option) { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     $sep = ' | '; | 
					
						
							| 
									
										
										
										
											2011-12-05 12:15:41 +00:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | unset($sep); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (dbFetchCell("SELECT count(*) FROM mac_accounting WHERE port_id = '".$port['port_id']."'") > '0') { | 
					
						
							|  |  |  |     echo generate_link($descr, $link_array, array('view' => 'macaccounting', 'graph' => $type)); | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ' | Mac Accounting : '; | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'graphs') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo generate_link('Bits', $link_array, array('view' => 'macaccounting', 'subview' => 'graphs', 'graph' => 'bits')); | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'graphs') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo '('; | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'minigraphs') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo generate_link('Mini', $link_array, array('view' => 'macaccounting', 'subview' => 'minigraphs', 'graph' => 'bits')); | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'minigraphs') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo '|'; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'top10') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo generate_link('Top10', $link_array, array('view' => 'macaccounting', 'subview' => 'top10', 'graph' => 'bits')); | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'bits' && $vars['subview'] == 'top10') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ') | '; | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'graphs') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo generate_link('Packets', $link_array, array('view' => 'macaccounting', 'subview' => 'graphs', 'graph' => 'pkts')); | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'graphs') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo '('; | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'minigraphs') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo generate_link('Mini', $link_array, array('view' => 'macaccounting', 'subview' => 'minigraphs', 'graph' => 'pkts')); | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'minigraphs') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo '|'; | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'top10') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo generate_link('Top10', $link_array, array('view' => 'macaccounting', 'subview' => 'top10', 'graph' => 'pkts')); | 
					
						
							|  |  |  |     if ($vars['view'] == 'macaccounting' && $vars['graph'] == 'pkts' && $vars['subview'] == 'top10') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ')'; | 
					
						
							|  |  |  | }//end if
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if (dbFetchCell("SELECT COUNT(*) FROM juniAtmVp WHERE port_id = '".$port['port_id']."'") > '0') { | 
					
						
							|  |  |  |     // FIXME ATM VPs
 | 
					
						
							|  |  |  |     // FIXME URLs BROKEN
 | 
					
						
							|  |  |  |     echo ' | ATM VPs : '; | 
					
						
							|  |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-11 14:54:05 -07:00
										 |  |  |     echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/bits/'>Bits</a>"; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ' | '; | 
					
						
							|  |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'packets') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-11 14:54:05 -07:00
										 |  |  |     echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/packets/'>Packets</a>"; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ' | '; | 
					
						
							|  |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'cells') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-11 14:54:05 -07:00
										 |  |  |     echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/cells/'>Cells</a>"; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |     echo ' | '; | 
					
						
							|  |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'errors') { | 
					
						
							|  |  |  |         echo "<span class='pagemenu-selected'>"; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-08-11 14:54:05 -07:00
										 |  |  |     echo "<a href='" . generate_url(array('page'=>'device','device'=>$device['device_id'], 'tab'=>'port', 'port'=>$port['port_id'])) . "/junose-atm-vp/errors/'>Errors</a>"; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  |     if ($vars['view'] == 'junose-atm-vp' && $vars['graph'] == 'bits') { | 
					
						
							|  |  |  |         echo '</span>'; | 
					
						
							|  |  |  |     } | 
					
						
							|  |  |  | }//end if
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | if ($_SESSION['userlevel'] >= '10') { | 
					
						
							| 
									
										
										
										
											2015-08-11 14:54:05 -07:00
										 |  |  |     echo "<span style='float: right;'><a href='" . generate_url(array('page'=>'bills', 'view'=>'add', 'port'=>$port['port_id'])) . "'><img src='images/16/money.png' border='0' align='absmiddle'> Create Bill</a></span>"; | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2009-02-06 14:53:33 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | print_optionbar_end(); | 
					
						
							| 
									
										
										
										
											2012-04-06 13:56:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | echo "<div style='margin: 5px;'>"; | 
					
						
							| 
									
										
										
										
											2012-04-06 13:56:23 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | require 'pages/device/port/'.mres($vars['view']).'.inc.php'; | 
					
						
							| 
									
										
										
										
											2011-03-16 23:10:10 +00:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-13 20:10:26 +02:00
										 |  |  | echo '</div>'; |