2007-04-03 14:10:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-18 14:41:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$pagetitle []  =  " Ports " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 12:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// Set Defaults here
  
						 
					
						
							
								
									
										
										
										
											2007-04-03 14:10:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if ( ! isset ( $vars [ 'format' ]))  {  $vars [ 'format' ]  =  " list_basic " ;  }  
						 
					
						
							
								
									
										
										
										
											2007-04-03 14:10:23 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-15 22:59:11 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								print_optionbar_start ();  
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								echo ( '<span style="font-weight: bold;">Lists</span> » ' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$menu_options  =  array ( 'basic'       =>  'Basic' ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      'detail'      =>  'Detail' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$sep  =  " " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( $menu_options  as  $option  =>  $text )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( $sep ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $vars [ 'format' ]  ==  " list_ " . $option ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " <span class='pagemenu-selected'> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( '<a href="'  .  generate_url ( $vars ,  array ( 'format'  =>  " list_ " . $option ))  .  '">'  .  $text  .  '</a>' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $vars [ 'format' ]  ==  " list_ " . $option ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " </span> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $sep  =  "  |  " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< span  style = " font-weight: bold; " > Graphs </ span >  & #187;
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$menu_options  =  array ( 'bits'  =>  'Bits' ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      'upkts'  =>  'Unicast Packets' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      'nupkts'  =>  'Non-Unicast Packets' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								                      'errors'  =>  'Errors' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$sep  =  " " ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( $menu_options  as  $option  =>  $text )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( $sep ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $vars [ 'format' ]  ==  'graph_' . $option ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( '<span class="pagemenu-selected">' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( '<a href="'  .  generate_url ( $vars ,  array ( 'format'  =>  'graph_' . $option ))  .  '">'  .  $text  .  '</a>' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $vars [ 'format' ]  ==  'graph_' . $option ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " </span> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $sep  =  "  |  " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								echo ( '<div style="float: right;">' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  < a  href = " <?php echo(generate_url( $vars )); ?> "  title = " Update the browser URL to reflect the search criteria. "  > Update  URL </ a >  | 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $vars [ 'searchbar' ]  ==  " hide " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( '<a href="' .  generate_url ( $vars ,  array ( 'searchbar'  =>  '' )) . '">Search</a>' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( '<a href="' .  generate_url ( $vars ,  array ( 'searchbar'  =>  'hide' )) . '">Search</a>' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( "   |  " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $vars [ 'bare' ]  ==  " yes " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( '<a href="' .  generate_url ( $vars ,  array ( 'bare'  =>  '' )) . '">Header</a>' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( '<a href="' .  generate_url ( $vars ,  array ( 'bare'  =>  'yes' )) . '">Header</a>' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								echo ( '</div>' );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								print_optionbar_end ();  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								print_optionbar_start ();  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if ( $vars [ 'searchbar' ]  !=  " hide " )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  < form  method = 'post'  action = ''  class = 'form-inline'  role = 'form' > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < div  class = " form-group " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < select  name = 'device_id'  id = 'device_id'  class = 'form-control input-sm' > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < option  value = '' > All  Devices </ option > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 14:51:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if ( $_SESSION [ 'userlevel' ]  >=  5 )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $results  =  dbFetchRows ( " SELECT `device_id`,`hostname` FROM `devices` GROUP BY `hostname` ORDER BY `hostname` " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								else  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $results  =  dbFetchRows ( " SELECT `D`.`device_id`,`D`.`hostname` FROM `devices` AS `D`, `devices_perms` AS `P` WHERE `P`.`user_id` = ? AND `P`.`device_id` = `D`.`device_id` GROUP BY `hostname` ORDER BY `hostname` " ,  array ( $_SESSION [ 'user_id' ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( $results  as  $data )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( '        <option value="' . $data [ 'device_id' ] . '"' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $data [ 'device_id' ]  ==  $vars [ 'device_id' ])  {  echo ( " selected " );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( " > " . $data [ 'hostname' ] . " </option> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if ( $_SESSION [ 'userlevel' ]  <  5 )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  $results  =  dbFetchRows ( " SELECT `D`.`device_id`,`D`.`hostname` FROM `ports` AS `I` JOIN `devices` AS `D` ON `D`.`device_id`=`I`.`device_id` JOIN `ports_perms` AS `PP` ON `PP`.`port_id`=`I`.`port_id` WHERE `PP`.`user_id` = ? AND `PP`.`port_id` = `I`.`port_id` GROUP BY `hostname` ORDER BY `hostname` " ,  array ( $_SESSION [ 'user_id' ])); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								else  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2014-06-26 00:21:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  $results  =  array (); 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 14:51:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( $results  as  $data )  
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  echo ( '        <option value="' . $data [ 'device_id' ] . '"' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  ( $data [ 'device_id' ]  ==  $vars [ 'device_id' ])  {  echo ( " selected " );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( " > " . $data [ 'hostname' ] . " </option> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
									
										
										
										
											2014-06-25 14:51:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      </ select > 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-15 19:16:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      < input  type = " hostname "  name = " hostname "  id = " hostname "  title = " Hostname "  class = " form-control input-sm "  < ? php  if  ( strlen ( $vars [ 'hostname' ]))  { echo ( 'value="' . $vars [ 'hostname' ] . '"' );}  ?>  placeholder="Hostname" />
 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    </ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < div  class = " form-group " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < select  name = " state "  id = " state "  class = " form-control input-sm " > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < option  value = " " > All  States </ option > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < option  value = " up "  < ? php  if  ( $vars [ 'state' ]  ==  " up " )  {  echo ( " selected " );  }  ?> >Up</option>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < option  value = " down " < ? php  if  ( $vars [ 'state' ]  ==  " down " )  {  echo ( " selected " );  }  ?> >Down</option>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < option  value = " admindown "  < ? php  if  ( $vars [ 'state' ]  ==  " admindown " )  {  echo ( " selected " );  }  ?> >Shutdown</option>
 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      </ select > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 14:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      < select  name = " ifSpeed "  id = " ifSpeed "  class = " form-control input-sm " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < option  value = " " > All  Speeds </ option > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( dbFetchRows ( " SELECT `ifSpeed` FROM `ports` GROUP BY `ifSpeed` ORDER BY `ifSpeed` " )  as  $data )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $data [ 'ifSpeed' ]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " <option value=' " . $data [ 'ifSpeed' ] . " ' " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    if  ( $data [ 'ifSpeed' ]  ==  $vars [ 'ifSpeed' ])  {  echo ( " selected " );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " > " . humanspeed ( $data [ 'ifSpeed' ]) . " </option> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       </ select > 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    </ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < div  class = " form-group " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < select  name = " ifType "  id = " ifType "  class = " form-control input-sm " > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < option  value = " " > All  Media </ option > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( dbFetchRows ( " SELECT `ifType` FROM `ports` GROUP BY `ifType` ORDER BY `ifType` " )  as  $data )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $data [ 'ifType' ]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    echo ( '        <option value="' . $data [ 'ifType' ] . '"' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( $data [ 'ifType' ]  ==  $vars [ 'ifType' ])  {  echo ( " selected " );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " > " . $data [ 'ifType' ] . " </option> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								       </ select > 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      < select  name = " port_descr_type "  id = " port_descr_type "  class = " form-control input-sm " > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < option  value = " " > All  Port  Types </ option > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 14:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
									
										
										
										
											2011-10-17 10:33:06 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$ports  =  dbFetchRows ( " SELECT `port_descr_type` FROM `ports` GROUP BY `port_descr_type` ORDER BY `port_descr_type` " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$total  =  count ( $ports );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								echo ( " Total:  $total " );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( $ports  as  $data )  
						 
					
						
							
								
									
										
										
										
											2011-09-14 14:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $data [ 'port_descr_type' ]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    echo ( '        <option value="' . $data [ 'port_descr_type' ] . '"' ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 14:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( $data [ 'port_descr_type' ]  ==  $vars [ 'port_descr_type' ])  {  echo ( " selected " );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    echo ( " > " . ucfirst ( $data [ 'port_descr_type' ]) . " </option> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      </ select > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    </ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    < div  class = " form-group " > 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-15 19:16:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      < input  title = " Port Description "  type = " text "  name = " ifAlias "  id = " ifAlias "  class = " form-control input-sm "  < ? php  if  ( strlen ( $vars [ 'ifAlias' ]))  { echo ( 'value="' . $vars [ 'ifAlias' ] . '"' );}  ?>  placeholder="Port Description"/>
 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < select  name = " location "  id = " location "  class = " form-control input-sm " > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          < option  value = " " > All  Locations </ option > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          < ? php 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 12:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								           // fix me function?
 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 12:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								           foreach  ( getlocations ()  as  $location )  // FIXME function name sucks maybe get_locations ?
 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								           { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								             if  ( $location ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								             { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               echo ( '<option value="' . $location . '"' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               if  ( $location  ==  $vars [ 'location' ])  {  echo ( "  selected " );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								               echo ( " > " . $location . " </option> " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								             } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								           } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								         ?> 
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        </ select > 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      </ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < div  class = " form-group " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < label  for = " ignore " > Ignored </ label > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < input  type = checkbox  id = " ignore "  name = " ignore "  value = " 1 "  class = " "  < ? php  if  ( $vars [ 'ignore' ])  {  echo ( " checked " );  }  ?>  ></input>
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < label  for = " disable " > Disabled </ label > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < input  type = checkbox  id = " disable "  name = " disable "  value = 1  class = " "  < ? php  if  ( $vars [ 'disable' ])  {  echo ( " checked " );  }  ?>  ></input>
 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        </ label > 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        < label  for = " deleted " > Deleted </ label > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < input  type = checkbox  id = " deleted "  name = " deleted "  value = 1  class = " "  < ? php  if  ( $vars [ 'deleted' ])  {  echo ( " checked " );  }  ?>  ></input>
 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        </ label > 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      </ div > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < div  class = " form-group " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        < select  name = " sort "  id = " sort "  class = " form-control input-sm " > 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 09:23:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								< ? php  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$sorts  =  array ( 'device'  =>  'Device' ,  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'port'  =>  'Port' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'speed'  =>  'Speed' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'traffic'  =>  'Traffic' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'traffic_in'  =>  'Traffic In' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'traffic_out'  =>  'Traffic Out' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'packets'  =>  'Packets' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'packets_in'  =>  'Packets In' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'packets_out'  =>  'Packets Out' , 
							 
						 
					
						
							
								
									
										
										
										
											2012-04-06 13:56:23 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								              'errors'  =>  'Errors' , 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 09:23:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								              'media'  =>  'Media' , 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								              'descr'  =>  'Description' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								foreach  ( $sorts  as  $sort  =>  $sort_text )  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( '<option value="' . $sort . '" ' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $vars [ 'sort' ]  ==  $sort )   {  echo ( " selected " );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  echo ( '>' . $sort_text . '</option>' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?> 
  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        </ select > 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      </ div > 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-15 19:16:06 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      < button  type = " submit "  class = " btn btn-default btn-sm " > Search </ button > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      < a  class = " btn btn-default btn-sm "  href = " <?php echo(generate_url(array('page' => 'ports', 'section' =>  $vars['section'] , 'bare' =>  $vars['bare'] ))); ?> "  title = " Reset critera to default. "  > Reset </ a > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      </ td > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    </ form > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  </ tr > 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								</ table >  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								< ? php  }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								print_optionbar_end ();  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$param  =  array ();  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if ( ! isset ( $vars [ 'ignore' ]))    {  $vars [ 'ignore' ]  =  " 0 " ;  }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if ( ! isset ( $vars [ 'disabled' ]))  {  $vars [ 'disabled' ]  =  " 0 " ;  }  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								if ( ! isset ( $vars [ 'deleted' ]))   {  $vars [ 'deleted' ]  =  " 0 " ;  }  
						 
					
						
							
								
									
										
										
										
											2011-09-14 14:28:42 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2014-06-26 00:21:22 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$where  =  '' ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-10-04 09:10:21 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								foreach  ( $vars  as  $var  =>  $value )  
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  if  ( $value  !=  " " ) 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    switch  ( $var ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      case  'hostname' : 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 14:51:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $where  .=  "  AND D.hostname LIKE ? " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $param []  =  " % " . $value . " % " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      case  'location' : 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 14:51:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $where  .=  "  AND D.location LIKE ? " ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $param []  =  " % " . $value . " % " ; 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 14:51:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      case  'device_id' : 
							 
						 
					
						
							
								
									
										
										
										
											2014-06-25 14:51:50 +01:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $where  .=  "  AND D.device_id = ? " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $param []  =  $value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      case  'deleted' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      case  'ignore' : 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        if  ( $value  ==  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $where  .=  "  AND (I.ignore = 1 OR D.ignore = 1) AND I.deleted = 0 " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      case  'disable' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      case  'ifSpeed' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( is_numeric ( $value )) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $where  .=  "  AND I. $var  = ? " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $param []  =  $value ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      case  'ifType' : 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        $where  .=  "  AND I. $var  = ? " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $param []  =  $value ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      case  'ifAlias' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      case  'port_descr_type' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $where  .=  "  AND I. $var  LIKE ? " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        $param []  =  " % " . $value . " % " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 12:16:05 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      case  'errors' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $value  ==  1 ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $where  .=  "  AND (I.`ifInErrors_delta` > '0' OR I.`ifOutErrors_delta` > '0') " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      case  'state' : 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        if  ( $value  ==  " down " ) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $where  .=  " AND I.ifAdminStatus = ? AND I.ifOperStatus = ? " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $param []  =  " up " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $param []  =  " down " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  elseif ( $value  ==  " up " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          $where  .=  " AND I.ifAdminStatus = ? AND I.ifOperStatus = ?  AND I.ignore = '0' AND D.ignore='0' AND I.deleted='0' " ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          $param []  =  " up " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								          $param []  =  " up " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        }  elseif ( $value  ==  " admindown " )  { 
							 
						 
					
						
							
								
									
										
										
										
											2014-01-13 10:05:19 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          $where  .=  " AND I.ifAdminStatus = ? AND D.ignore = 0 " ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								          $param []  =  " down " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-19 11:15:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-20 16:03:54 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								$query  =  " SELECT * FROM `ports` AS I, `devices` AS D WHERE I.device_id = D.device_id  " . $where . "   " . $query_sort ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$row  =  1 ;  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								list ( $format ,  $subformat )  =  explode ( " _ " ,  $vars [ 'format' ]);  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								$ports  =  dbFetchRows ( $query ,  $param );  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 12:24:34 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								// FIXME - only populate what we need to search at this point, because we shouldn't show *all* ports, as it's silly.
  
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 18:35:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								foreach  ( $ports  as  $port )  
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  if  ( $config [ 'memcached' ][ 'enable' ]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 18:35:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    if  ( $config [ 'memcached' ][ 'enable' ]) 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 18:35:17 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								      $state  =  $memcache -> get ( 'port-' . $port [ 'port_id' ] . '-state' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      if ( is_array ( $state ))  {  $ports [ $port [ 'port_id' ]]  =  array_merge ( $port ,  $state );  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								      unset ( $state ); 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								switch  ( $vars [ 'sort' ])  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'traffic' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifOctets_rate' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'traffic_in' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifInOctets_rate' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'traffic_out' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifOutOctets_rate' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'packets' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifUcastPkts_rate' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'packets_in' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifInUcastOctets_rate' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'packets_out' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifOutUcastOctets_rate' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'errors' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifErrors_rate' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 09:23:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  case  'speed' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifSpeed' ,  SORT_DESC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 09:23:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'port' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifDescr' ,  SORT_ASC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 09:23:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'media' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifType' ,  SORT_ASC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 09:23:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'descr' : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'ifAlias' ,  SORT_ASC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-10-27 09:23:12 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    break ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								  case  'device' : 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								  default : 
							 
						 
					
						
							
								
									
										
										
										
											2012-05-25 10:34:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								    $ports  =  array_sort ( $ports ,  'hostname' ,  SORT_ASC ); 
							 
						 
					
						
							
								
									
										
										
										
											2011-09-26 16:31:13 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2011-09-14 13:38:01 +00:00 
										
									 
								 
							 
							
								
									
										 
								
							 
							
								 
							
							
								if ( file_exists ( 'pages/ports/' . $format . '.inc.php' ))  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								{  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								 include ( 'pages/ports/' . $format . '.inc.php' ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								}  
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							
							
								?>