ADIF Export for LOTW ready for signing
这个提交包含在:
父节点
047636b674
当前提交
042475a989
共有 3 个文件被更改,包括 132 次插入 和 8 次删除
|
|
@ -162,6 +162,12 @@ class Lotw extends CI_Controller {
|
|||
$this->load->model('Dxcc');
|
||||
$data['station_profile_dxcc'] = $this->Dxcc->lookup_country($data['lotw_cert_info']->cert_dxcc);
|
||||
|
||||
// Get QSOs
|
||||
|
||||
$this->load->model('Logbook_model');
|
||||
|
||||
$data['qsos'] = $this->Logbook_model->get_lotw_qsos_to_upload($data['station_profile']->station_id);
|
||||
|
||||
$this->load->view('lotw_views/adif_views/adif_export', $data);
|
||||
}
|
||||
} else {
|
||||
|
|
@ -626,13 +632,13 @@ class Lotw extends CI_Controller {
|
|||
|
||||
}
|
||||
|
||||
function signlog() {
|
||||
function signlog($sign_key, $string) {
|
||||
|
||||
$qso_string = "14IO87IPEU-0052770CM2MG0IIQ435.355562145.878136FMSAT2020-08-1212:10:53ZAO-92";
|
||||
$qso_string = $string;
|
||||
|
||||
$key = "";
|
||||
$key = $sign_key;
|
||||
|
||||
$pkeyid = openssl_pkey_get_private($key, 'peter');
|
||||
$pkeyid = openssl_pkey_get_private($key, 'cloudlog');
|
||||
//openssl_sign($plaintext, $signature, $pkeyid, OPENSSL_ALGO_SHA1 );
|
||||
//openssl_free_key($pkeyid);
|
||||
|
||||
|
|
@ -640,7 +646,7 @@ class Lotw extends CI_Controller {
|
|||
if(openssl_sign($qso_string, $signature, $pkeyid, OPENSSL_ALGO_SHA1)) {
|
||||
openssl_free_key($pkeyid);
|
||||
$signature_b64 = base64_encode($signature);
|
||||
echo($signature_b64."\n");
|
||||
return $signature_b64;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -2157,7 +2157,20 @@ class Logbook_model extends CI_Model {
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function get_lotw_qsos_to_upload($station_id) {
|
||||
|
||||
$this->db->select('COL_CALL, COL_BAND, COL_BAND_RX, COL_TIME_ON, COL_RST_RCVD, COL_RST_SENT, COL_MODE, COL_FREQ, COL_FREQ_RX, COL_GRIDSQUARE, COL_SAT_NAME, COL_PROP_MODE');
|
||||
|
||||
$this->db->where("station_id", 1);
|
||||
|
||||
$this->db->order_by("COL_TIME_ON", "desc");
|
||||
$this->db->limit(1);
|
||||
$query = $this->db->get($this->config->item('table_name'));
|
||||
|
||||
return $query;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function validateADIFDate($date, $format = 'Ymd')
|
||||
|
|
|
|||
|
|
@ -1,11 +1,16 @@
|
|||
<?php
|
||||
header('Content-Type: text/plain; charset=utf-8');
|
||||
?>
|
||||
<?php
|
||||
$cert1 = str_replace("-----BEGIN ENCRYPTED PRIVATE KEY-----", "", $lotw_cert_info->cert_key);
|
||||
$cert2 = str_replace("-----END ENCRYPTED PRIVATE KEY-----", "", $cert1);
|
||||
?>
|
||||
<TQSL_IDENT:54>TQSL V2.5.4 Lib: V2.5 Config: V11.12 AllowDupes: false
|
||||
|
||||
<Rec_Type:5>tCERT
|
||||
<CERT_UID:1>1
|
||||
<CERTIFICATE:<?php echo strlen($lotw_cert_info->cert_key); ?>><?php echo $lotw_cert_info->cert_key; ?>
|
||||
<CERTIFICATE:<?php echo strlen(trim($cert2)); ?>><?php echo trim($cert2); ?>
|
||||
|
||||
<eor>
|
||||
|
||||
<Rec_Type:8>tSTATION
|
||||
|
|
@ -23,4 +28,104 @@
|
|||
|
||||
<?php if(isset($station_profile->station_iota)) { ?><IOTA:<?php echo strlen($station_profile->station_iota); ?>><?php echo $station_profile->station_iota; ?><?php } ?>
|
||||
|
||||
<eor>
|
||||
<eor>
|
||||
|
||||
<?php foreach ($qsos->result() as $qso) { ?>
|
||||
<Rec_Type:8>tCONTACT
|
||||
<STATION_UID:1>1
|
||||
<CALL:<?php echo strlen($qso->COL_CALL); ?>><?php echo $qso->COL_CALL; ?>
|
||||
|
||||
<BAND:<?php echo strlen($qso->COL_BAND); ?>><?php echo strtoupper($qso->COL_BAND); ?>
|
||||
|
||||
<MODE:<?php echo strlen($qso->COL_MODE); ?>><?php echo strtoupper($qso->COL_MODE); ?>
|
||||
|
||||
<?php if($qso->COL_FREQ != "0") { ?><?php $freq_in_mhz = $qso->COL_FREQ / 1000000; ?><FREQ:<?php echo strlen($freq_in_mhz); ?>><?php echo $freq_in_mhz; ?><?php } ?>
|
||||
|
||||
<?php if($qso->COL_FREQ_RX) { ?><?php $freq_in_mhz_rx = $qso->COL_FREQ_RX / 1000000; ?><FREQ_RX:<?php echo strlen($freq_in_mhz_rx); ?>><?php echo $freq_in_mhz_rx; ?><?php } ?>
|
||||
|
||||
<PROP_MODE:<?php echo strlen($qso->COL_PROP_MODE); ?>><?php echo strtoupper($qso->COL_PROP_MODE); ?>
|
||||
|
||||
<SAT_NAME:<?php echo strlen($qso->COL_SAT_NAME); ?>><?php echo strtoupper($qso->COL_SAT_NAME); ?>
|
||||
|
||||
<?php if($qso->COL_BAND_RX) { ?><BAND_RX:<?php echo strlen($qso->COL_BAND_RX); ?>><?php echo strtoupper($qso->COL_BAND_RX); ?><?php } ?>
|
||||
|
||||
<?php $date_on = strtotime($qso->COL_TIME_ON); $new_date = date('Y-m-d', $date_on); ?>
|
||||
<QSO_DATE:<?php echo strlen($new_date); ?>><?php echo $new_date; ?>
|
||||
|
||||
<?php $time_on = strtotime($qso->COL_TIME_ON); $new_on = date('H:i:s', $time_on); ?>
|
||||
<QSO_TIME:<?php echo strlen($new_on."Z"); ?>><?php echo $new_on."Z"; ?>
|
||||
|
||||
<?php
|
||||
|
||||
|
||||
$sign_string = "";
|
||||
|
||||
// Add CQ Zone
|
||||
if($station_profile->station_cq) {
|
||||
$sign_string .= $station_profile->station_cq;
|
||||
}
|
||||
|
||||
// Add Gridsquare
|
||||
if($station_profile->station_gridsquare) {
|
||||
$sign_string .= strtoupper($station_profile->station_gridsquare);
|
||||
}
|
||||
|
||||
if($station_profile->station_iota) {
|
||||
$sign_string .= strtoupper($station_profile->station_iota);
|
||||
}
|
||||
|
||||
if($station_profile->station_itu) {
|
||||
$sign_string .= $station_profile->station_itu;
|
||||
}
|
||||
|
||||
if($qso->COL_BAND) {
|
||||
$sign_string .= strtoupper($qso->COL_BAND);
|
||||
}
|
||||
|
||||
if($qso->COL_BAND_RX) {
|
||||
$sign_string .= strtoupper($qso->COL_BAND_RX);
|
||||
}
|
||||
|
||||
if($qso->COL_CALL) {
|
||||
$sign_string .= strtoupper($qso->COL_CALL);
|
||||
}
|
||||
|
||||
if($freq_in_mhz) {
|
||||
$sign_string .= strtoupper($freq_in_mhz);
|
||||
}
|
||||
|
||||
if($freq_in_mhz_rx) {
|
||||
$sign_string .= strtoupper($freq_in_mhz_rx);
|
||||
}
|
||||
|
||||
if($qso->COL_MODE) {
|
||||
$sign_string .= strtoupper($qso->COL_MODE);
|
||||
}
|
||||
|
||||
|
||||
if($qso->COL_PROP_MODE) {
|
||||
$sign_string .= strtoupper($qso->COL_PROP_MODE);
|
||||
}
|
||||
|
||||
$sign_string .= $new_date;
|
||||
|
||||
$sign_string .= $new_on."Z";
|
||||
|
||||
if($qso->COL_SAT_NAME) {
|
||||
$sign_string .= strtoupper($qso->COL_SAT_NAME);
|
||||
}
|
||||
|
||||
?>
|
||||
<?php
|
||||
$CI =& get_instance();
|
||||
$signed_item = $CI->signlog($lotw_cert_info->cert_key, $sign_string);
|
||||
|
||||
?>
|
||||
<SIGN_LOTW_V2.0:<?php echo strlen($signed_item); ?>:6><?php echo $signed_item; ?>
|
||||
|
||||
<SIGNDATA:<?php echo strlen($sign_string); ?>><?php echo $sign_string; ?>
|
||||
|
||||
<eor>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
|||
正在加载…
在新工单中引用