mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
Handle errors when querying qrzcq (i.e. non-premium)
This commit is contained in:
@@ -85,8 +85,13 @@ class Callbook {
|
||||
}
|
||||
|
||||
if (!$this->ci->session->userdata('qrzcq_session_key')) {
|
||||
$qrzcq_session_key = $this->ci->qrzcq->session($username, $password);
|
||||
$this->ci->session->set_userdata('qrzcq_session_key', $qrzcq_session_key);
|
||||
$result = $this->ci->qrzcq->session($username, $password);
|
||||
if ($result[0] == 0) {
|
||||
$this->ci->session->set_userdata('qrzcq_session_key', $result[1]);
|
||||
} else {
|
||||
$data['error'] = __("QRZCQ Error").": ".$result[1];
|
||||
return $data;
|
||||
}
|
||||
}
|
||||
|
||||
$callbook = $this->ci->qrzcq->search($callsign, $this->ci->session->userdata('qrzcq_session_key'), $reduced);
|
||||
|
||||
@@ -27,12 +27,15 @@ class Qrzcq {
|
||||
// Create XML object
|
||||
$xml = simplexml_load_string($xml);
|
||||
|
||||
if (isset($xml->Session->Error)) {
|
||||
log_message('debug', 'Error: '.$xml->Session->Error);
|
||||
if (isset($xml->Session->Key)) {
|
||||
$result = array( 0, (string) $xml->Session->Key);
|
||||
} else if (isset($xml->Session->Error)) {
|
||||
$result = array( 1, (string) $xml->Session->Error);
|
||||
} else {
|
||||
$result = array( 2, 'Unknown error');
|
||||
}
|
||||
|
||||
// Return Session Key
|
||||
return (string) $xml->Session->Key;
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Set Session Key session.
|
||||
|
||||
Reference in New Issue
Block a user