Fixed maps in Windows. Tiquet: #2153
(cherry picked from commit 298b509b97
)
This commit is contained in:
parent
8b518ae9b2
commit
83a88d7a91
|
@ -109,8 +109,16 @@ else {
|
||||||
io_safe_output($config['graphviz_bin_dir'] . "/")
|
io_safe_output($config['graphviz_bin_dir'] . "/")
|
||||||
:
|
:
|
||||||
"";
|
"";
|
||||||
|
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||||
|
if ($is_windows) {
|
||||||
|
$graphviz_path = str_replace("/", "\\", $graphviz_path );
|
||||||
|
$filter = $filter . '.exe';
|
||||||
|
}
|
||||||
|
|
||||||
$cmd = escapeshellarg($graphviz_path.$filter) . " -Tcmapx " . escapeshellarg("-o$filename_map") . " -Tpng ". escapeshellarg("-o$filename_img") . " " . escapeshellarg($filename_dot);
|
$cmd = escapeshellarg($graphviz_path.$filter) . " -Tcmapx " .
|
||||||
|
escapeshellarg("-o$filename_map") . " -Tpng ".
|
||||||
|
escapeshellarg("-o$filename_img") . " " .
|
||||||
|
escapeshellarg($filename_dot);
|
||||||
$result = system ($cmd);
|
$result = system ($cmd);
|
||||||
fclose ($fh);
|
fclose ($fh);
|
||||||
unlink ($filename_dot);
|
unlink ($filename_dot);
|
||||||
|
@ -128,7 +136,10 @@ if ($result !== false) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
echo "<div style='text-align:center'>";
|
echo "<div style='text-align:center'>";
|
||||||
$image_url = str_replace(realpath(io_safe_output($config['homedir'])), "", realpath($filename_img));
|
if ($is_windows)
|
||||||
|
$image_url = str_replace('\\',"/",str_replace($config['homedir'], "", $filename_img));
|
||||||
|
else
|
||||||
|
$image_url = str_replace(realpath(io_safe_output($config['homedir'])), "", realpath($filename_img));
|
||||||
html_print_image ($image_url, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
|
html_print_image ($image_url, false, array ("alt" => __('Network map'), "usemap" => "#networkmap"));
|
||||||
echo "</div>";
|
echo "</div>";
|
||||||
require ($filename_map);
|
require ($filename_map);
|
||||||
|
|
|
@ -114,13 +114,20 @@ else {
|
||||||
io_safe_output($config['graphviz_bin_dir'] . "/")
|
io_safe_output($config['graphviz_bin_dir'] . "/")
|
||||||
:
|
:
|
||||||
"";
|
"";
|
||||||
|
$is_windows = strtoupper(substr(PHP_OS, 0, 3)) == 'WIN';
|
||||||
|
if ($is_windows) {
|
||||||
|
$graphviz_path = str_replace("/", "\\", $graphviz_path );
|
||||||
|
$filename_map = str_replace("/", "\\", $filename_map );
|
||||||
|
$filename_img = str_replace("/", "\\", $filename_img );
|
||||||
|
$filename_dot = str_replace("/", "\\", $filename_dot );
|
||||||
|
$filter = $filter . '.exe';
|
||||||
|
}
|
||||||
$cmd = escapeshellarg($graphviz_path . $filter) .
|
$cmd = escapeshellarg($graphviz_path . $filter) .
|
||||||
" -Tcmapx " . escapeshellarg("-o$filename_map") .
|
" -Tcmapx " . escapeshellarg("-o$filename_map") .
|
||||||
" -Tpng ". escapeshellarg("-o$filename_img") .
|
" -Tpng ". escapeshellarg("-o$filename_img") .
|
||||||
" " . escapeshellarg($filename_dot);
|
" " . escapeshellarg($filename_dot);
|
||||||
$result = system ($cmd);
|
|
||||||
|
|
||||||
|
$result = system ($cmd);
|
||||||
fclose ($fh);
|
fclose ($fh);
|
||||||
unlink ($filename_dot);
|
unlink ($filename_dot);
|
||||||
//~ html_debug_print($cmd);
|
//~ html_debug_print($cmd);
|
||||||
|
|
Loading…
Reference in New Issue