2009-09-07 11:07:59 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								< ? php 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-27 14:44:38 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								include ( " ../includes/defaults.inc.php " ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								include ( " ../config.php " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								include ( " ../includes/functions.php " ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-20 17:37:42 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								include ( " includes/authenticate.inc.php " ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-17 21:30:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								if  ( isset ( $_GET [ 'device' ]))  {  $where  =  " WHERE device_id =  " . $_GET [ 'device' ];  }  else  {  $where  =  " " ;  } 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								$deviceresult  =  mysql_query ( " SELECT * from devices  $where " ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-17 21:30:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								if  ( isset ( $_GET [ 'format' ])  &&  preg_match ( " /^[a-z]* $ / " ,  $_GET [ 'format' ])) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  $map  =  " digraph G  {  sep=0.01; size= \" 12,5.5 \" ; pack=100; bgcolor=transparent; splines=true; overlap=scale; concentrate=0; epsilon=0.001; rankdir=0;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								     node  [  fontname = \ " helvetica \" , fontstyle=bold, style=filled, color=white, fillcolor=lightgrey, overlap=false;];
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								     edge  [  bgcolor = white ;  fontname = \ " helvetica \" ; fontstyle=bold; arrowhead=dot; arrowtail=dot];
 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-17 21:30:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								     graph  [ bgcolor = transparent ;]; \n\n " ;
 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  if ( ! $_SESSION [ 'authenticated' ])  
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    $map  .=  " \" Not authenticated \"  [fontsize=20 fillcolor= \" lightblue \"  URL= \" / \"  shape=box3d] \n " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    while  ( $device  =  mysql_fetch_array ( $deviceresult )) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								    { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      if ( $device ) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-20 17:22:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $sql  =  " SELECT * from ports AS I, links AS L WHERE I.device_id =  " . $device [ 'device_id' ] . "  AND L.local_interface_id = I.interface_id " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $links  =  mysql_query ( $sql ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        if  ( mysql_num_rows ( $links )) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          $map  .=  " \" " . $device [ 'hostname' ] . " \"  [fontsize=20 fillcolor= \" lightblue \"  URL= \" /device/ " . $device [ 'device_id' ] . " /map/ \"  shape=box3d] \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        while ( $link  =  mysql_fetch_array ( $links ))  
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-15 23:56:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          $local_interface_id  =  $link [ 'local_interface_id' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          $remote_interface_id  =  $link [ 'remote_interface_id' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          $i  =  0 ;  $done  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-17 00:05:14 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          while  ( isset ( $linkdone )  &&  $i  <  count ( $linkdone )) 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-15 23:56:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $thislink  =  " $remote_interface_id   $local_interface_id " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  ( $linkdone [ $i ]  ==  $thislink )  {  $done  =  1 ;  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $i ++ ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          if ( ! $done )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								          { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-15 23:56:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $linkdone []  =  " $local_interface_id   $remote_interface_id " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if ( $link [ 'ifSpeed' ]  >=  " 10000000000 " )  
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $info  =  " color=lightred style= \" setlinewidth(8) \" " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  elseif  ( $link [ 'ifSpeed' ]  >=  " 1000000000 " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $info  =  " color=lightblue style= \" setlinewidth(4) \" " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  elseif  ( $link [ 'ifSpeed' ]  >=  " 100000000 " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $info  =  " color=lightgrey style= \" setlinewidth(2) \" " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  elseif  ( $link [ 'ifSpeed' ]  >=  " 10000000 " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $info  =  " style= \" setlinewidth(1) \" " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $info  =  " style= \" setlinewidth(1) \" " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $src  =  $device [ 'hostname' ]; 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-20 17:49:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if ( $remote_interface_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $dst  =  mysql_result ( mysql_query ( " SELECT `hostname` FROM `devices` AS D, `ports` AS I WHERE I.interface_id = ' $remote_interface_id '  AND D.device_id = I.device_id " ), 0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $dst_host  =  mysql_result ( mysql_query ( " SELECT D.device_id FROM `devices` AS D, `ports` AS I WHERE I.interface_id = ' $remote_interface_id '  AND D.device_id = I.device_id " ), 0 ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									      $dst_host  =  $link [ 'remote_hostname' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $dst  =  $link [ 'remote_hostname' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-20 17:22:22 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $sif  =  ifNameDescr ( mysql_fetch_array ( mysql_query ( " SELECT * FROM ports WHERE `interface_id`= "  .  $link [ 'local_interface_id' ])), $device ); 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-20 17:49:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if ( $remote_interface_id )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $dif  =  ifNameDescr ( mysql_fetch_array ( mysql_query ( " SELECT * FROM ports WHERE `interface_id`= "  .  $link [ 'remote_interface_id' ]))); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            }  else  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $dif [ 'label' ]  =  $link [ 'remote_port' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									      $dif [ 'interface_id' ]  =  $link [ 'remote_hostname' ]  .  $link [ 'remote_port' ]; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
									    } 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-02-15 23:56:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $map  .=  " \" "  .  $sif [ 'interface_id' ]  .  " \"  [label= \" "  .  $sif [ 'label' ]  .  " \" , fontsize=12, fillcolor=lightblue URL= \" /device/ " . $device [ 'device_id' ] . " /interface/ $local_interface_id / \" ] \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:36:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  ( ! $ifdone [ $src ][ $sif [ 'interface_id' ]]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $map  .=  " \" $src\ "  ->  \ " "  .  $sif [ 'interface_id' ]  .  " \"  [weight=500000, arrowsize=0, len=0]; \n " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $ifdone [ $src ][ $sif [ 'interface_id' ]]  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            $map  .=  " \" $dst\ "  [ URL = \ " /device/ $dst_host /map/ \"  fontsize=20 shape=box3d] \n " ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            if ( $dst_host  ==  $device [ 'device_id' ])  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-15 23:56:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              $map  .=  " \" "  .  $dif [ 'interface_id' ]  .  " \"  [label= \" "  .  $dif [ 'label' ]  .  " \" , fontsize=12, fillcolor=lightblue, URL= \" /device/ $dst_host /interface/ $remote_interface_id / \" ] \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            }  else  { 
							 
						 
					
						
							
								
									
										
										
										
											2010-02-15 23:56:30 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								              $map  .=  " \" "  .  $dif [ 'interface_id' ]  .  " \"  [label= \" "  .  $dif [ 'label' ]  .  "   \" , fontsize=12, fillcolor=lightgray, URL= \" /device/ $dst_host /interface/ $remote_interface_id / \" ] \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:36:18 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            if  ( ! $ifdone [ $dst ][ $dif [ 'interface_id' ]]) 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $map  .=  " \" "  .  $dif [ 'interface_id' ]  .  " \"  ->  \" $dst\ "  [ weight = 500000 ,  arrowsize = 0 ,  len = 0 ]; \n " ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								              $ifdone [ $dst ][ $dif [ 'interface_id' ]]  =  1 ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								            } 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								            $map  .=  " \" "  .  $sif [ 'interface_id' ]  .  " \"  ->  \" "  .  $dif [ 'interface_id' ]  .  " \"  [weight=1, arrowhead=normal, arrowtail=normal, len=2,  $info ]  \n " ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								          } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								        } 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:28:02 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								        $done  =  0 ; 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								      } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    } 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  $map  .=  " 
 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								}; " ;
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  if  ( $_GET [ 'debug' ]  ==  1 )  {  echo ( " <pre> $map </pre> " ); exit ();  } 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								
							 
						 
					
						
							
								
									
										
										
										
											2010-01-09 18:23:39 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								  $img  =  shell_exec ( " echo  \" " . addslashes ( $map ) . " \"  | dot -T " . $_GET [ 'format' ] . " " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  if ( $_GET [ 'format' ]  ==  " png " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    header ( " Content-type: image/ " . $_GET [ 'format' ]); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  }  elseif  ( $_GET [ 'format' ]  ==  " svg " )  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    header ( " Content-type: image/svg+xml " ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    $img  =  str_replace ( " <a  " ,  " <a target  =  \" _parent \"   " ,  $img ); 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  echo ( " $img " ); 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2010-01-17 21:30:12 +00:00 
										
									 
								 
							 
							
								
									
										 
									 
								
							 
							
								 
							 
							
							
								else 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								{ 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  if  ( $_SESSION [ 'authenticated' ])  ## FIXME level 10 only?
 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  { 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    echo  ' < center > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    < object  data = " '.  $config['base_url']  . '/map.php?format=svg "  type = " image/svg+xml " > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								    </ object > 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								</ center > ' ; 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								  } 
							 
						 
					
						
							
								
							 
							
								
							 
							
								 
							 
							
							
								} 
							 
						 
					
						
							
								
									
										
										
										
											2009-03-11 14:54:13 +00:00 
										
									 
								 
							 
							
								
							 
							
								 
							 
							
							
								?>