Skip to content

Commit

Permalink
Refine test for valid default integration as part of logon code.
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-unwin committed Aug 13, 2021
1 parent 45631f6 commit ebcda41
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions code_igniter/application/controllers/logon.php
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ public function check_defaults()

// Run an integration for Linux default only to populate the locations, pollers and groups
if ($this->db->table_exists('integrations') and $this->db->table_exists('integrations_log')) {
$sql = "SELECT id FROM integrations WHERE name = 'Default NMIS Integration'";
$sql = "SELECT id FROM integrations WHERE name = 'Default NMIS Integration' ORDER BY id LIMIT 1";
$query = $this->db->query($sql);
$result = $query->result();
if (!empty($result[0]->id)) {
Expand All @@ -437,7 +437,8 @@ public function check_defaults()
$integration = $this->m_integrations->read($result[0]->id);
$integration = $integration[0];
$integration->debug = false;
if ((stripos($integration->attributes->attributes->url, 'localhost') !== false or
if (!empty($integration->attributes->attributes->url) and
(stripos($integration->attributes->attributes->url, 'localhost') !== false or
stripos($integration->attributes->attributes->url, '127.0.0.1') !== false or
stripos($integration->attributes->attributes->url, '127.0.1.1') !== false) and
empty($integration->attributes->attributes->username) and
Expand Down

0 comments on commit ebcda41

Please sign in to comment.