diff --git a/html/map.php b/html/map.php index bc17a01e5..d7b1aae66 100755 --- a/html/map.php +++ b/html/map.php @@ -3,10 +3,10 @@ ### FIXME : remove link when port/host is not in the database (things /seen/ but not *discovered*) ### No, that should be there... I like to see that stuff :> (adama) - ini_set('display_errors', 1); - ini_set('display_startup_errors', 1); - ini_set('log_errors', 1); - ini_set('error_reporting', E_ALL); +ini_set('display_errors', 1); +ini_set('display_startup_errors', 1); +ini_set('log_errors', 1); +ini_set('error_reporting', E_ALL); $links = 1; @@ -64,7 +64,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format'])) if (!isset($locations[$device['location']])) { $locations[$device['location']] = $loc_count; $loc_count++; } $loc_id = $locations[$device['location']]; - $map .= "\"".$device['hostname']."\" [fontsize=20, fillcolor=\"lightblue\", group=".$loc_id." URL=\"{$config['base_url']}/device/device=".$device['device_id']."/tab=map/\" shape=box3d]\n"; + $map .= "\"".$device['hostname']."\" [fontsize=20, fillcolor=\"lightblue\", group=".$loc_id." URL=\"{$config['base_url']}device/device=".$device['device_id']."/tab=map/\" shape=box3d]\n"; } foreach ($links as $link) @@ -110,7 +110,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format'])) $dif = ifNameDescr(dbFetchRow("SELECT * FROM ports WHERE `interface_id` = ?", array($link['remote_interface_id']))); } else { $dif['label'] = $link['remote_port']; - $dif['interface_id'] = $link['remote_hostname'] . $link['remote_port']; + $dif['interface_id'] = $link['remote_hostname'] . '/' . $link['remote_port']; } if ($where == "") @@ -118,7 +118,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format'])) $map .= "\"$src\" -> \"" . $dst . "\" [weight=500000, arrowsize=0, len=0];\n"; $ifdone[$src][$sif['interface_id']] = 1; } else { - $map .= "\"" . $sif['interface_id'] . "\" [label=\"" . $sif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}/device/device=".$device['device_id']."/port/$local_interface_id/\"]\n"; + $map .= "\"" . $sif['interface_id'] . "\" [label=\"" . $sif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}device/device=".$device['device_id']."/tab=port/port=$local_interface_id/\"]\n"; if (!$ifdone[$src][$sif['interface_id']]) { $map .= "\"$src\" -> \"" . $sif['interface_id'] . "\" [weight=500000, arrowsize=0, len=0];\n"; @@ -127,16 +127,21 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format'])) if ($dst_host) { - $map .= "\"$dst\" [URL=\"{$config['base_url']}/device/device=$dst_host/tab=map/\", fontsize=20, shape=box3d]\n"; + $map .= "\"$dst\" [URL=\"{$config['base_url']}device/device=$dst_host/tab=map/\", fontsize=20, shape=box3d]\n"; } else { $map .= "\"$dst\" [ fontsize=20 shape=box3d]\n"; } if ($dst_host == $device['device_id'] || $where == '') { - $map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}/device/device=$dst_host/tab=port/port=$remote_interface_id/\"]\n"; + $map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . "\", fontsize=12, fillcolor=lightblue, URL=\"{$config['base_url']}device/device=$dst_host/tab=port/port=$remote_interface_id/\"]\n"; } else { - $map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . " \", fontsize=12, fillcolor=lightgray, URL=\"{$config['base_url']}/device/device=$dst_host/tab=port/port=$remote_interface_id/\"]\n"; + $map .= "\"" . $dif['interface_id'] . "\" [label=\"" . $dif['label'] . " \", fontsize=12, fillcolor=lightgray"; + if ($dst_host) + { + $map .= ", URL=\"{$config['base_url']}device/device=$dst_host/tab=port/port=$remote_interface_id/\""; + } + $map .= "]\n"; } if (!$ifdone[$dst][$dif['interface_id']]) @@ -153,8 +158,7 @@ if (isset($_GET['format']) && preg_match("/^[a-z]*$/", $_GET['format'])) } } - $map .= " -};"; + $map .= "\n};"; if ($_GET['debug'] == 1) {