From e557e08c93f6044a288f9e23107685472d01a23d Mon Sep 17 00:00:00 2001 From: Kevin Duret <duret.kevin@gmail.com> Date: Tue, 3 Apr 2018 11:10:08 +0200 Subject: [PATCH] fix(api): fix php warning in realtime host api (#6174) * fix(api): fix php warning in realtime host api * fix(api): fix php warning in centreon classes --- www/api/class/centreon_realtime_hosts.class.php | 5 +++-- www/class/centreonHostgroups.class.php | 2 +- www/class/centreonInstance.class.php | 2 +- www/class/centreonServicegroups.class.php | 2 +- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/www/api/class/centreon_realtime_hosts.class.php b/www/api/class/centreon_realtime_hosts.class.php index e12bd09187..da12e90a8d 100644 --- a/www/api/class/centreon_realtime_hosts.class.php +++ b/www/api/class/centreon_realtime_hosts.class.php @@ -406,8 +406,9 @@ class CentreonRealtimeHosts extends CentreonRealtimeBase $query .= " AND h.enabled = 1 "; if ( - in_array($this->sortType, explode(',', $this->arguments['fields'])) || - is_null($this->arguments['fields']) + !isset($this->arguments['fields']) || + is_null($this->arguments['fields']) || + in_array($this->sortType, explode(',', $this->arguments['fields'])) ) { $q = 'ASC'; if (isset($this->order) && strtoupper($this->order) === 'DESC') { diff --git a/www/class/centreonHostgroups.class.php b/www/class/centreonHostgroups.class.php index dbb907bce3..0fb5142454 100644 --- a/www/class/centreonHostgroups.class.php +++ b/www/class/centreonHostgroups.class.php @@ -373,7 +373,7 @@ class CentreonHostgroups $hostList[] = array( 'host' => $elem['host_name'], 'host_id' => $elem['host_id'], - 'hg_name' => $elem[$hgName] + 'hg_name' => $hgName ); } diff --git a/www/class/centreonInstance.class.php b/www/class/centreonInstance.class.php index fc77cbb461..8363bc95b5 100644 --- a/www/class/centreonInstance.class.php +++ b/www/class/centreonInstance.class.php @@ -271,7 +271,7 @@ class CentreonInstance while ($elem = $result->fetchrow()) { $instanceList[] = array( 'host' => $elem['host_name'], - 'name' => $elem['instance_name'] + 'name' => $instanceName ); } diff --git a/www/class/centreonServicegroups.class.php b/www/class/centreonServicegroups.class.php index df14efa2c8..8b0c709e64 100644 --- a/www/class/centreonServicegroups.class.php +++ b/www/class/centreonServicegroups.class.php @@ -263,7 +263,7 @@ class CentreonServicegroups 'service' => $elem['service_description'], 'service_id' => $elem['service_id'], 'host' => $elem['host_name'], - 'sg_name' => $elem[$sgName] + 'sg_name' => $sgName ); } -- GitLab