diff --git a/application/libraries/Callbook.php b/application/libraries/Callbook.php index eb47125cf..aaf0b2c6d 100644 --- a/application/libraries/Callbook.php +++ b/application/libraries/Callbook.php @@ -22,35 +22,35 @@ class Callbook { case 'qrz': if ($this->ci->config->item('qrz_username') == null || $this->ci->config->item('qrz_password') == null) { $callbook['error'] = 'Lookup not configured. Please review configuration.'; - return $callbook; } - return $this->qrz($this->ci->config->item('qrz_username'), $this->ci->config->item('qrz_password'), $callsign, $this->ci->config->item('use_fullname')); + $callbook = $this->qrz($this->ci->config->item('qrz_username'), $this->ci->config->item('qrz_password'), $callsign, $this->ci->config->item('use_fullname')); break; case 'qrzcq': if ($this->ci->config->item('qrzcq_username') == null || $this->ci->config->item('qrzcq_password') == null) { $callbook['error'] = 'Lookup not configured. Please review configuration.'; - return $callbook; } - return $this->qrzcq($this->ci->config->item('qrzcq_username'), $this->ci->config->item('qrzcq_password'), $callsign); + $callbook = $this->qrzcq($this->ci->config->item('qrzcq_username'), $this->ci->config->item('qrzcq_password'), $callsign); break; case 'hamqth': if ($this->ci->config->item('hamqth_username') == null || $this->ci->config->item('hamqth_password') == null) { $callbook['error'] = 'Lookup not configured. Please review configuration.'; - return $callbook; } - return $this->hamqth($this->ci->config->item('hamqth_username'), $this->ci->config->item('hamqth_password'), $callsign); + $callbook = $this->hamqth($this->ci->config->item('hamqth_username'), $this->ci->config->item('hamqth_password'), $callsign); break; case 'qrzru': if ($this->ci->config->item('qrzru_username') == null || $this->ci->config->item('qrzru_password') == null) { $callbook['error'] = 'Lookup not configured. Please review configuration.'; - return $callbook; } - return $this->qrzru($this->ci->config->item('qrzru_username'), $this->ci->config->item('qrzru_password'), $callsign); + $callbook = $this->qrzru($this->ci->config->item('qrzru_username'), $this->ci->config->item('qrzru_password'), $callsign); break; default: $callbook['error'] = 'No callbook defined. Please review configuration.'; - return $callbook; } + // Handle callbook specific fields + if (! array_key_exists('geoloc', $callbook)) { + $callbook['geoloc'] = ''; + } + return $callbook; } function qrz($username, $password, $callsign, $fullname) { diff --git a/application/libraries/Qrz.php b/application/libraries/Qrz.php index cfe24f285..3e8d5f21c 100644 --- a/application/libraries/Qrz.php +++ b/application/libraries/Qrz.php @@ -112,16 +112,17 @@ class Qrz { if ($reduced == false) { $data['gridsquare'] = $clean_gridsquare; - $data['city'] = (string)$xml->Callsign->addr2; - $data['lat'] = (string)$xml->Callsign->lat; - $data['long'] = (string)$xml->Callsign->lon; - $data['dxcc'] = (string)$xml->Callsign->dxcc; - $data['state'] = (string)$xml->Callsign->state; - $data['iota'] = (string)$xml->Callsign->iota; + $data['geoloc'] = (string)$xml->Callsign->geoloc; + $data['city'] = (string)$xml->Callsign->addr2; + $data['lat'] = (string)$xml->Callsign->lat; + $data['long'] = (string)$xml->Callsign->lon; + $data['dxcc'] = (string)$xml->Callsign->dxcc; + $data['state'] = (string)$xml->Callsign->state; + $data['iota'] = (string)$xml->Callsign->iota; $data['qslmgr'] = (string)$xml->Callsign->qslmgr; - $data['image'] = (string)$xml->Callsign->image; - $data['ituz'] = (string)$xml->Callsign->ituzone; - $data['cqz'] = (string)$xml->Callsign->cqzone; + $data['image'] = (string)$xml->Callsign->image; + $data['ituz'] = (string)$xml->Callsign->ituzone; + $data['cqz'] = (string)$xml->Callsign->cqzone; if ($xml->Callsign->country == "United States") { $data['us_county'] = (string)$xml->Callsign->county; @@ -132,14 +133,14 @@ class Qrz { } else { $data['gridsquare'] = ''; - $data['city'] = ''; - $data['lat'] = ''; - $data['long'] = ''; - $data['dxcc'] = ''; - $data['state'] = ''; - $data['iota'] = ''; + $data['city'] = ''; + $data['lat'] = ''; + $data['long'] = ''; + $data['dxcc'] = ''; + $data['state'] = ''; + $data['iota'] = ''; $data['qslmgr'] = (string)$xml->Callsign->qslmgr; - $data['image'] = (string)$xml->Callsign->image; + $data['image'] = (string)$xml->Callsign->image; $data['us_county'] = ''; $data['ituz'] = ''; $data['cqz'] = ''; diff --git a/application/views/search/result.php b/application/views/search/result.php index 602f0684a..c6c5e8e17 100644 --- a/application/views/search/result.php +++ b/application/views/search/result.php @@ -54,6 +54,9 @@ } else { echo " ".strtoupper($callsign['gridsquare']).""; } + if ($callsign['geoloc'] == "grid") { + echo " ".__("Grid is auto-detected by callbook and probably wrong").""; + } ?>