mirror of
https://github.com/wavelog/wavelog.git
synced 2026-03-22 10:24:14 +00:00
lotw_model is the better name
This commit is contained in:
@@ -16,10 +16,10 @@ class Dashboard extends CI_Controller
|
||||
$this->load->model('logbook_model');
|
||||
|
||||
// LoTW infos
|
||||
$this->load->model('Lotw');
|
||||
$this->load->model('Lotw_model');
|
||||
$current_date = date('Y-m-d H:i:s');
|
||||
$data['lotw_cert_expired'] = $this->Lotw->lotw_cert_expired($this->session->userdata('user_id'), $current_date);
|
||||
$data['lotw_cert_expiring'] = $this->Lotw->lotw_cert_expiring($this->session->userdata('user_id'), $current_date);
|
||||
$data['lotw_cert_expired'] = $this->Lotw_model->lotw_cert_expired($this->session->userdata('user_id'), $current_date);
|
||||
$data['lotw_cert_expiring'] = $this->Lotw_model->lotw_cert_expiring($this->session->userdata('user_id'), $current_date);
|
||||
|
||||
|
||||
$this->load->model('logbooks_model');
|
||||
|
||||
@@ -50,10 +50,10 @@ class Lotw extends CI_Controller {
|
||||
}
|
||||
|
||||
// Load required models for page generation
|
||||
$this->load->model('Lotw');
|
||||
$this->load->model('Lotw_model');
|
||||
|
||||
// Get Array of the logged in users LoTW certs.
|
||||
$data['lotw_cert_results'] = $this->Lotw->lotw_certs($this->session->userdata('user_id'));
|
||||
$data['lotw_cert_results'] = $this->Lotw_model->lotw_certs($this->session->userdata('user_id'));
|
||||
|
||||
// Set Page Title
|
||||
$data['page_title'] = __("Logbook of the World");
|
||||
@@ -142,7 +142,7 @@ class Lotw extends CI_Controller {
|
||||
else
|
||||
{
|
||||
// Load database queries
|
||||
$this->load->model('Lotw');
|
||||
$this->load->model('Lotw_model');
|
||||
|
||||
//Upload of P12 successful
|
||||
$data = array('upload_data' => $this->upload->data());
|
||||
@@ -150,20 +150,20 @@ class Lotw extends CI_Controller {
|
||||
$info = $this->decrypt_key($data['upload_data']['full_path']);
|
||||
|
||||
// Check to see if certificate is already in the system
|
||||
$new_certificate = $this->Lotw->find_cert($info['issued_callsign'], $info['dxcc-id'], $this->session->userdata('user_id'));
|
||||
$new_certificate = $this->Lotw_model->find_cert($info['issued_callsign'], $info['dxcc-id'], $this->session->userdata('user_id'));
|
||||
|
||||
if($new_certificate == 0) {
|
||||
// New Certificate Store in Database
|
||||
|
||||
// Store Certificate Data into MySQL
|
||||
$this->Lotw->store_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $info['dxcc-id'], $info['validFrom'], $info['validTo_Date'], $info['qso-first-date'], $info['qso-end-date'], $info['pem_key'], $info['general_cert']);
|
||||
$this->Lotw_model->store_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $info['dxcc-id'], $info['validFrom'], $info['validTo_Date'], $info['qso-first-date'], $info['qso-end-date'], $info['pem_key'], $info['general_cert']);
|
||||
|
||||
// Cert success flash message
|
||||
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certificate Imported.');
|
||||
} else {
|
||||
// Certificate is in the system time to update
|
||||
|
||||
$this->Lotw->update_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $info['dxcc-id'], $info['validFrom'], $info['validTo_Date'], $info['qso-first-date'], $info['qso-end-date'], $info['pem_key'], $info['general_cert']);
|
||||
$this->Lotw_model->update_certificate($this->session->userdata('user_id'), $info['issued_callsign'], $info['dxcc-id'], $info['validFrom'], $info['validTo_Date'], $info['qso-first-date'], $info['qso-end-date'], $info['pem_key'], $info['general_cert']);
|
||||
|
||||
// Cert success flash message
|
||||
$this->session->set_flashdata('Success', $info['issued_callsign'].' Certificate Updated.');
|
||||
@@ -226,9 +226,9 @@ class Lotw extends CI_Controller {
|
||||
foreach ($station_profiles->result() as $station_profile) {
|
||||
|
||||
// Get Certificate Data
|
||||
$this->load->model('Lotw');
|
||||
$this->load->model('Lotw_model');
|
||||
$data['station_profile'] = $station_profile;
|
||||
$data['lotw_cert_info'] = $this->Lotw->lotw_cert_details($station_profile->station_callsign, $station_profile->station_dxcc);
|
||||
$data['lotw_cert_info'] = $this->Lotw_model->lotw_cert_details($station_profile->station_callsign, $station_profile->station_dxcc);
|
||||
|
||||
// If Station Profile has no LoTW Cert continue on.
|
||||
if(!isset($data['lotw_cert_info']->cert_dxcc_id)) {
|
||||
@@ -324,7 +324,7 @@ class Lotw extends CI_Controller {
|
||||
|
||||
if(curl_errno($ch)){
|
||||
echo $station_profile->station_callsign." (".$station_profile->station_profile_name."): Upload Failed - ".curl_strerror(curl_errno($ch))." (".curl_errno($ch).")<br>";
|
||||
$this->Lotw->last_upload($data['lotw_cert_info']->lotw_cert_id, "Upload failed");
|
||||
$this->Lotw_model->last_upload($data['lotw_cert_info']->lotw_cert_id, "Upload failed");
|
||||
if (curl_errno($ch) == 28) { // break on timeout
|
||||
echo "Timeout reached. Stopping subsequent uploads.<br>";
|
||||
break;
|
||||
@@ -338,7 +338,7 @@ class Lotw extends CI_Controller {
|
||||
if ($pos === false) {
|
||||
// Upload of TQ8 Failed for unknown reason
|
||||
echo $station_profile->station_callsign." (".$station_profile->station_profile_name."): Upload Failed - ".curl_strerror(curl_errno($ch))." (".curl_errno($ch).")<br>";
|
||||
$this->Lotw->last_upload($data['lotw_cert_info']->lotw_cert_id, "Upload failed");
|
||||
$this->Lotw_model->last_upload($data['lotw_cert_info']->lotw_cert_id, "Upload failed");
|
||||
if (curl_errno($ch) == 28) { // break on timeout
|
||||
echo "Timeout reached. Stopping subsequent uploads.<br>";
|
||||
break;
|
||||
@@ -350,7 +350,7 @@ class Lotw extends CI_Controller {
|
||||
|
||||
echo $station_profile->station_callsign." (".$station_profile->station_profile_name."): Upload Successful - ".$filename_for_saving."<br>";
|
||||
|
||||
$this->Lotw->last_upload($data['lotw_cert_info']->lotw_cert_id, "Success");
|
||||
$this->Lotw_model->last_upload($data['lotw_cert_info']->lotw_cert_id, "Success");
|
||||
|
||||
// Mark QSOs as Sent
|
||||
foreach ($qso_id_array as $qso_number) {
|
||||
@@ -389,9 +389,9 @@ class Lotw extends CI_Controller {
|
||||
$this->load->model('user_model');
|
||||
if(!$this->user_model->authorize(2)) { $this->session->set_flashdata('notice', 'You\'re not allowed to do that!'); redirect('dashboard'); }
|
||||
|
||||
$this->load->model('Lotw');
|
||||
$this->load->model('Lotw_model');
|
||||
|
||||
$this->Lotw->delete_certificate($this->session->userdata('user_id'), $cert_id);
|
||||
$this->Lotw_model->delete_certificate($this->session->userdata('user_id'), $cert_id);
|
||||
|
||||
$this->session->set_flashdata('Success', 'Certificate Deleted.');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user