Skip to content
This repository has been archived by the owner on Dec 13, 2022. It is now read-only.

Fix graph display with special characters #5554 #5565

Merged
merged 2 commits into from
Aug 30, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions www/class/centreonGraphService.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ public function getData($rows = 200)
$vname[$metric['metric']] = 'v' . $i;
$info = array(
"data" => array(),
"legend" => $metric["metric_legend"],
"graph_type" => "line",
"unit" => $metric["unit"],
"color" => $metric["ds_color_line"],
Expand All @@ -121,6 +120,7 @@ public function getData($rows = 200)
"crit" => null,
"warn" => null
);
$info['legend'] = str_replace('\\\\', '\\', $metric['metric_legend']);

/* Add legend getting data */
foreach ($legendDataInfo as $name => $key) {
Expand All @@ -135,7 +135,7 @@ public function getData($rows = 200)
$displayformat = "%7.2lf";
}
$commandLegendLine .= ' VDEF:l' . $i . $key . '=v' . $i . ',' . $key;
$commandLegendLine .= ' PRINT:l' . $i . $key . ':"' . $metric["metric_legend"] .
$commandLegendLine .= ' PRINT:l' . $i . $key . ':"' . str_replace(':', '\:', $metric['metric_legend']) .
'|' . ucfirst($name) . '|' . $displayformat . '"';
}
}
Expand Down
2 changes: 1 addition & 1 deletion www/include/monitoring/objectDetails/serviceDetails.php
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@

$optionsURL = "host_name=" . urlencode($host_name) . "&service_description=" . urlencode($svc_description);

$DBRES = $pearDBO->query("SELECT id FROM `index_data`, metrics WHERE metrics.index_id = index_data.id AND host_name LIKE '" . $pearDBO->escape($host_name) . "' AND service_description LIKE '" . $pearDBO->escape($svc_description) . "' LIMIT 1");
$DBRES = $pearDBO->query("SELECT id FROM `index_data` WHERE host_name = '" . $pearDBO->escape($host_name) . "' AND service_description = '" . $pearDBO->escape($svc_description) . "' LIMIT 1");
$index_data = 0;
if ($DBRES->numRows()) {
$row = $DBRES->fetchRow();
Expand Down
2 changes: 1 addition & 1 deletion www/include/views/graphs/graphs.html
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ <h2>{t}Grid system{/t}</h2>
<script src="./include/common/javascript/jquery/jquery.cookie.js"></script>
<script src="./include/common/javascript/centreon/centreon-tour.js"></script>
<script>
var defaultCharts = JSON.parse('{$defaultCharts}');
var defaultCharts = {$defaultCharts};
var nbDisplayedCharts = {$nbDisplayedCharts};
var tooManyChartMsg = "{t}You cannot add more charts. The maximum charts is {/t}" + nbDisplayedCharts;
</script>
Expand Down