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

Fix: Sanitize and bind CALPI Centreon service class dev-21.10.x #11836

Merged
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
12 changes: 6 additions & 6 deletions www/class/centreon-clapi/centreonService.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -1584,12 +1584,12 @@ public function getCustomMacroInDb($serviceId = null, $template = null)
$arr = array();
$i = 0;
if ($serviceId) {
$res = $this->db->query("SELECT svc_macro_name, svc_macro_value, is_password, description
FROM on_demand_macro_service
WHERE svc_svc_id = " .
$serviceId . "
ORDER BY macro_order ASC");
while ($row = $res->fetch()) {
$statement = $this->db->prepare("SELECT svc_macro_name, svc_macro_value, is_password, description " .
"FROM on_demand_macro_service " .
"WHERE svc_svc_id = :serviceId ORDER BY macro_order ASC");
$statement->bindValue(':serviceId', (int) $serviceId, \PDO::PARAM_INT);
$statement->execute();
while ($row = $statement->fetch()) {
if (preg_match('/\$_SERVICE(.*)\$$/', $row['svc_macro_name'], $matches)) {
$arr[$i]['svc_macro_name'] = $matches[1];
$arr[$i]['svc_macro_value'] = $row['svc_macro_value'];
Expand Down