Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
8 changes: 4 additions & 4 deletions monitor_controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ function monitorGetZoomDropdownState(bool &$dozoombgndcolor): array {
*
* @return void
*/
function monitorRenderPrimaryFilterRow(array $dashboards, array $monitor_status, array $monitor_view_type, array $monitor_grouping, array $item_rows, int|null $mon_zoom_status): void {
function monitorRenderPrimaryFilterRow(array $dashboards, array $monitor_status, array $monitor_view_type, array $monitor_grouping, array $item_rows, mixed $mon_zoom_status): void {
drawFilterDropdown('dashboard', __('Layout', 'monitor'), $dashboards);
drawFilterDropdown('status', __('Status', 'monitor'), $monitor_status, $mon_zoom_status);
drawFilterDropdown('view', __('View', 'monitor'), $monitor_view_type);
Expand Down Expand Up @@ -465,7 +465,7 @@ function monitorRenderPrimaryFilterRow(array $dashboards, array $monitor_status,
*
* @return void
*/
function monitorRenderGroupingDropdowns(array $classes, array $criticalities, array $monitor_trim, array $page_refresh_interval, string|null $mon_zoom_size): void {
function monitorRenderGroupingDropdowns(array $classes, array $criticalities, array $monitor_trim, array $page_refresh_interval, mixed $mon_zoom_size): void {
drawFilterDropdown('crit', __('Criticality', 'monitor'), $criticalities);

if (get_request_var('view') != 'list') {
Expand Down Expand Up @@ -971,13 +971,13 @@ function validateRequestVars(bool $force = false): void {
/**
* Load host row and normalize status fields for AJAX tooltip rendering.
*
* @param int $id Host id.
* @param int $id|string Host id.
* @param array $thold_hosts Threshold host map.
* @param array $config Global Cacti config.
*
* @return array
*/
function monitorLoadAjaxStatusHost(int|string $id, array $thold_hosts, array $config): array {
function monitorLoadAjaxStatusHost(mixed $id, array $thold_hosts, array $config): array {
$host = db_fetch_row_prepared(
'SELECT *
FROM host
Expand Down
10 changes: 5 additions & 5 deletions monitor_render.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ function renderDefault(): string {
$maxlen = 10;

if (get_request_var('view') == 'default') {
$maxlen = db_fetch_cell("SELECT MAX(LENGTH(description))
$maxlen = (int) db_fetch_cell("SELECT MAX(LENGTH(description))
FROM host AS h
$sql_join
$sql_where");
Expand Down Expand Up @@ -692,11 +692,11 @@ function getHostStatus(array $host, bool $real = false): int {
/**
* Translate status code into localized display label.
*
* @param int $status Monitor status code.
* @param int|string $status Monitor status code.
*
* @return string
*/
function getHostStatusDescription(int|string $status): string {
function getHostStatusDescription(mixed $status): string {
global $icolorsdisplay;

if (array_key_exists($status, $icolorsdisplay)) {
Expand Down Expand Up @@ -803,12 +803,12 @@ function getStatusIcon(int $status, string $icon): string {
/**
* Convert uptime/fail timestamp into compact human-readable duration text.
*
* @param string|int $status_time Timestamp string or SNMP uptime ticks.
* @param int|string $status_time Timestamp string or SNMP uptime ticks.
* @param bool $seconds Include seconds in output string.
*
* @return string
*/
function monitorPrintHostTime(int|string $status_time, bool $seconds = false): string {
function monitorPrintHostTime(mixed $status_time, bool $seconds = false): string {
// If the host is down, make a downtime since message
$dt = '';

Expand Down
40 changes: 20 additions & 20 deletions poller_functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@
*
* @param array $reboot_emails Recipient map keyed by email, then host id.
* @param array $alert_emails List of raw email addresses.
* @param int $host_id Host id to associate with each recipient.
* @param int|string $host_id Host id to associate with each recipient.
*
* @return void
*/
function monitorAddEmails(array &$reboot_emails, array $alert_emails, int|string $host_id): void {
function monitorAddEmails(array &$reboot_emails, array $alert_emails, mixd $host_id): void {
if (cacti_sizeof($alert_emails)) {
foreach ($alert_emails as $email) {
$reboot_emails[trim(strtolower($email))][$host_id] = $host_id;
Expand All @@ -45,14 +45,14 @@ function monitorAddEmails(array &$reboot_emails, array $alert_emails, int|string
/**
* Add a host id to recipients coming from a notification list id.
*
* @param array $reboot_emails Recipient map keyed by email, then host id.
* @param int $notify_list Notification list id.
* @param int $host_id Host id to add.
* @param array $reboot_emails Recipient map keyed by email, then host id.
* @param int|string|null $notify_list Notification list id.
* @param int|string $host_id Host id to add.
* @param array $notification_lists Map of list id to comma-delimited emails.
*
* @return void
*/
function monitorAddNotificationList(array &$reboot_emails, int|string|null $notify_list, int|string $host_id, array $notification_lists): void {
function monitorAddNotificationList(array &$reboot_emails, mixed $notify_list, mixed $host_id, array $notification_lists): void {
if ($notify_list !== null && $notify_list > 0 && isset($notification_lists[$notify_list])) {
$emails = explode(',', $notification_lists[$notify_list]);
monitorAddEmails($reboot_emails, $emails, $host_id);
Expand Down Expand Up @@ -130,14 +130,14 @@ function getNotificationListsMap(): array {
/**
* Add reboot recipients based on host threshold notification settings.
*
* @param array $reboot_emails Recipient map keyed by email, then host id.
* @param int $host_id Host id being processed.
* @param array $alert_emails Global alert email list.
* @param array $notification_lists Map of notification list id to emails.
* @param array $reboot_emails Recipient map keyed by email, then host id.
* @param int|string $host_id Host id being processed.
* @param array $alert_emails Global alert email list.
* @param array $notification_lists Map of notification list id to emails.
*
* @return void
*/
function addTholdRebootRecipients(array &$reboot_emails, int|string $host_id, array $alert_emails, array $notification_lists): void {
function addTholdRebootRecipients(array &$reboot_emails, mixed $host_id, array $alert_emails, array $notification_lists): void {
$notify = db_fetch_row_prepared(
'SELECT thold_send_email, thold_host_email
FROM host
Expand Down Expand Up @@ -490,11 +490,11 @@ function normalizeAndLogNotificationHosts(array &$alert_hosts, array &$warn_host
/**
* Build shared intro copy for ping threshold email and text output.
*
* @param int $freq Resend frequency in minutes.
* @param int|string $freq Resend frequency in minutes.
*
* @return array{string, string}
*/
function buildPingNotificationIntro(int|string $freq): array {
function buildPingNotificationIntro(mixed $freq): array {
$body = '<h1>' . __(MONITOR_PING_NOTIFICATION_SUBJECT, 'monitor') . '</h1>' . PHP_EOL;
$body_txt = __(MONITOR_PING_NOTIFICATION_SUBJECT, 'monitor') . PHP_EOL;

Expand Down Expand Up @@ -819,15 +819,15 @@ function addGroupedNotificationEntry(string $type, array $entry, array &$global_
/**
* Query and group threshold-breached hosts for one severity type.
*
* @param string $type Severity key (`alert` or `warn`).
* @param int $criticality Minimum criticality threshold.
* @param array $global_list Global grouped bucket, updated in place.
* @param array $notify_list Per-list grouped bucket, updated in place.
* @param array $lists Set of notification list ids, updated in place.
* @param int|string $type Severity key (`alert` or `warn`).
* @param int $criticality Minimum criticality threshold.
* @param array $global_list Global grouped bucket, updated in place.
* @param array $notify_list Per-list grouped bucket, updated in place.
* @param array $lists Set of notification list ids, updated in place.
*
* @return void
*/
function getHostsByListType(string $type, int|string $criticality, array &$global_list, array &$notify_list, array &$lists): void {
function getHostsByListType(string $type, mixed $criticality, array &$global_list, array &$notify_list, array &$lists): void {
$last_time = date(MONITOR_DATE_TIME_FORMAT, time() - read_config_option('monitor_resend_frequency') * 60);

$hosts = db_fetch_cell_prepared(
Expand Down Expand Up @@ -954,7 +954,7 @@ function flattenLists(array &$global_list, array &$notify_list): void {
*
* @return void
*/
function addEmailsToNotificationMap(array &$notification_emails, array $emails, string|int $scope_key): void {
function addEmailsToNotificationMap(array &$notification_emails, array $emails, mixed $scope_key): void {
foreach ($emails as $user) {
$user = trim($user);

Expand Down
Loading