From 8b75167cf8a357367d3f2409b52f571cbdab6145 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 6 Jun 2017 13:11:28 +0200 Subject: [PATCH 1/2] Added OS filter --- .../include/functions_pandora_networkmap.php | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 757e6da9a6..07a8c49fae 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -122,7 +122,16 @@ function networkmap_process_networkmap($id = 0) { null, $old_mode); - $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_dot = sys_get_temp_dir() . "\\networkmap_" . $filter; + break; + default: + $filename_dot = sys_get_temp_dir() . "/networkmap_" . $filter; + break; + } if ($simple) { $filename_dot .= "_simple"; @@ -133,8 +142,17 @@ function networkmap_process_networkmap($id = 0) { $filename_dot .= "_" . $id . ".dot"; file_put_contents($filename_dot, $graph); - - $filename_plain = sys_get_temp_dir() . "/plain.txt"; + + switch (PHP_OS) { + case "WIN32": + case "WINNT": + case "Windows": + $filename_plain = sys_get_temp_dir() . "\\plain.txt"; + break; + default: + $filename_plain = sys_get_temp_dir() . "/plain.txt"; + break; + } $cmd = "$filter -Tplain -o " . $filename_plain . " " . $filename_dot; From 5d9d1cf77b4752fbd8f1bfcd95c8eeaf4add5174 Mon Sep 17 00:00:00 2001 From: Arturo Gonzalez Date: Tue, 6 Jun 2017 15:53:56 +0200 Subject: [PATCH 2/2] Added better idea, thanks luis --- pandora_console/include/functions_pandora_networkmap.php | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pandora_console/include/functions_pandora_networkmap.php b/pandora_console/include/functions_pandora_networkmap.php index 07a8c49fae..97a4fd079e 100644 --- a/pandora_console/include/functions_pandora_networkmap.php +++ b/pandora_console/include/functions_pandora_networkmap.php @@ -148,14 +148,15 @@ function networkmap_process_networkmap($id = 0) { case "WINNT": case "Windows": $filename_plain = sys_get_temp_dir() . "\\plain.txt"; + $cmd = $config['graphviz_win'] . "$filter -Tplain -o " . $filename_plain . " " . + $filename_dot; break; default: $filename_plain = sys_get_temp_dir() . "/plain.txt"; + $cmd = "$filter -Tplain -o " . $filename_plain . " " . + $filename_dot; break; } - - $cmd = "$filter -Tplain -o " . $filename_plain . " " . - $filename_dot; system ($cmd);