mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
LoTW CRL check function
This commit is contained in:
@@ -1257,4 +1257,26 @@ class Lotw extends CI_Controller {
|
||||
endswitch;
|
||||
}
|
||||
|
||||
function lotw_cert_status ($serial = null) {
|
||||
if (($serial ?? '') != '' && is_numeric($serial)) {
|
||||
$url = 'https://lotw.arrl.org/lotw/crl?serial='.$serial;
|
||||
$ch = curl_init();
|
||||
curl_setopt($ch, CURLOPT_URL, $url);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 10);
|
||||
$result = curl_exec($ch);
|
||||
$xml = new SimpleXMLElement($result);
|
||||
switch ((string)$xml->Status) {
|
||||
case 'Superceded':
|
||||
return 1;
|
||||
case 'Unrevoked':
|
||||
return 0;
|
||||
default:
|
||||
log_message('error', 'Unknown LotW CRL status: '.(string)$xml->Status);
|
||||
return 99;
|
||||
}
|
||||
}
|
||||
return 99;
|
||||
}
|
||||
|
||||
} // end class
|
||||
|
||||
@@ -12,7 +12,7 @@ class Lotw_model extends CI_Model {
|
||||
*/
|
||||
function lotw_certs($user_id) {
|
||||
|
||||
$this->db->select('lotw_certs.lotw_cert_id as lotw_cert_id, lotw_certs.callsign as callsign, dxcc_entities.name as cert_dxcc, dxcc_entities.end as cert_dxcc_end, lotw_certs.qso_start_date as qso_start_date, lotw_certs.qso_end_date as qso_end_date, lotw_certs.date_created as date_created, lotw_certs.date_expires as date_expires, lotw_certs.last_upload as last_upload, lotw_certs.last_upload_fail as last_upload_fail, lotw_certs.last_upload_status as last_upload_status');
|
||||
$this->db->select('lotw_certs.lotw_cert_id as lotw_cert_id, lotw_certs.serial as serial, lotw_certs.callsign as callsign, dxcc_entities.name as cert_dxcc, dxcc_entities.end as cert_dxcc_end, lotw_certs.qso_start_date as qso_start_date, lotw_certs.qso_end_date as qso_end_date, lotw_certs.date_created as date_created, lotw_certs.date_expires as date_expires, lotw_certs.last_upload as last_upload, lotw_certs.last_upload_fail as last_upload_fail, lotw_certs.last_upload_status as last_upload_status');
|
||||
$this->db->where('user_id', $user_id);
|
||||
$this->db->join('dxcc_entities','lotw_certs.cert_dxcc_id = dxcc_entities.adif','left');
|
||||
$this->db->order_by('callsign', 'ASC');
|
||||
|
||||
Reference in New Issue
Block a user