Added exception handling when qrz or hamqth is not available/accessible.
这个提交包含在:
父节点
8660d3d3ce
当前提交
593db48556
共有 3 个文件被更改,包括 97 次插入 和 89 次删除
|
|
@ -56,7 +56,8 @@ class Hamqth {
|
|||
|
||||
public function search($callsign, $key)
|
||||
{
|
||||
|
||||
$data = null;
|
||||
try {
|
||||
// URL to the XML Source
|
||||
$xml_feed_url = 'https://www.hamqth.com/xml.php?id=' . $key . '&callsign=' . $callsign . '&prg=cloudlog';
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ class Hamqth {
|
|||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
if (empty($xml)) return;
|
||||
|
||||
// Return Required Fields
|
||||
$data['callsign'] = (string)$xml->search->callsign;
|
||||
|
|
@ -90,7 +92,8 @@ class Hamqth {
|
|||
$data['state'] = null;
|
||||
$data['us_county'] = null;
|
||||
}
|
||||
|
||||
} finally {
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,7 +56,8 @@ class Qrz {
|
|||
|
||||
public function search($callsign, $key)
|
||||
{
|
||||
|
||||
$data = null;
|
||||
try {
|
||||
// URL to the XML Source
|
||||
$xml_feed_url = 'http://xmldata.qrz.com/xml/current/?s=' . $key . ';callsign=' . $callsign . '';
|
||||
|
||||
|
|
@ -70,6 +71,7 @@ class Qrz {
|
|||
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
if (empty($xml)) return;
|
||||
|
||||
// Return Required Fields
|
||||
$data['callsign'] = (string)$xml->Callsign->call;
|
||||
|
|
@ -88,8 +90,9 @@ class Qrz {
|
|||
$data['state'] = null;
|
||||
$data['us_county'] = null;
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2170,8 +2170,9 @@ class Logbook_model extends CI_Model {
|
|||
|
||||
public function loadCallBook($callsign)
|
||||
{
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null)
|
||||
{
|
||||
$callbook = null;
|
||||
try {
|
||||
if ($this->config->item('callbook') == "qrz" && $this->config->item('qrz_username') != null && $this->config->item('qrz_password') != null) {
|
||||
// Lookup using QRZ
|
||||
$this->load->library('qrz');
|
||||
|
||||
|
|
@ -2183,8 +2184,7 @@ class Logbook_model extends CI_Model {
|
|||
$callbook = $this->qrz->search($callsign, $this->session->userdata('qrz_session_key'));
|
||||
}
|
||||
|
||||
if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null)
|
||||
{
|
||||
if ($this->config->item('callbook') == "hamqth" && $this->config->item('hamqth_username') != null && $this->config->item('hamqth_password') != null) {
|
||||
// Load the HamQTH library
|
||||
$this->load->library('hamqth');
|
||||
|
||||
|
|
@ -2202,8 +2202,10 @@ class Logbook_model extends CI_Model {
|
|||
$callbook = $this->hamqth->search($callsign, $this->session->userdata('hamqth_session_key'));
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
return $callbook;
|
||||
}
|
||||
}
|
||||
|
||||
public function update_all_station_ids() {
|
||||
|
||||
|
|
|
|||
正在加载…
在新工单中引用