diff --git a/includes/html/print-alert-rules.php b/includes/html/print-alert-rules.php index 47597035cf..dd48066258 100644 --- a/includes/html/print-alert-rules.php +++ b/includes/html/print-alert-rules.php @@ -199,14 +199,14 @@ foreach ($rule_list as $rule) { if ((int) $sub['state'] === AlertState::CLEAR) { $ico = 'check'; $col = 'success'; - $status_msg = 'All devices matching ' . $rule['name'] . ' are OK'; + $status_msg = 'All devices matching ' . htmlentities($rule['name']) . ' are OK'; } if ((int) $sub['state'] === AlertState::ACTIVE || (int) $sub['state'] === AlertState::ACKNOWLEDGED) { $alert_style = alert_layout($severity); $ico = $alert_style['icon']; $col = $alert_style['icon_color']; $extra = $alert_style['background_color']; - $status_msg = 'Some devices matching ' . $rule['name'] . ' are currently alerting'; + $status_msg = 'Some devices matching ' . htmlentities($rule['name']) . ' are currently alerting'; } } @@ -218,7 +218,7 @@ foreach ($rule_list as $rule) { $ico = 'pause'; $col = ''; $extra = 'active'; - $status_msg = $rule['name'] . ' is OFF'; + $status_msg = htmlentities($rule['name']) . ' is OFF'; } else { $alert_checked = 'checked'; } @@ -261,7 +261,7 @@ foreach ($rule_list as $rule) { // Name - echo '' . $rule['name'] . ''; + echo '' . htmlentities($rule['name']) . ''; // Devices (and Groups) @@ -277,14 +277,12 @@ foreach ($rule_list as $rule) { $except_device_or_group = 'EXCEPT '; } - $popover_position = 'right'; - $locations = null; if ($location_count) { $location_query = 'SELECT locations.location, locations.id FROM alert_location_map, locations WHERE alert_location_map.rule_id=? and alert_location_map.location_id = locations.id ORDER BY location'; $location_maps = dbFetchRows($location_query, [$rule['id']]); foreach ($location_maps as $location_map) { - $locations .= $except_device_or_group . '' . htmlentities($location_map['location']) . '
'; + $locations .= $except_device_or_group . '' . htmlentities($location_map['location']) . '
'; } } @@ -293,7 +291,7 @@ foreach ($rule_list as $rule) { $group_query = 'SELECT device_groups.name, device_groups.id FROM alert_group_map, device_groups WHERE alert_group_map.rule_id=? and alert_group_map.group_id = device_groups.id ORDER BY name'; $group_maps = dbFetchRows($group_query, [$rule['id']]); foreach ($group_maps as $group_map) { - $groups .= $except_device_or_group . '' . htmlentities($group_map['name']) . '
'; + $groups .= $except_device_or_group . '' . htmlentities($group_map['name']) . '
'; } } @@ -302,7 +300,7 @@ foreach ($rule_list as $rule) { $device_query = 'SELECT devices.device_id,devices.hostname FROM alert_device_map, devices WHERE alert_device_map.rule_id=? and alert_device_map.device_id = devices.device_id ORDER BY hostname'; $device_maps = dbFetchRows($device_query, [$rule['id']]); foreach ($device_maps as $device_map) { - $devices .= $except_device_or_group . '' . htmlentities(DeviceCache::get($device_map['device_id'])->displayName()) . '
'; + $devices .= $except_device_or_group . '' . htmlentities(DeviceCache::get($device_map['device_id'])->displayName()) . '
'; } } @@ -318,7 +316,7 @@ foreach ($rule_list as $rule) { } if (! $devices && ! $groups && ! $locations) { // All Devices - echo 'All Devices
'; + echo 'All Devices
'; } echo ''; @@ -380,7 +378,7 @@ foreach ($rule_list as $rule) { echo '' . htmlentities($rule_display) . ''; // Severity - echo '' . ($rule['severity'] == 'ok' ? strtoupper($rule['severity']) : ucwords($rule['severity'])) . ''; + echo '' . htmlentities($rule['severity'] == 'ok' ? strtoupper($rule['severity']) : ucwords($rule['severity'])) . ''; // Status @@ -388,10 +386,10 @@ foreach ($rule_list as $rule) { echo ""; if ($rule_extra['mute'] === true) { - echo ""; + echo ""; } if ($sub['state'] == AlertState::ACKNOWLEDGED) { - echo ""; + echo ""; } echo ''; // Enabled @@ -400,25 +398,23 @@ foreach ($rule_list as $rule) { echo ''; if ($rule['disabled']) { - $enabled_msg = $rule['name'] . ' is OFF'; + $enabled_msg = htmlentities($rule['name']) . ' is OFF'; } if (! $rule['disabled']) { - $enabled_msg = $rule['name'] . ' is ON'; + $enabled_msg = htmlentities($rule['name']) . ' is ON'; } echo "
"; - echo ""; + echo ""; echo '
'; echo ''; // Action - $action_popover = 'left'; - echo ''; echo "
"; - echo " "; - echo ""; + echo " "; + echo ""; echo ''; echo "\r\n";